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

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段的大小

你可能感兴趣的:(驱动)