cancel
Showing results for 
Search instead for 
Did you mean: 

Can someone please explain to me this Code Generator option?

Grant Bt
Senior

For the life of me I cannot understand what is being said in the first box:

STM32Cube Firmware Library Package option
The following actions are possible:
* Copy all used libraries into the project folder
   STM32CubeMX copies to the user project folder the drivers libraries (HAL, CMSIS) 
   and the middleware libraries relevant to the user configuration (e.g. FatFs, USB).
* Copy only the necessary library files:
   STM32CubeMX copies to the user project folder only the library files relevant to the 
   user configuration (e.g., SDIO HAL driver from the HAL library). 
   :
etc

I can see when I select the first option that I get a TON of files and directories copied into my Drivers\CMSIS folder.

When I choose the second option I get only Device and Include.

BUT I'm not using any of them! I created basically a blank project so this must be a language issue. What does "copy all used libraries" mean? Does it really mean "copy ALL libraries"? That's the only thing I can come up with here. Help?

 0693W00000BdbZKQAZ.jpg 

3 REPLIES 3
Bubbles
ST Employee

Hi @Grant Bt​ ,

this is a language issue. The first option should rather read "copy all libraries relevant to the used product". This is an overkill in most situations. Especially in case of CMSIS. But in case you later decide to turn on for example DSP emulation in the build, it's already prepared in the CMSIS folder. Same for neural network and other libraries. The word "used" cold be changed to "usable", I'll propose a change internally.

J.

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.

Hello @Grant Bt​ ,

Thanks for your feedback. To directly answer you question "What does "copy all used libraries" mean? Does it really mean "copy ALL libraries"": Yes it means copy all the drivers libraries (HAL, CMSIS).

I'll try to develop more the explanation of the STM32Cube Firmware Library Package option you've mentioned in your post to make it more clear.

In fact, Checking Copy all used libraries into the project folder results a generated project containing all the source and header files of the selected middleware and drivers.

CMSIS and STM32F4xx_HAL_Driver driver libraries will be copied from <Repository _directory>\STM32Cube_FW_xx_xx\Drivers without taking account whether those drivers libraries are relevant or not to the user configuration in CubeMX.

In the Screenshots below I've tried to develop in advance this point (I've generated a project from scratch based on STM32F401RDT MCU as an example, this general for alll MCUs):

0693W00000BdfOVQAZ.pngFurthermore, trying to compare two generated Drivers\STM32F4xx_HAL_Driver\Src folders when using the exact same CubeMX configuration but with a different STM32Cube Firmware Library Package option:

0693W00000BdfVqQAJ.pngAll HAL and LL driver files will be generated automatically once the Copy all used libraries into the project folder option is checked. Not the case of Copy only the necessary library files option which will assure the generation of only the relevant driver files matching the user configuration done with CubeMX.

Actually, Copy all used libraries into the project folder option is very handy for users who may want to use peripherals that have not been configured with CubeMx. It assures that CubeMx will copy the LL source and header files in the generated project making it flexible to the users choice of library for the initialization code generation: if a user chooses to generate the initialization code with the HAL, and if the “Copy all used libraries into the project folder�? is checked, the LL files that may be needed to build the project will be copied and the generated project will produce an executable.

Hoping that I've clarified the image.

Khouloud.

Grant Bt
Senior

Thanks gang! Very helpful. "Available" might also be a good choice versus "usable", but either are a great improvement. Also please add something resembling what has been said above in the PDF explanation (why choose one over the other).

I think the Project Settings -> Application Structure needs a bit better of an explanation too. Near as I can tell Advanced versus Basic is just how the Source and Include files are stored in the user's project directory. Correct me if I'm wrong. This item has a good "why" but not so much what it actually does. Maybe change this to Application Directory Structure.

Finally, Help -> Help might better to say Help -> User Manual or something to that effect. I spent a lot of time web searching for various answers before realizing that "UM1718 User manual STM32CubeMX for STM32 configuration and initialization C code generation" even existed. It does not appear under Docs & Resources and for whatever reason I was never drawn to click Help -> Help (my fault of course).

Edit: I found this helpful. Not sure where it originates from

https://sips2017.sciencesconf.org/data/STM32CubeIntro_demo.pdf

GB