@jay_heng @Sabina_Bruce
Finally got something working. I used Jay's utility to create a binary image, then compared the first 0x200 bytes of jay's image (FDCB location) with the first 0x200 of my binary, and worked back to getting a struct that gives an identical 0x200 bytes.
Here's the coded struct below... I have little idea about many of the field decisions because I can't find any docs on how to set them up correctly. This code is the very definition of a pass-it-on whisper! I do sincerely wish that NXP would release some good documentation on how to configure this struct. I don't know yet if this is an optimal configuration. Some testing required to see what performance I get.
Good info in Chapters 9 and 27 of the Reference Manual. Jay's utility can help you configure your FDCB.
Table 9.9 lists the boot pins options. Table 9.14 has the full definition of the FDCB struct. Table 9.15 has the LUT sequence definition for Serial Nor.
In a nutshell:
To get McuXpresso to program the GD25LX, set BOOT_CFG2[2:0] on your board to 0b000 (3B SPI). Big thanks to Sabina for this tip: it was crucial to allow me to program the flash via McuX. I also set up my board so I can force it into USB DFU mode (to work with Jay's utility) by having the option to pull BOOT_CFG1[6] high.
In C/C++ Build/MCU Settings, Memory details, set your Flash memory to the correct address/size, and select MIMXRT1050_SFDP_QSPI.cfx as your flash driver.
In C/C++ Build/Settings/Mcu C Compiler/Preprocessor, define the following symbols:
XIP_EXTERNAL_FLASH=1
XIP_BOOT_HEADER_ENABLE=1
McuX will automatically create the FDCB and fill it out to allow XIP booting.
If you don't need the ROM bootloader to initialize SDRAM or other peripherals, set XIP_BOOT_HEADER_DCD_ENABLE=0. If you do need SDRAM etc, then set it to 1 and you will need to provide the DCD data block also (Xpresso has a config tool for this).
I hope this is useful to anyone else booting off this flash device. Caveat: I've just got this working and there may be some bugs/mistakes in my code.
Thanks very much to Jay and Sabina for their help in solving this problem.
Eamonn
//Based on Jay Heng's McuBootUtility output configured for GD25LX:
const flexspi_nor_config_t hyperflash_config = {
.memConfig =
{
.tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClksrc=kFlexSPIReadSampleClk_ExternalInputFromDqsPad,
.csHoldTime = 3u,
.csSetupTime = 3u,
.columnAddressWidth = 0u,
.deviceModeCfgEnable = 0,
.deviceModeType = 0,
.waitTimeCfgCommands = 0,
//.deviceModeSeq = 0, //This is a flexspi_lut_seq_t sub-struct.
.deviceModeArg = 0,
.configCmdEnable = 0,
//.configModeType[0..2] = 0,
//.configCmdSeqs[3] = 0, //This an array of flexspi_lut_seq_t sub-structs.
//.configCmdArgs0..2] = 0, //Array of uint32_t.
.controllerMiscOption = 0x00000050, // Enable DDR mode, Safe configuration.
.deviceType = 0x01, //kFlexSpiDeviceType_SerialNOR
.sflashPadType = 8, //kSerialFlash_8Pads,
.serialClkFreq = 8, //kFlexSpiSerialClk_166MHz,
.lutCustomSeqEnable = 0, //LUT customization disabled.
.sflashA1Size = 0x2000000, //32u * 1024u * 1024u,
.sflashA2Size = 0,
.sflashB1Size = 0,
.sflashB2Size = 0,
.csPadSettingOverride = 0,
.sclkPadSettingOverride = 0,
.dataPadSettingOverride = 0,
.dqsPadSettingOverride = 0,
.timeoutInMs = 0,
.commandInterval = 0,
.dataValidTime = {15u, 0u},
.busyOffset = 0,
.busyBitPolarity = 0,
.lookupTable =
{
// Read LUTs as per binary from Jay Heng's MCUBootUtility configured for GD25LX...
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xFD, RADDR_DDR, FLEXSPI_8PAD, 0x20),
FLEXSPI_LUT_SEQ(DUMMY_DDR, FLEXSPI_8PAD, 0x06, READ_DDR, FLEXSPI_8PAD, 0x04),
0,0,
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x04),
0,0,0,
0,0,0,0,
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP, FLEXSPI_1PAD, 0x0),
0,0,0,
0,0,0,0,
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x21, RADDR_SDR, FLEXSPI_1PAD, 0x20),
0,0,0,
0,0,0,0,
0,0,0,0,
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xDC, RADDR_SDR, FLEXSPI_1PAD, 0x20),
0,0,0,
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x8E, RADDR_SDR, FLEXSPI_8PAD, 0x20),
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_8PAD, 0x80, STOP, FLEXSPI_1PAD, 0x0),
0,0,
0,0,0,0,
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60, STOP, FLEXSPI_1PAD, 0x0),
},
},
.pageSize = 0x100,
.sectorSize = 0x1000,
.ipcmdSerialClkFreq = 1,
.isUniformBlockSize = 0,
.serialNorType = 0,
.needExitNoCmdMode = 0,
.halfClkForNonReadCmd = 1,
.needRestoreNoCmdMode = 0,
.blockSize = 64u * 1024u,
};