Skip to content

Commit

Permalink
Merge pull request #393 from danielinux/nxp_dcd_data
Browse files Browse the repository at this point in the history
Added custom DCD for i.mx-RT10XX
  • Loading branch information
bigbrett authored Nov 17, 2023
2 parents ee4a70f + 0d614fc commit c910b7f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
4 changes: 4 additions & 0 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -781,5 +781,9 @@ ifeq ($(DEBUG_UART),1)
CFLAGS+=-DDEBUG_UART
endif

ifeq ($(NXP_CUSTOM_DCD),1)
CFLAGS+=-DNXP_CUSTOM_DCD
endif

CFLAGS+=-DWOLFBOOT_ARCH_$(ARCH)
CFLAGS+=-DTARGET_$(TARGET)
14 changes: 14 additions & 0 deletions docs/Targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,20 @@ You can also get the SDK and CMSIS bundles using these repositories:
* https://github.com/nxp-mcuxpresso/CMSIS_5
Use MCUXSDK=1 with this option, since the pack paths are different.

### Custom Device Configuration Data (DCD)

On iMX-RT10xx it is possible to load a custom DCD section from an external
source file. A customized DCD section should be declared within the `.dcd_data`
section, e.g.:


`const uint8_t __attribute__((section(".dcd_data"))) dcd_data[] = { /* ... */ };`


If an external `.dcd_data` section is provided, the option `NXP_CUSTOM_DCD=1` must
be added to the configuration.


### Testing Update

First make the update partition, pre-triggered for update
Expand Down
13 changes: 11 additions & 2 deletions hal/imx_rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,14 +568,23 @@ const BOOT_DATA_T __attribute__((section(".boot_data"))) boot_data = {
0xFFFFFFFF /* empty - extra data word */
};

const uint8_t dcd_data[1] = {0};

extern void isr_reset(void);
extern const uint32_t __dcd_data_start;
const uint32_t dcd_data_addr = (uint32_t) &__dcd_data_start;

#ifndef NXP_CUSTOM_DCD
/* If a DCD section is populated, it should be mapped to the .dcd_data section.
* By default, provide an empty section.
*/
const uint8_t __attribute__((section(".dcd_data"))) dcd_data[sizeof(uint32_t)] = { 0 };
#endif

const ivt __attribute__((section(".image_vt"))) image_vector_table = {
IVT_HEADER, /* IVT Header */
(uint32_t)isr_reset, /* Image Entry Function */
IVT_RSVD, /* Reserved = 0 */
(uint32_t)dcd_data, /* Address where DCD information is stored */
(uint32_t)dcd_data_addr, /* Address where DCD information is stored */
(uint32_t)&boot_data, /* Address where BOOT Data Structure is stored */
(uint32_t)&image_vector_table, /* Pointer to IVT Self (absolute address */
(uint32_t)CSF_ADDRESS, /* Address where CSF file is stored */
Expand Down
1 change: 1 addition & 0 deletions hal/imx_rt.ld
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SECTIONS
. = ORIGIN(FLASH) + 0x1000;
KEEP(*(.image_vt))
KEEP(*(.boot_data))
__dcd_data_start = .;
KEEP(*(.dcd_data))
. = ORIGIN(FLASH) + 0x2000;
KEEP(*(.isr_vector))
Expand Down
4 changes: 3 additions & 1 deletion tools/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ifeq ($(ARCH),)
MCUXPRESSO_DRIVERS?=$(MCUXPRESSO)/devices/MK64F12
MCUXPRESSO_CMSIS?=$(PWD)/CMSIS_5/CMSIS
FREEDOM_E_SDK?=$(HOME)/src/freedom-e-sdk
NXP_CUSTOM_DCD=0
STM32CUBE?=$(HOME)/STM32Cube/Repository/STM32Cube_FW_WB_V1.3.0
CYPRESS_PDL?=$(HOME)/src/psoc6pdl
CYPRESS_TARGET_LIB?=$(HOME)/src/TARGET_CY8CKIT-062S2-43012
Expand Down Expand Up @@ -95,4 +96,5 @@ CONFIG_VARS:= ARCH TARGET SIGN HASH MCUXSDK MCUXPRESSO MCUXPRESSO_CPU MCUXPRESSO
LMS_LEVELS LMS_HEIGHT LMS_WINTERNITZ \
WOLFBOOT_UNIVERSAL_KEYSTORE \
XMSS_PARAMS \
ELF
ELF \
NXP_CUSTOM_DCD

0 comments on commit c910b7f

Please sign in to comment.