cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting cubeMX generated dts file with yocto

WLeun.3
Associate III

Hi everyone,

I am using stm32mp157f-dk2 with openSTLinux-5.4-dunfell-eglf distribution.

I would like to configure my device tree using cubeMX.

The generated dts file seems OK to me. However, how can I tell yocto to use my newly generated device tree?

The instruction on https://wiki.st.com/stm32mpu/wiki/How_to_create_your_own_machine

didn't mention anything about this.

I have tried to modify the meta-st-stm32mp-addons/classes/cubemx-stm32mp.bbclass but it doesn't work.

It seems to me that the default meta-st-stm32mp-addons/conf/machine/stm32mp1-mx.conf is not used.

​Regards,

Leung

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @WLeun.3​ ,

You have to use the version of CubeMX delivered with your OSTL (5.4) version which is the STM32CubeMX6.1.

Wiki: https://wiki.st.com/stm32mpu-ecosystem-v2/wiki/STM32MP15_ecosystem_release_note_-_v2.1.0#STM32CubeMX

STM32CubeMX v6.1 -> This one generates Device tree compliance with openstlinux-5.4-dunfell-mp1-20-11-12 tag

0693W00000KbAVhQAN.png 

To my knowledge there is no other way to use an old version of OpenSTLinux.

Regards,

Kevin

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.

View solution in original post

11 REPLIES 11
Kevin HUBER
ST Employee

Hello @WLeun.3​ ,

The information that you need are in the wiki page that you shared:

you have to browse with CubeMX until the folder "<path of STM32MP1_Distribution_Package>/layers/meta-st/meta-st-stm32mp-addons/mx/"

  • At build 3 sub-folders are created and populated with generated device tree files :

- <ProjectName>/kernel

- <ProjectName>/u-boot

- <ProjectName>/tf-a

Where <ProjectName> is the “STM32CubeMX user project name�?

  • Then you must edit the .conf file of your machine, located in "layers/meta-st/meta-st-stm32mp-addons/conf/machine/" as explained here:

https://wiki.st.com/stm32mpu/wiki/How_to_create_your_own_machine#Edit_the_new_machine_file-_stm32mp1--3CProjectName-3E-conf

CubeMX Project config
You have to uncomment and configure the following variables to set your CubeMX project:
- CUBEMX_DTB name of CubeMX generated device tree files, without file extension (e.g. stm32mp157c-<ProjectName>-mx)
- CUBEMX_PROJECT path of CubeMX generated device tree files relative to layer path folder (e.g. mx/STM32MP157C-EV1/my-demo/DeviceTree/my-demo)

All your modifications must be done after the lines:

###########################################################################
#
# User machine customization sections
#
###########################################################################

In order to give a better view on how to configure these variables, some machine samples are provided to show how to set-up a disco and eval board cubeMX machine: refer to conf/machine/examples from meta-st-stm32mp-addons layer.

For example:

layers/meta-st/meta-st-stm32mp-addons/conf/machine/examples/stm32mp1-disco-mx.conf.sample

You will see how to set the variable CUBEMX_DTB and CUBEMX_PROJECT.

Then when you build, follow these steps: https://wiki.st.com/stm32mpu/wiki/How_to_create_your_own_machine#Compile_your_image_with_the_yocto_build_process

Especially this command to specify your machine and use the .conf that you edited/created:

MACHINE=stm32mp1-<ProjectName> DISTRO=openstlinux-weston source layers/meta-st/script/envsetup.sh

Regards,

Kevin

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

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.

Hi Kevin,

My problem was that I didn't re-export my MACHINE variable, as MACHINE=stm32mp1-<ProjectName>.

After fixing this, I recompiled the image. The following error pop out:

ERROR: /home/lascar/Qt/layers/meta-st/meta-st-stm32mp/recipes-security/optee/optee-os-stm32mp_3.9.0.bb: 
 
[cubemx-stm32mp] Not able to find "mx/DK2/DeviceTree/CA7/DK2" path from current BBPATH var:
	/home/lascar/Qt/build-openstlinuxeglfs-stm32mp1-DK2
	/home/lascar/Qt/layers/meta-st/meta-st-stm32mp-addons
	/home/lascar/Qt/layers/meta-openembedded/meta-python
	/home/lascar/Qt/layers/meta-openembedded/meta-oe
	/home/lascar/Qt/layers/meta-openembedded/meta-gnome
	/home/lascar/Qt/layers/meta-openembedded/meta-initramfs
	/home/lascar/Qt/layers/meta-openembedded/meta-multimedia
	/home/lascar/Qt/layers/meta-openembedded/meta-networking
	/home/lascar/Qt/layers/meta-openembedded/meta-webserver
	/home/lascar/Qt/layers/meta-openembedded/meta-filesystems
	/home/lascar/Qt/layers/meta-openembedded/meta-perl
	/home/lascar/Qt/layers/meta-st/meta-st-stm32mp
	/home/lascar/Qt/layers/meta-qt5
	/home/lascar/Qt/layers/meta-st/meta-st-openstlinux
	/home/lascar/Qt/layers/openembedded-core/meta.

This is already the entire error log.

A quick review of optee-os-stm32mp_3.9.0.bb show me the following

COMPATIBLE_MACHINE = "(stm32mpcommon)"
 
OPTEEMACHINE ?= "stm32mp1"
OPTEEMACHINE_stm32mp1common = "stm32mp1"
OPTEEOUTPUTMACHINE ?= "stm32mp1"
OPTEEOUTPUTMACHINE_stm32mp1common = "stm32mp1"

However, manually changing these variable to stm32mp1-<ProjectName> doesn't work as intended? stm32mp1 is the original MACHINE variable that I used.

Any idea what may went wrong here?

I suspect that it is something related to my image(st-example-image-qt) because the meta-st-stm32mp-addons was not included originally. I have to manually used bitbake-layers add-layer command to add it into my project.

Regards,

Leung

Hello @WLeun.3​ ,

I think that your error is related to:

you have to browse with CubeMX until the folder "<path of STM32MP1_Distribution_Package>/layers/meta-st/meta-st-stm32mp-addons/mx/"

  • At build 3 sub-folders are created and populated with generated device tree files :

- <ProjectName>/kernel

- <ProjectName>/u-boot

- <ProjectName>/tf-a

Where <ProjectName> is the “STM32CubeMX user project name�?

-----------------------

Do you have something in your folder "<path of STM32MP1_Distribution_Package>/layers/meta-st/meta-st-stm32mp-addons/mx/" ?

Because the error seems to indicate that these 3 folders haven't be created by CubeMx.

Regards,

Kevin

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.

Hi @Kevin HUBER​,

0693W00000Ka2tKQAR.png 

0693W00000Ka2tAQAR.png 

I didn't find any mistake by myself.

Could you help take a look? Thanks

Regards,

Leung

Hi @WLeun.3​ ,

In the path expected by the build, the folder DeviceTree is before CA7, but in your environment, the folder CA7 is the first one.

I will check my configuration to verify If your configuration is the right one, or if it is the one from the recipe.

Regards,

Kevin

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.

HI @WLeun.3​ ,

Please, can you tell me which CubeMx version are you using?

Regards,

Kevin

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.

Hi @Kevin HUBER​ ,

It is version 6.4.0. I have just download it recently.

Regards,

Leung

Hello @WLeun.3​ ,

Please can you verify your variable CUBEMX_PROJECT from your .conf file of your MACHINE.

This variable must be set to the path where CubeMx generated the DTS.

In your case it must be:

CUBEMX_PROJECT = "mx/DK2/CA7/DeviceTree/DK2"

The recipe that throw the error is: "layers/meta-st/meta-st-stm32mp-addons/classes/cubemx-stm32mp.bbclass", line 53

Regards,

Kevin

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

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.

Hi @Kevin HUBER​ ,

Yeah you are correct. Sorry that I have made such a silly typo mistake. I have fixed that accordingly.

However, when I compile it, I encounter another error, claiming that the

stm32mp15-m4-srm.dtsi: No such file or directory
|    17 | #include "stm32mp15-m4-srm.dtsi"

After checking the tmp-glibc/work-shared/stm32mp1-<project name>/kernel-source/arch/arm/boot/dts, I find that there is a stm32mp157-m4-srm.dtsi.

I guess this is another typo mistake in the file generated by cubeMX.

Can you help me to check that?

Just in case you need that, I have also attached my complete log.

Thanks again for your kindest help.

Regards,

Leung