Hello! We have two custom boards: one for the 1064 and another one for the 1062
We have a bootloader that works for the 1064 and I'm trying to port it to the 1062 (booting from the external hyperflash, the one with the base address 0x60000000, so connected to the FLEXSPI2). The base for that bootloader (the one that works for the 1064, which boots from the internal QSPI flash with has the base address 0x7000000, so connected to FLEXSPI) came from the SDK_folder/middleware/mcu-boot/src
I've got it to boot, and I can see messages coming from the debug console, so far so good
The part where I'm stuck at is: the bootloader does some hardware tests and it is supposed to write a flag to a specific address in the hyperflash to verify that such tests were run (the address it writes to is above the image end address, so it is not overwriting the bootloader code itself). But the erase function for the hyperflash is always returning an error.
I was able to track down the error to the initialization of the hyperflash.
Here's where the first error happens:
status_t flexspi_nor_get_config(uint32_t instance, flexspi_nor_config_t *config, serial_nor_config_option_t *option)
{
status_t status = g_bootloaderTree->flexSpiNorDriver->get_config(instance, config, option);
if ((status == kStatus_Success) && option->option0.B.option_size)
{
// A workaround to support drive strength configuration using Flash APIs
if (option->option1.B.drive_strength)
{
flexspi_update_padsetting(&config->memConfig, option->option1.B.drive_strength);
}
// A workaround to support parallel mode using Flash APIs
if (option->option1.B.flash_connection == kSerialNorConnection_Parallel)
{
config->memConfig.controllerMiscOption |= FLEXSPI_BITMASK(kFlexSpiMiscOffset_ParallelEnable);
config->pageSize *= 2;
config->sectorSize *= 2;
config->blockSize *= 2;
config->memConfig.sflashB1Size = config->memConfig.sflashA1Size;
}g_bootloaderTree->flexSpiNorDriver->get_config
}
return status;
}
The call to:
g_bootloaderTree->flexSpiNorDriver->get_config
Returns with the error code 0x4, which should be kStatus_InvalidArgument? (correct me if I'm wrong on this)
So, I am not sure that the input parameters, namely the instance and option are correct.
With the 1064 bootloader, the instance number that we used for the internal QSPI flash (connected to FLEXSPI) was 1. Which value should we use for the instance when using the external hyperflash, which uses FLEXSPI2? I've tried with 0, and board simply reboots after it calls the get_config command. I've also tried with 2, with such value the board doesn't reboot but returns the aforementioned 0x4 error.
Also, for the option parameter it gets initialized in this snippet:
serial_nor_config_option_t option;
option.option0.U = BL_FLEXSPI_NOR_CFG_OPT0;
option.option1.U = BL_FLEXSPI_NOR_CFG_OPT1;
if (option.option0.B.tag == kSerialNorCfgOption_Tag)
{
return flexspi_nor_mem_config((uint32_t *)&option);
}
And the values for BL_FLEXSPI_NOR_CFG_OPT0 and BL_FLEXSPI_NOR_CFG_OPT1 are:
#define BL_FLEXSPI_NOR_CFG_OPT0 (0xc0000008u)
#define BL_FLEXSPI_NOR_CFG_OPT1 (0x0u)
I'm not sure those are the correct values. I would like to know how to properly configure them, or if there's something else that I'm missing to be able to properly initialize the hyperflash so it can be written
Thank you so much!