2020-12-26 03:38 AM
After loading the elf file variables are detected incorrect (wrong address an/or size)
Two examples with output of readelf
1) used in *.c file:
uint8_t counter_error_handler __attribute__((section(".internal_ram")));
> readelf Bluepill_USB_CDC.elf -s |grep error
1374: 20002e28 1 OBJECT GLOBAL DEFAULT 9 counter_error_handler
2) used in *.cpp file:
static uint16_t blink_period;
> readelf Bluepill_USB_CDC.elf -a |grep blink
389: 2000052c 2 OBJECT LOCAL DEFAULT 8 _ZL12blink_period
in STM32CubeMonitor these variables are listed with incorrect address and size (blink_period) and incorrect address (counter_error_handler)
Is this an issue of using a c/cpp project ?
Solved! Go to Solution.
2021-01-04 01:50 AM
Hello Michael
This is quite strange. I am surprised by the result shown.
Best regards
Stephane
2021-01-04 01:50 AM
Hello Michael
This is quite strange. I am surprised by the result shown.
Best regards
Stephane
2021-01-04 02:08 AM
A contemporary .MAP file might be definitive.
Generally I'd have more confidence in the Linker than the average ELF parser.
2021-01-04 02:32 AM
Hi Stephane,
thanks for your feedback.
According to your notes I've tried to reproduce the issue with a clean build. But I can't ;)
The addresses and sizes are now correct. Don't know whats going wrong the first time - therefore sorry for any confusion ...
> readelf Bluepill_USB_CDC.elf -s | grep blink
343: 200002bc 2 OBJECT LOCAL DEFAULT 7 _ZL12blink_period
> readelf Bluepill_USB_CDC.elf -s | grep error
1208: 20002b60 1 OBJECT GLOBAL DEFAULT 8 counter_error_handler
Best regards,
Michel