cancel
Showing results for 
Search instead for 
Did you mean: 

Errors compiling with STMCubeIDE likely because module libraries aren't included. How do you include missing libraries? Or could it be something else?

DCyr
Associate III

We generate the firmware code using the Motor Control Workbench that calls the STMCubeMX that then calls the STMCubeIDE. We were able to successfully compile the firmware this way using the IAR IDE, but we get many compiler errors with the STMCubeIDE. An example of the errors is:

../Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_timebase_rtc_alarm_template.c:98:1: error: unknown type name 'RTC_HandleTypeDef'; did you mean 'I2C_HandleTypeDef' RTC_HandleTypeDef    hRTC_Handle;

52 REPLIES 52
ben5en
Associate II

Good Morning,

I have the same problem, is there no official answer? If you look at the response rate and the number of answers in the other topics, Motor Control Support seems rather sparse. I also asked a question here on 24.09.19 and so far have not received an answer. What a shame.

DCyr
Associate III

I got it to compile by using the series of steps below that includes setting the "Target toolchain" to ST TrueSTUDIO, not STMCubeIDE, however, STMCubeIDE is still invoked and flashes the firmware. The missing modules seem to have been included with this change. Is this how you are compiling?

There were still 2 errors related to converting the "name.ELF" object module to "name.HEX". See below how to fix these 2 remaining errors.

Target Toolchain with STMCubeIDE doesn't work, but ST TrueSTUDIO works (with a couple of build errors - see below) 

"Open Project" intitates STMCubeIDE

THERE ARE 23 WARNINGS LIKE THIS:

warning: comparison between pointer and zero character constant [-Wpointer-compare]

THESE WERE THE 2 REMAINING ERRORS:

arm-atollic-eabi-objcopy.exe -O ihex "ElectronicSpeedControl.elf" "ElectronicSpeedControl.hex"

c:/st/stm32cubeide_1.0.2/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.make.win32_1.0.2.201907030841/tools/bin/sh: arm-atollic-eabi-objcopy.exe: not found

make[1]: *** [makefile:67: post-build] Error 127

make: *** [makefile:40: all] Error 2

"make all" terminated with exit code 2. Build might be incomplete.

21:18:48 Build Failed. 2 errors, 23 warnings. (took 34s.371ms)

Error 127 was due to the absence of a program that converts ELF to HEX.  Search for "objcopy.exe on your computer (there were 4 copies on mine!!!), then copy objcopy.exe to the same library mentioned in the error message above and rename it "arm-atollic-eabi-objcopy.exe". That eliminated this error.

DMolo
Senior

I also have this problem, and have gotten around it by getting STMCWB to create a truestudio project I then import. This disables virtually all the CUBEMX functionality within CUBEIDE though, which is annoying...

Surely this is fairly high on ST's list of things to fix?

cedric H
ST Employee

Dear all,

The latest version of cubeIDE (1.1.0) is now able to handle correctly the motor control projects.

We tested our new MCSDK 5.4.2 successfully with cubeMX 5.4.0.

The MCSDK version 5.4.2 (upload on st.com ongoing) adds the support of the examples with cubeIDE.

So, CubeMX 5.4 + cubeIDE 1.1.0 + MCSDK 5.4.2 should work out of the box.

Regards

Cedric

DCyr
Associate III

Hi Cedric,

We downloaded the latest MCSDK 5.4.2 and that seemed to fix some problems, but there is a new error that I can't understand because I can't find an explanation anywhere describing ERROR 1. Also, what does makefile:43 mean? This was using the STEVAL-SPIN3204 and the associated software "out of the box".

make: *** [makefile:43: 6steps_STEVAL-SPIN3204-2019-11-12.elf] Error 1

"make -j8 all" terminated with exit code 2. Build might be incomplete.

16:06:50 Build Failed. 1 errors, 0 warnings. (took 7s.817ms)

make: *** [makefile:43: 6steps_STEVAL-SPIN3204-2019-11-12.elf] Error 1 6steps_STEVAL-SPIN3204-2019-11-12 C/C++ Problem

Thanks for your help,

David Cyr

The process uses the Motor Control Workbench to define the motor, MCSDK then calls STM32CubeMX that then opens the project in STM32CubeIDE. The Target Toolchain is specified as STMCubeIDE.

cedric H
ST Employee

​Hello David,

We just realized that the latest version of the workbench we put in the release does not allow to copy the example anymore.

Let me explain.

For some example, we provide a folder with additional files. For instance, the 6steps example is located by default here :

C:\Program Files (x86)\STMicroelectronics\MC_SDK_5.4.2\Projects\STEVAL-SPIN3204\Demonstration\6Steps_STEVAL-SPIN3204

The workbench must copy the content of this folder into the new location. It is required to keep the same stmcx name, just change the path.

Because of the copy issue of the Workbench, you must copy the folder manually, at the same level than the stmcx file.

Example : c:\My_test\6steps_STEVAL-SPIN3204.stmcx

                       My_test\6steps_STEVAL-SPIN3204\6steps_STEVAL-SPIN3204.ioc (+ all the files present inside C:\Program Files (x86)\STMicroelectronics\MC_SDK_5.4.2\Projects\STEVAL-SPIN3204\Demonstration\6Steps_STEVAL-SPIN3204 )

Once it is done, as we provide an IOC file, you must click on update instead of generate in order to not erase the IOC we provided.

(thanks to the update button, only the motor control parameters coded inside the IOC are changed)

I noticed another issue in the example provided due to an API changed in the HAL library.

So, if you use the version 1.11.0 , the line 250 of the file 6step_conf.c must be changed into :

HAL_TIMEx_ConfigCommutEvent((TIM_HandleTypeDef *) pHfTimer, TIM_TS_NONE, TIM_COMMUTATION_SOFTWARE);

We are preparing a new release to fix all these issues.

Regards

Cedric

DMolo
Senior

Anther observation is that the stm32f3 library has, for no apparent reason,​ changed the timer synchro function to a timer synchronisation function, so it doesn't compile, can't find the function etc (written from my phone, sorry no actual function name)

I'd generally complain that the st cube software family results in a lot of frustration with things just not really working, compiler/project settings and​ code getting overwritten, libraries that are far too abstracted and variables defined and held in unpredictable, scattered and unfindable places...

I appreciate the tool to some extent since I'm a hardware engineer not a software guy, so when the mcsdk does work and the process flows smoothly it really does accelerate my progress hugely, but I do spend an extraordinary amount of time fighting broken st tools.

By contrast, infineon libraries are really easy to read and understand (for the motor ones at least) though their chips resist programming strongly (seggers seemingly can't touch them and their memtool simply doesn't work) and the code generation tools, examples and libraries are sparse.

DCyr
Associate III

Thanks for the quick and candid response.  Much appreciated!   

1)     Could you please give me a rough idea when you expect to release the next version that fixes these issues? 

2)     How do I generate FOC firmware for the SPIN3204, since only a 6-step library is provided?

3)     There is no file “6step_conf.c�? on my computer anywhere, and I downloaded STSW-SPIN3204 as well as the latest software MCSDK version 5.4.2. A file search found 2 files “6step_conf.c.ftl�?, and if these are what you referenced in your instructions, line 250 does not look appropriate to change as described.

4)     You say copy the files manually, but I downloaded the STSW-SPIN3204 and put it in the STM32CubeIDE workspace, so it’s not in the C:\Program Files (x86)\STMicroelectronics\MC_SDK_5.4.2\Projects\STEVAL-SPIN3204\Demonstration\6Steps_STEVAL-SPIN3204 library. Is that OK or is the folder within the MCSDK more updated than the STSW-SPIN3204 I downloaded?

5)     There is no folder for the STEVAL-SPIN3201 in C:\Program Files (x86)\STMicroelectronics\MC_SDK_5.4.2\Projects\.  I assume we can download STSW-SPIN3201 and file it anywhere such that the MCSDK can open the sample project. Is this correct?

Since I am unable to understand and execute what you described, I will have to wait for the next release. I have 3 ST evaluation boards, the STEVAL-SPIN3201, STEVAL-ESC001V1 and STEVAL-ESC002V1. I was considering ordering the STEVAL-SPIN3204, which is why I am trying to compile that code.  This is the status of each:

STEVAL-SPIN3204: As discussed in this thread

STEVAL-SPIN3201: Compile errors as indicated in another thread (https://community.st.com/s/question/0D50X0000BaJqRwSQK/what-is-the-reason-for-compile-errors-with-stm32cubeide-for-stevalspin3201-and-stevalesc001v1-sample-programs-that-are-unable-to-find-modules-even-though-the-libraries-with-the-missing-modules-are-in-the-includes?t=1573654791725)

STEVAL-ESC001V1: Compiles OK with the new MCSDK Version 5.4.2 and downloads to the eval board but it does not run the motor with a PWM signal even though the Motor Profiler and the GUI do, so I know it is electrically connected properly. Perhaps a code change is required to recognize the PWM signal as the speed controller, but I can’t find where in the generated code.

STEVAL-ESC002V1: There is only an EWARM sample program for IAR’s IDE. Since my IAR license expired, with the intent to use the STM32CubeIDE, I can no longer generate firmware. Motor control was also deficient, as the ESC lost control of the motor if the speed request was altered too rapidly.

A general comment about ST products: I attended a workshop in Montreal earlier this year. Preparation for the lab was detailed to the point that is was very easy to install and set up the environment. It would be most helpful if this type of guide were provided to implement the evaluation boards. For example, there is no indication in the user guides where to unpack STSW files.