2020-05-13 12:31 PM
I'm preparing a basic embedded programming course. I will use some Nucleo boards with CubeIDE. For the bases of C and C++ programming, I also want to use CubeIDE but I didn't found the documentation for configuring STM32CubeIDE to compile a simple ANSI C project with the Cross GCC toolchain.
Can someone help me what's missing to the Eclipse core of STM32CubeIDE to be able build ANSI C project?
2020-05-13 12:42 PM
Problem with where printf("Hello World!") goes on an embedded system. You need to actually do all the plumbing, selecting the pins, uart peripheral, and bring it all up.
Perhaps use an existing example/template project as a starting point, or drive CubeIDE/CubeMX through the exercise of picking a UART and PINs for the ST-LINK VCP on the NUCLEO you're using. Check the manual, and the schematic in the manual.
2020-05-13 01:18 PM
I clive1,
Thanks for your answer but for the bases of C and C++ programming (while, for, if...else, etc.), I don't want to use any board. I wish to use CudeIDE as a simple console program like Code::Blocks before introducing the idea of peripherals (GPIOs, USART, ADC, etc.). I wish to be able to use the same IDE. It's quite easy to use CubeIDE to configure any peripherals but it doesn't structure a program. This programming course is the first step in programming and I don't want multiple IDEs.
I'm asking this question because if your go to File - New in CubeIDE you can select C/C++ Project and do a basic HelloWorld ANSI C project. But CubeIDE needs some configurations to set some paths (includes, gcc complier, etc.) to works. I already done something like that with AtmelStudio but I want to change to STM32CubeIDE this year. I already solve the path for the includes but not for the compiler.
Regards,
BTrem
2020-05-13 01:34 PM
Do you want the compiled program to run on the PC? I don't know if it works or whether STM32CubeMX can do it at all but you might try:
Install a gcc compiler for your platform first (Cygwin or mingw on Windows).
When selecting the project type, uncheck Show project types and toolchains... at the bottom.
2020-05-15 05:12 AM
Your question is not very clear what you want achive. I have attached a screen shot with a window for project creation. CubeIDE should be able to build anything because it is Eclipse . You need to have the right software installed and it looks like you can build even PC applications unless it is somehow blocked.
2020-05-15 08:30 AM
Hi berendi
Yes, I want to run simples ANSI C or C++ programs on the PC from STM32CubeIDE. I'm almost there.
I had already MinGW GCC installed on my PC that I'm using with CodeBlocks.
In changing the toolchain for MinGW GCC (Properties > C/C++ Build > Tool Chain Editor > Current toolchain > MinGW GCC) and the path (Properties > C/C++ Build > Environnement > Environnementvariables to set > MINGW_HOME > C:\Program Files (x86)\CodeBlocks\MinGW) I was able to make the simple "HelloWorld" program works as expected but once. Now when I rebuild the project, I get this stange error message :
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: cannot open output file MyProjectName.exe: Permission denied
I'm searching in many documents but I didn't found the right produre wet.
Hi Hansd56
As mention earlier, I'm preparing (or revise) a basic embedded programming course. It's in the first semester for any electrical engineering student and some of them had experiences with the Arduino IDE.
In that course, for teaching the bases of C programming (while loop, for loop, if...else, function, structure, typedef, etc. all the basic stuff) I was using CodeBlocks in console application with the debug mode. Then doing a bit of Arduino IDE (I don't like the lack of debug/tracing) and finaly with AtmelStudio (that I don't like much).
The problem is passing from an IDE to the others confuse some students.
So instead of changing IDE, I wish to stay with the same. It's easier to hunderstand the concept of HAL and handlers if you somewhat master the concept of function, structure and typedef. I agree with you that Eclipse should be able to build anything even a simple ANSI C console application.
I'm able to change the toolchain in a project after it's creation but I don't see MinGW in the new project window yet. I'm near the solution, it's work once. But there are some twicks to fix. I just need the right documentation or explanation.
Regards,
BTrem
2020-05-15 09:25 AM
The program might not have terminated properly. Try to find and kill it in the task manager, or restart the PC.
Also, eclipse doesn't like paths with spaces or other funny characters in it, try reinstalling mingw in c:\mingw, it might work better.