0:链接脚本:
LR_IROM1 0x08000000 0x00040000 { ; load region size_region
ER_IROM1 0x08000000 0x00040000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM1 0x20000000 { ; RW data
.ANY (+RW +ZI)
}
RW_IRAM2 +0 {
.ANY (+RW)
}
}
1:得到连接脚本段地址的地址:
extern unsigned int Image$$RW_IRAM2$$RW$$Base;//Image$$RW_IRAM2$$Base ;
unsigned int CMD_point = (unsigned int) &Image$$RW_IRAM2$$RW$$Base ;//section ("RW_IRAM2");//|Image$$RW_IRAM2$$Base| ;
printf("%x",CMD_point);
2:指定代码段到对应地址
long rw1 __attribute__((section ("RW_IRAM2")))=4;
阅读(3655) | 评论(0) | 转发(0) |