AnsweredAssumed Answered

FOC SDK 4.2 clearing thumb mode with Eclipse AC6

Question asked by Krellmann.Martin on Jan 3, 2016
Latest reply on Nov 2, 2016 by giraldez_gamez.franc
Hi,

i recently ran into a problem with a FOC SDK 4.2 base motor control project.
After assembling a project for Eclipse AC6 (API sources + EWARM library from web edition) I got usage faults during the execution of a initialization function in the library.
I investigated this further and found out that a branch (BLX R1) to "R3_4_F30X_Init" from the function "PWMC_Init" cleared the T-Bit of the EPSR. The content of R1 was 0x8001f88 before the branch. So the behaviour is clear: The address is even and not odd as it should for preserving thumb mode. Thus, the CPU enters ARM mode and fails on the next instruction since it only supports thumb mode. (It is a STM32F303VCT6)

To resolve the problem for me I just requested a license agreement for the source code of the FOC SDK. Hopefully I will receive the forms soon.

But, I wanted to discuss this here as well. Am I wrong that the IAR compiler (EWARM library) should behave the same way as GCC and add a 0x1 to the branch target address at compile time? If this is true, then maybe the STM32F303_single_drive library of SDK version 4.2 was build with wrong options?

Best regards,
Martin Krellmann.

Edit: Or did I make a mistake with my code alignment? Which is on even addresses as I would expect it to be.

Outcomes