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
  • I wouldn't need to change between the different applications that often at all. Once every few months maybe.

    So, I guess it is possible that I can go the route of over-writing the IVT each time.

    I've had a look around but I cannot find a specific memory map that shows me where things are supposed to be located. I've analysed a hex file configured to run from 0x4000, and apart from the boot vector (0x0000), the hex file doesn't contain any other information outside of the expected memory range (0x4000 - 0x6500). However, the code runs fine at that location (when programmed via flip as the only application in memory)

    If the IVT was stored somewhere else, wouldn't it show up in the Hex file?

    I'm sorry if I sound a little naive here. This is my first time looking at IAP and multiple applications, so my knowledge is pretty thin, and I can't seem to find anything that relevant in all the documentation that i've found.

    Also, does it make any difference that I'm coding it in C rather than assembler?

Reply
  • I wouldn't need to change between the different applications that often at all. Once every few months maybe.

    So, I guess it is possible that I can go the route of over-writing the IVT each time.

    I've had a look around but I cannot find a specific memory map that shows me where things are supposed to be located. I've analysed a hex file configured to run from 0x4000, and apart from the boot vector (0x0000), the hex file doesn't contain any other information outside of the expected memory range (0x4000 - 0x6500). However, the code runs fine at that location (when programmed via flip as the only application in memory)

    If the IVT was stored somewhere else, wouldn't it show up in the Hex file?

    I'm sorry if I sound a little naive here. This is my first time looking at IAP and multiple applications, so my knowledge is pretty thin, and I can't seem to find anything that relevant in all the documentation that i've found.

    Also, does it make any difference that I'm coding it in C rather than assembler?

Children
  • If the IVT was stored somewhere else, wouldn't it show up in the Hex file?

    It should be at the address you specified in the Target/C51 dialog. There's nothing that's immediately obious about it, though - it merely contains a jump to the actual interrupt service routine.

    Also, does it make any difference that I'm coding it in C rather than assembler?

    Unfortunately, it does. The C compiler does not allow you to put any real code in the 8 byte space reserved for each interrupt vector - it only puts a jump to the actual ISR in there. If you want direct access to those 8 bytes, you will have to write the table in assembly.