cancel
Showing results for 
Search instead for 
Did you mean: 

Problem compiling code generated by MC workbench and CubeMX.

dc2ac
Associate II

I am using STM32CubeIDE 1.12.1 and MC Workbench 6.20 to generate the profiler firmware to run with the Motor Profiler software. I am running into two problems.

The first one: If I use the P-NUCLEO_IHM003 kit in the Example Projects to generate the code, I don't have this problem. If I create a new project by selecting the motor and the power board (same as the example) to generate the code, I get this error with the static function "R3_1_RLGetPhaseCurrents()".

In file included from ../../Inc/mc_config.h:40,
from ../../Inc/motorcontrol.h:25,
from C:/Users/dc2ac/.st_workbench/projects/motor-profiler/Src/mc_interface.c:28:
../../MCSDK_v6.2.0-Full/MotorControl/MCSDK/MCLib/G4xx/Inc/r3_1_g4xx_pwm_curr_fdbk.h:263:13: warning: 'R3_1_RLGetPhaseCurrents' declared 'static' but never defined [-Wunused-function]
263 | static void R3_1_RLGetPhaseCurrents(PWMC_Handle_t *pHdl, ab_t *pStator_Currents);
| ^~~~~~~~~~~~~~~~~~~~~~~

The second problem is when I included the motor profiler checkbox in the application configuration tab, I got compile errors. If I don't check the box, it compiles normally. When the box is checked, it includes the "libmp-IAR_ARMv7-M.a" file. When linking, there are multiple errors related to "warning: 'R3_1_RLGetPhaseCurrents' declared 'static' but never defined".

Help is appreciated.

 

7 REPLIES 7
dc2ac
Associate II

Sorry for the quick copy and paste in the last post. The second problem is related to the error "unknown mandatory EABI object attribute 50" when linking the "libmp-IAR_ARMv7-M.a" file.

cedric h1
Associate III

Hello @dc2ac ,

The first point is a warning that does not affect the compilation.

The second point is due the compiler version. Please update your cubeIDE to version 1.13.2.

Regards

Cedric

If you agree with my answer, please accept it by clicking on 'Accept as solution'."

If you agree with my answer, please accept it by clicking on 'Accept as solution'."

Hi Cedric,

The second point is fixed after the upgrade to 1.13.2. On the first point, any idea where the code generation is different between the example project and the new project?

Thanks for your reply.

For the first error you have not included in compilation r3_1_g4xx_pwm_curr_fdbk.c file which is important, where the definition of R3_1_RLGetPhaseCurrents function is available.

Hello @dc2ac ,

The difference between the example and the new project is the profiler checkbox. Your new project will build a project aiming to profile your motor. Once your binary is compiled and flashed, you can connect the Motor Control Pilot and start the profiler.

Regards

Cedric

If you agree with my answer, please accept it by clicking on 'Accept as solution'."

Hello @SRedd.5,

The first point is not an error but only a warning. It does not affect the binary generation.

The r3_1_g4xx_pwm_curr_fdbk.c is properly included in the files to be compiled.

Regards

Cedric

If you agree with my answer, please accept it by clicking on 'Accept as solution'."

After playing around with the check boxes, I now can create a new project and get the same result as the example project. All is good and the first error is gone.