cancel
Showing results for 
Search instead for 
Did you mean: 

General questions on STM32CubeIDE

brokenkeyboard
Associate II

Hello,

(Hobbyist there) A few years ago I tried to develop on STM32 microcontrollers (the so called 'blue pill' to be exact) but the toolchain installation and the whole code generating process made me give up (also there wasn't full linux support if I'm not wrong, up to this day I still can't find official linux drivers for the ST-link). Fortunaly ST released the STM32CubeIDE which encompasses everything, making things a lot more easier for beginners.

But after a few days of testing with the software and consulting documentations, I have a few questions and things I fail to achieve:

1) When creating an STM32Project, I can choose between C and C++, but I don't see the difference between the two. At the end I just have a bunch of .h/c files and no .cpp files whatsoever (and especially no main.cpp). What does this mean ? Do I have to manually create .cpp and .h files in the Src and Inc folders, and must I copy the content of main.c in my own main.cpp ? How to tell the software to compile using these files ? And by the way where should I put C/C++ libraries and how to tell the compiler to use them ?

2) I don't quite understand the CMSIS libraries. From what I understood they mainly contain registers define and very little functions, and must be used with the documentation of the ARM processor in hand. But I didn't understand if it was truly ARM or ST who published those libraries for ST MCUs (for example I read that it was indeed released by ARM but also read things like 'STM32 CMSIS-compliant libraries'). Also do the HAL and/or LL libraries rely on the CMSIS to work ? If not what are the differences of LL libraries and CMSIS libraries ? And do the HAL libraries rely on the LL libraries to work ?

3) And I understood that HAL libraries/drivers provide an abstraction layer and are more or less microncontroller-independant, unlike the LL libraires who provides a sometimes crucial hands-on control (controlling registers bits, etc.). But I'm confused on how to use them. I found the advanced settings option to switch between HAL and LL drivers for each peripheral, but I don't understand exactly what the 'Generated Function calls' option do. When all drivers are HAL selected, none of the .._ll_...c/h files are present in the project directory tree and the _hal_..c/h files corresponding to the peripherals selected are here, but also some that I didn't select when generating the project (like i2c) while others (that I also didn't select) are not there (like _hal_adc); and when selecting one driver as LL, GPIO for instance, the ..._ll_gpio.h/c appears, but also a bunch of others LL .c/h files, and others stay hidden. Why is that ? And does this mean that selecting the LL driver means using the LL driver and/or the HAL driver while selecting the HAL driver means using only the HAL driver ? Can I initialize the peripherals using the HAL driver and then use the LL driver as long as I know what I'm doing ? Can I only call files that are visually present in the project directory tree ?

4) And finally, when building the project (using the 'hammer' icon), I can choose between building for the release or for debug (btw I know I can (un)comment the #define USE_FULL_ASSERT for debugging the functions parameters ) but for uploading the code I only found the debug option. How can I just build in release mode (once the project is completed) and upload it ? Online I found people advising to use a special configuration for debug, but I thought it to be absurd and there had to be an option to just upload the compiled code.

Thanks in advance for your replies.

20 REPLIES 20

EDIT: I've found the file 'STM32CubeF1GettingStarted.pdf' in the 'documentation' folder in the folder from the STM32 firmware library (.zip) that was automatically downloaded by STM32CubeIDE when creating my first project that uses this MCU family. It's quite well explained, and answers some of the questions I asked. But strangely It's not on ST's web page of the MCU I use, and contain many informations that are nowhere to be find on ST's web page for CubeIDE.

I wish I found this file earlier, which is kind of hidden when you didn't downloaded the .zip firmware package manually and would be helpful for other beginners starting with CubeIDE.