Skip to main content
fgilm.1
Associate II
June 16, 2023
Question

C not embedded C

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 

    This topic has been closed for replies.

    11 replies

    Peter BENSCH
    ST Technical Moderator
    June 22, 2023

    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.
    Tesla DeLorean
    Guru
    June 22, 2023

    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Pavel A.
    June 22, 2023

    > 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.

    fgilm.1
    fgilm.1Author
    Associate II
    June 28, 2023

    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

    AScha.3
    Super User
    June 28, 2023

    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 on " Best Answer ".
    KnarfB
    Super User
    June 28, 2023

    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

    KnarfB
    Super User
    June 29, 2023

    Looking around is probably not enough. It is like mountaineering, scuba diving, or other adventures: for your first trips strictly follow a guide, maybe the STM32CubeIDE user guide.

    KnarfB

    fgilm.1
    fgilm.1Author
    Associate II
    June 29, 2023

    Thanks, Grate idea.   Guess were I started, that did not wotk for me so I looked areound in the IDE; and the above is what I found.    So Please tell me were in the guide that explains this and I will try again (I do nort understand most of the gide at this time).   Thank you, ƒg