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

Switching between code programs

I have two different code programs: Program "B" which is located at 1000h and Program "A" located at 0h (it ends before 1000h) and it's working properly. How can I start executing program "B" from Program "A". I have tried this software reset but it doesn't work:

((void  (code *)  (void)) 0x01000) ();
Note: there is no need for sharing data between programs. I just need to switch between executing one program or another

Parents
  • Thank for your reply Drew Davis,
    Actually what I want to do is to execute a separate code (a complete system) from my application. The problem is that I don't have the source code for that "separate code". So my idea is in somehow to place the code (the one I don't have the source code) in a empty space of the memory and then try to invoke it from my application. Do you think there is a way to do this?
    Than you very much.

Reply
  • Thank for your reply Drew Davis,
    Actually what I want to do is to execute a separate code (a complete system) from my application. The problem is that I don't have the source code for that "separate code". So my idea is in somehow to place the code (the one I don't have the source code) in a empty space of the memory and then try to invoke it from my application. Do you think there is a way to do this?
    Than you very much.

Children
  • Do you think there is a way to do this?

    No. Not if you're moving the code from its real address to some other position in memory. That cannot possibly work, because 8051 isn't position-independent. And that's before we even begin to look at what usage of data memory that code may have, which the .hex file you have will tell you nothing about.