Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 1 month ago.
Absolute Variable Location fo ST nucleo
Hi to all i have this problem i want use the STM Studio for debug and diagnose my software, i use keil ide for write my software, in user manual i read that i have to use a Absolute Variable Location, but i don't know how to do. i write this easy code
mbed and stm studio
#include "mbed.h" DigitalOut myled(LED1); int i; int main() { i=0; while(1) { myled = 1; // LED is ON wait(0.2); // 200 ms myled = 0; // LED is OFF i++; wait(1.0); // 1 sec } }
in Language Extensions of keil documantation http://www.keil.com/support/man/docs/c51/c51_le_absvarloc.htm, i see this:
int xdata i _at_ 0x8000; /* int at xdata 0x8000 */
but i have this error "error: expected ';' after top level decalration", can you help me? Best Regards A.
1 Answer
10 years, 1 month ago.
For STM Studio and mbed online compilator (because lack map or elf files), i use global variables definitions like this:
volatile int i __attribute__((at(0x20001000))); int licz __attribute__((at(0x20001010))) =0;
and manualy copy these addresses to STM Studio. Address values in definitions are not critical but depend on the size of the RAM. It's better to be somewhere closer to the begin of RAM (but not in begin) in area of static variables.