Skip to content

Commit 0f25c80

Browse files
author
Daniel Fedai Larsen
committed
Add support for MIMXRT1042XJM5B
1 parent c6ac284 commit 0f25c80

7 files changed

Lines changed: 97 additions & 5 deletions

File tree

arch.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,11 @@ ifeq ($(TARGET),imx_rt)
394394
CFLAGS+=-I$(MCUXPRESSO)/boards/evkbimxrt1050/xip/
395395
endif
396396

397+
ifeq ($(MCUXPRESSO_CPU),MIMXRT1042XJM5B)
398+
ARCH_FLASH_OFFSET=0x60000000
399+
CFLAGS+=-I$(MCUXPRESSO)/boards/evkmimxrt1040/xip/
400+
endif
401+
397402
ifeq ($(PKA),1)
398403
ifeq ($(MCUXSDK),1)
399404
PKA_EXTRA_OBJS+= $(MCUXPRESSO)/drivers/fsl_dcp.o

config/examples/imx-rt1040.config

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
ARCH?=ARM
2+
TARGET?=imx_rt
3+
SIGN?=ECC256
4+
HASH?=SHA256
5+
MCUXSDK?=0
6+
MCUXPRESSO?=$(PWD)/../SDK_2_14_0_EVKB-IMXRT1040
7+
MCUXPRESSO_CMSIS?=$(MCUXPRESSO)/CMSIS
8+
MCUXPRESSO_CPU?=MIMXRT1042XJM5B
9+
MCUXPRESSO_DRIVERS?=$(MCUXPRESSO)/devices/MIMXRT1042
10+
DEBUG?=0
11+
VTOR?=1
12+
CORTEX_M0?=0
13+
NO_ASM?=0
14+
NO_MPU=1
15+
EXT_FLASH?=0
16+
SPI_FLASH?=0
17+
ALLOW_DOWNGRADE?=0
18+
NVM_FLASH_WRITEONCE?=1
19+
WOLFBOOT_VERSION?=0
20+
V?=0
21+
SPMATH?=1
22+
RAM_CODE?=0
23+
DUALBANK_SWAP?=0
24+
PKA?=0
25+
WOLFBOOT_PARTITION_SIZE?=0x20000
26+
WOLFBOOT_SECTOR_SIZE?=0x1000
27+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x60010000
28+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x60030000
29+
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x60050000
30+
WOLFBOOT_SMALL_STACK?=1
31+
32+
# Flash Options
33+
CFLAGS_EXTRA+=-DCONFIG_HYPERFLASH
34+
#CFLAGS_EXTRA+=-DCONFIG_FLASH_IS25WP064A
35+
#CFLAGS_EXTRA+=-DCONFIG_FLASH_W25Q64JV

docs/Targets.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,16 @@ First make the update partition, pre-triggered for update
11861186
tools/scripts/prepare_update.sh
11871187
```
11881188

1189-
Then connect to the board with JLinkExe, for the rt1050 do:
1189+
Then connect to the board with JLinkExe, for the rt1040 do:
1190+
1191+
```sh
1192+
# HyperFlash
1193+
JLinkExe -if swd -speed 5000 -Device "MIMXRT1042xxxxB"
1194+
# QSPI
1195+
JLinkExe -if swd -speed 5000 -Device "MIMXRT1042xxxxB?BankAddr=0x60000000&Loader=QSPI"
1196+
```
1197+
1198+
For the rt1050 do:
11901199

11911200
```sh
11921201
# HyperFlash
@@ -1214,6 +1223,8 @@ loadbin update.bin 0x60030000
12141223
### NXP iMX-RT Debugging JTAG / JLINK
12151224

12161225
```sh
1226+
# rt-1040
1227+
JLinkGDBServer -Device MIMXRT1042xxxxB -speed 5000 -if swd -port 3333
12171228
# rt-1050
12181229
JLinkGDBServer -Device MIMXRT1052xxx6A -speed 5000 -if swd -port 3333
12191230
# rt-1060

hal/imx_rt.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
#include "evkmimxrt1060_flexspi_nor_config.h"
3939
#define USE_GET_CONFIG
4040
#endif
41+
#ifdef CPU_MIMXRT1042XJM5B
42+
#include "evkmimxrt1040_flexspi_nor_config.h"
43+
#endif
4144
#ifdef CPU_MIMXRT1052DVJ6B
4245
#include "evkbimxrt1050_flexspi_nor_config.h"
4346
#endif
@@ -277,7 +280,7 @@ const flexspi_nor_config_t __attribute__((section(".flash_config"))) qspiflash_c
277280

278281

279282
/** Flash configuration in the .flash_config section of flash **/
280-
#ifdef CPU_MIMXRT1052DVJ6B
283+
#if defined(CPU_MIMXRT1042XJM5B) || defined(CPU_MIMXRT1052DVJ6B)
281284

282285
#ifdef CONFIG_FLASH_W25Q64JV
283286
/* Winbond W25Q64JV */
@@ -543,11 +546,11 @@ const flexspi_nor_config_t __attribute__((section(".flash_config"))) qspiflash_c
543546
.ipcmdSerialClkFreq = 0,
544547
};
545548
#endif
546-
#endif /* CPU_MIMXRT1052DVJ6B */
549+
#endif /* CPU_MIMXRT1042XJM5B || CPU_MIMXRT1052DVJ6B */
547550

548551

549552
#ifndef __FLASH_BASE
550-
#if defined(CPU_MIMXRT1052DVJ6B) || defined(CPU_MIMXRT1062DVL6A)
553+
#if defined(CPU_MIMXRT1042XJM5B) || defined(CPU_MIMXRT1052DVJ6B) || defined(CPU_MIMXRT1062DVL6A)
551554
#define __FLASH_BASE 0x60000000
552555
#elif defined(CPU_MIMXRT1064DVL6A)
553556
#define __FLASH_BASE 0x70000000

test-app/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,11 @@ ifeq ($(TARGET),imx_rt)
252252
$(MCUXPRESSO_DRIVERS)/utilities/debug_console/fsl_debug_console.o
253253
endif
254254

255-
ifeq ($(MCUXPRESSO_CPU),MIMXRT1052DVJ6B)
255+
ifeq ($(MCUXPRESSO_CPU),MIMXRT1042XJM5B)
256+
CFLAGS+=-I$(MCUXPRESSO_DRIVERS)/project_template/ \
257+
-I$(MCUXPRESSO)/boards/evkmimxrt1040/xip/
258+
APP_OBJS+=$(MCUXPRESSO_DRIVERS)/system_MIMXRT1042.o
259+
else ifeq ($(MCUXPRESSO_CPU),MIMXRT1052DVJ6B)
256260
CFLAGS+=-I$(MCUXPRESSO_DRIVERS)/project_template/ \
257261
-I$(MCUXPRESSO)/boards/evkmimxrt1050/xip/
258262
APP_OBJS+=$(MCUXPRESSO_DRIVERS)/system_MIMXRT1052.o

test-app/app_imx_rt.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,32 @@ void rt1050_init_pins(void)
121121
}
122122
#endif
123123

124+
#ifdef CPU_MIMXRT1042XJM5B
125+
void rt1040_init_pins(void)
126+
{
127+
gpio_pin_config_t USER_LED_config = {
128+
.direction = kGPIO_DigitalOutput,
129+
.outputLogic = 0U,
130+
.interruptMode = kGPIO_NoIntmode
131+
};
132+
133+
CLOCK_EnableClock(kCLOCK_Iomuxc);
134+
135+
GPIO_PinInit(USER_LED_GPIO, USER_LED_PIN, &USER_LED_config);
136+
137+
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, 0U);
138+
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_12_LPUART1_TX, 0U);
139+
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_13_LPUART1_RX, 0U);
140+
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_04_CCM_CLKO1, 0U);
141+
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B0_05_CCM_CLKO2, 0U);
142+
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, 0x10B0U);
143+
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_12_LPUART1_TX, 0x10B0U);
144+
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_13_LPUART1_RX, 0x10B0U);
145+
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B0_04_CCM_CLKO1, 0x10B0U);
146+
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B0_05_CCM_CLKO2, 0x10B0U);
147+
}
148+
#endif
149+
124150

125151
void main(void)
126152
{
@@ -129,6 +155,8 @@ void main(void)
129155
rt1060_init_pins();
130156
#elif defined(CPU_MIMXRT1052DVJ6B)
131157
rt1050_init_pins();
158+
#elif defined(CPU_MIMXRT1042XJM5B)
159+
rt1040_init_pins();
132160
#endif
133161
SystemCoreClockUpdate();
134162
init_debug_console();

test-app/imx_rt_clock_config.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,21 @@ void imx_rt_init_boot_clock(void)
154154
/* Set Flexspi clock source. */
155155
CLOCK_SetMux(kCLOCK_FlexspiMux, 3);
156156
#endif
157+
#if !defined(CPU_MIMXRT1042XJM5B)
157158
/* Disable CSI clock gate. */
158159
CLOCK_DisableClock(kCLOCK_Csi);
159160
/* Set CSI_PODF. */
160161
CLOCK_SetDiv(kCLOCK_CsiDiv, 1);
161162
/* Set Csi clock source. */
162163
CLOCK_SetMux(kCLOCK_CsiMux, 0);
164+
#endif
163165
/* Disable LPSPI clock gate. */
164166
CLOCK_DisableClock(kCLOCK_Lpspi1);
165167
CLOCK_DisableClock(kCLOCK_Lpspi2);
166168
CLOCK_DisableClock(kCLOCK_Lpspi3);
169+
#if !defined(CPU_MIMXRT1042XJM5B)
167170
CLOCK_DisableClock(kCLOCK_Lpspi4);
171+
#endif
168172
/* Set LPSPI_PODF. */
169173
CLOCK_SetDiv(kCLOCK_LpspiDiv, 4);
170174
/* Set Lpspi clock source. */
@@ -350,12 +354,14 @@ void imx_rt_init_boot_clock(void)
350354
#endif
351355
/* Enable Enet25M output. */
352356
CCM_ANALOG->PLL_ENET |= CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_MASK;
357+
#if !defined(CPU_MIMXRT1042XJM5B)
353358
/* DeInit Usb2 PLL. */
354359
CLOCK_DeinitUsb2Pll();
355360
/* Bypass Usb2 PLL. */
356361
CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllUsb2, 1);
357362
/* Enable Usb2 PLL output. */
358363
CCM_ANALOG->PLL_USB2 |= CCM_ANALOG_PLL_USB2_ENABLE_MASK;
364+
#endif
359365
/* Set preperiph clock source. */
360366
CLOCK_SetMux(kCLOCK_PrePeriphMux, 3);
361367
/* Set periph clock source. */

0 commit comments

Comments
 (0)