欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

获取程序编译后链接脚本中变量

程序员文章站 2022-06-05 17:29:01
...

sct文件:各段在内存中的分配情况,每一次编译完后

	extern unsigned int Image$$ER_IROM1$$Base;
	extern unsigned int Image$$ER_IROM1$$Limit;
	extern unsigned int Image$$ER_IROM1$$Length;   
	
	extern unsigned int Image$$RW_IRAM1$$Base;
	extern unsigned int Image$$RW_IRAM1$$Limit;
	extern unsigned int Image$$RW_IRAM1$$Length;     
	
	extern unsigned int Image$$RW_IRAM1$$ZI$$Base;
	extern unsigned int Image$$RW_IRAM1$$ZI$$Limit;
	extern unsigned int Image$$RW_IRAM1$$ZI$$Length;    
	
	
	unsigned int base,limit,length;
	base = (unsigned int )&Image$$ER_IROM1$$Base;
	limit = (unsigned int )&Image$$ER_IROM1$$Limit;
	length = (unsigned int )&Image$$ER_IROM1$$Length;
	printf("\nER_IROM1 Base = 0x%x\nER_IROM1 Limit = 0x%x\nER_IROM1 Length = %d\n",base,limit,length);
	
	base = (unsigned int )&Image$$RW_IRAM1$$Base;
	limit = (unsigned int )&Image$$RW_IRAM1$$Limit;
	length = (unsigned int )&Image$$RW_IRAM1$$Length;
	printf("\nRW_IRAM1 Base = 0x%x\nRW_IRAM1 Limit = 0x%x\nRW_IRAM1 Length = %d\n",base,limit,length);
	
	base = (unsigned int )&Image$$RW_IRAM1$$ZI$$Base;
	limit = (unsigned int )&Image$$RW_IRAM1$$ZI$$Limit;
	length = (unsigned int )&Image$$RW_IRAM1$$ZI$$Length;  
	printf("\nRW_IRAM1_ZI Base = 0x%x\nRW_IRAM1_ZI Limit = 0x%x\nRW_IRAM1_ZI Length = %d\n",base,limit,length);
Image$$ER_IROM1$$Length : CODE段和RO_data段的大小
Image$$RW_IRAM1$$Length : RW_data段的大小
Image$$RW_IRAM1$$ZI$$Length : ZI_data段的大小
相关标签: 驱动