| Torello 
 
 
 Joined: 29 Sep 2006
 Posts: 128
 
 
 
			    
 
 | 
			
				| Force int8 Rom x{} just after program code |  
				|  Posted: Thu Oct 15, 2009 8:54 am |   |  
				| 
 |  
				| 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
 }
 | 
 |  |