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

Is the simulator able to run code dynamically generated?

Dear All,

I'm facing serious difficulties with the keil Cortex-m3 simulator behavior.
On my project I create code dynamically and place it in an allocated memory area.

The project runs fine until I switch the execution to the recently generated code.
The simulator, however can recognize the code, and I can see the dissembled binary code as Assembly instructions in the memory.

And here is the problem: after switch the execution to the generated code, the simulator cant write anymore to the memory! Any push or pop are considered executed by the simulator, the SP is incremented and decremented correctly, but no writes occur.

after this, every functions call and return is a complete mess, because the return of a function occurs eventually to an old address that was previously pushed into the stack (since the respective PUSH LR didn't wrote to memory).

The problem persists even after I reset the simulator. In order to debug the project again in the simulator I have to quit and re-enter the debug session.

Anyone had a similar problem? Any clue that might help? Or is this something that the simulator cant handle?

thanks in advance to everyone,
cheers,

Alex

0