AC6 + CubeMX include problems
Hello, thank you for you comments.
cipriansalageanu, it is true that officially CubeMX doesn't supports Linux, but in the reality it is written fully in Java, and Java is OS-independent, and in fact it works smoothly also on Linux just launching it with "java -jar SetupSTM32CubeMX-4.10.1-RC2.exe". But probably there are some lines not well programmed that cause the output project files of CubeMX to be not OS-independent: with a very small afford CubeMX can be corrected and distributed officially for every OS.
diabolo38, I already tried you method without success. The problem was that I didn't "rebuild/freshen" in the "index" menu of the project. Then it works.
But I wanted a solution that allowed me to generate smoothly projects with CubeMX, add my code, and eventually update the configurations with CubeMX without copying code around.
So I can write the steps for everyone that uses the Workbench from Linux:
- From CubeMX, in the "project settings" and code "generation tab" you can select "copy...." (case (A)), or "add..." (case (B)). Once generated the project for SW4STM32, before opening the Workbench navigate to the project folder (e.g. named "test"), then go to "test/SW4STM32/test Configuration", and edit the hidden file .cproject.
- Inside that file, find "..\STM32F401RETx_FLASH.ld" and change to "../STM32F401RETx_FLASH.ld".
- Find if the flags "weak=attributeweak" and "packed=attributepacked" are present or not, and eventually add single quotes and change them to "'weak=attributeweak'" and "'packed=attributepacked'".
- Then, in the “Include paths” list look for the "Inc" path and change it to "../../../Inc". The other paths must be changed according to you choice in CubeMX discussed before: in the case of (A) just add "../../../" in front of every entry, so e.g. change "Drivers/STM32F4xx_HAL_Driver/Inc" to "../../../Drivers/STM32F4xx_HAL_Driver/Inc"; in the case of (B), just change every "\" to "/" in the paths, so they e.g. change "..\..\../../../../STM32Cube/Repository/STM32Cube_FW_F4_V1.8.0/Drivers/STM32F4xx_HAL_Driver/Inc" to "../../../../../../STM32Cube/Repository/STM32Cube_FW_F4_V1.8.0/Drivers/STM32F4xx_HAL_Driver/Inc".
After these steps, open the Workbench, import the project, and it should compile perfectly. If you generate again the code from CubeMX, you must edit again the .cproject, close the Eclipse project, repoen it, and eventually rebuild the indexes.
You can do these steps also from the GUI Eclipse, but the edits directly on the .cproject files can be easily automatized: I will write a simple script for it.
The debug also works, but before you must add the Openocd rules for udev, e.g. with https://github.com/arduino/OpenOCD/blob/master/contrib/99-openocd.rules
Hope this will help someone, and it can serve also as suggestions for developes.