CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Force int8 Rom x{} just after program code

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Torello



Joined: 29 Sep 2006
Posts: 120

View user's profile Send private message

Force int8 Rom x{} just after program code
PostPosted: Thu Oct 15, 2009 8:54 am     Reply with quote

Hi,

In the functions below, Bootmark is read and written once if the Mcu reset was caused by a firmware flash.
In my app it works OK. My question is the following:

The compiler puts BootMark totally at the end of the program memory. I don't want this because the application will be expanded with a bootloader. Is there an easy way to let the compiler put Bootmark just after the end of my program code?

Code:


 int8 ROM BootMark[2]= {0x00,0x00};

//==============================================================================
void bos_McuRstGetSource() {
  //-- Check Mcu source of (re)boot
  bos.McuRstMode=0;                                  // load "undefined"
  if (RI&POR) bos.McuRstMode|= MclrRst;              // Mclr reset caused Mcu reboot
  else
    if (!RI) bos.McuRstMode|= SoftRst;               // Reset intstruction cause Mcu reboot   
    else
      if (!POR) bos.McuRstMode |= PwrRst;            // PowerOn -OR- Flash reprogram caused Mcu reboot
  //-- Check if firmware has been reprogrammed
  if (read_program_eeprom(&BootMark)!=0xEBEB) {      // T:Firmware is flashed! (firmware Reprograms 0 in rom int16 'bootmark')
    bos.McuRstMode |= FwRst;                         // flag firmware (re)program reboot
  }
}
//==============================================================================
void bos_McuRstAckSource() {
  RI=1; POR=1;                                       // need to set flag for next detection
  if (read_program_eeprom(&BootMark)!=0xEBEB)        // Only write if needed! ( as precausion on endurance)
    write_program_eeprom(&Bootmark, 0xEBEB);         // Set the bootflag<>0
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group