|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
How do I reserve code space so the compiler and linker will automatically split my program between code space from 0x0000 to 0x1FFF and 0x8000 to 0xFFFF?
There are a number of ways you can use the C51 compiler and linker to avoid using sections of the CODE space. The easiest way is to declare an array in CODE that resides at the desired address. For example, to exclude the CODE space from 0x2000 to 0x7FFF, the following code will work.
unsigned char code dummy [0x6000] _at_ 0x2000; xdata unsigned char *dummy2 = &dummy; // To avoid Warnings
Note that the array "dummy" is 6000 characters (bytes) long and starts at 0x2000 in the CODE space. The XDATA pointer, "dummy2", is used to avoid compiler and linker warnings. If you omit it, the linker will probably complain that nothing uses the dummy array.
Article last edited on: 2004-06-07 08:36:06
Did you find this article helpful? Yes No
How can we improve this article?