This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Wierd problem in modifying the bootloader code

Hi,

I am using Phytec LPC3250 board for my design and I have a very important problem that I have been spending time on for days.

I want to modify my bootloader_NOR code so that I can send my application code image from the serial port.

However, when I define a global variable and use this variable in a function it gets wierd values. My code can be simplified as below:

#include "LPC318x.H"

int  m = 0;

void MyFunction(int value)    // do nothing function
{
}

int main(void)
{
  for(;;)
  {
    m++;                        // <- Breakpoint
    MyFunction(m);
  }
}

When I debug the code, I see "m = 0xE0000420" at the breakpoint where I expect to see 0x00.

This ruins all my intention and I cannot proceed to modify the code.

I think the data in the RAM region is corrupted but I dont know why and I have no sensible solution for this.

Thanks for your helps in advance.

Parents
  • Hi Michael, thanks for your reply.

    I am pretty sure that the problem is not assigning the variable value. The problem is that the RAM region I am using is changed by the program. As soon as the program starts the value at the memory address 0x08000004 becomes "0xE000032F". So, if my variable is located at that address, I cannot ever reach my variable value.

    Also, if my variable is not located at an address that changes automatically, then there is no problem. However, no one can assure that.

    Also, the problem is not only the variables, when I try to read the serial receive buffer (from address 0x40090000) I get nonsense values. So, I cannot make the serial communication work either.

    Thanks for your replies.

Reply
  • Hi Michael, thanks for your reply.

    I am pretty sure that the problem is not assigning the variable value. The problem is that the RAM region I am using is changed by the program. As soon as the program starts the value at the memory address 0x08000004 becomes "0xE000032F". So, if my variable is located at that address, I cannot ever reach my variable value.

    Also, if my variable is not located at an address that changes automatically, then there is no problem. However, no one can assure that.

    Also, the problem is not only the variables, when I try to read the serial receive buffer (from address 0x40090000) I get nonsense values. So, I cannot make the serial communication work either.

    Thanks for your replies.

Children
No data