Best way of modifying device tree

All design tool related questions: compiler, assembler, linker. Embedded programming questions: assembler, C code.

Moderator: nferre

gcb87
Posts: 4
Joined: Wed Jul 22, 2020 3:40 pm

Best way of modifying device tree

Sun Nov 22, 2020 9:01 am

Hi,

For my custom board based on sama5d27 SOM I woud like to create my own device tree.

Up to now I have been using and applying a diff to the at91-sama5d27_som1_ek.dts file
Because I need to customize nearly every pin I thought it would be better to use my own file

What are the recommended approaches?

I tried to copy this file and rename it and add this to a bbappend kernel recipe

Code: Select all

SRC_URI += "file://my_dt.dts;subdir=git/arch/${ARCH}/boot/dts"

KERNEL_DEVICETREE += " my_dt.dtb"
I see my_dt.dtb in the output folder but its not being used

I also tried to change KERNEL_DEVICETREE in the .conf file but the build fails with FATAL ERROR: Couldn't open "./at91-sama5d27_som1_ek.dtb": No such file or directory
I cant see anywhere that is selecting at91-sama5d27_som1_ek.dtb as the device tree blob file in the uboot config

Any ideas? Help is appreciated!
blue_z
Location: USA
Posts: 2145
Joined: Thu Apr 19, 2007 10:15 pm

Re: Best way of modifying device tree

Tue Nov 24, 2020 12:19 am

gcb87 wrote: For my custom board based on sama5d27 SOM I woud like to create my own device tree.
That makes sense, since the DT blob file should be named for the board it describes.

gcb87 wrote: I tried to copy this file and rename it and add this to a bbappend kernel recipe ...
Apparently you are using Yocto, and neglect to mention that.
I do not offer specific advice on Yocto.

gcb87 wrote: ... but the build fails ...
Apparently you have been reusing more than just the Microchip/Atmel DT for your "custom board based on sama5d27 SOM".
If you use the build configuration(s) of something other than your board, then do not expect piecemeal replacement to be successfull.
You need to provide a full set of (customized) configuration files that the build tool (e.g. Yocto) expects for your board.
Try searching for "sama5d27_som1_ek" as a string in filenames and in files for instances that would require substitution with your board's name.

gcb87 wrote: I cant see anywhere that is selecting at91-sama5d27_som1_ek.dtb as the device tree blob file in the uboot config
The reference is probably only in a text string for the default U-Boot environment, which is in a header file indirectly specified by the board configuration. Hence my previous advice.

Regards
gcb87
Posts: 4
Joined: Wed Jul 22, 2020 3:40 pm

Re: Best way of modifying device tree

Wed Dec 02, 2020 8:35 am

Sorry you are correct, I forgot to mention I am using yocto

So as you mentioned I copied the atmel bsp recipies, because I am using their SOM, this seemed to make sense

I actually tried replacing any mention of 91-sama5d27_som1_ek in the uboot recipe before posting here but that didnt help either.

Thanks anyway
blue_z
Location: USA
Posts: 2145
Joined: Thu Apr 19, 2007 10:15 pm

Re: Best way of modifying device tree

Thu Dec 03, 2020 10:42 pm

gcb87 wrote: So as you mentioned I copied the atmel bsp recipies, because I am using their SOM, this seemed to make sense
"Copied" to where? For what purpose?

You seem to conflate SoM with a board. That's a mistake.
The top-level configuration for Yocto as well as boot programs (i.e. AT91Bootstrap and U-Boot) require specification of the board and boot medium.
At the top-level configuration for Yocto as well as boot programs there is no specification of the SoM or SoC.
Note: Yocto uses the term "Machine" in place of "board".


gcb87 wrote: I actually tried replacing any mention of 91-sama5d27_som1_ek [sic] in the uboot recipe before posting here but that didnt help either.
Replace with what?


Fundamentally you are asking the wrong question.
Your real question should be "how to add my board to Yocto?"

The README file in U-Boot source code also has pertinent directions.
Some of the modifications that I alluded to starts at line 4678, "if (a similar board exists) ..." through line 4686.

Regards
gcb87
Posts: 4
Joined: Wed Jul 22, 2020 3:40 pm

Re: Best way of modifying device tree

Fri Dec 04, 2020 12:12 am

My board uses the SOM as the EK, so it seemed to make sense to copy the BSP layer that is used by the EK in the atmel meta layer to my own layer and then modify it
I'm not conflating anything, just trying to reuse where possible

Unless I have misunderstood something, it seems that this is generally the recommended approach

I dont think I am asking the wrong question at all

Thanks anyway

Return to “Development Tools”

Who is online

Users browsing this forum: No registered users and 1 guest