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
  • It would be helpful if you would explain why you want to do this.

    If you explained what you're actually trying to achieve, people may well be able to offer more appropriate suggestions.

    Yes, the are perfectly valid reasons to do this (Per has already given one) - but there are also very many cases where it is not necessary at all...

Reply
  • It would be helpful if you would explain why you want to do this.

    If you explained what you're actually trying to achieve, people may well be able to offer more appropriate suggestions.

    Yes, the are perfectly valid reasons to do this (Per has already given one) - but there are also very many cases where it is not necessary at all...

Children
More questions in this forum