2019-10-03 11:54 AM
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;
2021-07-07 10:33 AM
Sorry I missed to react about his :
"From MCWorkbench, I used the Update button instead of Generate (Generate should be removed or disabled if it does not work)
I closed MCW and opened Cube MX
I generated code (no changes to .ioc"
If you did not modify the IOC, you do not have to open cubeMX and generate again. It has already been done by the workbench. You just generate the code twice. Once the project is generated from the workbench you can just click on "Open Folder" and you will see that your complete project is already there.
Cedric
2021-07-07 12:06 PM
Hi Cedric,
Thank you for the explanation -it goes a long way to help me understand what I should be doing.
I tagged on to the thread since I was exeriencing the exact message described in it.
If I read this correctly, I should use Generate from the MC Workbench only when creating a new project from the workbench. ANytime I use it again on the same project it is likely to cause problems.
Th examples have already been generated, so I should only ever update them.
Is this correct?
So the criticla points from this thread are
These last two are a bit of a pain, may be unnecessary unless you are working against a deadline. They are easy enough to do. An easy work around would be tot create an .ioc specifically to initialise these pins, generate to separate files, then copy these files in to the MC project.
Perhaps the Generate button needs to either be greyed out, or carry a warning dialog if invoked and the files exist.
Perhaps the .ioc can be tagged so that CubeIDE->Mx cannot open it (or IDE can spawn External CubeMX ?).
Thanks for the help.
Chris
2021-07-09 07:50 AM
Hello Chris,
I will try to answer point by point.
" I should use Generate from the MC Workbench only when creating a new project from the workbench. ANytime I use it again on the same project it is likely to cause problems."
Not really. When you start a project from scratch, you do not have the choice, only the generate button can be clicked, as there is nothing to update.
The rule of thumb, is that as far as you do not change the IOC file generated clicking on generate button is the safest solution.
The trick to understand here is that starting from an example, is NOT starting from scratch. We provide within the example an IOC that you must not override to keep the example functional. This is why we ask you to click on the update button in the provided readme.txt file. The purpose here is to allow the user to change only the motor parameters.
"So the criticla points from this thread are
You can generate project multiple time, clicking on generate button will guarantee you that the IOC is always coherent but written from scratch.
Almost correct ! Whole project is not generated, but the IOC file is already provided. It has just to be updated with your motor parameters. So yes only click on Update button when you start from an example (as stated in the readme.txt file ;) )
This is our recommendation today.
For the first generation you do not really have the choice. cubeMX version embedded inside cubeIDE is not proposed amongst the possible choices. An action is on going to detect it but It is not the case yet.
Once the code is generated, modification of the IOC could be done by cubeMX or embedded cubeIDE version. I tested both successfully but our preferred way in the dev team is to use standalone cubeMX version. It is an old habit as the cubeMX embedded in cubeIDE is a pretty new feature.
Not sure what are you referring to here,
If you need to add IPs or modify the IOC, the safest way to proceed is to do this inside cubeMX, and once the IOC is modified generate the code from cubeMX only. You should avoid to use the MC Workbench and click on update button to update an IOC modified by cubeMX excepting you completely understand what you are modifying.
"They are easy enough to do. An easy work around would be tot create an .ioc specifically to initialise these pins, generate to separate files, then copy these files in to the MC project."
We are working hard to iron this part, For the time being the best advice I can give you is to avoid round-trip between cubeMX and MC Workbench,
Regards
Cedric