Showing results for 
Search instead for 
Did you mean: 

How to use the device tree generated by CubeMX to generate images and add a serial port to MP135

# How to use the device tree generated by CubeMX to generate images and add a serial port to MP135

My hardware platform is MP135, and now I want to add a serial port UART8 to it, so I plan to modify the device tree.  
But I encountered some issues while using the SDK.According to the official 'how to do. txt', I compiled u-boot and generated the following content in the deploy folder:
~/workspace/STM32/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-v2022.10-stm32mp-r1-r0/deploy$ ls
debug                       u-boot-stm32mp157c-ed1.dtb
u-boot-nodtb-stm32mp13.bin  u-boot-stm32mp157c-ev1.dtb
u-boot-nodtb-stm32mp15.bin  u-boot-stm32mp157d-dk1.dtb
u-boot-stm32mp135f-dk.dtb   u-boot-stm32mp157d-ev1.dtb
u-boot-stm32mp157a-dk1.dtb  u-boot-stm32mp157f-dk2.dtb
u-boot-stm32mp157a-ev1.dtb  u-boot-stm32mp157f-ed1.dtb
u-boot-stm32mp157c-dk2.dtb  u-boot-stm32mp157f-ev1.dtb

According to the official tutorial, I should copy these files to the flp folder of StarterPackage. This confuses me because I didn't see a similar file on StarterPackage, but instead:
~/workspace/STM32/IMAGE/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/images/stm32mp1/fip$ ls
#in starter package
fip-stm32mp135f-dk-optee.bin   fip-stm32mp157d-dk1-optee.bin
fip-stm32mp157a-dk1-optee.bin  fip-stm32mp157d-ev1-optee.bin
fip-stm32mp157a-ev1-optee.bin  fip-stm32mp157f-dk2-optee.bin
fip-stm32mp157c-dk2-optee.bin  fip-stm32mp157f-ed1-optee.bin
fip-stm32mp157c-ed1-optee.bin  fip-stm32mp157f-ev1-optee.bin

And when I compile optee, What appears in the deploy folder are these things:
~/workspace/STM32/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/optee-os-stm32mp-3.19.0-stm32mp-r1-r0/deploy$ ls
debug                                tee-pageable_v2-stm32mp157d-dk1.bin
tee-header_v2-stm32mp157a-dk1.bin    tee-pageable_v2-stm32mp157d-ev1.bin
tee-header_v2-stm32mp157a-ev1.bin    tee-pageable_v2-stm32mp157f-dk2.bin
tee-header_v2-stm32mp157c-dk2.bin    tee-pageable_v2-stm32mp157f-ed1.bin
tee-header_v2-stm32mp157c-ed1.bin    tee-pageable_v2-stm32mp157f-ev1.bin
tee-header_v2-stm32mp157c-ev1.bin    tee-pager_v2-stm32mp157a-dk1.bin
tee-header_v2-stm32mp157d-dk1.bin    tee-pager_v2-stm32mp157a-ev1.bin
tee-header_v2-stm32mp157d-ev1.bin    tee-pager_v2-stm32mp157c-dk2.bin
tee-header_v2-stm32mp157f-dk2.bin    tee-pager_v2-stm32mp157c-ed1.bin
tee-header_v2-stm32mp157f-ed1.bin    tee-pager_v2-stm32mp157c-ev1.bin
tee-header_v2-stm32mp157f-ev1.bin    tee-pager_v2-stm32mp157d-dk1.bin
tee-pageable_v2-stm32mp157a-dk1.bin  tee-pager_v2-stm32mp157d-ev1.bin
tee-pageable_v2-stm32mp157a-ev1.bin  tee-pager_v2-stm32mp157f-dk2.bin
tee-pageable_v2-stm32mp157c-dk2.bin  tee-pager_v2-stm32mp157f-ed1.bin
tee-pageable_v2-stm32mp157c-ed1.bin  tee-pager_v2-stm32mp157f-ev1.bin
I don't know where these files should be placed.
For the above situation, I would like to raise a few questions:

1. **Does adding a serial port require modifying the Linux kernel?**  
I don't know why it's so troublesome to just add a serial port
1. **How to use the device tree generated by CubeMX to compile images?**  
Please do not give me the tutorial link on the official website. I have read all the relevant tutorials on the official website, but none of them fully describe the tutorial from CubeMX device tree to image generation.
1. **How can the files generated by compiling source code be added to the starter package?**  
As mentioned above, The files generated by the SDK do not match well with the files in the StarterPackage.I hope to receive your answer!
ST Employee

Hi @hhh1 ,


If I understand correctly, you want to try to add a uart ?


First of all, I'd advise you to use the developer package (or the distribution package if you prefer to use yocto) to make your modifications, as this will be easier for you.
You can see how to use them here :

and here :

To add a uart, yes, you need to modify your device tree to add your node with uart parameters, then recompile using the developer package and the SDK.

As for modifying the fip, I suggest you follow this page to understand how it works :


Don't hesitate to contact me if you want more details.




In order 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.