CW08,怎么将一个C语言函数定位在一个绝对地址上?
 
- UID
- 104380
- 性别
- 男
|
|
|
|
|
|
 
- UID
- 104380
- 性别
- 男
|

先在PRM文件中加入你要的SECTION地址:
/* This is a linker parameter file for the GP32 */
NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */
SEGMENTS /* here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
Z_RAM = READ_WRITE 0x0040 TO 0x00FF;
RAM = READ_WRITE 0x0100 TO 0x023F;
ROM = READ_ONLY 0x8000 TO 0xFDFF;
T_ROM = READ_ONLY 0xFC06 TO 0xFDFF;
END
PLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */
DEFAULT_ROM INTO ROM;
DEFAULT_RAM INTO RAM;
_DATA_ZEROPAGE, MY_ZEROPAGE INTO Z_RAM;
MY_ROM INTO T_ROM;
END
STACKSIZE 0x50
VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. */
//VECTOR 0 Entry /* reset vector: this is the default entry point for a Assembly application. */
//INIT Entry /* for assembly applications: that this is as well the initialization entry point */
然后在程序中将次函数定义为放在MY_ROM:
#pragma CODE_SECTION MY_ROM
void funct1(void){
asm lda #2;
}
#pragma CODE_SECTION DEFAULT
void main(void) {
funct1();
}
[此贴子已经被strongchen于2005-10-11 17:38:24编辑过] |
|
|
|
|
|