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

Hex files located in different memory areas

I need to be able to hold two applications on-chip at a time so I can choose which one to run (using a code based reset giving a start vector)

T89C51AC2

The default one will be compiled for the 'standard' memory location (0x0000?), and the second one, that will be flashed into memory via IAP at 0x4000.

My initial thoughts to compile a hex file for this upper location (in uVision 3) would be to change the project settings:

C51 Tab : (checked) Interrupt Vectors At Address: 0x4000
BL51 Locate Tab : (Un-Checked) Use Memory Layout from Target Dialog
BL51 Locate Tab : Code 0x4000

This 'seems' to produce a hex file located at 0x4000 (although I am not yet ready to test its operation)

However, this hex file contains a line that writes to memory location 0x0000. Is this normal? This would overwrite data placed there by the lower memory hex file?!

Or, am I approaching this the wrong way, because something doesn't feel right here.

Parents
  • * Have a flag in memory that indicates whether program A or program B is currently running, and put conditional jumps in the IVT that just jump to another jump table inside the appropriate program (which, of course, needs to be located at a fixed address if you don't want to update the IVT all the time). This adds a little bit of additional latency to the interrupts.

    Of course, the first decision must fit into the 8 byte space that is reserved for each interrupt vector.

    Two LJMPs (3 bytes each) and a JB (3 bytes) won't work, but the 8 bytes can hold an JB, an AJMP and a LJMP. Or, if you want something more sophisticated, two PUSHs, a MOV direct, #immediate, and a RET (not necessarily in this order :) ), so you can actuall determine the address of the second jump table at run-time.

Reply
  • * Have a flag in memory that indicates whether program A or program B is currently running, and put conditional jumps in the IVT that just jump to another jump table inside the appropriate program (which, of course, needs to be located at a fixed address if you don't want to update the IVT all the time). This adds a little bit of additional latency to the interrupts.

    Of course, the first decision must fit into the 8 byte space that is reserved for each interrupt vector.

    Two LJMPs (3 bytes each) and a JB (3 bytes) won't work, but the 8 bytes can hold an JB, an AJMP and a LJMP. Or, if you want something more sophisticated, two PUSHs, a MOV direct, #immediate, and a RET (not necessarily in this order :) ), so you can actuall determine the address of the second jump table at run-time.

Children
No data