[rtems commit] bsp/imxrt: Enforce alignment for devicetree

Christian Mauderer christianm at rtems.org
Mon Feb 21 08:24:17 UTC 2022


Module:    rtems
Branch:    master
Commit:    6fe6622489217d2e42dc7bf2349aff74f6cc0766
Changeset: http://git.rtems.org/rtems/commit/?id=6fe6622489217d2e42dc7bf2349aff74f6cc0766

Author:    Christian Mauderer <christian.mauderer at embedded-brains.de>
Date:      Wed Feb 16 10:21:54 2022 +0100

bsp/imxrt: Enforce alignment for devicetree

A device tree binary has to be 8 byte aligned in memory. This is checked
since RTEMS commit 34052ef78cf8724dee73e9279b2c6bff8cfed234 "libfdt: Add
FDT alignment check to fdt_check_header()".

---

 bsps/arm/imxrt/dts/imxrt1050-evkb.c   | 2 +-
 bsps/arm/imxrt/dts/imxrt1050-evkb.dts | 2 +-
 bsps/arm/imxrt/include/bsp.h          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bsps/arm/imxrt/dts/imxrt1050-evkb.c b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
index 301e790..ecae160 100644
--- a/bsps/arm/imxrt/dts/imxrt1050-evkb.c
+++ b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
@@ -6,7 +6,7 @@
 
 #include <sys/types.h>
 
-const unsigned char imxrt_dtb[] = {
+const unsigned char imxrt_dtb[] __attribute__(( __aligned__(8) )) = {
   0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x3f, 0xf6, 0x00, 0x00, 0x00, 0x38, 
   0x00, 0x00, 0x3b, 0xf8, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11, 
   0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xbe, 
diff --git a/bsps/arm/imxrt/dts/imxrt1050-evkb.dts b/bsps/arm/imxrt/dts/imxrt1050-evkb.dts
index 9310371..dae7e89 100644
--- a/bsps/arm/imxrt/dts/imxrt1050-evkb.dts
+++ b/bsps/arm/imxrt/dts/imxrt1050-evkb.dts
@@ -31,7 +31,7 @@
  *     export BSP_DIR="${RTEMS_SRC_DIR}/bsps/arm/imxrt/"
  *     arm-rtems6-cpp -P -x assembler-with-cpp -I "${BSP_DIR}/include/" -include "${BSP_DIR}/dts/imxrt1050-evkb.dts" /dev/null | \
  *         dtc -O dtb -o "${BSP_DIR}/dts/imxrt1050-evkb.dtb" -b 0 -p 64
- *     rtems-bin2c -C -N imxrt_dtb "${BSP_DIR}/dts/imxrt1050-evkb.dtb" "${BSP_DIR}/dts/imxrt1050-evkb.c"
+ *     rtems-bin2c -A 8 -C -N imxrt_dtb "${BSP_DIR}/dts/imxrt1050-evkb.dtb" "${BSP_DIR}/dts/imxrt1050-evkb.c"
  */
 
 /dts-v1/;
diff --git a/bsps/arm/imxrt/include/bsp.h b/bsps/arm/imxrt/include/bsp.h
index f93c28a..6d5c7fe 100644
--- a/bsps/arm/imxrt/include/bsp.h
+++ b/bsps/arm/imxrt/include/bsp.h
@@ -57,7 +57,7 @@ extern "C" {
 #define BSP_FEATURE_IRQ_EXTENSION
 
 #define BSP_FDT_IS_SUPPORTED
-extern const unsigned char imxrt_dtb[];
+extern const unsigned char imxrt_dtb[] __attribute__(( __aligned__(8) ));
 extern const size_t imxrt_dtb_size;
 
 void *imx_get_reg_of_node(const void *fdt, int node);



More information about the vc mailing list