Last active
March 28, 2026 09:47
-
-
Save matwey/629be97641f02c6ecb48308c0b63da79 to your computer and use it in GitHub Desktop.
u-boot overlay.dtbo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| *.dtbo | |
| *.i | |
| boot.scr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # mkimage -A arm -T script -C none -n "Boot script" -d boot.cmd boot.scr | |
| load ${devtype} ${devnum}:${distro_bootpart} ${fdtoverlay_addr_r} ${prefix}overlay.dtbo | |
| fdt addr ${fdtoverlay_addr_r} | |
| fdt header get fdtoverlay_size totalsize | |
| fdt move ${fdtcontroladdr} ${fdt_addr_r} | |
| fdt resize ${fdtoverlay_size} | |
| fdt apply ${fdtoverlay_addr_r} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CPP=cpp | |
| DTC=dtc | |
| MKIMAGE=mkimage | |
| LINUX=/home/matwey/lab/linux | |
| all: boot.scr overlay-gps.dtbo overlay-i2c.dtbo | |
| clean: | |
| rm -rf boot.scr overlay-gps.dtbo overlay-i2c.dtbo *.i | |
| boot.scr: boot.cmd | |
| ${MKIMAGE} -A arm -T script -C none -n "Boot script" -d $< $@ | |
| %.i: %.dtso | |
| ${CPP} -x assembler-with-cpp -I ${LINUX}/include $< $@ | |
| %.dtbo: %.i | |
| ${DTC} -@ -O dtb -o $@ $< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* cpp -x assembler-with-cpp -I /home/matwey/lab/linux/include overlay.dtso overlay.i */ | |
| /* dtc -O dtb -o overlay.dtbo overlay.dtso */ | |
| /dts-v1/; | |
| /plugin/; | |
| #include <dt-bindings/gpio/gpio.h> | |
| &pio { | |
| uart5_ph_pins: uart5-ph-pins { | |
| pins = "PH2", "PH3"; | |
| function = "uart5"; | |
| }; | |
| pps_pi1_pins: pps-pi1-pins { | |
| pins = "PI1"; | |
| function = "pps_pi1"; | |
| }; | |
| }; | |
| &{/} { | |
| pps_pi1: pps-pi1 { | |
| compatible = "pps-gpio"; | |
| pinctrl-names = "default"; | |
| pinctrl-0 = <&pps_pi1_pins>; | |
| gpios = <&pio 8 1 GPIO_ACTIVE_HIGH>; // PI1 | |
| status = "okay"; | |
| }; | |
| }; | |
| &uart5 { | |
| pinctrl-names = "default"; | |
| pinctrl-0 = <&uart5_ph_pins>; | |
| status = "okay"; | |
| }; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* cpp -x assembler-with-cpp -I /home/matwey/lab/linux/include overlay.dtso overlay.i */ | |
| /* dtc -O dtb -o overlay.dtbo overlay.dtso */ | |
| /dts-v1/; | |
| /plugin/; | |
| #include <dt-bindings/i2c/i2c.h> | |
| #include <dt-bindings/gpio/gpio.h> | |
| &i2c0 { | |
| status = "okay"; | |
| }; | |
| &i2c1 { | |
| status = "okay"; | |
| }; | |
| &{/} { | |
| i2c_gpio: i2c-gpio { | |
| compatible = "i2c-gpio"; | |
| sda-gpios = <&pio 8 0 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; // PI0 (29) | |
| scl-gpios = <&pio 8 15 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; // PI15 (31) | |
| i2c-gpio,delay-us = <2>; /* ~100 kHz */ | |
| #address-cells = <1>; | |
| #size-cells = <0>; | |
| status = "okay"; | |
| testunit@30 { | |
| compatible = "slave-testunit"; | |
| reg = <(0x30 | I2C_OWN_SLAVE_ADDRESS)>; | |
| }; | |
| }; | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment