View previous topic :: View next topic |
Author |
Message |
Torello
Joined: 29 Sep 2006 Posts: 120
|
int8 Rom problem CCS > 4.130 |
Posted: Thu Sep 20, 2012 7:46 am |
|
|
Hi,
In version upto 4.130 below snipped worked perfectly:
Code: |
//=== Global varaiables assignment =============================================
int8 ROM BootMark[2]= {0x00,0x00}; //clear this Program Flash int16 at Firmware program to detect a firmware program
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
}
} |
Now in version 4.136, I get an error on the &BootMark reference "expecting an identifier"
Any thoughts why? _________________ Regards, Edwin. PCWHD v5.114 |
|
|
Torello
Joined: 29 Sep 2006 Posts: 120
|
|
Posted: Thu Sep 20, 2012 9:01 am |
|
|
-- _________________ Regards, Edwin. PCWHD v5.114
Last edited by Torello on Thu Sep 20, 2012 9:05 am; edited 1 time in total |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Thu Sep 20, 2012 9:03 am |
|
|
Because support for program memory pointers, i.e. const and rom, is a recent addition to the compiler and has worked/not worked/has altered syntax on various recent releases of the compiler. In other words it worked OK on 4.130, but isn't working on 4.136. That doesn't imply anything about its working, or not in 4.131, 132, 133, 134 or 135 :-(
The support for this function has been, to say the least, flakey.
Be that as it may, have you checked out restart_cause(), which does much the same as your code? Indeed it does more.
RF Developer |
|
|
Torello
Joined: 29 Sep 2006 Posts: 120
|
|
Posted: Thu Sep 20, 2012 9:12 am |
|
|
I removed the "address off" operator which should not be necessary. Seems to work (still testing).
At reboot I also need to know if the firmware has been reflashed. If so I re-intitialize the eeprom parameters with default values.
restart_cause() doesn't detect a program reflash _________________ Regards, Edwin. PCWHD v5.114 |
|
|
|