Skip to content

Commit e1f1647

Browse files
authored
Merge pull request #7766 from tannewt/switch_nxp_sdk
Switch iMX RT sdk to NXP repo
2 parents 53b1661 + 9c3c055 commit e1f1647

File tree

32 files changed

+323
-509
lines changed

32 files changed

+323
-509
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
url = https://github.com/adafruit/Adafruit_MP3
101101
[submodule "ports/mimxrt10xx/sdk"]
102102
path = ports/mimxrt10xx/sdk
103-
url = https://github.com/adafruit/MIMXRT10xx_SDK
103+
url = https://github.com/nxp-mcuxpresso/mcux-sdk.git
104104
[submodule "frozen/Adafruit_CircuitPython_Register"]
105105
path = frozen/Adafruit_CircuitPython_Register
106106
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git

ports/mimxrt10xx/Makefile

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ CROSS_COMPILE = arm-none-eabi-
3030
INC += \
3131
-I. \
3232
-I../.. \
33-
-I../lib/mp-readline \
34-
-I../shared/timeutils \
33+
-I../../lib/cmsis/inc \
3534
-I../../lib/tinyusb/src \
3635
-I../../supervisor/shared/usb \
3736
-I$(BUILD) \
@@ -42,7 +41,7 @@ INC += \
4241
-Isdk/CMSIS/Include \
4342
-Isdk/devices/$(CHIP_FAMILY) \
4443
-Isdk/devices/$(CHIP_FAMILY)/drivers \
45-
-Isdk/devices/$(CHIP_FAMILY)/xip \
44+
-Isdk/drivers/common
4645

4746
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
4847

@@ -106,25 +105,26 @@ LDFLAGS += -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mthumb -mapcs
106105
BOOTLOADER_SIZE := 0x6000C000
107106

108107
SRC_SDK := \
109-
drivers/fsl_adc.c \
110-
drivers/fsl_cache.c \
111-
drivers/fsl_clock.c \
112-
drivers/fsl_common.c \
113-
drivers/fsl_flexspi.c \
114-
drivers/fsl_gpio.c \
115-
drivers/fsl_lpi2c.c \
116-
drivers/fsl_lpspi.c \
117-
drivers/fsl_lpuart.c \
118-
drivers/fsl_ocotp.c \
119-
drivers/fsl_pwm.c \
120-
drivers/fsl_snvs_hp.c \
121-
drivers/fsl_snvs_lp.c \
122-
drivers/fsl_tempmon.c \
123-
drivers/fsl_trng.c \
124-
system_$(CHIP_FAMILY).c \
125-
126-
SRC_SDK := $(addprefix sdk/devices/$(CHIP_FAMILY)/, $(SRC_SDK))
127-
$(addprefix $(BUILD)/, $(SRC_SDK:.c=.o)): CFLAGS += -Wno-undef -Wno-missing-prototypes -Wno-cast-align
108+
devices/$(CHIP_FAMILY)/drivers/fsl_clock.c \
109+
devices/$(CHIP_FAMILY)/system_$(CHIP_FAMILY).c \
110+
devices/$(CHIP_FAMILY)/xip/fsl_flexspi_nor_boot.c \
111+
drivers/adc_12b1msps_sar/fsl_adc.c \
112+
drivers/cache/armv7-m7/fsl_cache.c \
113+
drivers/common/fsl_common_arm.c \
114+
drivers/common/fsl_common.c \
115+
drivers/flexspi/fsl_flexspi.c \
116+
drivers/igpio/fsl_gpio.c \
117+
drivers/lpi2c/fsl_lpi2c.c \
118+
drivers/lpspi/fsl_lpspi.c \
119+
drivers/lpuart/fsl_lpuart.c \
120+
drivers/ocotp/fsl_ocotp.c \
121+
drivers/pwm/fsl_pwm.c \
122+
drivers/snvs_hp/fsl_snvs_hp.c \
123+
drivers/snvs_lp/fsl_snvs_lp.c \
124+
drivers/tempmon/fsl_tempmon.c \
125+
drivers/trng/fsl_trng.c \
126+
127+
SRC_SDK := $(addprefix sdk/, $(SRC_SDK))
128128

129129
SRC_C += \
130130
background.c \
@@ -191,8 +191,7 @@ $(BUILD)/firmware.uf2: $(BUILD)/firmware.elf
191191
$(STEPECHO) "Create $@"
192192
$(Q)$(OBJCOPY) -O binary -R .stack -R .dtcm_bss -R .ivt -R .flash_config $^ $@-binpart
193193
$(Q)$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -f MIMXRT10XX -c -o $@ $@-binpart
194-
195-
# $(Q)rm $@-binpart
194+
$(Q)rm $@-binpart
196195

197196
$(BUILD)/firmware.hex: $(BUILD)/firmware.elf
198197
$(Q)$(OBJCOPY) -O ihex -R .stack -R .dtcm_bss $< $@

ports/mimxrt10xx/board.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

ports/mimxrt10xx/boards/board.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2023 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "mpconfigboard.h"
28+
29+
#define XIP_BOOT_HEADER_ENABLE (1)

ports/mimxrt10xx/boards/feather_m7_1011/flash_config.c

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,21 @@
77

88
#include "boards/flash_config.h"
99

10-
#include "fsl_flexspi_nor_boot.h"
11-
12-
__attribute__((section(".boot_hdr.ivt")))
13-
/*************************************
14-
* IVT Data
15-
*************************************/
16-
const ivt image_vector_table = {
17-
IVT_HEADER, /* IVT Header */
18-
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
19-
IVT_RSVD, /* Reserved = 0 */
20-
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
21-
(uint32_t)BOOT_DATA_ADDRESS, /* Address where BOOT Data Structure is stored */
22-
(uint32_t)&image_vector_table, /* Pointer to IVT Self (absolute address */
23-
(uint32_t)CSF_ADDRESS, /* Address where CSF file is stored */
24-
IVT_RSVD /* Reserved = 0 */
25-
};
26-
27-
__attribute__((section(".boot_hdr.boot_data")))
28-
/*************************************
29-
* Boot Data
30-
*************************************/
31-
const BOOT_DATA_T boot_data = {
32-
FLASH_BASE, /* boot start location */
33-
FLASH_SIZE, /* size */
34-
PLUGIN_FLAG, /* Plugin flag*/
35-
0xFFFFFFFF /* empty - extra data word */
36-
};
10+
#include "xip/fsl_flexspi_nor_boot.h"
3711

3812
// Config for W25Q32JV with QSPI routed.
3913
__attribute__((section(".boot_hdr.conf")))
4014
const flexspi_nor_config_t qspiflash_config = {
4115
.pageSize = 256u,
4216
.sectorSize = 4u * 1024u,
43-
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz,
17+
.ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz,
4418
.blockSize = 0x00010000,
4519
.isUniformBlockSize = false,
4620
.memConfig =
4721
{
4822
.tag = FLEXSPI_CFG_BLK_TAG,
4923
.version = FLEXSPI_CFG_BLK_VERSION,
50-
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad,
24+
.readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad,
5125
.csHoldTime = 3u,
5226
.csSetupTime = 3u,
5327

@@ -61,13 +35,13 @@ const flexspi_nor_config_t qspiflash_config = {
6135
.seqNum = 1u,
6236
},
6337
.deviceModeArg = 0x02, // Bit pattern for setting Quad Enable.
64-
.deviceType = kFlexSpiDeviceType_SerialNOR,
38+
.deviceType = kFLEXSPIDeviceType_SerialNOR,
6539
.sflashPadType = kSerialFlash_4Pads,
66-
.serialClkFreq = kFlexSpiSerialClk_133MHz,
40+
.serialClkFreq = kFLEXSPISerialClk_133MHz,
6741
.sflashA1Size = FLASH_SIZE,
6842
.lookupTable =
6943
{
70-
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
44+
// FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
7145
// The high 16 bits is command 1 and the low are command 0.
7246
// Within a command, the top 6 bits are the opcode, the next two are the number
7347
// of pads and then last byte is the operand. The operand's meaning changes
@@ -78,20 +52,20 @@ const flexspi_nor_config_t qspiflash_config = {
7852

7953
// 0: ROM: Read LUTs
8054
// Quad version
81-
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
55+
SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
8256
RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */),
83-
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
57+
FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
8458
READ_SDR, FLEXSPI_4PAD, 0x04),
8559
// Single fast read version, good for debugging.
86-
// FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
60+
// FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
8761
// RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
88-
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
62+
// FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
8963
// READ_SDR, FLEXSPI_1PAD, 0x04),
9064
TWO_EMPTY_STEPS,
9165
TWO_EMPTY_STEPS),
9266

9367
// 1: ROM: Read status
94-
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
68+
SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
9569
READ_SDR, FLEXSPI_1PAD, 0x02),
9670
TWO_EMPTY_STEPS,
9771
TWO_EMPTY_STEPS,
@@ -101,21 +75,21 @@ const flexspi_nor_config_t qspiflash_config = {
10175
EMPTY_SEQUENCE,
10276

10377
// 3: ROM: Write Enable
104-
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
78+
SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
10579
STOP, FLEXSPI_1PAD, 0x00),
10680
TWO_EMPTY_STEPS,
10781
TWO_EMPTY_STEPS,
10882
TWO_EMPTY_STEPS),
10983

11084
// 4: Config: Write Status -2
111-
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */,
85+
SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */,
11286
WRITE_SDR, FLEXSPI_1PAD, 0x01 /* number of bytes to write */),
11387
TWO_EMPTY_STEPS,
11488
TWO_EMPTY_STEPS,
11589
TWO_EMPTY_STEPS),
11690

11791
// 5: ROM: Erase Sector
118-
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
92+
SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
11993
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
12094
TWO_EMPTY_STEPS,
12195
TWO_EMPTY_STEPS,
@@ -128,17 +102,17 @@ const flexspi_nor_config_t qspiflash_config = {
128102
EMPTY_SEQUENCE,
129103

130104
// 8: Block Erase
131-
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
105+
SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
132106
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
133107
TWO_EMPTY_STEPS,
134108
TWO_EMPTY_STEPS,
135109
TWO_EMPTY_STEPS),
136110

137111
// 9: ROM: Page program
138-
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
112+
SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
139113
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
140114

141-
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
115+
FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
142116
STOP, FLEXSPI_1PAD, 0),
143117
TWO_EMPTY_STEPS,
144118
TWO_EMPTY_STEPS),
@@ -147,7 +121,7 @@ const flexspi_nor_config_t qspiflash_config = {
147121
EMPTY_SEQUENCE,
148122

149123
// 11: ROM: Chip erase
150-
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
124+
SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
151125
STOP, FLEXSPI_1PAD, 0),
152126
TWO_EMPTY_STEPS,
153127
TWO_EMPTY_STEPS,

0 commit comments

Comments
 (0)