Importing an STM32CubeMX generated project under System Workbench for STM32
I have created a project in STM32CubeMX version 4.17.0 using firmware package STM32Cube_FW_F4_V1.13.0. I have selected the toolchain SW4STM32, with “Generate Under Root” checked. I have selected “Copy only the necessary library files” in order to generate the FreeRTOS and USB_Device libraries. When I generate code in Cube, the following folders are created; Drivers/CMSIS, Drivers/STM32F4xx_HAL_Driver, Inc, Middlewares/ST/STM32_USB_Device_Library, Middlewares/Third_Party/FreeRTOS, and Src. The generated code looks like what I would expect.
I have then imported the cube output as an existing project into eclipse. I have installed system workbench from the eclipse using “Install New Software...”. So I am using the latest version of System Workbench.
When I build the application, I get hundreds of errors. It appears that the compiler cannot see all the include directories.
I noticed that all the include directories were references to outside of the workspace. I have changed all the includes to the same folders but within the workspace; i.e. the folders which were included by selecting “Copy only the necessary library files” in cube. I also noticed that the includes were only listed under Properties > C/C++ Build > Settings > MCU GCC Assembler > General. I have copied them into Properties > C/C++ Build > Settings > MCU GCC Compiler > Includes.
However, I still get hundreds of errors; such as:
../Src/main.c:544:17: error: ‘GPIOC’ undeclared (first use in this function)
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
In file included from /home/gateway/workspace/target-actuator/Inc/stm32f4xx_hal_conf.h:358:0,
from /home/gateway/workspace/target-actuator/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h:48,
from ../Src/main.c:45:
/home/gateway/workspace/target-actuator/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:291:3: error: unknown type name ‘TIM_TypeDef’
TIM_TypeDef *Instance; /*!< Register base address */
I assume doing an import is correct. I have seen other videos which create a cube project, then create a new project in eclipse. I will give that a go. I will also create a simpler cube project (i.e. without FreeRTOS). Just needed some confirmation that I’m using the right settings in cube and following the right import steps in eclipse.
Also, since im using a custom made board, I need a configuration file for the debugger. It appears in order to do this, I need to create a new project in eclipse anyway. As the import doesn’t generate anything, and the debugger assumes I am using a development kit. Is this correct?