2023-06-16 12:39 PM - last edited on 2023-06-22 04:32 AM by KDJEM.1
I want to use STm32cubeIDE to just program in C for learning C, is that posable? If so where can I find detailed instruction to set it up?
Thank you, ƒg
2023-06-22 01:31 AM
Well, even if this is possible in principle, the question is whether it makes sense.
The problem is that C is a programming language for which the compiler GNU GCC is also included in the STM32CubeIDE. As its name suggests, this is an IDE for embedded systems based on microcontrollers called STM32. The compiler can now translate the source code and help find syntactical and semantic errors.
However, a compiler and thus also the STM32CubeIDE typically cannot find logical errors, which is why the generated binary is downloaded to the target platform and can be processed there via an integrated debugger. In the process, breakpoints can be set, variable values can be tracked, etc.
Without this debugging, learning C is limited to the first-mentioned function of checking for syntactic and semantic errors, which might be actually not very useful, might it?
Regards
/Peter
2023-06-22 04:05 AM
Wouldn't it be easier just to use a PC based compiler to build command line C executables that you can test and run more directly, and do file IO, etc afforded by a full/proper OS?
2023-06-22 11:17 AM
As you say GNU GCC is included. Why not use it, but how?
2023-06-22 11:59 AM - edited 2023-06-22 12:01 PM
> Why not use it
Because it is not just a GNU GCC compiler. It is a compiler for bare metal ARM Cortex-M.
Are you sure that your want to learn the GNU dialect of C rather than Clang, and Eclipse CDT based IDE rather than Clion or VS Code?
As for instructions - Google is a very good start.
If you have a specific STM32 project in mind, please say so.
2023-06-28 09:47 AM
Yes, I have a STM32 project in mind. I am thinking that it would be better to stick with one platform when learning C so that it will get me familiar with Embedded platform at the same time. If I am not sure how C procedure works that I may be using Embedded C, I would be able to try it and work it out before I use it in Embedded C. Currently, I am trying to learn both. Because GNU GCC is also included in the STM32CubeIDE, it would be nice to be able to use it.
Thank you, ƒg
2023-06-28 10:13 AM - edited 2023-06-28 10:13 AM
so buy a cheap disco board, to make some first programs and see them work (or not
12,38 €
2023-06-28 12:11 PM
There seems to be some confusion. GNU/GCC comes in many forms, by Embedded you probably mean the ARM Cross-Compiler, it runs on a PC, but the code runs on a different Target device.
There are versions of GNU/GCC that will run and compile code of the native environment, ie the PC.
Learning and competence in C can be achieved on the PC, running code on the PC. People learn in different ways, but I'd still suggest that understanding and experimenting with compilers and code can be done using command line tools. Learning the Windows or Linux GUI, menus, graphic applications, definitely a lot more complex and involved, but learning about files, data representation, structures and pointers, can all be done.
2023-06-28 01:01 PM
Back to your question: https://www.st.com/content/st_com/en/support/learning/stm32-education.html is a good starting point for learning. As others have already said: Embedded projects have a different focus. So if you want to learn the C library functions (for strings, dynamic memory, file IO, networking,...), you are better off with a PC-only setup. Also, setting up the toolchain (compiler, debugger, IDE) is more involved for embedded, because of cross-compilation and cross-debugging. Finally, embedded projects often involve sensors or actuators which need software support. Here you find a broad spectrum from register-level programming up to high-level C abstractions with no single dominating style or standard.
KnarfB
2023-06-28 09:23 PM
I looked around to see what was there. This is what I have tried:
Click on “Create a new C or C++ Project.”
In the window, New C/C++ Project, selected “ALL” and “C Managed Build” -> Next
In the window, C Project,
Project name: I put “try”
Project type: Executable, I selected “Hello World ANSI C Project” (“Empty Project” was the other choise)
Toolchain: (Hello World selected “Cross GCC” for me)
-> Next
In the window Basic Settings:
Author: I put my name
Copyright notice: it said “Your copyright notice”
Hollo world greeting: it said “!!!Hello World!!!”
Source: it said “src” {do not know what this means??}
-> Next
In the window Select Configuration “Debug” and “Release” are selected -> Next
In the window, Cross GCC Command
Cross compiler prefix: {I do not know what to put here}
Cross compiler path: it said “C\ST\C\.metadata” {same place the Hello World program is located}
I cannot go any farther because of, Cross compiler prefix, if I do the program will not run.
Thank you, ƒg