Hi All,
My goal is build a bootloader in order to launch and if needed upgrade, my application.
I'm working witu MCUxpresso and LPC54102 microcontroller.
I have already build the bootloader project named SBL.c, thi code is a single core code mapped in the first sector of the LPC Flash memory (Location 0x0, size 0x8000).
I have build also a simple application that toggle a led by one of the GPIO port just to debug the bootloader. This second application is mapped on the second sector of LPC Flash memory (Location 0x8000, size 0x8000).
When I launch the SBL.c by debugger the it goes on a fault condition when it is calling the second application .... Attached a part of SBL.c and a Debugger error.
I have also tryed to leave the SBL.c running without the debugger but it seems not working.
//SBL.c
//Define my Application Address
#define APPLICATION_ADDRESS 0x00008020
typedef void(*pFunction)(void);
pFunction appEntry;
uint32_t appStack;
//Disabling interrupts, before changing interrupt vectors
__disable_irq();
//Get the application stack pointer
appStack=(uint32_t)*((__IO uint32_t*)APPLICATION_ADDRESS);
//Get the application entry point
appEntry=(pFunction)(__IO uint32_t*)(APPLICATION_ADDRESS+4);
// Set vector table offset
SCB->VTOR = APPLICATION_ADDRESS;
//Enable interrupts before jumping to application
__enable_irq();
//Set application stack pointer
__set_MSP(appStack);
appEntry(); //Errors appear when call this function
Thanks in advance.
Hello @eu_mtaverna,
Could you please try declaring the appEntry(); as follows?
static void(*appEntry)(void)=0;
appEntry=(void(*)())(APPLICATION_ADDRESS+4);
appEntry();
Also, could you please read the following application note? https://www.nxp.com/docs/en/application-note/AN11610.zip. It might be useful.
Best regards, Raul.
Hi, Thanks a lot for replay, the issue was about the systick interrupts that I haven't disabled....
Now the bootloader works and can start correctly a single core application.
Now a new issue appears with a dual core application: when the bootloader lounch a dual core application only the Master core seems to starts. The Slave core seems to loop in boot condition.... Have you any Idea about??
Hello @eu_mtaverna,
Could you please take a look to the following application notes related with the dual core applications?
Regards, Raul.
Hi RaulRomero, I have take a look to the application notes as you seggest, but I have not fix.. The issue seems in the Chip_CPU_CM0Boot(uint32_t *coentry, uint32_t *costackptr) function.
When the above function clears the Slave Reset an HardFault (HFSR) appears. At first I thought about a Debugger problem, but also without Debugger the CM0 Slave don't starts correctly.
Do you have suggestion about in order to investigate?
Thanks