ST


A world leader in providing the semiconductor solutions that make a positive contribution to people’s lives, both today and in the future.

steps to create a new STM32 platform

Please follow these steps to add a new STM32 platform on GitHub (SDK code).

<SERIE> = F0, F1, F2, F3, F4, F7, L0, L1, L4, ...
<SUBSERIE> = F302x8, F401xE, L476xG, ...
<BOARD> = NUCLEO_F410RE, DISCO_L476VG, ...

Platform folders and files creation

  • In mbed-os\targets\TARGET_STM\TARGET_STM32<SERIE> or TARGET_STM32<SERIE>\TARGET_STM32<SUBSERIE> folder
    • Create the TARGET_<BOARD> folder
  • In the TARGET_<BOARD> folder
    • Create the following files or copy them from a similar existing platform
      • objects.h : May be updated depending of the peripherals used
      • PeripheralNames.h : May be updated depending of the peripherals used
      • PeripheralPins.c : Check device datasheet for all available alternate functions. To help you in this task, you can use the python script mbed-os\tools\targets\STM32_gen_PeripheralPins.py. Note that you will have to install the STM32CubeMX software first.
      • PinNames.h : Check device datasheet for all available GPIO pins
      • PortNames.h : Check device datasheet for all available GPIO ports
    • Create the device folder
  • In the TARGET_<BOARD>\device folder
    • Create the following files or copy them from a similar existing platform
      • cmsis.h
      • cmsis_nvic.c
      • cmsis_nvic.h : Update the number of vectors. Check in stm32<DEVICE>xx.h file
      • hal_tick.h : Update the timer used for the ticker
      • stm32<SERIE>xx.h : copy it from STM32Cube package (CMSIS driver)
      • stm32<SERIE>xx_hal_conf.h : copy it from STM32Cube package (HAL driver)
      • stm32<DEVICE>xx.h : copy it from STM32Cube package (CMSIS driver)
      • system_stm32<SERIE>xx.c : copy it from STM32Cube package (CMSIS driver) + add clock configuration functions by copying/adapting from a similar existing platform
      • system_stm32<SERIE>xx.h : copy it from STM32Cube package (CMSIS driver)
    • Create the TOOLCHAIN_<COMPILER> folder(s) you want to be supported by your platform. In order to be mbed compliant you have to support ARM, IAR and GCC_ARM compilers.
  • In each TARGET_<BOARD>\device\TOOLCHAIN_<COMPILER> folder
    • Create the following files or copy them from a similar existing platform
      • startup_stm32<DEVICE>.S : copy it from STM32Cube package (CMSIS folder)
      • stm32<DEVICE>.ld (for GCC_ARM) : copy it from a similar existing platform
      • stm32<DEVICE>.sct (for ARM_MICRO/ARM_STD) : copy it from a similar existing platform
      • sys.cpp (for ARM_MICRO/ARM_STD) : copy it from a similar existing platform
      • stm32<DEVICE>.icf (for IAR) : copy it from STM32Cube package (CMSIS folder)
  • In mbed-os\targets\TARGET_STM folder
    • Add the new device (if not already present) in the mbed_rtx.h file in the correct memory area.

Python and JSON files modification

  • Update the following files by adding the new TARGET_<BOARD> platform in them
    • mbed-os\targets\targets.json
    • mbed-os\tools\build_travis.py
    • mbed-os\tools\export_test.py
    • mbed-os\tools\sw4stm32\_init_.py
    • mbed-os\tools\tests.py

Compile and test your SDK code

  • For mbedOS 2 use the tools
    • mbed-os\tools\build.py
    • mbed-os\tools\singletest.py
  • For mbedOS 5 use the tools
    • "mbed compile" and "mbed test" commands

Publish your work

  • The SDK code must be published on GitHub https://github.com/ARMmbed/mbed-os
  • It is best practise to create multiple small commits by arranging them logically. Give also meaningful names to your commits and don't hesitate to add additional information in the commit message.
  • Send a Pull-Request with a meaningful title (NUCLEO_F413ZG: Add new Platform).
  • Attach in this Pull-Request the test reports you have performed.
  • ST and ARM teams will review it and give feedback on GitHub in the Pull-Request.
  • If the Pull-Request is accepted, then the new SDK code will be merged in GitHub.
  • ST will have to create the platform page, pinout etc...
  • Then after ARM approval, the new SDK code will be added by ARM team on mbed on-line compiler.

Usefull links

https://docs.mbed.com/docs/mbed-os-handbook/en/5.2/advanced/porting_guide/
https://developer.mbed.org/handbook/mbed-SDK-porting


All wikipages