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

Jump to function at absolute address

Hi,

In my project I have some functions that has to be protected against changes. For that reason a checksum has to be calculated on that specific code in runtime, just to prove that the actual code is intact.

Those specific functions are built in an own outside project (just to protect it from changes) and downloaded to a dedicated area in the flash.

When the standard code wants to access this functionality in the "outside code" an absolute jump is made to the start address of this outside function (0x50000).

This seems to go right, in the "outside code" I can set some outputs to light some LEDs, so the jump seems to have gone right.

But when I try to use variables in this "outside code" nothing seems to work, I tried to make a while loop to blink a diode and counted a variable down to zero, but the variables seems corrupt.

What can be the problem? Can it be something with the memory model that makes references to variables corrupt? I don't know, I'm not so good at memory models.

Any Idea, some one ?

Regards / Rasmus

Parents
  • Ok, I guess I expressed my self badly, let's try again.

    I have my standard project to build my main application. Then I have some functions that can't be built together with the rest of the code, but they are part of the whole application.
    For that reason I have build those function in a separate project.

    When I have built those both projects I merge the hex file from the outside code to the standard code hex file. I use other flash and RAM areas for the "outside code" so it wont be a conflict.

    When I want to call this functions from the standard code I use a function pointer pointing at address 0x50'000 which is the start address for the outside, stand alone built code.

    I can jump to this code using the function pointer and set some outputs, but when I start using variables something goes wrong. The variables seem to be corrupt.

Reply
  • Ok, I guess I expressed my self badly, let's try again.

    I have my standard project to build my main application. Then I have some functions that can't be built together with the rest of the code, but they are part of the whole application.
    For that reason I have build those function in a separate project.

    When I have built those both projects I merge the hex file from the outside code to the standard code hex file. I use other flash and RAM areas for the "outside code" so it wont be a conflict.

    When I want to call this functions from the standard code I use a function pointer pointing at address 0x50'000 which is the start address for the outside, stand alone built code.

    I can jump to this code using the function pointer and set some outputs, but when I start using variables something goes wrong. The variables seem to be corrupt.

Children