2021-08-19 11:12 PM
Check this out. Don't know if anyone encountered this before...
After updating to v1.7.0, all my function pointer or even pointer assignments got mess-up. Function pointer value will be automatically +1 by mistake.
If anyone knows how to fix it?
Going to uninstall all STM and do a clean full install to see if this can go away.
Wish me luck...
2021-08-19 11:58 PM
On ARM, the least significant bit indicates if a function is a thumb mode function (1) or not (0). As function addresses are 2 resp. 4-byte aligned, there is no other use of that bit and the core shall execute the function pointer call correctly.
See for example https://developer.arm.com/documentation/dui0471/i/interworking-arm-and-thumb/pointers-to-functions-in-thumb-state
hth
KnarfB
2021-08-20 01:50 PM
Hi, Knarf, thanks for the info.
But in my case, this automatically "add one" does cause except failure to jump to the function that pointed.
I have to manually -1 or +2 the address to get it works. Ex. in picture:
Task_WSD_UART_Process() @ 0x80089b8.
fun_ptr = &(Task_WSD_UART_Process - 1); // call successfully, fun_ptr = 0x80089b7
fun_ptr = &(Task_WSD_UART_Process); // call failed, fun_ptr = 0x80089b9
fun_ptr = &(Task_WSD_UART_Process + 1); // call failled, fun_ptr = 0x80089b9
fun_ptr = &(Task_WSD_UART_Process + 2); // call successfully, fun_ptr = 0x80089bb
I'm using thumb2 instruction set.
-mcpu=cortex-m4 -c -x assembler-with-cpp --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb
How can I avoid this if it's related with thumb state?
2024-06-08 09:41 AM - edited 2024-06-08 07:26 PM
How did you solve above issue?I am facing a similar kind of issue for stm32f407vet6.I have a structure pointer.