Well. I guess it was not IAP after I put a dummy function in the
place of the IAP Call.
I tried to use a static variable. The problem was still there. BTW, I
am using GCC 3.4.4. It is a cpp program.
I looked at the assembly. It may have something to do with R11, the
frame pointer. The problem seems appear when under stress. OK, I am
working on my own bootloader. Bootloading a really small code, it
works ok. When loading a few KBytes, it shows up.
I can get around the symptom by a simple if statement, such as,
switch(m_CmdStep) {
case 1:
...
break;
case 2:
if(!Started()) {
if(m_CmdStep==2)
Starting();
m_CmdStep=3;
}
break;
case 3:
...
break;
};
But I fear I hid the real problem. Any ideas ?
Thanks for all replies.
Greg
--- In lpc2000@yahoogroups.com, "fl429" <fl429@...> wrote:
>
> Hi, Folks,
>
> Hopefully, someone can shed some light to this. Thanks.
>
> First, this is not my first app on the LPC2138. I had no trouble
> before, until I use IAP in this one.
>
> The IAP calls seem working OK. No error reported. Flash memory does
> program as expected, as far as I can see.
>
> But, a simle C structure in one of the functions now behaves
wierdly
> SOMETIMES. This is called repeatedly in a loop.
>
> switch(m_CmdTmp) {
> case 1:
> ..... codes here
> m_CmdTmp=2;
> break;
> case 2:
> if(!Started()) {
> Starting(); <<====== Point 1
> // some other stuff ... here
> m_CmdTmp=3;
> }
> break;
> case 3:
> ...
> break;
> }
>
> After some poking around, I found I am at Point 1 while m_CmdTmp
> already equals 3 (m_CmdTmp=3).
> There is no interrupts changing the value of m_CmdTmp behind my
> back ! m_CmdTmp is supposed to progress ONLY in this switch routine.
>
> I tried to change stack sizes to no avail. I reserved 256 bytes
from
> the TOP of SRAM (0x400007e00 and up) from being used by this APP.
> No, I still have this problem.
>
> Any ideas ?
>
> Thanks a lot,
>
> Greg
>Message
Re: IAP and then strange behavior
2006-02-03 by fl429
Attachments
- No local attachments were found for this message.