I am using the LPC5526 (NON-S) and want to re-enter the serial (uart) bootloader by a call from my program.
The ISP and SWD pins are not accessible (in the final product) and both will be locked out security bits in the future (to prevent possible readout).
Reading through the User manual: 9.3.4 runBootloader API mentions exactly what i need.
However this does not work.
The example below doesn't respond to a serial program (tested with Flashmagic) and when i suspend the program it is halted in an "HardFault_Handler"
If i use the alternative location from the fsl_iap the program just reboots.
And finaly using the undocumented NXP forum suggestion also just reboots.
Short: Is it possible to jump to the UART ISP bootloader direct from my program? or do i have to do something before jumping? like turning off interrupts?
Example: In the application image boot process, regardless of whether the ISP pin is
connected to the high level, the device will directly enter the ISP mode through the UART
interface according to the parameter ispInterface in arg.
//Version 2.1.4.
// from fsl_iap.c: LPC5528_SERIES -> #define BOOTLOADER_API_TREE_POINTER ((bootloader_tree_t *)0x130010f0U)
// other LPC550x & LPC551x series -> #define BOOTLOADER_API_TREE_POINTER ((bootloader_tree_t *)0x1301fe00U)
////#define BOOTLOADER_TREE_LOCATION (0x130010f0U) // from fsl_iap.c: LPC5528_SERIES ??
#define BOOTLOADER_TREE_LOCATION (0x1301fe00) // from ROM_API.PDF / User Manual
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 reserved0; /*!< Do NOT use. */
// flash_driver_interface_t flashDriver;
// const kb_interface_t *kbApi; /*!< Bootloader API. */
// const uint32_t reserved1[4]; /*!< Do NOT use. */
// const skboot_authenticate_interface_t *skbootAuthenticate; /*!< Image authentication API. */
} bootloader_tree_t;
bootloader_tree_t *romApiTree = (bootloader_tree_t *)BOOTLOADER_TREE_LOCATION;
uint32_t arg = 0xEB120000; //0xEB: represents Enter Boot; 0x12: represents enter ISP mode by UART only
void EnterBootLoader(void)
{
ReadChipUUID();
#if (true)
// official NXP method
romApiTree->runBootloader(&arg);
#else
// Undocumanted NXP forum solution (not working, just reboots)
PMC->AOREG1 |= (0x0A << 16); //Set to boot from ROM
NVIC_SystemReset(); //Reset
#endif
for(;;)
{
}
};