A blog about electronics and programming
Home ElectronicsSTM32 How to quickly import a STM32CubeMX project inside an Eclipse project

How to quickly import a STM32CubeMX project inside an Eclipse project

by Carmine Noviello
Published: Last Updated on 48 comments 5K views 5 minutes read

I've implemented a faster way to automatically import CubeMX project into an Eclipse tool-chain based on the GNU ARM Plugin, as described either on this blog and in my book.

I've implemented a bare-bone python script that simply "translates" a CubeMX project for the SW4STM32 (aka AC6) tool-chain in a project generated with the GNU ARM plugin. The script can be downloaded from my github account. Let's see how this works.

First of all, we have to generate a new Eclipse project using the GNU ARM Plugin. Go to File->New->C Project and select "Hello World ARM Cortex-M C/C++ project. You can choose the project name you want. Click on “Next“. Here we assume "test1" as Eclipse project name.

Schermata 2015-06-04 alle 08.11.57In the next step you have to configure your microcontroller. For example, for a STM32-F4 you have to choose Cortex-M4 core, while for a STM32-F0 you have to choose Cortex-M0. The Clock, Flash size and RAM parameters depend on your MCU. For a STM32F401RE you can use the same values shown in the following picture. Set the other options as shown below.Schermata 2015-06-04 alle 08.14.12

If you are using a Nucleo, this table extracted from my book shows the right values for all Nucleo boards.

ch4-table-nucleo-specs

In the next step leave all parameters unchanged except for the last one: Vendor CMSIS name. Change it from DEVICE to stm32f4xx if you have a STM32F4 based board, or stm32f1xx for F1 boards, and so on. Please, be sure to use this pattern, otherwise the script simply doesn't work.Schermata 2015-06-04 alle 08.24.02Click on “Next“. You can leave the default parameters in the next steps. After a while, Eclipse will generate a new project for you. Now, click on the project root in the Project Explorer  view and click on "Close Project" entry. 

Now, use the CubeMX tool to configure your MCU according your needs. When finished, click on the Project->Generate code menu. In the Project Settings dialog give the name you want to the project and select an output directory where store the project. Here we assume that the CubeMX project name is "mymcu".  Choose SW4STM32 as Toolchain/IDE (this is really important, to not skip this step) and generate the code.

Finally, to use the tool I've made, you can easily type the following command at terminal prompt:

When finished, open the project "test1" in Eclipse, click with the right mouse button on the project root and choose "Refresh" (this will force the scan of the source tree, since it has been changed while the Eclipse project was closed). Finished. 🙂

Don't forget to update the file mem.ld, changing the FLASH origin address from 0x00000000 to 0x08000000.

The script now supports also the import of Middleware libraries (FatFS, FreeRTOS, LwIP).

The script is designed to work both in Python 2.7 and 3.x. It requires the lxml library.

Windows users can download a pre-compiled lxml package directly from here:

https://pypi.python.org/packages/2.7/l/lxml/lxml-3.5.0.win32-py2.7.exe#md5=3fb7a9fb71b7d0f53881291614bd323c

Linux and MacOS X users can install lxml using pip:

Please, let me know if it worked for you 😉


You may also like

48 comments

Alex November 16, 2015 - 12:49 am

Hello!

I run your script on windows 7. When I type such a line in cmd I get this

http://itmag.es/1HOyO

Reply
Carmine Noviello November 24, 2015 - 11:43 am

Hi,
The script is coded in Python 2.7, not Python 3.x. Use Python 2.7 to run it 😉

Reply
Henrik November 24, 2015 - 3:24 pm

Hi Carmine!

First a great big THANK YOU for all your hard work putting together guides, scripts and other material regarding STM32 development!

I am trying to run your script on Win 8 using Python 2.7, but installing lxml (which I understand is needed) seems a bit out of my depth.

Any advice?
//Henrik

Reply
Carmine Noviello December 4, 2015 - 9:06 am

Hi Henrik,
Sorry for late replay, but I'm experiencing an issue with this blog and emails (I don't receive email about comments any more and I don't know why.....).

You can find an lxml binary distribution for Windows here:

ftp://ftp.zlatkovic.com/libxml/

Please, let me know if it works for you.

Carmine

Reply
Kevin November 24, 2015 - 8:58 pm

Carmine,

This is awesome. Thank you for providing this! The only issue I ran into was that the python script requires lxml (I had neither installed), but I found a Windows installation at https://pypi.python.org/simple/lxml/. I downloaded xml-3.5.0.win32-py2.7.exe and your script ran with no errors, and I was able to build a project according to your instructions.

This will be extremely helpful to many of us that were using GCC and Eclipse with the old standard peripheral libraries. I greatly appreciate your efforts.

Reply
Carmine Noviello December 4, 2015 - 9:06 am

Hi Kevin,
Thank you for sharing 😉

Carmine

Reply
Kevin November 30, 2015 - 10:20 pm

Carmine,

FYI, I tried enabling the FreeRTOS middleware, but the libraries did not get imported. Guess it's time to learn Python. The script you've already provided should give me a big head start.

Reply
Carmine Noviello December 4, 2015 - 9:07 am

Yes, the script currently doesn't import middleware libraries. I'll update it soon.

Reply
Carmine Noviello December 14, 2015 - 6:09 pm

Hi Kevin,
The script now supports the import of middleware libraries.

Reply
Kevin December 15, 2015 - 2:45 pm

I was about to dig into Python yesterday when I saw your update. I only had one issue on my Windows machine - the include paths for the Middlewares were incorrect. I had to replace the forward slashes in line 320 with double backslashes to generate the correct include paths. Thanks again for your work. I had just tried the latest CubeMX with the new version of Atollic TrueStudio (v5.4 Lite is no longer code size limited), and I could not get it to import correctly, so I guess I'll be sticking with the GNU tools for now (thanks to you!)

Reply
Carmine Noviello December 15, 2015 - 5:17 pm

Thanks for advising me of this incompatibility on Windows.

Reply
Kevin December 17, 2015 - 2:47 pm

FYI, an update with respect to TrueStudio Lite and CubeMX - I was able to get it to work properly only if I did NOT copy the project into the workspace. The files MUST be referenced from the CubeMX TrueStudio output folder. When I left the Copy Project into Workspace checkbox unchecked in the Atollic Import Existing Projects into Workspace dialog, it worked seamlessly. This is now a really great option for building large projects using STM32 devices with CubeMX if you don't want to mess with setting up all of the GNU tools and GDB. I was able to import the CubeMX (with FreeRTOS) onto a 429i-Disco board, compile and debug, without having to modify anything. Kudos to Atollic for giving the Lite version unlimited code size capability. After I do some performance testing, I will likely upgrade to the Pro version to get the RTOS-aware debugging capabilities.

Reply
Mark J. Blair December 30, 2015 - 2:35 am

Thank you for writing this script. It is quite helpful!

I found that it worked best if I replaced mem.ld with a mem.ld file from a project created by (for example) the "STM32F4xx C/C++ Project" template. This gave me not only the correct flash and RAM origin addresses, but also correct definitions of other memory regions. However, I was not able to use your script to import STM32CubeMX code directly into such a project, due to mis-naming of the vendor CMSIS directory. So, I imported code with your script into a project created with the "Hello World..." template as directed, then replaced its mem.ld with one created in a different project that came from the "STM32F4xx..." template.

Do you think you might consider adding support for importing STM32CubeMX code into Eclipse projects created with the various "STM32F..." templates? I think that this would make it a little bit easier to launch new projects with correct linker scripts for the more complex STM32F variants.

Reply
Carmine Noviello December 31, 2015 - 10:26 am

Hi,
I've plans to improve the script. Maybe a good solution would be to have the ability to specify the CMSIS directory at command line, or a way to automatically discover its name.

Reply
laurent damon January 7, 2016 - 3:22 pm

Hello,

Thank you for your tutorial and the time spent on it.

When I try your python script, i get the following error, any clue of where it comes ?

Traceback (most recent call last):
File "CubeMXImporter-master\cubemximporter.py", line 420, in
cubeImporter.cubeMXProjectPath = args.cubemx_path
File "CubeMXImporter-master\cubemximporter.py", line 49, in setCubeMXProjectPath
self.detectHALInfo()
File "CubeMXImporter-master\cubemximporter.py", line 188, in detectHALInfo
options = root.xpath("//option[@superClass='gnu.c.compiler.option.preprocess
or.def.symbols']")[0]
AttributeError: 'str' object has no attribute 'xpath'

Reply
Carmine Noviello January 7, 2016 - 3:32 pm

Hi,
It seems that there is no .cproject file inside the "SW4STM32/project-name Configuration" folder. I have to add a better check inside the detectHALInfo() method.
Try to regenerate the CubeMX C project ensuring that the selected toolchain is SW4STM32.

Reply
tiwag February 23, 2016 - 10:14 pm

you should really test the SW4STM32 (System Workbench for STM32, aka AC6) eclipse plugin.
with the last version i'm able to directly open a CubeMX generated project and it builds and debugs without any further steps necessary.

Reply
Carmine Noviello February 24, 2016 - 7:01 am

AC6 has still too many issues, and it doesn't run on the Mac, which is the platform I use everyday.

Reply
Daniel July 24, 2016 - 7:02 am

It worked for me, thanks!

Reply
Ran August 1, 2016 - 4:06 pm

Hi Carmine,
Thanks for the script and your guides, worked great and very helpful!

Reply
silpa November 1, 2016 - 10:21 am

Hai

I am currently using your cubemximporter ,I tried to port freertos program to eclipse but the middlewares files are not importing properly. when i give the cubemximporter command in terminal it shows like :

"The original CubeMX project contains the FreeRTOS middleware library.
This library was imported in the Eclipse project correctly, but you still need to
configure your tool-chain 'Float ABI' and 'FPU Type' if your STM32 support hard float
(e.g. for a STM32F4 MCU set 'Float ABI'='FP Instructions(hard)'' and 'FPU Type'='fpv4-sp-d16'.
Moreover, exclude from build those MemManage files (heap_1.c, etc) not needed for your project."

in eclipse the error comes like

" arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -Wall -Wextra -g -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F103xB -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f103" -I"../system/include/stm32f1xx" -I"../system/include/cmsis/device" -I"Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3" -I"Middlewares/Third_Party/FreeRTOS/Source/include" -I"Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS" -std=gnu11 -MMD -MP -MF"src/freertos.d" -MT"src/freertos.o" -c -o "src/freertos.o" "../src/freertos.c"
../src/freertos.c:35:22: fatal error: FreeRTOS.h: No such file or directory
#include "FreeRTOS.h"
^
compilation terminated.
make: *** [src/freertos.o] Error 1

How to solve this?I have successfully ported the Hal files but problem with the freertos middlewares. Can you please help me?

Reply
Carmine Noviello November 3, 2016 - 6:11 am

I've checked with the latest CubeMX and CubeMXImporter tool and it works correctly. Your project seems to use FreeRTOS, but something wrong happened with your project settings. Review all the steps carefully.

Reply
dijith December 23, 2016 - 4:14 pm

can u help me to add freertos n an existng file to a coide

Reply
dijithp December 23, 2016 - 4:15 pm

can u help me to add freertos n an existng project file to a coide from coocox

Reply
Krzysztof Pudłowski January 17, 2017 - 4:58 pm

Afret upgrading CubeMx to 4.19

I have problem ....

Microsoft Windows [Wersja 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Wszelkie prawa zastrzeżone.

C:\developing\stm32\python\CubeMXImporter-master>"convert - l1 blinkings.bat"

C:\developing\stm32\python\CubeMXImporter-master>c:\python27\python.exe cubemxim
porter.py C:\developing\stm32\workspace\STM32Cubel1Blinking D:\installs\stm\cub
emxl1\stm32l1mxblinking\STM32l1mxblinking
Traceback (most recent call last):
File "cubemximporter.py", line 536, in
cubeImporter.importCMSIS()
File "cubemximporter.py", line 310, in importCMSIS
shutil.copy(loc[0], loc[1])
File "c:\python27\lib\shutil.py", line 119, in copy
copyfile(src, dst)
File "c:\python27\lib\shutil.py", line 82, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: 'D:\\installs\\stm\\cubemxl1\\stm3
2l1mxblinking\\STM32l1mxblinking\\Drivers/CMSIS/Device/ST/STM32L1xx/Source/Templ
ates/gcc/startup_stm32l100xc.s'

C:\developing\stm32\python\CubeMXImporter-master>

Reply
Carmine Noviello January 18, 2017 - 8:23 am

Thank you for letting me know this. I've fixed the bug and released an update on github.

Reply
Krzysztof Pudłowski January 18, 2017 - 1:05 pm

Confirmed. Works.

Reply
Krzysztof Pudłowski January 17, 2017 - 5:06 pm

And next while building Eclipse project

Building target: STM32CubeL1Blinking.elf
Invoking: Cross ARM C++ Linker
arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra -g3 -T mem.ld -T libs.ld -T sections.ld -nostartfiles -Xlinker --gc-sections -L"../ldscripts" -Wl,-Map,"STM32CubeL1Blinking.map" -o "STM32CubeL1Blinking.elf" ./system/src/stm32l1xx/stm32l1xx_hal.o ./system/src/stm32l1xx/stm32l1xx_hal_adc.o ./system/src/stm32l1xx/stm32l1xx_hal_adc_ex.o ./system/src/stm32l1xx/stm32l1xx_hal_cortex.o ./system/src/stm32l1xx/stm32l1xx_hal_dac.o ./system/src/stm32l1xx/stm32l1xx_hal_dac_ex.o ./system/src/stm32l1xx/stm32l1xx_hal_dma.o ./system/src/stm32l1xx/stm32l1xx_hal_flash.o ./system/src/stm32l1xx/stm32l1xx_hal_flash_ex.o ./system/src/stm32l1xx/stm32l1xx_hal_flash_ramfunc.o ./system/src/stm32l1xx/stm32l1xx_hal_gpio.o ./system/src/stm32l1xx/stm32l1xx_hal_pwr.o ./system/src/stm32l1xx/stm32l1xx_hal_pwr_ex.o ./system/src/stm32l1xx/stm32l1xx_hal_rcc.o ./system/src/stm32l1xx/stm32l1xx_hal_rcc_ex.o ./system/src/stm32l1xx/stm32l1xx_hal_tim.o ./system/src/stm32l1xx/stm32l1xx_hal_tim_ex.o ./system/src/newlib/_cxx.o ./system/src/newlib/_exit.o ./system/src/newlib/_sbrk.o ./system/src/newlib/_startup.o ./system/src/newlib/_syscalls.o ./system/src/newlib/assert.o ./system/src/diag/Trace.o ./system/src/diag/trace_impl.o ./system/src/cortexm/_initialize_hardware.o ./system/src/cortexm/_reset_hardware.o ./system/src/cortexm/exception_handlers.o ./system/src/cmsis/system_stm32l1xx.o ./src/main.o ./src/stm32l1xx_hal_msp.o ./src/stm32l1xx_it.o ./src/system_stm32l1xx.o
./src/system_stm32l1xx.o: In function SystemInit':
C:\developing\stm32\workspace\STM32CubeL1Blinking\Debug/../src/system_stm32l1xx.c:161: multiple definition of
SystemInit'
./system/src/cmsis/system_stm32l1xx.o:C:\developing\stm32\workspace\STM32CubeL1Blinking\Debug/../system/src/cmsis/system_stm32l1xx.c:161: first defined here
./src/system_stm32l1xx.o: In function SystemCoreClockUpdate':
C:\developing\stm32\workspace\STM32CubeL1Blinking\Debug/../src/system_stm32l1xx.c:232: multiple definition of
SystemCoreClockUpdate'
./system/src/cmsis/system_stm32l1xx.o:C:\developing\stm32\workspace\STM32CubeL1Blinking\Debug/../system/src/cmsis/system_stm32l1xx.c:232: first defined here
./src/system_stm32l1xx.o:(.rodata.APBPrescTable+0x0): multiple definition of APBPrescTable'
./system/src/cmsis/system_stm32l1xx.o:(.rodata.APBPrescTable+0x0): first defined here
./src/system_stm32l1xx.o: In function
.LANCHOR2':
system_stm32l1xx.c:(.rodata.AHBPrescTable+0x0): multiple definition of AHBPrescTable'
./system/src/cmsis/system_stm32l1xx.o:system_stm32l1xx.c:(.rodata.AHBPrescTable+0x0): first defined here
./src/system_stm32l1xx.o: In function
.LANCHOR1':
system_stm32l1xx.c:(.rodata.PLLMulTable+0x0): multiple definition of PLLMulTable'
./system/src/cmsis/system_stm32l1xx.o:system_stm32l1xx.c:(.rodata.PLLMulTable+0x0): first defined here
./src/system_stm32l1xx.o: In function
.LANCHOR0':
system_stm32l1xx.c:(.data.SystemCoreClock+0x0): multiple definition of `SystemCoreClock'
./system/src/cmsis/system_stm32l1xx.o:system_stm32l1xx.c:(.data.SystemCoreClock+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
cs-make: *** [STM32CubeL1Blinking.elf] Error 1

Reply
Krzysztof Pudlowski January 21, 2017 - 11:12 pm

I have problem with generating template from Cube to Eclipse for Discovery F0.
Program seems to by dead, When running from ST-link, I have halted state, and when I press in Core Panel Run button I have "Unable to run application message"

Reply
Carmine Noviello January 24, 2017 - 10:25 pm

I suspect that the assembly file containing vector table (startup_stm32f0xx.S) doesn't end with capital "S".

Reply
Krzysztof Pudłowski January 25, 2017 - 10:05 pm

I have four discovery boards

1. F0Discovery Device family :STM32F051x4/F051x6/F051x8/F030x8
2. F1Discovery Device family :STM32F100xx Low/Medium density Value Line
3. F4Discovery Device family :STM32F411xC/E
4. L1Discovery Device family :STM32L100xC/L15xxC/L162xC

I'm trying to begin my work using hal templates for all of tose boards.

Projects in CubeMX are here
https://drive.google.com/open?id=0BzX4UpG5CGNzdVF4eHZza0dRT0k

and after conversion in python

Projects in Eclipse are here

https://drive.google.com/open?id=0BzX4UpG5CGNzSktoTkpnTnBWVVU

I'm doing something stupid wrong...

F0 - Unable to run application message
F1 - main loop is dead,
F4 - works
L1 - main loop is dead

I'm interested at the beginning in using ADC for three pots, DAC for DDS audio output

Eclipse IDE for C/C++ Developers

Version: Mars.2 Release (4.5.2)
Build id: 20160218-0600

CubeMx version 4.19.0

Reply
Carmine Noviello January 30, 2017 - 7:50 am

I just checked the L1 project. If I'm not wrong, that MCU has 16K of SRAM + 4K of EEPROM. So the SRAM definition in mem.ld file is wrong (put it at 16K).

Reply
Krzysztof Pudłowski January 30, 2017 - 9:49 pm

Changing to

FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 4K

I Have

Building target: STM32CubeL1Blinking.elf
Invoking: Cross ARM C++ Linker
arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -Wextra -g3 -T mem.ld -T libs.ld -T sections.ld -nostartfiles -Xlinker --gc-sections -L"../ldscripts" -Wl,-Map,"STM32CubeL1Blinking.map" -o "STM32CubeL1Blinking.elf" ./system/src/stm32l1xx/stm32l1xx_hal.o ./system/src/stm32l1xx/stm32l1xx_hal_adc.o ./system/src/stm32l1xx/stm32l1xx_hal_adc_ex.o ./system/src/stm32l1xx/stm32l1xx_hal_cortex.o ./system/src/stm32l1xx/stm32l1xx_hal_dac.o ./system/src/stm32l1xx/stm32l1xx_hal_dac_ex.o ./system/src/stm32l1xx/stm32l1xx_hal_dma.o ./system/src/stm32l1xx/stm32l1xx_hal_flash.o ./system/src/stm32l1xx/stm32l1xx_hal_flash_ex.o ./system/src/stm32l1xx/stm32l1xx_hal_flash_ramfunc.o ./system/src/stm32l1xx/stm32l1xx_hal_gpio.o ./system/src/stm32l1xx/stm32l1xx_hal_pwr.o ./system/src/stm32l1xx/stm32l1xx_hal_pwr_ex.o ./system/src/stm32l1xx/stm32l1xx_hal_rcc.o ./system/src/stm32l1xx/stm32l1xx_hal_rcc_ex.o ./system/src/stm32l1xx/stm32l1xx_hal_tim.o ./system/src/stm32l1xx/stm32l1xx_hal_tim_ex.o ./system/src/newlib/_cxx.o ./system/src/newlib/_exit.o ./system/src/newlib/_sbrk.o ./system/src/newlib/_startup.o ./system/src/newlib/_syscalls.o ./system/src/newlib/assert.o ./system/src/diag/Trace.o ./system/src/diag/trace_impl.o ./system/src/cortexm/_initialize_hardware.o ./system/src/cortexm/_reset_hardware.o ./system/src/cortexm/exception_handlers.o ./system/src/cmsis/startup_stm32l100xc.o ./system/src/cmsis/system_stm32l1xx.o ./src/main.o ./src/stm32l1xx_hal_msp.o ./src/stm32l1xx_it.o
c:/developing/stm32/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld.exe: STM32CubeL1Blinking.elf section .text' will not fit in region FLASH'
c:/developing/stm32/sourcery_codebench_lite_for_arm_eabi/bin/../lib/gcc/arm-none-eabi/4.8.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 19780 bytes

Best regards

Reply
Carmine Noviello January 30, 2017 - 10:26 pm

The right definitions for your MCU are:

FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K

Reply
Krzysztof Pudłowski January 30, 2017 - 10:45 pm

My mistake....
You saved my day.
Now it works for
F0,F1,L1 and F4
At least blinking demos.

Thanks a lot.

Clovis February 7, 2017 - 3:48 pm

Hi Carmine,

Your tutorials about STM32 dev with Eclipse+GCC+OpenOCD are very helpful, thank you !
Unfortunately, I get the following error when running your script (Ubuntu 16.04 32-bit, Eclipse Neon, latest lxml pkg.) :

Traceback (most recent call last):
File "/home/user/CubeMXImporter/cubemximporter.py", line 541, in
cubeImporter.importHAL()
File "/home/user/CubeMXImporter/cubemximporter.py", line 339, in importHAL
self.addAssemblerMacros((self.HAL_MCU_TYPE,))
File "/home/user/CubeMXImporter/cubemximporter.py", line 129, in addAssemblerMacros
self.__addOptionValuesToProject(macros, "ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs", False)
File "/home/user/CubeMXImporter/cubemximporter.py", line 101, in __addOptionValuesToProject
options[0]] # List all available values to avoid reinsert again the same value
IndexError: list index out of range

I am a bit familiar to Python, but not enough to spot my problem..

Reply
Carmine Noviello February 8, 2017 - 8:07 am

Are you exporting the project in CubeMX selecting the SW4STM32 toolchain?

Reply
Clovis February 8, 2017 - 4:14 pm

Yes I selected SW4STM32 as target IDE in CubeMX. I tried again this morning with some fresh Eclipse and CubeMX projects, but got the same error.

I wanted to see what would be my python error if I change the CubeMX output project format : I got the same error as in my previous post for all of them, except for TrueSTUDIO format : "The generated CubeMX project is not for SW4STM32"

Running the python script as root didn't help either.

Reply
Carmine Noviello February 8, 2017 - 4:21 pm

Are you using latest CubeMX 4.19? What about GNU ARM Eclipse plug-ins? Can you post both Eclipse and CubeMX projects somewhere so that I can give them a look?

Reply
Clovis February 8, 2017 - 5:44 pm

OK, I spotted what was my problem :

When creating the Eclipse project, if you uncheck "Debug" to only leave "Release", you'll get the same error as me. I suppose your script expects both Debug and Release to be checked, as implied in the tutorial.

This was my only issue !
It builds, it flashes, my Nucleo-F401RE is blinking, I am happy !
Thank you. I hope your e-book will be published as paper version soon !

dilbert April 19, 2017 - 8:31 pm

Hi Carmine,
I am new to the Eclipse GUN/GCC tools set. Currently, I had both IDE platform installed
- Eclipse C/C++ IDE CDT 9.2 & GNU ARM Eclipse 3.3.1
- AC6 (SystemWorkbench)

I follow you post and able to debug the Nucleo-F411RE board.

My current project is using a new STM(STLKT) platform using a STM32L4 chip. Which it has a release with Application for a quick start. I am able to build/load/run this STLKT release for SW4STM32 (AC6).

However, our goal is to use Eclipse GNU/GCC platform due to other projects also using this.

As a new coming, how could I imported this "SW4STM32" project into "Eclipse GNU/GCC" ??
Does your example scripts will work ?
When I compare the AC6 vs GNU, mainly is the LinkerScript.ld.
Also, my new Project does not provide the Cortex-M options

Thanks for advice

Reply
dilbert April 19, 2017 - 8:32 pm

Hi Carmine,
I am new to the Eclipse GUN/GCC tools set. Currently, I had both IDE platform installed
- Eclipse C/C++ IDE CDT 9.2 & GNU ARM Eclipse 3.3.1
- AC6 (SystemWorkbench)

I follow you post and able to debug the Nucleo-F411RE board.

My current project is using a new STM(STLKT) platform using a STM32L4 chip. Which it has a release with Application for a quick start. I am able to build/load/run this STLKT release for SW4STM32 (AC6).

However, our goal is to use Eclipse GNU/GCC platform due to other projects also using this.

As a new to this, how could I imported this "SW4STM32" project into "Eclipse GNU/GCC" ??
Does your example scripts will work ?
When I compare the AC6 vs GNU, mainly is the LinkerScript.ld.
Also, my new Project does not provide the Cortex-M options

Thanks for advice

Reply
Krzysztof Pudłowski April 27, 2017 - 9:36 pm

How to profile app generated with CubeMX + python script.

I'm looking how to use profiler with my project in eclipse.

Similar to:

https://mcuoneclipse.com/2015/08/23/tutorial-using-gnu-profiling-gprof-with-arm-cortex-m/

Reply
Jon May 30, 2018 - 2:33 am

This tool looks really helpful but when I try to run it I'm getting the following error:

jond07@jond07-HP-EliteBook-8440pWJ681AW:~/Mbed_Stuff/Workspace/Software&Toolchain/ExtraTools/CubeMXImporter-master$
python cubemximporter.py home/jond07/Mbed_S
tuff/Workspace/EclipseWorkspace/demo02/LED_Stuff home/jond07/Mbed_Stuff/Workspace/Software&Toolchain/CubeMX_Projects/LED_Stuff_withRTOS
[1] 20282
bash: Toolchain/CubeMX_Projects/LED_Stuff_withRTOS: No such file or directory
jond07@jond07-HP-EliteBook-8440p-WJ681AW:~/Mbed_Stuff/Workspace/Software&Toolchain/ExtraTools/CubeMXImporter-master$
Traceback (most recent call last):
File "cubemximporter.py", line 536, in
cubeImporter.eclipseProjectPath = args.eclipse_path
File "cubemximporter.py", line 88, in setEclipseProjectPath
raise InvalidEclipseFolder("The folder '%s' doesn't seem an Eclipse project" % path)
__main__.InvalidEclipseFolder: The folder 'home/jond07/Mbed_Stuff/Workspace/EclipseWorkspace/demo02/LED_Stuff' doesn't seem an Eclipse project

I'm on ubuntu 16.04. I'm guessing I'm entering the file path wrong here but I can't figure out how it should be formatted.

Reply
Murgui August 12, 2018 - 3:28 pm

Hi Carmine,

I've been following all your guides for installing and having a proper Eclipse + GCC development toolchain. I think you have a nice talent for communicating. I own a STM32F334 development board, which has a STM32F334R8T6 MCU. I followed your tutorials #1 and #2 and also this tutorial for importing the project from CubeMX. I'm unable to light a single LED.

I have no clue why, all the dependencies seem correct. Have you experienced any issue with the STM32F3 family?

I uploaded the resulting code to GH: https://github.com/murgui/STM32F3348

The compilations succeeds and the flashing procedure works properly, just the LED won't light. Do you have any idea of what should I check?

Thanks for your tutorials.

M.

Reply
AlexIdushy October 22, 2022 - 3:23 pm

Hi. I try go step by step but after that how I "Close Project" Eclipse, there aren't .ioc file. And i can't open CubeMX project. Where can i mistake?

Reply
AlexIdushy October 23, 2022 - 4:30 pm

script deleted this file. What is it mean?
Prj/include/timer.h
Prj/src/main.c
Prj/src/timer.c
Prj/src/write.c
Prj/system/include/cmsis/cmsis_device.h
Prj/system/include/cmsis/stm32f4xx.h
Prj/system/include/cmsis/system_stm32f4xx.h
Prj/system/include/stm32f4xx/README_DRIVERS.txt
Prj/system/src/cmsis/README_DEVICE.txt
Prj/system/src/cmsis/system_stm32f4xx.c
Prj/system/src/cmsis/vectors_stm32f4xx.c
Prj/system/src/stm32f4xx/README_DRIVERS.txt

Reply
Sahira October 5, 2023 - 10:19 am

Hello, This link "https://pypi.python.org/packages/2.7/l/lxml/lxml-3.5.0.win32-py2.7.exe#md5=3fb7a9fb71b7d0f53881291614bd323c" is not working for lxml packages. I am using windows 11 and download 64 bit lxml2-2.9.3 package and extracted. But still have error "C:\msys64\mingw64\bin\python.exe: can't open file 'C:\\Users\\ufaro\\cubemximporter.py': [Errno 2] No such file or directory".
I am bought a STM32F746 discovery board and trying to print hello world on my lcd display.

Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.