cancel
Showing results for 
Search instead for 
Did you mean: 

FOC SDK 4.2 clearing thumb mode with Eclipse AC6

martin.k
Associate II
Posted on January 03, 2016 at 15:27

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.

#foc-sdk-stm32f303-gcc-ac6
5 REPLIES 5
re.wolff9
Senior
Posted on January 05, 2016 at 12:13

That sounds very much like a bug in your linker. I've had to fix mine for exactly that. 

 https://bugs.launchpad.net/gcc-arm-embedded/+bug/1421389

martin.k
Associate II
Posted on January 05, 2016 at 16:54

Intersting, I have exactly that version of ld mentioned there.

I just downloaded a more recent version of gcc and will try to use that with my Ac6 Plugin later this evening. Then I will place an update here.

martin.k
Associate II
Posted on February 07, 2016 at 00:14

Hi.

It took me a while before I could get back on this issue.

I did install the most recent version of arm-gcc an checked it again. Unfortunately I still have the issue.

Do you know if that patch got merged into binutils?

Thanks.

Martin.
francisco
Associate
Posted on November 02, 2016 at 08:23

Hi Martin,

I am also using FOC SDK v4.2 with AC6 to program a STM32F303. And just as you, ran into the same problem. Could you find a solution?

In the bug report they provide a patch for the linker script but I cannot find elf23-arm.c in my system. Did you try patching?

Best regards,

Francisco

Laurent Ca...
Lead II

The question has been moved from the "Motor Control Hardware" section to the "STM32 Motor Control" section (the question is about the STM32 MC SDK). 

Best regards