Changing the device tree?

Dear support,

I’m starting my first project with the Colibri i.MX7D module. (Colibri iMX7D 1GB, V1.1A)
It is currently running Angstrom v2017.12.

Basic setup of the development environment is done and I’m able to compile/download/debug applications.

For the project, we are developing our own carrier board and we need a number of pins to be redefined. I’m talking mainly of :

Usage of GPT1 with the CLK and COMPARE pins routed to SODIMM pins 60 and 93
Usage of two SPI interfaces, ecspi1 and ecspi3 (SCLK, MOSI and MISO)

My first question is whether it is possible to change the “ALT” value of a specific pin (e.g. GPT1.CLK is on ALT1 while the reset state is ALT5) without modification of the device tree ?
If I understand correctly, changing the device tree implies recompilation of the Linux kernel and I’m currently not familiar with the process. I browsed through several pages on the Toradex website but I’m not sure where to start and what to select. So if there is no other way to modify pin functions, can you tell me where to start and e.g. what BSP version (3, 2.8?) to use ?
Will this still be the Angstrom v2017.1 kernel ?

Thanks

You can change device tree in u-boot with fdt command (for example U-Boot Flattened Device Tree - Xilinx Wiki - Confluence (atlassian.net)

But setting up kernel development environment is easy as per toradex’ instructions. When it is up, you can compile only the device tree blob (DTB) and copy it to your running environment and reboot. No need to build kernel or flash new image for every test. I prefer this way.

Thanks for your quick answer!

I looked at the link and tried boot the fatload and fdt commands on the target board but both are unknown. Are these commands and the change in the device tree supposed to be done on target or in an external development environment? Sorry if this is a stupid question, I’m really just diving into Linux kernels and configuration…

Being an experienced sw developper, I may prefer this way as well. The instructions you refer to, are these on this page ? :
https://developer.toradex.com/knowledge-base/build-u-boot-and-linux-kernel-from-source-code#tab-imx-7
Or rather this one ? :

If you have any other links that will speed me up, I’ll very much appreciate !

Thanks !

On the target board, over serial port debug console. You need to interrupt the boot to enter u-boot bootloader and use it from there, not from linux side.

I used the instruction in the first wiki link Build U-Boot and Linux Kernel from Source Code (toradex.com). Do step by step the preparations, and in “Kernel compilation” subsection, there is two commands

$ make -j$(nproc) zImage 2>&1 | tee build.log
$ make DTC_FLAGS="-@" <device-tree>.dtb

first one compiles kernel, and second one the device tree.

I use different SoM (imx8) so you need to change accordingly, but I do make DTC_FLAGS="-@" imx8qxp-colibri-eval-v3.dtb and then copy it to my boot partition (when linux is up and running and has internet connection) with something like

scp arch/arm64/boot/dts/freescale/imx8qxp-colibri-eval-v3.dtb root@192.168.1.11:/media/mmcblk0p1/

where source path is the freshly built DTB and the target path the correct location of the DTB on target module. Then I reboot and it boots with new DTB.

Thanks!
I’ll give it a try (not sure whether I manage to do this today however) and let you know.

Hi @ompie !

Welcome to the Toradex Community! :smiley:

The OS that you are using is pretty old for a project that is in its first steps.

Is there a reason to use such an old OS?

Best regards,

Hello @henrique.tx,
No there is no specific reason. I bought the module almost two years ago and installed it at that time. So I’m definitely open for a suggestion of what to use instead.
Thanks

Hi @ompie ,

Would you be interested in setting up a call where we could talk about your project and find the best fitting setup for you?

Best Regards
Kevin

Hi Kevin,
That would be useful I think. Especially since there are some other points to decide on. Ideally, I would like to use the cortex-M4 for data transfer of samples from SPI to shared memory (100kHz+ rate of 18 byte samples).
Monday I’ll be available “any time” for a call so let me know when suits you best and how to reach out (Skype, phone?)

Jeroen

Hi @ompie !

Just to share some piece of information about sharing data between Linux and Cortex-M: please take a look at this answer.

Best regards,

Hi @henrique.tx ,

Yes, that’s indeed similar to what what I need. I’ll start a different thread for this when needed, just to keep the current thread on device trees and Kernel compilation.
Thanks !