CubeMX2Makefile icon indicating copy to clipboard operation
CubeMX2Makefile copied to clipboard

.cproject file quotes some strings

Open robin-ds opened this issue 9 years ago • 7 comments

When parsing valueType="definedSymbols" on my Debian system. the .cproject file has the following: <listOptionValue builtIn="false" value="__weak=&quot;__attribute__((weak))&quot;" /> <listOptionValue builtIn="false" value="__packed=&quot;__attribute__((__packed__))&quot;" /> This results in the generated Makefile containing: C_DEFS = -D__weak="__attribute__\(\(weak\)\)" -D__packed="__attribute__\(\(__packed__\)\)"

which causes the compile to fail with: Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal.c:204:1: error: stray '\' in program __weak void HAL_MspInit(void)

Either use the double quotes from the .cproject file or escape the round brackets but not both!!

Strangely, all works well on a *buntu system!!

Found the difference!! The debian system (which fails) is running 4.11.0 and the *buntu system is running 4.10.1

robin-ds avatar Oct 27 '15 02:10 robin-ds

Yes it also fails on msys2 bash which I used on Windows. It seems that manually un-escape ( with ( and ) with ) will work. I will fix it.

baoshi avatar Nov 04 '15 07:11 baoshi

Any progress on this?

robin-ds avatar Jan 25 '16 00:01 robin-ds

I've encountered the same issue running STM32CubeMX 4.12.0.

rogerdahl avatar Feb 05 '16 02:02 rogerdahl

Unfortunately, CubeMX2Makefile.py will probably break for every other update of STM32CubeMX, as the project file format changes. Keeping it working will require long term commitment from the original author or the community. Of course, the real solution is for ST to add a Makefile project target for MX.

rogerdahl avatar Feb 05 '16 02:02 rogerdahl

Sorry guys. I will look into that next week when I put things down. ST keep change things make this difficult to keep updates.

baoshi avatar Feb 05 '16 02:02 baoshi

For this issue, just delete -D__weak="attribute((weak))" flag from the C-DEFS, then you will be good depending on the GCC version you are using.

One more thing though.

As of STM32CubeMX 4.13.0, it changed the tool chain directory name from SW4STM32/"Project Name" Configuration to just STM4STM32/"Project Name" so you have to either rename your tool chain directory after STM32CubeMX generates it or you may want to remove the ' Configuration' string from the python script, CubeMX2Makefile.py

innomatica avatar Feb 17 '16 16:02 innomatica

@innomatica I've submitted a PR that fixes the C_DEFS quoting issue.

rogerdahl avatar Feb 17 '16 18:02 rogerdahl