Harrie Noorlander

LPC11C24 bootloader interrupt redirecting/remapping

Discussion created by Harrie Noorlander on Nov 3, 2016
Latest reply on Dec 9, 2016 by Harrie Noorlander

Dear Community,

 

I seem to be having an issue with getting redirecting and/or remapping interrupts on a LPC11C24.

The used boot-loader is based on AN10995.

The problem is that I need to use interrupts in both the secondary boot-loader as well as in the application.

 

In order to jump from boot-loader to application I use the code below:

__disable_irq();
/* Load main stack pointer with application stack pointer initial value, stored at first location of application area */
asm volatile("ldr r0, =0x3000"); asm volatile("ldr r0, [r0]"); asm volatile("mov sp, r0");
__enable_irq();
/* Load program counter with application reset vector address, located at second word of application area. */
asm volatile("ldr r0, =0x3004"); asm volatile("ldr r0, [r0]"); asm volatile("mov pc, r0");
/* User application execution should now start and never return here.... */

 

When the boot-loader is not using interrupt, I can use the code below to relocate interrupt from boot-loader to application.

void UART_IRQHandler(void) __attribute__ (( naked ));

void UART_IRQHandler(void) {

asm volatile("ldr r0, =0x3094"); asm volatile("ldr r0, [r0]"); asm volatile("mov pc, r0");

}

Doing so, interrupt in the application are working fine, but the boot-loader is able to use interrupts.

 

To get interrupts in boot-loader, "__attribute__ (( naked ))" needs to be removed , to avoid getting compiler errors,

void UART_IRQHandler(void);

void UART_IRQHandler(void) {

/* handle interrupt <code> here */

}

Now interrupt are working fine in the boot-loader, however when the device gets an interrupt while in application, the interrupt is using the the interrupt handler from the boot-loader instead of it's own application interrupt handler.

 

In the threads below, multiple options have been proposed already, but I can not get them to work.

2nd bootloader - Requiring the same interrupt in bootloader and main application 

Secondary Bootloader on Cortex-M0 

 

Any suggestions to get interrupts in both boot-loader and application are welcome, but a working example is fine as well.

 

Kind regards.

Outcomes