Forum : ST7/STM8
Original Post
Post Information | Post |
---|---|
October 8, 2011 - 4:49pm
|
Hi, Fabrizio |
Forum : ST7/STM8
Post Information | Post |
---|---|
October 8, 2011 - 4:49pm
|
Hi, Fabrizio |
Hi Fabrizio,
This will be a COMPILER directive, not linker:
- Activate the "DMC(data)" compiler directive. This will select the "data" mode as default memory class. All variables will in "data" mode have a 16-bit address, although "page0" variables have an 8-bit address (hence generate shorter code).
- Add the "page0" qualifer on all variables that you explicitly want to be in the 256 lower bytes.
page0 unsigned char fastcounter = 4;
This is it.
Note that if you do not want to perform this task manually, you can use the auto-relocation mode: Once your project is almost ok (compiles and links properly), activate the autoreloc through the Ride7 interface, which will locate your variables at the most efficient place depending on tits usage: The most used variabnles will get in page0, the other ones in data.
Also note that there is no speed difference between page0 and data variables on STM8. Both are equally fast, so this mechanism is useful only for code size reduction.
Best Regards,