Content originally posted in LPCWare by saraswathi on Mon May 27 07:15:42 MST 2013 Hi, I am working on secondary bootloader for LPC11U24. I am using USB interrupt at secondary bootloader and application code. Hence I can't redirect the interrupt to application. For this reason I am using remapping of interrupts to RAM. I reffered the post http://knowledgebase.nxp.com/showthread.php?t=3615 and copied the following code to to my application main.c file. [B]#define VECTOR_IN_RAM_LENGTH 47 //stackpointer not counted uint32_t vector_in_ram[VECTOR_IN_RAM_LENGTH] __attribute__ ((section ("vtable")));[/B] [B] uint32_t *p = (uint32_t *) 0x1000;[/B] [B] __disable_irq(); // copy the interrupt vector table on base RAM for (i=0; i<VECTOR_IN_RAM_LENGTH; i++) vector_in_ram = *(p + i); LPC_SYSCON->SYSMEMREMAP = 0x1; __enable_irq();[/B]
I am just modifying here "uint32_t *p = (uint32_t *) 0x4000;" since my application start address is 4000.
With only this much change the interrupts are not working at application. What other modifications I need to do at application main.c? What needs to be added at bootloader code?
Also, I giving the memory mapping of both the projects. The memory mapping selected for bootloader is as follows: /* Define each memory region */ MFlash32 (rx) : ORIGIN = 0x0, LENGTH = 0x3000 /* 12k */ RamLoc8 (rwx) : ORIGIN = 0x100000c0, LENGTH = 0x1f40 /* 7k */ RamUsb2 (rwx) : ORIGIN = 0x20004000, LENGTH = 0x800 /* 2k */
/* Define a symbol for the top of each memory region */ __top_MFlash32 = 0x0 + 0x3000; __top_RamLoc8 = 0x100000c0 + 0x1f40; __top_RamUsb2 = 0x20004000 + 0x800;
The memory mapping selected for application is as follows: /* Define each memory region */ MFlash32 (rx) : ORIGIN = 0x4000, LENGTH = 0x4000 /* 16k */ RamLoc8 (rwx) : ORIGIN = 0x100000c0, LENGTH = 0x1f40 /* 7k */ RamUsb2 (rwx) : ORIGIN = 0x20004000, LENGTH = 0x800 /* 2k */
/* Define a symbol for the top of each memory region */ __top_MFlash32 = 0x4000 + 0x4000; __top_RamLoc8 = 0x100000c0 + 0x1f40; __top_RamUsb2 = 0x20004000 + 0x800;