flashiap(driver_example) in sdk 2.7.0 of lpc55s69 is operating in hardfault
reason: runCmdFuncOption was declare in struct struct BootloaderTree. when iap function(such as: FLASH_Erase) was called, BOOTLOADER_API_TREE_POINTER, where is mapped in rom address, was wrote. Then, it results in hardfault.
It is recommanded that it was re written as below.
typedef struct BootloaderTree
{
void (*runBootloader)(void *arg); /*!< Function to start the bootloader executing. */
standard_version_t bootloader_version; /*!< Bootloader version number. */
const char *copyright; /*!< Copyright string. */
const uint32_t *reserved; /*!< Do NOT use. */
flash_driver_interface_t flashDriver;
function_command_option_t runCmdFuncOption;
} bootloader_tree_t;
function_command_option_t runCmdFuncOption;
#define RUN_COMMAND_FUNC_OPTION BOOTLOADER_API_TREE_POINTER->runCmdFuncOption
POST: the last 8k flash is recommanded never iap. At lease, I have never operated succeed.
Hi Zhihong Li,
Thank you for your interest in NXP Semiconductor products and
the opportunity to serve you.
To provide the fastest possible support, I've attached an update fsl_iap.c, please use it instead of the original fsl_iap.c.
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
I updated fsl_iap.c, but the problem is still. Is there anyone can offer more help...
@Quincy Wang, you can test SDK2.7.1, the Flash driver version update from 2.0.2 in SDK2.7 to 2.1.3 in SDK2.7.1.
/*! @brief Flash driver version for SDK*/
#define FSL_FLASH_DRIVER_VERSION (MAKE_VERSION(2, 0, 2)) /*!< Version 2.0.2 */
/*! @brief Flash driver version for SDK*/
#define FSL_FLASH_DRIVER_VERSION (MAKE_VERSION(2, 1, 3)) /*!< Version 2.1.3 */
Hi jeremyzhou ,
Can it be so that this fix need for some old version of board ?
On my A2 board it return version 3 of flash API
PRINTF("FLASH API version - %d\r\n", versionMajor); ---> 3
But fix implemented for version 2 only
if (versionMajor == 2U)
{
runCmdFuncOption.commandAddr = 0x1300413bU; /*!< get the flash erase api location adress in rom */
return runCmdFuncOption.eraseCommend(config, start, lengthInBytes, key);
}
else
{
assert(VERSION1_FLASH_API_TREE);
return VERSION1_FLASH_API_TREE->flash_erase(config, start, lengthInBytes, key);
}
Regards,
Eugene