Skip to content

Commit

Permalink
Uniform device tree for differnt core configs
Browse files Browse the repository at this point in the history
Instead of having multiple device tree files for differnt number of
cores, a single file is used. The device tree must be processes by a
C/C++ preprocessor before it is compiled. NRCPU must be passed to the
preprocessor. The compilation of the device trees is shifted from
buildroot to the postprocessing step.

Signed-off-by: Nils Bosbach <bosbach@ice.rwth-aachen.de>
  • Loading branch information
nbosb committed Nov 9, 2023
1 parent 78c4750 commit e73f33e
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 162 deletions.
2 changes: 0 additions & 2 deletions linux/files/avp64-linux-defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.4"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="/app/files/avp64_linux_kernel.config"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="/app/files/avp64_linux.dts /app/files/avp64_linux_dualcore.dts"
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_GDB=y
BR2_PACKAGE_STRACE=y
Expand Down
156 changes: 0 additions & 156 deletions linux/files/avp64_linux_dualcore.dts

This file was deleted.

35 changes: 35 additions & 0 deletions linux/files/dt/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
O ?= .
CPP ?= cpp
DTC ?= dtc

CPPFLAGS := -nostdinc -undef -x assembler-with-cpp

OBJ := ${O}/avp64x1.dtb ${O}/avp64x2.dtb ${O}/avp64x4.dtb ${O}/avp64x8.dtb

all: $(OBJ)

clean:
$(RM) $(OBJ)

${O}/%.dtb: ${O}/%.dts
@mkdir -p ${O}
$(DTC) -I dts -O dtb -o $@ $<

${O}/avp64x1.dts: avp64.dts
@mkdir -p ${O}
$(CPP) $(CPPFLAGS) -D NRCPU=1 -o $@ $<

${O}/avp64x2.dts: avp64.dts
@mkdir -p ${O}
$(CPP) $(CPPFLAGS) -D NRCPU=2 -o $@ $<

${O}/avp64x4.dts: avp64.dts
@mkdir -p ${O}
$(CPP) $(CPPFLAGS) -D NRCPU=4 -o $@ $<

${O}/avp64x8.dts: avp64.dts
@mkdir -p ${O}
$(CPP) $(CPPFLAGS) -D NRCPU=8 -o $@ $<

.PHONY: all clean
.INTERMEDIATE: $(OBJ:dtb=dts)
66 changes: 62 additions & 4 deletions linux/files/avp64_linux.dts → linux/files/dt/avp64.dts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/******************************************************************************
* *
* Copyright 2020 Lukas Jünger *
* Copyright 2023 Lukas Jünger, Nils Bosbach *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
Expand All @@ -16,6 +16,10 @@
* *
******************************************************************************/

#ifndef NRCPU
#error NRCPU undefined
#endif

/dts-v1/;

/ {
Expand All @@ -42,6 +46,61 @@
reg = <0x0 0x0>;
};

#if NRCPU > 1
cpu1: cpu@1 {
device_type = "cpu";
compatible = "arm,armv8";
enable-method = "spin-table";
cpu-release-addr = <0x0 0x00004000>;
reg = <0x0 0x1>;
};
#if NRCPU > 2
cpu2: cpu@2 {
device_type = "cpu";
compatible = "arm,armv8";
enable-method = "spin-table";
cpu-release-addr = <0x0 0x00004000>;
reg = <0x0 0x2>;
};
cpu3: cpu@3 {
device_type = "cpu";
compatible = "arm,armv8";
enable-method = "spin-table";
cpu-release-addr = <0x0 0x00004000>;
reg = <0x0 0x3>;
};
#if NRCPU > 4
cpu4: cpu@4 {
device_type = "cpu";
compatible = "arm,armv8";
enable-method = "spin-table";
cpu-release-addr = <0x0 0x00004000>;
reg = <0x0 0x4>;
};
cpu5: cpu@5 {
device_type = "cpu";
compatible = "arm,armv8";
enable-method = "spin-table";
cpu-release-addr = <0x0 0x00004000>;
reg = <0x0 0x5>;
};
cpu6: cpu@6 {
device_type = "cpu";
compatible = "arm,armv8";
enable-method = "spin-table";
cpu-release-addr = <0x0 0x00004000>;
reg = <0x0 0x6>;
};
cpu7: cpu@7 {
device_type = "cpu";
compatible = "arm,armv8";
enable-method = "spin-table";
cpu-release-addr = <0x0 0x00004000>;
reg = <0x0 0x7>;
};
#endif // NRCPU > 4
#endif // NRCPU > 2
#endif // NRCPU > 1
};

chosen {
Expand Down Expand Up @@ -148,14 +207,13 @@ amba {
};
};

gpio0: gpio@0x10149000 {
gpio0: gpio@10149000 {
compatible = "brcm,bcm6345-gpio";
reg = <0x10149000 4>;
reg-names = "dat";
gpio-controller;
#gpio-cells = <2>;
//big-endian;
};
};
};

v2m_clk24mhz: clk24mhz {
Expand Down
3 changes: 3 additions & 0 deletions linux/files/post-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ genimage \
--inputpath "${BINARIES_DIR}" \
--outputpath "${BINARIES_DIR}" \
--config "${GENIMAGE_CFG}"

# compile device trees
make -C /app/files/dt O=/app/build/buildroot/output/dt

0 comments on commit e73f33e

Please sign in to comment.