Content originally posted in LPCWare by mmoyano on Mon Jul 05 19:49:48 MST 2010
Thank you curtvm and klatecki
The issue is solved and is perfectly working. Both solutions is OK:
A) An implementation of an user vector table with a "JUMPS" section to achieve a branch between the original vector table on bootloader and the secondary vector table on user application.
B) An Implementation of a remapping of secondary vector table to ram (0x10000000).
I had two mistakes, first I wrote bad the BOOT VECTOR TABLE, you can see that the 18º position was copy two times (see extra info file) but in addition, I had to use the MOV instruction with the PC register to achive a real JUMPS between each vector tables. By correcting both errors, the solution is working.
Second, one day I wrote some of code to test the remapping of the vector table to RAM and I do not remember what was my error but then I came to write again this code and is working now. Below it is find the basic code to remap the vector table:
int32 vector_in_ram[52] __attribute__ ((section ("vtable")));
// _________________________________________________________________
int main(void)
{
int i;
int32 *p = (int32 *) 0x1000;
__disable_irq();
// copy the interrupt vector table on base RAM
for (i=0;i<52;i++)
{
vector_in_ram = *(p + i);
}
LPC_SYSCON->SYSMEMREMAP = 0x1;
Below you can see some extract of JUMPS function with the MOV instruction used:
void __jumps(void) __attribute__ ((naked, used, section(".jumps")));
// _________________________________________________________________
void __jumps(void)
{
__asm("ldr r3,=0x1000"); __asm("ldr r2,[r3]"); __asm("mov pc,r2");
__asm("ldr r3,=0x1004"); __asm("ldr r2,[r3]"); __asm("mov pc,r2");
__asm("ldr r3,=0x1008"); __asm("ldr r2,[r3]"); __asm("mov pc,r2");
__asm("ldr r3,=0x100C"); __asm("ldr r2,[r3]"); __asm("mov pc,r2");
__asm("ldr r3,=0x1010"); __asm("ldr r2,[r3]"); __asm("mov pc,r2");
__asm("ldr r3,=0x1014"); __asm("ldr r2,[r3]"); __asm("mov pc,r2");
__asm("ldr r3,=0x1018"); __asm("ldr r2,[r3]"); __asm("mov pc,r2");
__asm("ldr r3,=0x101C"); __asm("ldr r2,[r3]"); __asm("mov pc,r2");
Well, both solutions is working now and I am happy. I hope that this issue can be help to someone else.
Thanks again to curtvm and klatecki. They helped me a lot.
Regards!