cancel
Showing results for 
Search instead for 
Did you mean: 

How do I merge the code from STM32CubeMX with HAL-libraries from the System Workbench project wizard?

misterstarshine
Associate III
Posted on September 07, 2016 at 17:10

Hi.

Hope this will not be a double post. I sent it earlier but got no confirmation whatsoever that it was ever submitted.

I've got the STM32F746G-DISCO board and I'm using the System Workbench IDE and STM32CubeMX for initialization code. The HAL libraries that come with the System Workbench project wizard look different and seem to be more easy to use than the corresponding libraries that can be imported from STM32CubeMX.

Since the ''import'' function in System Workbench seems to always create a new project rather than adding code to an existing one I find a need to merge the STM32CubeMX code with code generated by the System Workbench project wizard.

The pathnames are different and when I tried to manually merge the projects by simple copy the files there were conflicts and problems that appeared in the resulting project.

A project generated by the project wizard in System Workbench has a folder named ''Utilities'' which contains a lot of useful headers and sourcecode. An example is the header file stm32746g_discovery_lcd.h which does not come with the code generated from STM32CubeMX. The corresponding header file for the LCD generated by STM32CubeMX is named stm32f7xx_hal_ltdc.h and appears to be less easy to use than the  stm32746g_discovery_lcd.h header file.

I might be doing something wrong or this might exclusively be a System Workbench issue.
3 REPLIES 3
christoph2399
Associate II
Posted on September 07, 2016 at 17:20

sorry but with iar i cant help you.

but maybe it's still based on the old peripheral-library. ST changed the it later to the HAL-library.

you can check the this [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32%20Legacy%20Firmware%20Libraries&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx&currentviews=12706]<< legacy post >> here

misterstarshine
Associate III
Posted on September 07, 2016 at 18:25

Thanks for your reply.

System Workbench is supplied from Ac6

The directory path from the STM32CubeMX generated code is

$(ProjDirPath)/Drivers/STM32F7xx_HAL_Driver

while the path from System Workbench project wizard is

$(ProjDirPath)/HAL_Driver/

and it seems both options have the same or at least similar HAL drivers but located in different paths. I'm having problems making those two work together.

The STM32CubeMX generated project gives me all I need except the ''Utilities'' folder that contains stuff I need. All examples out there I've seen rely on the code found in the ''Utilities'' folder.

christoph2399
Associate II
Posted on September 07, 2016 at 21:47

my advice, change your project.

cubemx gives you just a suggestion, it's not written in stone. change it.

imigrate to the latest hal-driver.

you have to know which source files your compiler is using to generate your firmware. remove all unknown / unnecessary source files