1 of 1 people found this helpful
I think I got this working. The issue is that cubemx main.c was calling SystemClock_Config() but it was already called by __initialize_hardware() so the call failed.
- created a GNU MCU STM32f4x project with an empty main
- generated the cubemx project as a subdirectory in the GNU MCU project
- removed calls to HAL_Init() and SytemClock_Config() from cubemx main
- added a #define in the USER CODE region of cubemx main to rename main to cubemx_main(). Call Cubemx_main() from GNU MCU main()
- modified the GNU MCU project to use all the cubemx generated code (with a couple exceptions) Used
- stm32f4xx_hal_msp.c - excluded from GNU MCU
- system_stm32f4xx.c - excluded from GNU MCU
- stm32f4xx_it.c - additional IRQ handlers
- stm32f4xx_hal_conf.h from cubemx, modify order of includes
Other than the extensive modifications to the project configuration regarding include and source file paths, it was fairly straight forward.
I have read the various posts regarding the integration of CubeMX. The goal is to create a C++ FreeRTOS project with peripheral initialization using CubeMX (STM32F407). I have gotten to the point that the project builds and loads in the debugger. My struggle seems to be system initialization.
This is what I have done.
- created a GNU MCU C++ project for the STM32F4xx
- used CubeMX to create a cubemx subdirectory in the GNU MCU project. Code generation configured as follows
- copy only necessary library files
- generate peripheral initialization files
- other toolchains (GPDSC)
- changed project configuration to use the HAL driver source and include from CubeMX
- both CubeMX and Eclipse packs claim to be at the same version but the code is not the same
I believe the cubeMX generated system_stm32f4xx.c should be used. To fix compiler issues, I copied APBPrescTable to the file in GNU MCU. When I included the CubeMX version it did not boot.
Do you have additional information about how to integrate these environments?