cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube Function pointer assignment got mess-up after updating to Ver1.7.0.

ETan.3
Associate II

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...

0693W00000DptL3QAJ.jpg

3 REPLIES 3
KnarfB
Principal III

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

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?

How did you solve above issue?I am facing a similar kind of issue for stm32f407vet6.I have a structure pointer.