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 assign initial values in code memory with specific location?

I want to define some values in code memory with specific location. For example

code unsigned char MyArray[] _at_ 0xF000 = {0x01, 0x02};


After that, I can use "MyArray[0]" and "MyArray[1]" to access the memory at 0xF000 and 0xF001.
How can I achieve this?

Parents
  • "Better way" means better than current programming style. i.e. {0xABCD, 0x01}.
    My current programming CSEG AT 0xF000
    ADDR_LBYTE: DB 0xCD
    ADDR_HBYTE: DB 0xAB
    DATA_BYTE: DB 0x01

    But now, I can re-write to : CSEG AT 0xF000
    ADDR_: DW 0xABCD
    DATA_BYTE: DB 0x01

    It's much friendly to programmers. I just need to change the parsing algorithm to reverse high-low byte order.

    I found some guys said KeilC does not support initial values in fixed allocation. If this is true, I think I've got the best way to program my firmware.

Reply
  • "Better way" means better than current programming style. i.e. {0xABCD, 0x01}.
    My current programming CSEG AT 0xF000
    ADDR_LBYTE: DB 0xCD
    ADDR_HBYTE: DB 0xAB
    DATA_BYTE: DB 0x01

    But now, I can re-write to : CSEG AT 0xF000
    ADDR_: DW 0xABCD
    DATA_BYTE: DB 0x01

    It's much friendly to programmers. I just need to change the parsing algorithm to reverse high-low byte order.

    I found some guys said KeilC does not support initial values in fixed allocation. If this is true, I think I've got the best way to program my firmware.

Children