cancel
Showing results for 
Search instead for 
Did you mean: 

How to compile examples from the FOC library using KEIL.

re.wolff9
Senior
Posted on December 26, 2015 at 20:10

Hi, 

Not getting anywhere with GCC I've gone ahead and installed windows, keil, cube and the FOC development kit. 

When I follow STM's howto for compiling the example, keil reports: ''undefined symbol: R3_1_F3xx_NewObject''

This symbol is defined in the Web/Project/MDK-ARM/MC_Library_Compiled/Exe/MC_Library_STM32F302x8_single_drive.lib library. 

And... under project->manage->project items I see   MC_Library_STM32F302x8_single_dri listed in the third column. Apparently the windows8 window-manager does not allow me to increase the size of that window, so I must assume that the last two letters are there. 

So: How do I check that this library is actually used, and/or how do I find out why it isn't finding this symbol?
5 REPLIES 5
re.wolff9
Senior
Posted on January 03, 2016 at 15:24

By disabling the UI code, I now have a ''fits in 32k'' binary. Didn't do a thing. Turns out the mainloop in ''main () '' was compiled to ''while (1) {};'' 

So now I defined the EXAMPLE_POTMETER define and... after adding the source file ot the project, I get compiler errors in that file. 

I think I have fixed those errors and it now compiles. 

But wouldn't it be nice if there was a source package that would provide me with a working example where I can ''fight'' with the development environment and other issues before having to debug code that I didn't write myself?

Is there  a FOC example for the IHM001?

re.wolff9
Senior
Posted on December 27, 2015 at 12:42

Ok. I decided to switch to F4xx CPUs, and then learned how to copy the proper MC software headers into the sources. I then went back to F3, and now it no longer stops at the undefined symbol. 

Alas, the Keil trial version does not allow > 32K code, so still no binary. 

Previous plan was to compile-and-link under Linux. However linking created an error: Function pointers didn't set the ''thumb'' bit, resulting in an exception. Diving into that, it turns out to be a known problem in the linker, patch applied, fixed, and now this problem seems to be solved. 

Gigi
ST Employee
Posted on January 07, 2016 at 17:32

Ciao Roger

Working with GCC is the hard way. This because the official release coming up only with IAR and Keil support and this mean that using one of this two tools the difficulty shall be less.

Probably with some configuration of the FW the 32k will be exceeded. But if you don't enable the motor profiler I think that the evaluation version of IAR and Keil can be sufficient to work with the serial communication and so controlling the motor using the ST MC Workbench (that is preferable).

Frankly I don't understand the issue that you get compiling the Potentimeter example, I'll verify it, usually it works.

For the IHM001 there isn't a particular example. The ST MC Workbench support out-of-the box this kit when you create new project, so you can configure very easily the MC FOC lib. to run on P-NULCEO-IHM001.

Ciao

Gigi

re.wolff9
Senior
Posted on January 10, 2016 at 16:52

Sorry for not reporting back on this problem once I solved it. 

In the ''getting started'' document an important step is missing: You need to set the MC workbench output directory to ....SystemDriveParameters/ 

There are a whole bunch of files there, some of which will be overwritten. This is very against my ''software engineering'' intuition. If the gui produces a bunch of header files, the generated files go together in one directory. 

The problem was that the wrong MC generated header files were found and used. 

I'm now at the point that compiling with GCC is possible, as well as with KEIL. I probably don't have the time to work on this the coming week, and I'll be sick/blind the week after that. 

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