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?
"I found some guys said KeilC does not support initial values in fixed allocation."
You don't need "some guys" to tell you that - Keil themselves clearly state it in their documentation:
http://www.keil.com/support/man/docs/c51/c51_le_absvarloc.htm
"If this is true"
Yes, it does exactly what it says on the tin!
"I think I've got the best way to program my firmware."
Maybe not "best", but perfectly acceptable!