Reset Problem in LPC23xx

Hi,

I am working on LPC2368 microcontroller. I was supposed to develop 2 firmwares in the same controller. I had developed a bootloader code and the actual code.
The bootloader runs at 0x0000 and the actual code is at 0x2000.
Now when i start the system it runs from 0x0000 and passes the execution to 0x2000 if there is no
firmware upgradation.
The actual code takes the upgration through serial port and stores at an address of 0x28000
and after succesful writing at 0x28000 it simply passes the execution to 0x0000 as follows

#define BOOTLOADER_START_ADDRESS 0x00

void execute_bootloader_code(void)
{

void (*bootloader_code_entry)(void);

VICIntEnClr = 0xFFFFFFFF; // disable all interrupts;

bootloader_code_entry = (void (*)(void))BOOTLOADER_START_ADDRESS;

bootloader_code_entry();
}

so when the bootloader runs and checks if there is a new firmware avaliable it erases the actual code at 0x2000 and starts writing the code from 0x28000 to 0x2000. Hence my new firmware has been upgraded and the execution is passed to 0x2000.

Now my problem is when i upgrade the code, my code is running upto a certain point in the intialization. The certain point is i am actually disbaling all interrupts and enabling only UART-2 and UART-0 interrupts.
When the execution comes to enabling of these interrupts the execution is passed to 0x000 i.e., reset vector...
I couldnt find the reason why my code is being reset. I had observed the RSIR and didnt find any thing suspicious..
How do i find why my code has jumped to 0x0000. can anyone suggest me to solve this problem.

Regards,
Srinivas.R

Parents
  • 1) Do you remember to remap the interrupt vectors? The boot loader owns the original interrupt vector table at address 0 in flash, so the processor needs to overlay a piece of RAM on top of the flash with your 0x2000-located interrupt vectors.

    2) Note that if the code initializes interrupts in the wrong order, you can get into big troubles since the boot loader has already initialized peripherials. Your boot loader did only disable all interrupts - it didn't fully disable the UART etc. So the same moment your application enables the UART interrupt vector, your UART is already initialized and might want to issue an interrupt - but with the vector still pointing into your boot loader.

Reply
  • 1) Do you remember to remap the interrupt vectors? The boot loader owns the original interrupt vector table at address 0 in flash, so the processor needs to overlay a piece of RAM on top of the flash with your 0x2000-located interrupt vectors.

    2) Note that if the code initializes interrupts in the wrong order, you can get into big troubles since the boot loader has already initialized peripherials. Your boot loader did only disable all interrupts - it didn't fully disable the UART etc. So the same moment your application enables the UART interrupt vector, your UART is already initialized and might want to issue an interrupt - but with the vector still pointing into your boot loader.

Children
More questions in this forum