cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 FOC SDK with another compiler

dayandenizcan
Associate
Posted on January 18, 2016 at 15:34

I am wondering if I can use STM32 FOC SDK with a compiler other than IAR EWARM or Keil MDK-ARM.

I have looked up to a document (presentation slide) named ''STM32 PMSM FOC SDK 4.2 - Hands on workshop with hardware tools'', and it says that ''Two IDEs are supported: IAR EWARM and KEIL ?Vision.'' on page 25. But based on SDK workflow diagrams in the same document, I concluded that STM32 PMSM FOC SDK only generates parameters as header file. So, I thought I should be able to take those header files and use wherever I want. Am I right? And if not, what am I missing?

Note: I attempted to try that, but the SDK gave an error which I think is about a completely different subject (pin mapping).

#stm32-pmsm-foc
4 REPLIES 4
re.wolff9
Senior
Posted on January 21, 2016 at 11:16

I've tried and by now managed to compile the FOC code with gcc. 

Getting to know the FOC code while at the same time porting it to an unsupported compiler is tricky. In the end I had to ''get it (almost) working with KEIL'' before I was able to get it to work with gcc. 

Some of the FOC code is ''binary only''. This is provided as a library for one of the supported compilers. It turns out that gcc supports the IAR library format. 

However, IAR apparenlty optimizes the code by eliminating functions that are never called. This functionality also exists in the gnu toolchain, but is implemented differently so it doesn't work with the supplied IAR library. . Therefore you'd need to recompile the library (but you don't get the source), or live with the fact that it compiles some 20k of dead code into your binary. 

Also the gnu linker has a bug that isn't yet fixed in the mainstream distributed binaries: The PC relative references to thumb functions are not linked correctly. 

 https://bugs.launchpad.net/gcc-arm-embedded/+bug/1421389?comments=all

That said, I've manged to port to GCC.... So it is possible. But there is no support from ST, as they say ''not supported''....

vmatos
Associate II
Posted on March 07, 2016 at 16:20

Hello Wolff.roger,

Could you give some pointers on how you were able to compile with gcc?

Currently I'm stuck linking pre-compiled object files. i.e. linking STO_SpeednPosFdbkClass.o and such, makes the program throw a Hard Fault on MCBoot function.

re.wolff9
Senior
Posted on March 14, 2016 at 10:30

You need to fix the linker bug first. It is calling a non-thumb function through a pointer, and the CPU then throws an exception because it doesn't support non-thumb. 

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