Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
2 years, 6 months ago.
STM32 pin configuration relationship to Mbed OS
I am confused as to how far the Mbed OS reaches. Wherever I am wrong in this description, use terms incorrectly, or don't make any contextual sense, please correct me....
When using STM32CubeMX, this software generates C code that configures the functionality of the pins on a specific MCU. It doesn't matter which MCU it is, but in my case I am using the STM32L475VG. The development board I have been working with is the DISCO_L475VG_IOT01A, but we are making custom board with the STM32L475VG and would like to use Mbed OS. Therefore I would like to create a new target for this new board within Mbed OS. I want to know where specifically the code from the CubeMX software goes inside the Mbed OS target in order to configure the MCU pins. I have searched through the target files in folders for different boards within the same MCU part number folder, but have seen no code that configures the hardware pin functionality. The code that is generated by CubeMX looks very similar to code that is in some higher-level target "device" folders, which aren't redefined at the board level, which leads me to believe that the code in the device folder doesn't perform any hardware configuration. Do I have to use a different tool to perform hardware configuration, and then follow the steps outlined in https://os.mbed.com/teams/ST/wiki/steps-to-create-a-new-STM32-platform, or is all the hardware configured within the Mbed OS code?
2 years, 6 months ago.
Glad to help with this. First, here is a link to an online article which explains the process for adding a custom Mbed-OS target: https://os.mbed.com/docs/mbed-os/v5.10/tools/adding-and-configuring-targets.html . You will see in the documentation that it will be possible for you to create a custom target that will be able to "inherit" settings from the DISCO_L475VG_IOT01A for the STM32L475VG. If you would like to see these settings, you can open the "mbed-os\targets\targets.json" file and search for "DISCO_L475VG_IOT01A".
Please note that if you are working with the Mbed CLI to compile your code, any changes that you make (in "custom_targets.json", etc) to enable a custom target will be picked up automatically when you compile.
However, if you are using a separate IDE (like uVision 5, IAR, Eclipse, etc) you will need to "mbed export" the custom target settings from the command line in order for your code to compile properly in your IDE. Any time that the custom target settings change, you will need to re-export the project in order for your IDE to pick up the changes you make.
Tres, Team Mbed