How to create your board device tree


1. Article purpose[edit source]

This article will help you to create a first TF-A device tree with STM32CubeMX, to bring up your board.

2. TF-A setup to get the serial log and USB boot[edit source]

  • In STM32CubeMX:
    • Create a new project from the MCU selector
    • Select the STM32MP1 part number that is mounted on your board
    • In Pinout & Configuration:
      • RCC: enable the HSE according to your board setup. The HSE is needed for various PLL (USB, DDR).
      • UARTx: setup the serial console.
        • Assign UARTx to the "Cortex-A7 non-secure" and the "Boot loader" contexts
        • Select the "Asynchronous" mode
        • In the "pinout view", change the RX and TX lines if STM32CubeMX default choices are not maching with your board.
        • Notice that UARTx instance is gotten from the device tree for the console but it is hard coded to UART4 with TX on GPIOG11 for the crash console, in plat/st/stm32mp1/stm32mp1_def.h.
      • USB OTG: setup the serial boot interface.
        • Assign USB OTG to the "Cortex-A7 non-secure", the "Boot loader" and "Boot ROM" contexts.
        • Select the "High speed OTG/Dual_Role_Device".
    • In Clock configuration:
      • Check that UARTx source clock corresponds to your wish or select HSI by default.
      • Configure the USBPHYC clock mux.
    • GENERATE CODE then:
      • Complete "USER CODE BEGIN root" with "chosen" and "aliases" nodes, taking ST boards values as example.