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

How to use software traps?

I want to insert software traps between segments on the code. Because this instructions should not be executed in right case, the mcu must be wrong when it execute the instructions in software traps. And I put " goto 0000" in software traps, so the mcu will restart when it dose not work correctly.
The problem is how shall I put these " goto 0000" instructions between code segments?By hand?

Parents

  • You don't mention which linker you are using. I'd suggest taking a look at the CODE (for BL51) and SEGMENTS (LX51) directives in the linker manual. These directives will let you specify the order of segments that make up your program.

    If you create a number of your software trap barriers, each in its own code segment, you could then tell the linker to mix the barriers with the actual code segments with a parameter like SEGMENTS(code1, barrier1, code2, barrier2). The linker can figure out the absolute addresses for the barriers as code1 and code2 change size. With big programs with lots of segments, you might find it more convenient to specify absolute addresses for the barrier segments, and let the linker work all the other segments around those as it chooses.




Reply

  • You don't mention which linker you are using. I'd suggest taking a look at the CODE (for BL51) and SEGMENTS (LX51) directives in the linker manual. These directives will let you specify the order of segments that make up your program.

    If you create a number of your software trap barriers, each in its own code segment, you could then tell the linker to mix the barriers with the actual code segments with a parameter like SEGMENTS(code1, barrier1, code2, barrier2). The linker can figure out the absolute addresses for the barriers as code1 and code2 change size. With big programs with lots of segments, you might find it more convenient to specify absolute addresses for the barrier segments, and let the linker work all the other segments around those as it chooses.




Children
No data