How to compile the device tree with the Developer Package

Revision as of 18:19, 11 June 2019 by Registered User

Template:ArticleMainWriter Template:ArticleFirstDraftVersion Template:ReviewersList


1. Purpose[edit source]

Info white.png Information
We strongly advise to compile a device tree in a Linux® environment.

The procedures described below are given as example, with limited support.

This article explains how to compile a device tree in a Windows® environment, and how to deploy the compiled devicetree. Some steps require Windows® bash, only available on Windows® 10 version.

2. Rationale[edit source]

STM32CubeMX can be used in both Linux® and Windows® environments.

The use of STM32MPU_Embedded_Software_distribution depends on a Linux® environment.

Nevertheless, the generation of a device tree from STM32CubeMX and its compilation may be managed in a Windows® environment for some components.

3. Pre-requisites[edit source]

  1. Install a cross-compiler
    • A cross compiler is needed to parse and prepare the device tree (.dts) file.
      System Workbench for STM32 is recommended.
      The zip file with the gcc can be found at <INSTALL_DIR>\plugins\fr.ac6.mcu.externaltools.arm-none.win32_1.16.0.201807130628\tools
      mingw64 is also a good alternative.
  2. Install a device tree compiler
    • To install a community device tree compiler, please refer to Device Tree Compiler (MSYS2 version)
    • Upon request, STMicroelectronics may provide an executable binary, without warranty nor support.


4. Kernel device tree update[edit source]

Info white.png Information
Steps 1 and 2 have to be done in a Windows® 10 git bash session (patch is natively supported by git bash)
  1. Get the Linux® source code
  2. Apply patches to the Linux® source code
  3. Create a workdir directory
    mkdir workdir
  4. Copy from source code of Linux the dt-bindings and dt files
    cp <KernelSources>/include/dt-bindinds workdir
    cp <KernelSources>/arch/arm/boot/dts/* workdir/
  5. Copy your dts into workdir
    cp <Your/dts/file.dts> workdir/
  6. Prepare dts
    cd workdir
    arm-none-eabi-gcc.exe -E -nostdinc -I . -undef -D__DTS__ -x assembler-with-cpp -o <yourDTS.dts>.tmp <yourDTS.dts>
  7. compile dts.tmp with dtc.exe
    dtc.exe -I dts -O dtb -o <DTBresult.dtb> <yourDTS.dts>.tmp


5. U-Boot device tree update[edit source]

This operation depends on the use of a mkimage with stm32 support for Windows® which is not officially available.

  • The usage of a a cross-compiler for Windows® and mingw64, the latest mkimage version (provided by U-Boot) will allow you to generate a mkimage version
  • Upon request, STMicroelectronics may provide an executable binary, without warranty nor support.


6. TF-A device tree update[edit source]

This operation is not supported. It is currently not possible to modify TF-A device tree without recompiling TF-A module.