Skip to content

Commit c910b7f

Browse files
authored
Merge pull request #393 from danielinux/nxp_dcd_data
Added custom DCD for i.mx-RT10XX
2 parents ee4a70f + 0d614fc commit c910b7f

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

arch.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,5 +781,9 @@ ifeq ($(DEBUG_UART),1)
781781
CFLAGS+=-DDEBUG_UART
782782
endif
783783

784+
ifeq ($(NXP_CUSTOM_DCD),1)
785+
CFLAGS+=-DNXP_CUSTOM_DCD
786+
endif
787+
784788
CFLAGS+=-DWOLFBOOT_ARCH_$(ARCH)
785789
CFLAGS+=-DTARGET_$(TARGET)

docs/Targets.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,20 @@ You can also get the SDK and CMSIS bundles using these repositories:
11641164
* https://github.com/nxp-mcuxpresso/CMSIS_5
11651165
Use MCUXSDK=1 with this option, since the pack paths are different.
11661166

1167+
### Custom Device Configuration Data (DCD)
1168+
1169+
On iMX-RT10xx it is possible to load a custom DCD section from an external
1170+
source file. A customized DCD section should be declared within the `.dcd_data`
1171+
section, e.g.:
1172+
1173+
1174+
`const uint8_t __attribute__((section(".dcd_data"))) dcd_data[] = { /* ... */ };`
1175+
1176+
1177+
If an external `.dcd_data` section is provided, the option `NXP_CUSTOM_DCD=1` must
1178+
be added to the configuration.
1179+
1180+
11671181
### Testing Update
11681182

11691183
First make the update partition, pre-triggered for update

hal/imx_rt.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,14 +568,23 @@ const BOOT_DATA_T __attribute__((section(".boot_data"))) boot_data = {
568568
0xFFFFFFFF /* empty - extra data word */
569569
};
570570

571-
const uint8_t dcd_data[1] = {0};
571+
572572
extern void isr_reset(void);
573+
extern const uint32_t __dcd_data_start;
574+
const uint32_t dcd_data_addr = (uint32_t) &__dcd_data_start;
575+
576+
#ifndef NXP_CUSTOM_DCD
577+
/* If a DCD section is populated, it should be mapped to the .dcd_data section.
578+
* By default, provide an empty section.
579+
*/
580+
const uint8_t __attribute__((section(".dcd_data"))) dcd_data[sizeof(uint32_t)] = { 0 };
581+
#endif
573582

574583
const ivt __attribute__((section(".image_vt"))) image_vector_table = {
575584
IVT_HEADER, /* IVT Header */
576585
(uint32_t)isr_reset, /* Image Entry Function */
577586
IVT_RSVD, /* Reserved = 0 */
578-
(uint32_t)dcd_data, /* Address where DCD information is stored */
587+
(uint32_t)dcd_data_addr, /* Address where DCD information is stored */
579588
(uint32_t)&boot_data, /* Address where BOOT Data Structure is stored */
580589
(uint32_t)&image_vector_table, /* Pointer to IVT Self (absolute address */
581590
(uint32_t)CSF_ADDRESS, /* Address where CSF file is stored */

hal/imx_rt.ld

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ SECTIONS
1515
. = ORIGIN(FLASH) + 0x1000;
1616
KEEP(*(.image_vt))
1717
KEEP(*(.boot_data))
18+
__dcd_data_start = .;
1819
KEEP(*(.dcd_data))
1920
. = ORIGIN(FLASH) + 0x2000;
2021
KEEP(*(.isr_vector))

tools/config.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ifeq ($(ARCH),)
1010
MCUXPRESSO_DRIVERS?=$(MCUXPRESSO)/devices/MK64F12
1111
MCUXPRESSO_CMSIS?=$(PWD)/CMSIS_5/CMSIS
1212
FREEDOM_E_SDK?=$(HOME)/src/freedom-e-sdk
13+
NXP_CUSTOM_DCD=0
1314
STM32CUBE?=$(HOME)/STM32Cube/Repository/STM32Cube_FW_WB_V1.3.0
1415
CYPRESS_PDL?=$(HOME)/src/psoc6pdl
1516
CYPRESS_TARGET_LIB?=$(HOME)/src/TARGET_CY8CKIT-062S2-43012
@@ -95,4 +96,5 @@ CONFIG_VARS:= ARCH TARGET SIGN HASH MCUXSDK MCUXPRESSO MCUXPRESSO_CPU MCUXPRESSO
9596
LMS_LEVELS LMS_HEIGHT LMS_WINTERNITZ \
9697
WOLFBOOT_UNIVERSAL_KEYSTORE \
9798
XMSS_PARAMS \
98-
ELF
99+
ELF \
100+
NXP_CUSTOM_DCD

0 commit comments

Comments
 (0)