Hi everyboby,
I have a problem with S12X and pointers at paged flash.
I am trying to read data from paged flash through a far pointer, but I am not able to do that using paged address.
The only way to read data is by using glabal address.
for example, I need to read data from paged address 0xFC8000.
unsigned int *far p;
unsigned int var;
p = (unsigned int *far)0xFC8000;
var = *p;
controller crashes.
when I use the global address FC8000*4000+400000=0x7F0000
p = (unsigned int *far)0x7F0000;
var = *p
It works fine.
Does anyone know if it is possible to read data from flash using paged address instead of global address?
Thank you
Nikos
Solved! Go to Solution.
For S12X parts compiler assumes that far pointer contains global address of object. When you take address of paged function, PPAGE-paged address is converted automatically to global address. So you may try typecasting your address constant to pointer to function, and only then to required pointer type.
p = (unsigned int *far) (void(*)(void)) 0xFC8000;
Hello Nikos,
have you try out this suggestions? Please keep us posted, we'd like to know :smileywink:
Regards,
Monica.
Monica,
wouldn't it be better to send private reminder message instead of floating up old threads? I agree, that thread initiators should either mark good answers as good or keep community informed about persisting problems. But those who answer shouldn't get such reminders.
Thanks Edward,
It is working.
Sorry for the late reply
For S12X parts compiler assumes that far pointer contains global address of object. When you take address of paged function, PPAGE-paged address is converted automatically to global address. So you may try typecasting your address constant to pointer to function, and only then to required pointer type.
p = (unsigned int *far) (void(*)(void)) 0xFC8000;
Hi,
Do you try to define FLASH Page before?
PPAGE=0xFC; // Define FLASH Page