diff options
| author | summivox <summivox@gmail.com> | 2023-08-20 23:13:59 -0700 |
|---|---|---|
| committer | Ian McIntyre <ianpmcintyre@gmail.com> | 2023-09-08 19:18:34 -0400 |
| commit | c6d3bcfb11800c58339037be58fa9935f816f1bb (patch) | |
| tree | 4e8b0d6cdae543e0443f4a8d4cf969f4def7a1f3 /src/host | |
| parent | e1fddd5b3b678c43ee59835d7b57bbc063a22d28 (diff) | |
Add optional DCD section in linker script
Users can define their device configuration data (DCD), and place the
data in the .dcd section. If the .dcd section has content, the entry in
the IVT points at the user's DCD. This plays well with imxrt-dcd.
Diffstat (limited to 'src/host')
| -rw-r--r-- | src/host/imxrt-boot-header.x | 7 | ||||
| -rw-r--r-- | src/host/imxrt-link.x | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/host/imxrt-boot-header.x b/src/host/imxrt-boot-header.x index 296eff5..ed9d789 100644 --- a/src/host/imxrt-boot-header.x +++ b/src/host/imxrt-boot-header.x @@ -53,7 +53,7 @@ SECTIONS LONG(0x402000D1); /* Header, magic number */ LONG(__sivector_table); /* Address of the vectors table */ LONG(0x00000000); /* RESERVED */ - LONG(0x00000000); /* Device Configuration Data (unused) */ + LONG(__dcd); /* Device Configuration Data */ LONG(__boot_data); /* Address to boot data */ LONG(__ivt); /* Self reference */ LONG(0x00000000); /* Command Sequence File (unused) */ @@ -67,6 +67,11 @@ SECTIONS LONG(__image_size); /* Length of image */ LONG(0x00000000); /* Plugin flag (unused) */ LONG(0xDEADBEEF); /* Dummy to align boot data to 16 bytes */ + . = ALIGN(4); + __dcd_start = .; + KEEP(*(.dcd)); /* Device Configuration Data */ + __dcd_end = .; + __dcd = ((__dcd_end - __dcd_start) > 0) ? __dcd_start : 0; *(.Reset); /* Jam the imxrt-rt reset handler into flash. */ *(.__pre_init); /* Also jam the pre-init function, since we need it to run before instructions are placed. */ . = ORIGIN(FLASH) + 0x2000; /* Reserve the remaining 8K as a convenience for a non-XIP boot. */ diff --git a/src/host/imxrt-link.x b/src/host/imxrt-link.x index d02a170..71b697e 100644 --- a/src/host/imxrt-link.x +++ b/src/host/imxrt-link.x @@ -191,6 +191,9 @@ ERROR(imxrt-rt): .got section detected in the input object files Dynamic relocations are not supported. If you are linking to C code compiled using the 'cc' crate then modify your build script to compile the C code _without_ the -fPIC flag. See the documentation of the `cc::Build.pic` method for details."); + +ASSERT((__dcd_end - __dcd_start) % 4 == 0, " +ERROR(imxrt-rt): .dcd (Device Configuration Data) size must be a multiple of 4 bytes."); /* Do not exceed this mark in the error messages above | */ /* ===--- End imxrt-link.x ---=== */ |
