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

Crash after adding Code

Crash after adding Code
I have an project with following Flash Code areas:

0x0000 - 0x4000: Downloader
0x4000 - 0xC000: Firmware
0xC000 - 0xFFFF: Parameters

In the Firmware area is about 1 kbyte free memory space. The Code runs in Flash.

The firmware works fine, reprogramming the Parameter area in Flash also on the target system works fine. If a add some code, the firmware crashs after following program part for reprogramming the flash (Parameters):

1. Copy Flash Programming routine from Flash into RAM
2. Switch memory model from Harvard memory to Von-Neumann memory.
(64k Flash, 32k RAM)
3. Run Flash Routine in RAM.

The Program does not return after running Flash Routines. There is no difference to delete the contents (emty funktion). The Jump out of the function fails. If I don't reprogram the Parameter Area, the firmware seems to work fine. I can not see any mal behave.
I had the same problem, if I divide the main() Funktion in more smaller functions. But I never found the cause.

I have controlled the stack on target system and there is enough space.

Has anybody an idea, what happens?

Thanks

Parents Reply Children
  • Erik,
    maybe you are right with your timing problem. The crash is caused after dividing the main() into more smaller functions with about 3 Parameters. Maybe it slow down the controller. But I'm not sure if it is enough for an crash.
    I will check it.

    I'm using an 80C320 form Dallas on an Phytec micro modul 8051 with horrible 16k Flash blocks.

    Armin