cancel
Showing results for 
Search instead for 
Did you mean: 

C not embedded C

fgilm.1
Associate II

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 

11 REPLIES 11
Peter BENSCH
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

As you say GNU GCC is included.    Why not use it, but how?

Pavel A.
Evangelist III

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.

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

so buy a cheap disco board, to make some first programs and see them work (or not 🙂 )

AScha3_0-1687972334435.png

https://www.mouser.de/ProductDetail/STMicroelectronics/STM32L152C-DISCO?qs=OMTSpu7JCCvskXaoWbf3ow%3D%3D

12,38 €

 

 

If you feel a post has answered your question, please click "Accept as Solution".

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
KnarfB
Principal III

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

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