Merge remote-tracking branch 'origin/main'

This commit is contained in:
Hosted Weblate 2023-03-22 17:57:20 +01:00
commit 47192bdc21
No known key found for this signature in database
GPG Key ID: A3FAAA06E6569B4C
32 changed files with 322 additions and 508 deletions

2
.gitmodules vendored
View File

@ -100,7 +100,7 @@
url = https://github.com/adafruit/Adafruit_MP3 url = https://github.com/adafruit/Adafruit_MP3
[submodule "ports/mimxrt10xx/sdk"] [submodule "ports/mimxrt10xx/sdk"]
path = ports/mimxrt10xx/sdk path = ports/mimxrt10xx/sdk
url = https://github.com/adafruit/MIMXRT10xx_SDK url = https://github.com/nxp-mcuxpresso/mcux-sdk.git
[submodule "frozen/Adafruit_CircuitPython_Register"] [submodule "frozen/Adafruit_CircuitPython_Register"]
path = frozen/Adafruit_CircuitPython_Register path = frozen/Adafruit_CircuitPython_Register
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git

View File

@ -30,8 +30,7 @@ CROSS_COMPILE = arm-none-eabi-
INC += \ INC += \
-I. \ -I. \
-I../.. \ -I../.. \
-I../lib/mp-readline \ -I../../lib/cmsis/inc \
-I../shared/timeutils \
-I../../lib/tinyusb/src \ -I../../lib/tinyusb/src \
-I../../supervisor/shared/usb \ -I../../supervisor/shared/usb \
-I$(BUILD) \ -I$(BUILD) \
@ -42,7 +41,7 @@ INC += \
-Isdk/CMSIS/Include \ -Isdk/CMSIS/Include \
-Isdk/devices/$(CHIP_FAMILY) \ -Isdk/devices/$(CHIP_FAMILY) \
-Isdk/devices/$(CHIP_FAMILY)/drivers \ -Isdk/devices/$(CHIP_FAMILY)/drivers \
-Isdk/devices/$(CHIP_FAMILY)/xip \ -Isdk/drivers/common
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt. # NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
@ -106,25 +105,26 @@ LDFLAGS += -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mthumb -mapcs
BOOTLOADER_SIZE := 0x6000C000 BOOTLOADER_SIZE := 0x6000C000
SRC_SDK := \ SRC_SDK := \
drivers/fsl_adc.c \ devices/$(CHIP_FAMILY)/drivers/fsl_clock.c \
drivers/fsl_cache.c \ devices/$(CHIP_FAMILY)/system_$(CHIP_FAMILY).c \
drivers/fsl_clock.c \ devices/$(CHIP_FAMILY)/xip/fsl_flexspi_nor_boot.c \
drivers/fsl_common.c \ drivers/adc_12b1msps_sar/fsl_adc.c \
drivers/fsl_flexspi.c \ drivers/cache/armv7-m7/fsl_cache.c \
drivers/fsl_gpio.c \ drivers/common/fsl_common_arm.c \
drivers/fsl_lpi2c.c \ drivers/common/fsl_common.c \
drivers/fsl_lpspi.c \ drivers/flexspi/fsl_flexspi.c \
drivers/fsl_lpuart.c \ drivers/igpio/fsl_gpio.c \
drivers/fsl_ocotp.c \ drivers/lpi2c/fsl_lpi2c.c \
drivers/fsl_pwm.c \ drivers/lpspi/fsl_lpspi.c \
drivers/fsl_snvs_hp.c \ drivers/lpuart/fsl_lpuart.c \
drivers/fsl_snvs_lp.c \ drivers/ocotp/fsl_ocotp.c \
drivers/fsl_tempmon.c \ drivers/pwm/fsl_pwm.c \
drivers/fsl_trng.c \ drivers/snvs_hp/fsl_snvs_hp.c \
system_$(CHIP_FAMILY).c \ drivers/snvs_lp/fsl_snvs_lp.c \
drivers/tempmon/fsl_tempmon.c \
drivers/trng/fsl_trng.c \
SRC_SDK := $(addprefix sdk/devices/$(CHIP_FAMILY)/, $(SRC_SDK)) SRC_SDK := $(addprefix sdk/, $(SRC_SDK))
$(addprefix $(BUILD)/, $(SRC_SDK:.c=.o)): CFLAGS += -Wno-undef -Wno-missing-prototypes -Wno-cast-align
SRC_C += \ SRC_C += \
background.c \ background.c \
@ -191,8 +191,7 @@ $(BUILD)/firmware.uf2: $(BUILD)/firmware.elf
$(STEPECHO) "Create $@" $(STEPECHO) "Create $@"
$(Q)$(OBJCOPY) -O binary -R .stack -R .dtcm_bss -R .ivt -R .flash_config $^ $@-binpart $(Q)$(OBJCOPY) -O binary -R .stack -R .dtcm_bss -R .ivt -R .flash_config $^ $@-binpart
$(Q)$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -f MIMXRT10XX -c -o $@ $@-binpart $(Q)$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -f MIMXRT10XX -c -o $@ $@-binpart
$(Q)rm $@-binpart
# $(Q)rm $@-binpart
$(BUILD)/firmware.hex: $(BUILD)/firmware.elf $(BUILD)/firmware.hex: $(BUILD)/firmware.elf
$(Q)$(OBJCOPY) -O ihex -R .stack -R .dtcm_bss $< $@ $(Q)$(OBJCOPY) -O ihex -R .stack -R .dtcm_bss $< $@

View File

@ -1 +0,0 @@
// Empty but needed for the SDK

View File

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

View File

@ -7,47 +7,21 @@
#include "boards/flash_config.h" #include "boards/flash_config.h"
#include "fsl_flexspi_nor_boot.h" #include "xip/fsl_flexspi_nor_boot.h"
__attribute__((section(".boot_hdr.ivt")))
/*************************************
* IVT Data
*************************************/
const ivt image_vector_table = {
IVT_HEADER, /* IVT Header */
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
IVT_RSVD, /* Reserved = 0 */
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
(uint32_t)BOOT_DATA_ADDRESS, /* 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 */
IVT_RSVD /* Reserved = 0 */
};
__attribute__((section(".boot_hdr.boot_data")))
/*************************************
* Boot Data
*************************************/
const BOOT_DATA_T boot_data = {
FLASH_BASE, /* boot start location */
FLASH_SIZE, /* size */
PLUGIN_FLAG, /* Plugin flag*/
0xFFFFFFFF /* empty - extra data word */
};
// Config for W25Q32JV with QSPI routed. // Config for W25Q32JV with QSPI routed.
__attribute__((section(".boot_hdr.conf"))) __attribute__((section(".boot_hdr.conf")))
const flexspi_nor_config_t qspiflash_config = { const flexspi_nor_config_t qspiflash_config = {
.pageSize = 256u, .pageSize = 256u,
.sectorSize = 4u * 1024u, .sectorSize = 4u * 1024u,
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz, .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz,
.blockSize = 0x00010000, .blockSize = 0x00010000,
.isUniformBlockSize = false, .isUniformBlockSize = false,
.memConfig = .memConfig =
{ {
.tag = FLEXSPI_CFG_BLK_TAG, .tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION, .version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad,
.csHoldTime = 3u, .csHoldTime = 3u,
.csSetupTime = 3u, .csSetupTime = 3u,
@ -61,13 +35,13 @@ const flexspi_nor_config_t qspiflash_config = {
.seqNum = 1u, .seqNum = 1u,
}, },
.deviceModeArg = 0x02, // Bit pattern for setting Quad Enable. .deviceModeArg = 0x02, // Bit pattern for setting Quad Enable.
.deviceType = kFlexSpiDeviceType_SerialNOR, .deviceType = kFLEXSPIDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads, .sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_133MHz, .serialClkFreq = kFLEXSPISerialClk_133MHz,
.sflashA1Size = FLASH_SIZE, .sflashA1Size = FLASH_SIZE,
.lookupTable = .lookupTable =
{ {
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
// The high 16 bits is command 1 and the low are command 0. // The high 16 bits is command 1 and the low are command 0.
// Within a command, the top 6 bits are the opcode, the next two are the number // Within a command, the top 6 bits are the opcode, the next two are the number
// of pads and then last byte is the operand. The operand's meaning changes // 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 = {
// 0: ROM: Read LUTs // 0: ROM: Read LUTs
// Quad version // Quad version
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
READ_SDR, FLEXSPI_4PAD, 0x04), READ_SDR, FLEXSPI_4PAD, 0x04),
// Single fast read version, good for debugging. // Single fast read version, good for debugging.
// FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
// RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
// READ_SDR, FLEXSPI_1PAD, 0x04), // READ_SDR, FLEXSPI_1PAD, 0x04),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 1: ROM: Read status // 1: ROM: Read status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
READ_SDR, FLEXSPI_1PAD, 0x02), READ_SDR, FLEXSPI_1PAD, 0x02),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -101,21 +75,21 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 3: ROM: Write Enable // 3: ROM: Write Enable
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
STOP, FLEXSPI_1PAD, 0x00), STOP, FLEXSPI_1PAD, 0x00),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 4: Config: Write Status -2 // 4: Config: Write Status -2
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */,
WRITE_SDR, FLEXSPI_1PAD, 0x01 /* number of bytes to write */), WRITE_SDR, FLEXSPI_1PAD, 0x01 /* number of bytes to write */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 5: ROM: Erase Sector // 5: ROM: Erase Sector
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -128,17 +102,17 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 8: Block Erase // 8: Block Erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 9: ROM: Page program // 9: ROM: Page program
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
@ -147,7 +121,7 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 11: ROM: Chip erase // 11: ROM: Chip erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,

View File

@ -7,47 +7,21 @@
#include "boards/flash_config.h" #include "boards/flash_config.h"
#include "fsl_flexspi_nor_boot.h" #include "xip/fsl_flexspi_nor_boot.h"
__attribute__((section(".boot_hdr.ivt")))
/*************************************
* IVT Data
*************************************/
const ivt image_vector_table = {
IVT_HEADER, /* IVT Header */
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
IVT_RSVD, /* Reserved = 0 */
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
(uint32_t)BOOT_DATA_ADDRESS, /* 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 */
IVT_RSVD /* Reserved = 0 */
};
__attribute__((section(".boot_hdr.boot_data")))
/*************************************
* Boot Data
*************************************/
const BOOT_DATA_T boot_data = {
FLASH_BASE, /* boot start location */
FLASH_SIZE, /* size */
PLUGIN_FLAG, /* Plugin flag*/
0xFFFFFFFF /* empty - extra data word */
};
// Config for W25Q64JV with QSPI routed. // Config for W25Q64JV with QSPI routed.
__attribute__((section(".boot_hdr.conf"))) __attribute__((section(".boot_hdr.conf")))
const flexspi_nor_config_t qspiflash_config = { const flexspi_nor_config_t qspiflash_config = {
.pageSize = 256u, .pageSize = 256u,
.sectorSize = 4u * 1024u, .sectorSize = 4u * 1024u,
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz, .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz,
.blockSize = 0x00010000, .blockSize = 0x00010000,
.isUniformBlockSize = false, .isUniformBlockSize = false,
.memConfig = .memConfig =
{ {
.tag = FLEXSPI_CFG_BLK_TAG, .tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION, .version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad,
.csHoldTime = 3u, .csHoldTime = 3u,
.csSetupTime = 3u, .csSetupTime = 3u,
@ -61,13 +35,13 @@ const flexspi_nor_config_t qspiflash_config = {
.seqNum = 1u, .seqNum = 1u,
}, },
.deviceModeArg = 0x02, .deviceModeArg = 0x02,
.deviceType = kFlexSpiDeviceType_SerialNOR, .deviceType = kFLEXSPIDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads, .sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_133MHz, .serialClkFreq = kFLEXSPISerialClk_133MHz,
.sflashA1Size = FLASH_SIZE, .sflashA1Size = FLASH_SIZE,
.lookupTable = .lookupTable =
{ {
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
// The high 16 bits is command 1 and the low are command 0. // The high 16 bits is command 1 and the low are command 0.
// Within a command, the top 6 bits are the opcode, the next two are the number // Within a command, the top 6 bits are the opcode, the next two are the number
// of pads and then last byte is the operand. The operand's meaning changes // 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 = {
// 0: ROM: Read LUTs // 0: ROM: Read LUTs
// Quad version // Quad version
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
READ_SDR, FLEXSPI_4PAD, 0x04), READ_SDR, FLEXSPI_4PAD, 0x04),
// Single fast read version, good for debugging. // Single fast read version, good for debugging.
// FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
// RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
// READ_SDR, FLEXSPI_1PAD, 0x04), // READ_SDR, FLEXSPI_1PAD, 0x04),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 1: ROM: Read status // 1: ROM: Read status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
READ_SDR, FLEXSPI_1PAD, 0x01), READ_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -101,21 +75,21 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 3: ROM: Write Enable // 3: ROM: Write Enable
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
STOP, FLEXSPI_1PAD, 0x00), STOP, FLEXSPI_1PAD, 0x00),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 4: Config: Write Status // 4: Config: Write Status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */,
WRITE_SDR, FLEXSPI_1PAD, 0x01), WRITE_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 5: ROM: Erase Sector // 5: ROM: Erase Sector
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -128,17 +102,17 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 8: Block Erase // 8: Block Erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 9: ROM: Page program // 9: ROM: Page program
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
@ -147,7 +121,7 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 11: ROM: Chip erase // 11: ROM: Chip erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,

View File

@ -7,48 +7,21 @@
#include "boards/flash_config.h" #include "boards/flash_config.h"
#include "fsl_flexspi_nor_boot.h" #include "xip/fsl_flexspi_nor_boot.h"
__attribute__((section(".boot_hdr.ivt")))
/*************************************
* IVT Data
*************************************/
const ivt image_vector_table = {
IVT_HEADER, /* IVT Header */
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
IVT_RSVD, /* Reserved = 0 */
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
(uint32_t)BOOT_DATA_ADDRESS, /* 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 */
IVT_RSVD /* Reserved = 0 */
};
__attribute__((section(".boot_hdr.boot_data")))
/*************************************
* Boot Data
*************************************/
const BOOT_DATA_T boot_data = {
FLASH_BASE, /* boot start location */
FLASH_SIZE, /* size */
PLUGIN_FLAG, /* Plugin flag*/
0xFFFFFFFF /* empty - extra data word */
};
// Config for W25Q64JV with QSPI routed. // Config for W25Q64JV with QSPI routed.
__attribute__((section(".boot_hdr.conf"))) __attribute__((section(".boot_hdr.conf")))
const flexspi_nor_config_t qspiflash_config = { const flexspi_nor_config_t qspiflash_config = {
.pageSize = 256u, .pageSize = 256u,
.sectorSize = 4u * 1024u, .sectorSize = 4u * 1024u,
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz, .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz,
.blockSize = 0x00010000, .blockSize = 0x00010000,
.isUniformBlockSize = false, .isUniformBlockSize = false,
.memConfig = .memConfig =
{ {
.tag = FLEXSPI_CFG_BLK_TAG, .tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION, .version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad,
.csHoldTime = 3u, .csHoldTime = 3u,
.csSetupTime = 3u, .csSetupTime = 3u,
@ -62,13 +35,13 @@ const flexspi_nor_config_t qspiflash_config = {
.seqNum = 1u, .seqNum = 1u,
}, },
.deviceModeArg = 0x02, .deviceModeArg = 0x02,
.deviceType = kFlexSpiDeviceType_SerialNOR, .deviceType = kFLEXSPIDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads, .sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_133MHz, .serialClkFreq = kFLEXSPISerialClk_133MHz,
.sflashA1Size = FLASH_SIZE, .sflashA1Size = FLASH_SIZE,
.lookupTable = .lookupTable =
{ {
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
// The high 16 bits is command 1 and the low are command 0. // The high 16 bits is command 1 and the low are command 0.
// Within a command, the top 6 bits are the opcode, the next two are the number // Within a command, the top 6 bits are the opcode, the next two are the number
// of pads and then last byte is the operand. The operand's meaning changes // of pads and then last byte is the operand. The operand's meaning changes
@ -79,20 +52,20 @@ const flexspi_nor_config_t qspiflash_config = {
// 0: ROM: Read LUTs // 0: ROM: Read LUTs
// Quad version // Quad version
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
READ_SDR, FLEXSPI_4PAD, 0x04), READ_SDR, FLEXSPI_4PAD, 0x04),
// Single fast read version, good for debugging. // Single fast read version, good for debugging.
// FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
// RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
// READ_SDR, FLEXSPI_1PAD, 0x04), // READ_SDR, FLEXSPI_1PAD, 0x04),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 1: ROM: Read status // 1: ROM: Read status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
READ_SDR, FLEXSPI_1PAD, 0x01), READ_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -102,21 +75,21 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 3: ROM: Write Enable // 3: ROM: Write Enable
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
STOP, FLEXSPI_1PAD, 0x00), STOP, FLEXSPI_1PAD, 0x00),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 4: Config: Write Status // 4: Config: Write Status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */,
WRITE_SDR, FLEXSPI_1PAD, 0x01), WRITE_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 5: ROM: Erase Sector // 5: ROM: Erase Sector
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -129,17 +102,17 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 8: Block Erase // 8: Block Erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 9: ROM: Page program // 9: ROM: Page program
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
@ -148,7 +121,7 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 11: ROM: Chip erase // 11: ROM: Chip erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,

View File

@ -34,7 +34,41 @@
#include "mpconfigboard.h" // For flash size settings #include "mpconfigboard.h" // For flash size settings
#include "fsl_common.h" #include "fsl_common.h"
#include "fsl_flexspi_nor_config.h" #ifdef CPU_MIMXRT1011DAE5A
// TODO: Remove this when the 1011 has a romapi header that matches the others.
#include "sdk/boards/evkmimxrt1010/xip/evkmimxrt1010_flexspi_nor_config.h"
typedef enum _flexspi_serial_clk_freq_caps
{
kFLEXSPISerialClk_NoChange = 0U,
kFLEXSPISerialClk_30MHz = 1U,
kFLEXSPISerialClk_50MHz = 2U,
kFLEXSPISerialClk_60MHz = 3U,
kFLEXSPISerialClk_75MHz = 4U,
kFLEXSPISerialClk_80MHz = 5U,
kFLEXSPISerialClk_100MHz = 6U,
kFLEXSPISerialClk_133MHz = 7U,
kFLEXSPISerialClk_166MHz = 8U,
kFLEXSPISerialClk_200MHz = 9U,
} caps_flexspi_serial_clk_freq_t;
/*! @brief FLEXSPI Read Sample Clock Source definition */
typedef enum _flexspi_read_sample_clk_caps
{
kFLEXSPIReadSampleClk_LoopbackInternally = 0U,
kFLEXSPIReadSampleClk_LoopbackFromDqsPad = 1U,
kFLEXSPIReadSampleClk_LoopbackFromSckPad = 2U,
kFLEXSPIReadSampleClk_ExternalInputFromDqsPad = 3U,
} caps_flexspi_read_sample_clk_t;
enum
{
kFLEXSPIDeviceType_SerialNOR = 1U, /*!< Flash device is Serial NOR */
};
#define FSL_ROM_FLEXSPI_LUT_SEQ FLEXSPI_LUT_SEQ
#else
#include "fsl_romapi.h"
#endif
#define SEQUENCE(first, second, third, fourth) first, second, third, fourth #define SEQUENCE(first, second, third, fourth) first, second, third, fourth
#define TWO_EMPTY_STEPS 0x00000000 #define TWO_EMPTY_STEPS 0x00000000

View File

@ -7,48 +7,21 @@
#include "boards/flash_config.h" #include "boards/flash_config.h"
#include "fsl_flexspi_nor_boot.h" #include "xip/fsl_flexspi_nor_boot.h"
__attribute__((section(".boot_hdr.ivt")))
/*************************************
* IVT Data
*************************************/
const ivt image_vector_table = {
IVT_HEADER, /* IVT Header */
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
IVT_RSVD, /* Reserved = 0 */
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
(uint32_t)BOOT_DATA_ADDRESS, /* 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 */
IVT_RSVD /* Reserved = 0 */
};
__attribute__((section(".boot_hdr.boot_data")))
/*************************************
* Boot Data
*************************************/
const BOOT_DATA_T boot_data = {
FLASH_BASE, /* boot start location */
FLASH_SIZE, /* size */
PLUGIN_FLAG, /* Plugin flag*/
0xFFFFFFFF /* empty - extra data word */
};
// Config for AT25SF128A with QSPI routed. // Config for AT25SF128A with QSPI routed.
__attribute__((section(".boot_hdr.conf"))) __attribute__((section(".boot_hdr.conf")))
const flexspi_nor_config_t qspiflash_config = { const flexspi_nor_config_t qspiflash_config = {
.pageSize = 256u, .pageSize = 256u,
.sectorSize = 4u * 1024u, .sectorSize = 4u * 1024u,
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz, .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz,
.blockSize = 0x00010000, .blockSize = 0x00010000,
.isUniformBlockSize = false, .isUniformBlockSize = false,
.memConfig = .memConfig =
{ {
.tag = FLEXSPI_CFG_BLK_TAG, .tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION, .version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad,
.csHoldTime = 3u, .csHoldTime = 3u,
.csSetupTime = 3u, .csSetupTime = 3u,
@ -62,13 +35,13 @@ const flexspi_nor_config_t qspiflash_config = {
.seqNum = 1u, .seqNum = 1u,
}, },
.deviceModeArg = 0x02, .deviceModeArg = 0x02,
.deviceType = kFlexSpiDeviceType_SerialNOR, .deviceType = kFLEXSPIDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads, .sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_60MHz, .serialClkFreq = kFLEXSPISerialClk_60MHz,
.sflashA1Size = FLASH_SIZE, .sflashA1Size = FLASH_SIZE,
.lookupTable = .lookupTable =
{ {
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
// The high 16 bits is command 1 and the low are command 0. // The high 16 bits is command 1 and the low are command 0.
// Within a command, the top 6 bits are the opcode, the next two are the number // Within a command, the top 6 bits are the opcode, the next two are the number
// of pads and then last byte is the operand. The operand's meaning changes // of pads and then last byte is the operand. The operand's meaning changes
@ -79,20 +52,20 @@ const flexspi_nor_config_t qspiflash_config = {
// 0: ROM: Read LUTs // 0: ROM: Read LUTs
// Quad version // Quad version
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
READ_SDR, FLEXSPI_4PAD, 0x04), READ_SDR, FLEXSPI_4PAD, 0x04),
// Single fast read version, good for debugging. // Single fast read version, good for debugging.
// FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
// RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
// READ_SDR, FLEXSPI_1PAD, 0x04), // READ_SDR, FLEXSPI_1PAD, 0x04),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 1: ROM: Read status // 1: ROM: Read status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
READ_SDR, FLEXSPI_1PAD, 0x02), READ_SDR, FLEXSPI_1PAD, 0x02),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -102,21 +75,21 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 3: ROM: Write Enable // 3: ROM: Write Enable
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
STOP, FLEXSPI_1PAD, 0x00), STOP, FLEXSPI_1PAD, 0x00),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 4: Config: Write Status // 4: Config: Write Status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */,
WRITE_SDR, FLEXSPI_1PAD, 0x01), WRITE_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 5: ROM: Erase Sector // 5: ROM: Erase Sector
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -129,17 +102,17 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 8: Block Erase // 8: Block Erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 9: ROM: Page program // 9: ROM: Page program
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
@ -148,7 +121,7 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 11: ROM: Chip erase // 11: ROM: Chip erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,

View File

@ -7,48 +7,21 @@
#include "boards/flash_config.h" #include "boards/flash_config.h"
#include "fsl_flexspi_nor_boot.h" #include "xip/fsl_flexspi_nor_boot.h"
__attribute__((section(".boot_hdr.ivt")))
/*************************************
* IVT Data
*************************************/
const ivt image_vector_table = {
IVT_HEADER, /* IVT Header */
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
IVT_RSVD, /* Reserved = 0 */
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
(uint32_t)BOOT_DATA_ADDRESS, /* 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 */
IVT_RSVD /* Reserved = 0 */
};
__attribute__((section(".boot_hdr.boot_data")))
/*************************************
* Boot Data
*************************************/
const BOOT_DATA_T boot_data = {
FLASH_BASE, /* boot start location */
FLASH_SIZE, /* size */
PLUGIN_FLAG, /* Plugin flag*/
0xFFFFFFFF /* empty - extra data word */
};
// Config for IS25LP064A with QSPI routed. // Config for IS25LP064A with QSPI routed.
__attribute__((section(".boot_hdr.conf"))) __attribute__((section(".boot_hdr.conf")))
const flexspi_nor_config_t qspiflash_config = { const flexspi_nor_config_t qspiflash_config = {
.pageSize = 256u, .pageSize = 256u,
.sectorSize = 4u * 1024u, .sectorSize = 4u * 1024u,
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz, .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz,
.blockSize = 0x00010000, .blockSize = 0x00010000,
.isUniformBlockSize = false, .isUniformBlockSize = false,
.memConfig = .memConfig =
{ {
.tag = FLEXSPI_CFG_BLK_TAG, .tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION, .version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad,
.csHoldTime = 3u, .csHoldTime = 3u,
.csSetupTime = 3u, .csSetupTime = 3u,
@ -62,13 +35,13 @@ const flexspi_nor_config_t qspiflash_config = {
.seqNum = 1u, .seqNum = 1u,
}, },
.deviceModeArg = 0x40, .deviceModeArg = 0x40,
.deviceType = kFlexSpiDeviceType_SerialNOR, .deviceType = kFLEXSPIDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads, .sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_30MHz, .serialClkFreq = kFLEXSPISerialClk_30MHz,
.sflashA1Size = FLASH_SIZE, .sflashA1Size = FLASH_SIZE,
.lookupTable = .lookupTable =
{ {
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
// The high 16 bits is command 1 and the low are command 0. // The high 16 bits is command 1 and the low are command 0.
// Within a command, the top 6 bits are the opcode, the next two are the number // Within a command, the top 6 bits are the opcode, the next two are the number
// of pads and then last byte is the operand. The operand's meaning changes // of pads and then last byte is the operand. The operand's meaning changes
@ -79,20 +52,20 @@ const flexspi_nor_config_t qspiflash_config = {
// 0: ROM: Read LUTs // 0: ROM: Read LUTs
// Quad version // Quad version
// SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, // SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
// RADDR_SDR, FLEXSPI_4PAD, 24 bits to transmit ), // RADDR_SDR, FLEXSPI_4PAD, 24 bits to transmit ),
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
// READ_SDR, FLEXSPI_4PAD, 0x04), // READ_SDR, FLEXSPI_4PAD, 0x04),
// Single fast read version, good for debugging. // Single fast read version, good for debugging.
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
READ_SDR, FLEXSPI_1PAD, 0x04), READ_SDR, FLEXSPI_1PAD, 0x04),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 1: ROM: Read status // 1: ROM: Read status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
READ_SDR, FLEXSPI_1PAD, 0x01), READ_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -102,21 +75,21 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 3: ROM: Write Enable // 3: ROM: Write Enable
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
STOP, FLEXSPI_1PAD, 0x00), STOP, FLEXSPI_1PAD, 0x00),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 4: Config: Write Status // 4: Config: Write Status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */,
WRITE_SDR, FLEXSPI_1PAD, 0x01), WRITE_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 5: ROM: Erase Sector // 5: ROM: Erase Sector
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -129,17 +102,17 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 8: Block Erase // 8: Block Erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 9: ROM: Page program // 9: ROM: Page program
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
@ -148,7 +121,7 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 11: ROM: Chip erase // 11: ROM: Chip erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,

View File

@ -7,48 +7,21 @@
#include "boards/flash_config.h" #include "boards/flash_config.h"
#include "fsl_flexspi_nor_boot.h" #include "xip/fsl_flexspi_nor_boot.h"
__attribute__((section(".boot_hdr.ivt")))
/*************************************
* IVT Data
*************************************/
const ivt image_vector_table = {
IVT_HEADER, /* IVT Header */
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
IVT_RSVD, /* Reserved = 0 */
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
(uint32_t)BOOT_DATA_ADDRESS, /* 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 */
IVT_RSVD /* Reserved = 0 */
};
__attribute__((section(".boot_hdr.boot_data")))
/*************************************
* Boot Data
*************************************/
const BOOT_DATA_T boot_data = {
FLASH_BASE, /* boot start location */
FLASH_SIZE, /* size */
PLUGIN_FLAG, /* Plugin flag*/
0xFFFFFFFF /* empty - extra data word */
};
// Config for IS25WP064A with QSPI routed. // Config for IS25WP064A with QSPI routed.
__attribute__((section(".boot_hdr.conf"))) __attribute__((section(".boot_hdr.conf")))
const flexspi_nor_config_t qspiflash_config = { const flexspi_nor_config_t qspiflash_config = {
.pageSize = 256u, .pageSize = 256u,
.sectorSize = 4u * 1024u, .sectorSize = 4u * 1024u,
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz, .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz,
.blockSize = 0x00010000, .blockSize = 0x00010000,
.isUniformBlockSize = false, .isUniformBlockSize = false,
.memConfig = .memConfig =
{ {
.tag = FLEXSPI_CFG_BLK_TAG, .tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION, .version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad,
.csHoldTime = 3u, .csHoldTime = 3u,
.csSetupTime = 3u, .csSetupTime = 3u,
@ -62,13 +35,13 @@ const flexspi_nor_config_t qspiflash_config = {
.seqNum = 1u, .seqNum = 1u,
}, },
.deviceModeArg = 0x40, .deviceModeArg = 0x40,
.deviceType = kFlexSpiDeviceType_SerialNOR, .deviceType = kFLEXSPIDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads, .sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_60MHz, .serialClkFreq = kFLEXSPISerialClk_60MHz,
.sflashA1Size = FLASH_SIZE, .sflashA1Size = FLASH_SIZE,
.lookupTable = .lookupTable =
{ {
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
// The high 16 bits is command 1 and the low are command 0. // The high 16 bits is command 1 and the low are command 0.
// Within a command, the top 6 bits are the opcode, the next two are the number // Within a command, the top 6 bits are the opcode, the next two are the number
// of pads and then last byte is the operand. The operand's meaning changes // of pads and then last byte is the operand. The operand's meaning changes
@ -79,20 +52,20 @@ const flexspi_nor_config_t qspiflash_config = {
// 0: ROM: Read LUTs // 0: ROM: Read LUTs
// Quad version // Quad version
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
READ_SDR, FLEXSPI_4PAD, 0x04), READ_SDR, FLEXSPI_4PAD, 0x04),
// Single fast read version, good for debugging. // Single fast read version, good for debugging.
// FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
// RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
// READ_SDR, FLEXSPI_1PAD, 0x04), // READ_SDR, FLEXSPI_1PAD, 0x04),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 1: ROM: Read status // 1: ROM: Read status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
READ_SDR, FLEXSPI_1PAD, 0x02), READ_SDR, FLEXSPI_1PAD, 0x02),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -102,21 +75,21 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 3: ROM: Write Enable // 3: ROM: Write Enable
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
STOP, FLEXSPI_1PAD, 0x00), STOP, FLEXSPI_1PAD, 0x00),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 4: Config: Write Status // 4: Config: Write Status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */,
WRITE_SDR, FLEXSPI_1PAD, 0x01), WRITE_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 5: ROM: Erase Sector // 5: ROM: Erase Sector
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -129,17 +102,17 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 8: Block Erase // 8: Block Erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 9: ROM: Page program // 9: ROM: Page program
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
@ -148,7 +121,7 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 11: ROM: Chip erase // 11: ROM: Chip erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,

View File

@ -7,48 +7,21 @@
#include "boards/flash_config.h" #include "boards/flash_config.h"
#include "fsl_flexspi_nor_boot.h" #include "xip/fsl_flexspi_nor_boot.h"
__attribute__((section(".boot_hdr.ivt"),used))
/*************************************
* IVT Data
*************************************/
const ivt image_vector_table = {
IVT_HEADER, /* IVT Header */
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
IVT_RSVD, /* Reserved = 0 */
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
(uint32_t)BOOT_DATA_ADDRESS, /* 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 */
IVT_RSVD /* Reserved = 0 */
};
__attribute__((section(".boot_hdr.boot_data"),used))
/*************************************
* Boot Data
*************************************/
const BOOT_DATA_T boot_data = {
FLASH_BASE, /* boot start location */
FLASH_SIZE, /* size */
PLUGIN_FLAG, /* Plugin flag*/
0xFFFFFFFF /* empty - extra data word */
};
// Config for W25Q32JV with QSPI routed. (compatible with GD25Q32) // Config for W25Q32JV with QSPI routed. (compatible with GD25Q32)
__attribute__((section(".boot_hdr.conf"))) __attribute__((section(".boot_hdr.conf")))
const flexspi_nor_config_t qspiflash_config = { const flexspi_nor_config_t qspiflash_config = {
.pageSize = 256u, .pageSize = 256u,
.sectorSize = 4u * 1024u, .sectorSize = 4u * 1024u,
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz, .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz,
.blockSize = 0x00010000, .blockSize = 0x00010000,
.isUniformBlockSize = false, .isUniformBlockSize = false,
.memConfig = .memConfig =
{ {
.tag = FLEXSPI_CFG_BLK_TAG, .tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION, .version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad,
.csHoldTime = 3u, .csHoldTime = 3u,
.csSetupTime = 3u, .csSetupTime = 3u,
@ -68,13 +41,13 @@ const flexspi_nor_config_t qspiflash_config = {
.seqId = 2u, .seqId = 2u,
.seqNum = 1u, .seqNum = 1u,
}, },
.deviceType = kFlexSpiDeviceType_SerialNOR, .deviceType = kFLEXSPIDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads, .sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_60MHz, .serialClkFreq = kFLEXSPISerialClk_60MHz,
.sflashA1Size = FLASH_SIZE, .sflashA1Size = FLASH_SIZE,
.lookupTable = .lookupTable =
{ {
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
// The high 16 bits is command 1 and the low are command 0. // The high 16 bits is command 1 and the low are command 0.
// Within a command, the top 6 bits are the opcode, the next two are the number // Within a command, the top 6 bits are the opcode, the next two are the number
// of pads and then last byte is the operand. The operand's meaning changes // of pads and then last byte is the operand. The operand's meaning changes
@ -85,48 +58,48 @@ const flexspi_nor_config_t qspiflash_config = {
// 0: ROM: Read LUTs // 0: ROM: Read LUTs
// Quad version // Quad version
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
READ_SDR, FLEXSPI_4PAD, 0x04), READ_SDR, FLEXSPI_4PAD, 0x04),
// Single fast read version, good for debugging. // Single fast read version, good for debugging.
// FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
// RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
// READ_SDR, FLEXSPI_1PAD, 0x04), // READ_SDR, FLEXSPI_1PAD, 0x04),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 1: ROM: Read status // 1: ROM: Read status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
READ_SDR, FLEXSPI_1PAD, 0x02), READ_SDR, FLEXSPI_1PAD, 0x02),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 2: Empty // 2: Empty
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x35 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x35 /* the command to send */,
DUMMY_SDR, FLEXSPI_1PAD, 8), DUMMY_SDR, FLEXSPI_1PAD, 8),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 3: ROM: Write Enable // 3: ROM: Write Enable
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
STOP, FLEXSPI_1PAD, 0x00), STOP, FLEXSPI_1PAD, 0x00),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 4: Config: Write Status // 4: Config: Write Status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */,
WRITE_SDR, FLEXSPI_1PAD, 0x02), WRITE_SDR, FLEXSPI_1PAD, 0x02),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 5: ROM: Erase Sector // 5: ROM: Erase Sector
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -139,17 +112,17 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 8: Block Erase // 8: Block Erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 9: ROM: Page program // 9: ROM: Page program
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
@ -158,7 +131,7 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 11: ROM: Chip erase // 11: ROM: Chip erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,

View File

@ -7,50 +7,21 @@
#include "boards/flash_config.h" #include "boards/flash_config.h"
#include "fsl_flexspi_nor_boot.h" #include "xip/fsl_flexspi_nor_boot.h"
__attribute__((section(".boot_hdr.ivt")))
/*************************************
* IVT Data
*************************************/
const ivt image_vector_table = {
0x432000D1, /* Teensy bootloader looks for this value*/
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
IVT_RSVD, /* Reserved = 0 */
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
(uint32_t)BOOT_DATA_ADDRESS, /* 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 */
IVT_RSVD /* Reserved = 0 */
};
extern unsigned long _flashimagelen;
__attribute__((section(".boot_hdr.boot_data")))
/*************************************
* Boot Data
*************************************/
const BOOT_DATA_T boot_data = {
FLASH_BASE, /* boot start location */
(uint32_t)&_flashimagelen, /* actual size of image */
PLUGIN_FLAG, /* Plugin flag*/
0xFFFFFFFF /* empty - extra data word */
};
// Config for W25Q64JV with QSPI routed. // Config for W25Q64JV with QSPI routed.
__attribute__((section(".boot_hdr.conf"))) __attribute__((section(".boot_hdr.conf")))
const flexspi_nor_config_t qspiflash_config = { const flexspi_nor_config_t qspiflash_config = {
.pageSize = 256u, .pageSize = 256u,
.sectorSize = 4u * 1024u, .sectorSize = 4u * 1024u,
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz, .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz,
.blockSize = 0x00010000, .blockSize = 0x00010000,
.isUniformBlockSize = false, .isUniformBlockSize = false,
.memConfig = .memConfig =
{ {
.tag = FLEXSPI_CFG_BLK_TAG, .tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION, .version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad,
.csHoldTime = 3u, .csHoldTime = 3u,
.csSetupTime = 3u, .csSetupTime = 3u,
@ -64,13 +35,13 @@ const flexspi_nor_config_t qspiflash_config = {
.seqNum = 1u, .seqNum = 1u,
}, },
.deviceModeArg = 0x02, .deviceModeArg = 0x02,
.deviceType = kFlexSpiDeviceType_SerialNOR, .deviceType = kFLEXSPIDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads, .sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_60MHz, .serialClkFreq = kFLEXSPISerialClk_60MHz,
.sflashA1Size = FLASH_SIZE, .sflashA1Size = FLASH_SIZE,
.lookupTable = .lookupTable =
{ {
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
// The high 16 bits is command 1 and the low are command 0. // The high 16 bits is command 1 and the low are command 0.
// Within a command, the top 6 bits are the opcode, the next two are the number // Within a command, the top 6 bits are the opcode, the next two are the number
// of pads and then last byte is the operand. The operand's meaning changes // of pads and then last byte is the operand. The operand's meaning changes
@ -81,20 +52,20 @@ const flexspi_nor_config_t qspiflash_config = {
// 0: ROM: Read LUTs // 0: ROM: Read LUTs
// Quad version // Quad version
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
READ_SDR, FLEXSPI_4PAD, 0x04), READ_SDR, FLEXSPI_4PAD, 0x04),
// Single fast read version, good for debugging. // Single fast read version, good for debugging.
// FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
// RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
// READ_SDR, FLEXSPI_1PAD, 0x04), // READ_SDR, FLEXSPI_1PAD, 0x04),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 1: ROM: Read status // 1: ROM: Read status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
READ_SDR, FLEXSPI_1PAD, 0x01), READ_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -104,21 +75,21 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 3: ROM: Write Enable // 3: ROM: Write Enable
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
STOP, FLEXSPI_1PAD, 0x00), STOP, FLEXSPI_1PAD, 0x00),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 4: Config: Write Status // 4: Config: Write Status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */,
WRITE_SDR, FLEXSPI_1PAD, 0x01), WRITE_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 5: ROM: Erase Sector // 5: ROM: Erase Sector
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -131,17 +102,17 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 8: Block Erase // 8: Block Erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 9: ROM: Page program // 9: ROM: Page program
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
@ -150,7 +121,7 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 11: ROM: Chip erase // 11: ROM: Chip erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,

View File

@ -7,50 +7,21 @@
#include "boards/flash_config.h" #include "boards/flash_config.h"
#include "fsl_flexspi_nor_boot.h" #include "xip/fsl_flexspi_nor_boot.h"
__attribute__((section(".boot_hdr.ivt")))
/*************************************
* IVT Data
*************************************/
const ivt image_vector_table = {
0x432000D1, /* Teensy bootloader looks for this value*/
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
IVT_RSVD, /* Reserved = 0 */
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
(uint32_t)BOOT_DATA_ADDRESS, /* 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 */
IVT_RSVD /* Reserved = 0 */
};
extern unsigned long _flashimagelen;
__attribute__((section(".boot_hdr.boot_data")))
/*************************************
* Boot Data
*************************************/
const BOOT_DATA_T boot_data = {
FLASH_BASE, /* boot start location */
(uint32_t)&_flashimagelen, /* actual size of image */
PLUGIN_FLAG, /* Plugin flag*/
0xFFFFFFFF /* empty - extra data word */
};
// Config for W25Q16JV with QSPI routed. // Config for W25Q16JV with QSPI routed.
__attribute__((section(".boot_hdr.conf"))) __attribute__((section(".boot_hdr.conf")))
const flexspi_nor_config_t qspiflash_config = { const flexspi_nor_config_t qspiflash_config = {
.pageSize = 256u, .pageSize = 256u,
.sectorSize = 4u * 1024u, .sectorSize = 4u * 1024u,
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz, .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz,
.blockSize = 0x00010000, .blockSize = 0x00010000,
.isUniformBlockSize = false, .isUniformBlockSize = false,
.memConfig = .memConfig =
{ {
.tag = FLEXSPI_CFG_BLK_TAG, .tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION, .version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad,
.csHoldTime = 3u, .csHoldTime = 3u,
.csSetupTime = 3u, .csSetupTime = 3u,
@ -70,13 +41,13 @@ const flexspi_nor_config_t qspiflash_config = {
.seqId = 2u, .seqId = 2u,
.seqNum = 1u, .seqNum = 1u,
}, },
.deviceType = kFlexSpiDeviceType_SerialNOR, .deviceType = kFLEXSPIDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads, .sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_60MHz, .serialClkFreq = kFLEXSPISerialClk_60MHz,
.sflashA1Size = FLASH_SIZE, .sflashA1Size = FLASH_SIZE,
.lookupTable = .lookupTable =
{ {
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
// The high 16 bits is command 1 and the low are command 0. // The high 16 bits is command 1 and the low are command 0.
// Within a command, the top 6 bits are the opcode, the next two are the number // Within a command, the top 6 bits are the opcode, the next two are the number
// of pads and then last byte is the operand. The operand's meaning changes // of pads and then last byte is the operand. The operand's meaning changes
@ -87,48 +58,48 @@ const flexspi_nor_config_t qspiflash_config = {
// 0: ROM: Read LUTs // 0: ROM: Read LUTs
// Quad version // Quad version
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
READ_SDR, FLEXSPI_4PAD, 0x04), READ_SDR, FLEXSPI_4PAD, 0x04),
// Single fast read version, good for debugging. // Single fast read version, good for debugging.
// FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
// RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
// READ_SDR, FLEXSPI_1PAD, 0x04), // READ_SDR, FLEXSPI_1PAD, 0x04),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 1: ROM: Read status // 1: ROM: Read status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
READ_SDR, FLEXSPI_1PAD, 0x02), READ_SDR, FLEXSPI_1PAD, 0x02),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 2: Empty // 2: Empty
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x35 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x35 /* the command to send */,
DUMMY_SDR, FLEXSPI_1PAD, 8), DUMMY_SDR, FLEXSPI_1PAD, 8),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 3: ROM: Write Enable // 3: ROM: Write Enable
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
STOP, FLEXSPI_1PAD, 0x00), STOP, FLEXSPI_1PAD, 0x00),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 4: Config: Write Status // 4: Config: Write Status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */,
WRITE_SDR, FLEXSPI_1PAD, 0x02), WRITE_SDR, FLEXSPI_1PAD, 0x02),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 5: ROM: Erase Sector // 5: ROM: Erase Sector
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -141,17 +112,17 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 8: Block Erase // 8: Block Erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 9: ROM: Page program // 9: ROM: Page program
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
@ -160,7 +131,7 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 11: ROM: Chip erase // 11: ROM: Chip erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,

View File

@ -7,50 +7,21 @@
#include "boards/flash_config.h" #include "boards/flash_config.h"
#include "fsl_flexspi_nor_boot.h" #include "xip/fsl_flexspi_nor_boot.h"
__attribute__((section(".boot_hdr.ivt")))
/*************************************
* IVT Data
*************************************/
const ivt image_vector_table = {
0x432000D1, /* Teensy bootloader looks for this value*/
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
IVT_RSVD, /* Reserved = 0 */
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
(uint32_t)BOOT_DATA_ADDRESS, /* 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 */
IVT_RSVD /* Reserved = 0 */
};
extern unsigned long _flashimagelen;
__attribute__((section(".boot_hdr.boot_data")))
/*************************************
* Boot Data
*************************************/
const BOOT_DATA_T boot_data = {
FLASH_BASE, /* boot start location */
(uint32_t)&_flashimagelen, /* actual size of image */
PLUGIN_FLAG, /* Plugin flag*/
0xFFFFFFFF /* empty - extra data word */
};
// Config for W25Q64JV with QSPI routed. // Config for W25Q64JV with QSPI routed.
__attribute__((section(".boot_hdr.conf"))) __attribute__((section(".boot_hdr.conf")))
const flexspi_nor_config_t qspiflash_config = { const flexspi_nor_config_t qspiflash_config = {
.pageSize = 256u, .pageSize = 256u,
.sectorSize = 4u * 1024u, .sectorSize = 4u * 1024u,
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz, .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz,
.blockSize = 0x00010000, .blockSize = 0x00010000,
.isUniformBlockSize = false, .isUniformBlockSize = false,
.memConfig = .memConfig =
{ {
.tag = FLEXSPI_CFG_BLK_TAG, .tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION, .version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad,
.csHoldTime = 3u, .csHoldTime = 3u,
.csSetupTime = 3u, .csSetupTime = 3u,
@ -64,13 +35,13 @@ const flexspi_nor_config_t qspiflash_config = {
.seqNum = 1u, .seqNum = 1u,
}, },
.deviceModeArg = 0x02, .deviceModeArg = 0x02,
.deviceType = kFlexSpiDeviceType_SerialNOR, .deviceType = kFLEXSPIDeviceType_SerialNOR,
.sflashPadType = kSerialFlash_4Pads, .sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_60MHz, .serialClkFreq = kFLEXSPISerialClk_60MHz,
.sflashA1Size = FLASH_SIZE, .sflashA1Size = FLASH_SIZE,
.lookupTable = .lookupTable =
{ {
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
// The high 16 bits is command 1 and the low are command 0. // The high 16 bits is command 1 and the low are command 0.
// Within a command, the top 6 bits are the opcode, the next two are the number // Within a command, the top 6 bits are the opcode, the next two are the number
// of pads and then last byte is the operand. The operand's meaning changes // of pads and then last byte is the operand. The operand's meaning changes
@ -81,20 +52,20 @@ const flexspi_nor_config_t qspiflash_config = {
// 0: ROM: Read LUTs // 0: ROM: Read LUTs
// Quad version // Quad version
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
READ_SDR, FLEXSPI_4PAD, 0x04), READ_SDR, FLEXSPI_4PAD, 0x04),
// Single fast read version, good for debugging. // Single fast read version, good for debugging.
// FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
// RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
// READ_SDR, FLEXSPI_1PAD, 0x04), // READ_SDR, FLEXSPI_1PAD, 0x04),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 1: ROM: Read status // 1: ROM: Read status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
READ_SDR, FLEXSPI_1PAD, 0x01), READ_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -104,21 +75,21 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 3: ROM: Write Enable // 3: ROM: Write Enable
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
STOP, FLEXSPI_1PAD, 0x00), STOP, FLEXSPI_1PAD, 0x00),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 4: Config: Write Status // 4: Config: Write Status
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */,
WRITE_SDR, FLEXSPI_1PAD, 0x01), WRITE_SDR, FLEXSPI_1PAD, 0x01),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 5: ROM: Erase Sector // 5: ROM: Erase Sector
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
@ -131,17 +102,17 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 8: Block Erase // 8: Block Erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
// 9: ROM: Page program // 9: ROM: Page program
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS), TWO_EMPTY_STEPS),
@ -150,7 +121,7 @@ const flexspi_nor_config_t qspiflash_config = {
EMPTY_SEQUENCE, EMPTY_SEQUENCE,
// 11: ROM: Chip erase // 11: ROM: Chip erase
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
STOP, FLEXSPI_1PAD, 0), STOP, FLEXSPI_1PAD, 0),
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,
TWO_EMPTY_STEPS, TWO_EMPTY_STEPS,

View File

@ -33,7 +33,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "fsl_adc.h" #include "sdk/drivers/adc_12b1msps_sar/fsl_adc.h"
#define ADC_CHANNEL_GROUP 0 #define ADC_CHANNEL_GROUP 0

View File

@ -34,8 +34,8 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "periph.h" #include "periph.h"
#include "fsl_lpi2c.h" #include "sdk/drivers/lpi2c/fsl_lpi2c.h"
#include "fsl_gpio.h" #include "sdk/drivers/igpio/fsl_gpio.h"
#define I2C_CLOCK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8 / (1 + CLOCK_GetDiv(kCLOCK_Lpi2cDiv))) #define I2C_CLOCK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8 / (1 + CLOCK_GetDiv(kCLOCK_Lpi2cDiv)))
#define IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT5 5U #define IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT5 5U

View File

@ -32,7 +32,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "periph.h" #include "periph.h"
#include "fsl_lpspi.h" #include "sdk/drivers/lpspi/fsl_lpspi.h"
#include <stdio.h> #include <stdio.h>

View File

@ -38,8 +38,8 @@
#include "py/stream.h" #include "py/stream.h"
#include "periph.h" #include "periph.h"
#include "fsl_lpuart.h" #include "sdk/drivers/lpuart/fsl_lpuart.h"
#include "fsl_gpio.h" #include "sdk/drivers/igpio/fsl_gpio.h"
// ========================================================== // ==========================================================
// Debug code // Debug code
// ========================================================== // ==========================================================

View File

@ -34,7 +34,7 @@
#include "py/obj.h" #include "py/obj.h"
#include "periph.h" #include "periph.h"
#include "fsl_lpuart.h" #include "sdk/drivers/lpuart/fsl_lpuart.h"
typedef struct { typedef struct {
mp_obj_base_t base; mp_obj_base_t base;

View File

@ -32,7 +32,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "py/mphal.h" #include "py/mphal.h"
#include "fsl_gpio.h" #include "sdk/drivers/igpio/fsl_gpio.h"
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/digitalio/DigitalInOut.h"

View File

@ -33,8 +33,8 @@
#include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/ResetReason.h" #include "shared-bindings/microcontroller/ResetReason.h"
#include "fsl_tempmon.h" #include "sdk/drivers/tempmon/fsl_tempmon.h"
#include "fsl_ocotp.h" #include "sdk/drivers/ocotp/fsl_ocotp.h"
#include "clocks.h" #include "clocks.h"
float common_hal_mcu_processor_get_temperature(void) { float common_hal_mcu_processor_get_temperature(void) {

View File

@ -33,7 +33,7 @@
#include "shared-bindings/os/__init__.h" #include "shared-bindings/os/__init__.h"
#include "fsl_trng.h" #include "sdk/drivers/trng/fsl_trng.h"
STATIC const qstr os_uname_info_fields[] = { STATIC const qstr os_uname_info_fields[] = {
MP_QSTR_sysname, MP_QSTR_nodename, MP_QSTR_sysname, MP_QSTR_nodename,

View File

@ -33,7 +33,7 @@
#include "shared-bindings/pwmio/PWMOut.h" #include "shared-bindings/pwmio/PWMOut.h"
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "fsl_pwm.h" #include "sdk/drivers/pwm/fsl_pwm.h"
#include "supervisor/shared/translate/translate.h" #include "supervisor/shared/translate/translate.h"
#include "periph.h" #include "periph.h"
@ -240,7 +240,6 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self,
// Disable all fault inputs // Disable all fault inputs
flexpwm->SM[submodule].DISMAP[0] = 0; flexpwm->SM[submodule].DISMAP[0] = 0;
flexpwm->SM[submodule].DISMAP[1] = 0;
PWM_SetPwmLdok(flexpwm, sm_mask, false); PWM_SetPwmLdok(flexpwm, sm_mask, false);
flexpwm->SM[submodule].CTRL = PWM_CTRL_FULL_MASK | PWM_CTRL_PRSC(self->prescaler); flexpwm->SM[submodule].CTRL = PWM_CTRL_FULL_MASK | PWM_CTRL_PRSC(self->prescaler);

View File

@ -35,8 +35,8 @@
#include "common-hal/rtc/RTC.h" #include "common-hal/rtc/RTC.h"
#include "supervisor/shared/translate/translate.h" #include "supervisor/shared/translate/translate.h"
#include "fsl_snvs_hp.h" #include "sdk/drivers/snvs_hp/fsl_snvs_hp.h"
#include "fsl_snvs_lp.h" #include "sdk/drivers/snvs_lp/fsl_snvs_lp.h"
void rtc_init(void) { void rtc_init(void) {
snvs_hp_rtc_config_t hpconfig; snvs_hp_rtc_config_t hpconfig;

View File

@ -195,6 +195,8 @@ SECTIONS
. += _ld_default_stack_size; . += _ld_default_stack_size;
} > DTCM } > DTCM
_ld_stack_top = ORIGIN(DTCM) + LENGTH(DTCM); _ld_stack_top = ORIGIN(DTCM) + LENGTH(DTCM);
/* For the SDK's isr vector table */
__StackTop = ORIGIN(DTCM) + LENGTH(DTCM);
.ARM.attributes 0 : { *(.ARM.attributes) } .ARM.attributes 0 : { *(.ARM.attributes) }
} }

View File

@ -35,11 +35,7 @@
#include "fsl_common.h" #include "fsl_common.h"
void mp_hal_delay_us(mp_uint_t delay) { void mp_hal_delay_us(mp_uint_t delay) {
#if defined(MIMXRT1011_SERIES) || defined(MIMXRT1021_SERIES)
SDK_DelayAtLeastUs(delay, SystemCoreClock); SDK_DelayAtLeastUs(delay, SystemCoreClock);
#else
SDK_DelayAtLeastUs(delay);
#endif
} }
void mp_hal_disable_all_interrupts(void) { void mp_hal_disable_all_interrupts(void) {

View File

@ -35,7 +35,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "fsl_iomuxc.h" #include "fsl_iomuxc.h"
#include "fsl_pwm.h" #include "sdk/drivers/pwm/fsl_pwm.h"
#include "py/obj.h" #include "py/obj.h"
extern const mp_obj_type_t mcu_pin_type; extern const mp_obj_type_t mcu_pin_type;

@ -1 +1 @@
Subproject commit 8363ff7bed7533b9e7e6a6239aace3d6da14f349 Subproject commit 2b9354539e6e4f722749e87b0bdc22966dc080d9

View File

@ -7,7 +7,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include "fsl_flexspi.h" #include "sdk/drivers/flexspi/fsl_flexspi.h"
#include "internal_flash.h" #include "internal_flash.h"
#include "boards/flash_config.h" #include "boards/flash_config.h"
#include "supervisor/internal_flash.h" #include "supervisor/internal_flash.h"

View File

@ -38,8 +38,8 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "lib/oofatfs/ff.h" #include "lib/oofatfs/ff.h"
#include "fsl_cache.h" #include "sdk/drivers/cache/armv7-m7/fsl_cache.h"
#include "fsl_flexspi.h" #include "sdk/drivers/flexspi/fsl_flexspi.h"
#include "fsl_iomuxc.h" #include "fsl_iomuxc.h"
// defined in linker // defined in linker

View File

@ -54,8 +54,8 @@
#include "clocks.h" #include "clocks.h"
#include "fsl_gpio.h" #include "sdk/drivers/igpio/fsl_gpio.h"
#include "fsl_lpuart.h" #include "sdk/drivers/lpuart/fsl_lpuart.h"
// Device memories must be accessed in order. // Device memories must be accessed in order.
#define DEVICE 2 #define DEVICE 2
@ -102,6 +102,36 @@ extern uint32_t _ld_isr_destination;
extern uint32_t _ld_isr_size; extern uint32_t _ld_isr_size;
extern uint32_t _ld_isr_flash_copy; extern uint32_t _ld_isr_flash_copy;
// Remove these once the SDK re-includes them.
// https://github.com/nxp-mcuxpresso/mcux-sdk/issues/110
/*! @name GPR14 - GPR14 General Purpose Register */
/*! @{ */
#define IOMUXC_GPR_GPR14_CM7_CFGITCMSZ_MASK (0xF0000U)
#define IOMUXC_GPR_GPR14_CM7_CFGITCMSZ_SHIFT (16U)
/*! CM7_CFGITCMSZ
* 0b0000..0 KB (No ITCM)
* 0b0011..4 KB
* 0b0100..8 KB
* 0b0101..16 KB
* 0b0110..32 KB
* 0b0111..64 KB
* 0b1000..128 KB
*/
#define IOMUXC_GPR_GPR14_CM7_CFGITCMSZ(x) (((uint32_t)(((uint32_t)(x)) << IOMUXC_GPR_GPR14_CM7_CFGITCMSZ_SHIFT)) & IOMUXC_GPR_GPR14_CM7_CFGITCMSZ_MASK)
#define IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ_MASK (0xF00000U)
#define IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ_SHIFT (20U)
/*! CM7_CFGDTCMSZ
* 0b0000..0 KB (No DTCM)
* 0b0011..4 KB
* 0b0100..8 KB
* 0b0101..16 KB
* 0b0110..32 KB
* 0b0111..64 KB
* 0b1000..128 KB
*/
#define IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ(x) (((uint32_t)(((uint32_t)(x)) << IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ_SHIFT)) & IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ_MASK)
/*! @} */
extern void main(void); extern void main(void);
// This replaces the Reset_Handler in startup_*.S and SystemInit in system_*.c. // This replaces the Reset_Handler in startup_*.S and SystemInit in system_*.c.