所用版本为CCS3.3.83;程序编译通过,但是load后(未运行)发现该语句没有起到任何效果。
CMD文件已经修改。
在做bootloader时用C语言(非汇编)直接写的程序,拿来用,结果发现#pragma CODE_SECTION(boot,".bootload")语句不起作用,未能够达到预期的分配效果。
所用版本为CCS3.3.83,程序编译能够通过,但是load后(未运行)发现该语句没有起到任何效果,boot()函数未被分配到boot函数代码段空间。
请各位专业人士指教问题原因
另:使用CCS3.3.38编译正常,代码段分配正常
Shine:
你到.map文件里看一下.bootload段有没有分配到指定的段?
hang SU:
回复 Shine:
.map文件中,boot_ram段占用量为零
Shine:
回复 hang SU:
能把相关的code_section代码和cmd文件贴出来么?
Shine:
回复 hang SU:
谢谢分享解决办法!
hang SU:
回复 Shine:
在另一台上装了一下,编译后map文件和boot文件如下
以下为boot部分
#define AWCCR*(unsigned int *)0xf0000004 #define A1CR*(unsigned int *)0xf0000010 #define PFUNC*(unsigned int *)0x44000010 #define PDIR*(unsigned int *)0x44000014 #define PDOUT*(unsigned int *)0x44000018 #define FLASH*(unsigned short *)(0x90000800)/* 将boot函数放在.boot_prog section *///#pragma CODE_SECTION(delay,".boot_load")#pragma CODE_SECTION(boot_prog,".boot_load")void boot_prog(){/* 由于boot函数运行时尚未初始化C语言运行环境的Stack,因此所有变量都采用register */register unsigned int * boot_dst;register unsigned int * boot_src;register unsigned intaddr;register unsigned intboot_ep;register unsigned intboot_cnt;register charpage;PFUNC = 0x00000800;PDIR= 0x00000800;PDOUT = 0x00000000;A1CR= 0x00160449;/* 被载入的程序的boot table所在的地址 */boot_src = (unsigned int *)(0x90000400);boot_ep = *boot_src++; /* 取得 Entry point */while(1){boot_cnt =(unsigned int) *boot_src++;addr = (unsigned int)boot_src & 0x00FFFFFF;page = (unsigned char)addr>>13;asm(" nop 9");PDOUT = 0x00000800;asm(" nop 9");FLASH = page;asm(" nop 9");PDOUT = 0x00000000;asm(" nop 9");boot_dst = (unsigned int *)(*boot_src++);if(boot_cnt == 0){(*(void (*)())boot_ep)(); /* 跳转到Entry point */}while(boot_cnt>0){*boot_dst++ = *boot_src++;addr = (unsigned int)boot_src & 0x00FFFFFF;page = addr>>13;asm(" nop 9");PDOUT = 0x00000800;asm(" nop 9");FLASH = page;asm(" nop 9");PDOUT = 0x00000000;asm(" nop 9");boot_cnt -= 4;}}}以下为编译后map文件
******************************************************************************TMS320C6x Linker PC v6.1.10****************************************************************************** >> Linked Tue Jun 16 10:04:47 2015OUTPUT FILE NAME:<./Debug/led.out> ENTRY POINT SYMBOL: "_c_int00"address: 10001480MEMORY CONFIGURATIONnameoriginlengthusedunusedattrfill -------------------------------------------------------------------BOOT_RAM 10000000 00000400 00000000 00000400 RWIX RAM100004000002000000001b4c0001e4b4RWIXSDRAM80000000080000000000000008000000RWIXFLASH_BOOT90000000000004000000000000000400RWIXFLASH_REST900004000001fc00000012400001e9c0RWIXSECTION ALLOCATION MAPoutputattributes/ sectionpageoriginlengthinput sections ------------------------------------------------ .pinit01000040000000000UNINITIALIZED.bss01000040000000000UNINITIALIZED.data01000040000000000UNINITIALIZED.stack01000164000000800UNINITIALIZED1000164000000008rts6700.lib : boot.obj (.stack)10001648000007f8--HOLE--.far010001e40000000a0UNINITIALIZED10001e400000008crts6700.lib : exit.obj (.far)10001ecc00000009led.obj (.far)10001ed500000003--HOLE--10001ed800000008rts6700.lib : _lock.obj (.far).cinit010001ee00000006c10001ee00000002crts6700.lib : exit.obj (.cinit)10001f0c00000004--HOLE-- [fill = 0]10001f100000001c: _lock.obj (.cinit)10001f2c00000004--HOLE-- [fill = 0]10001f3000000011led.obj (.cinit)10001f4100000007--HOLE-- [fill = 0]10001f4800000004(.pad.cinit) [fill = 0].text09000040000001240RUN ADDR = 1000040090000400000006a0dec672x.obj (.text)90000aa000000360csl_C6722.lib : csl_emifHwSetup.o (.text:csl_section:emif)90000e0000000240rts6700.lib : memcpy62.obj (.text:_memcpy)9000104000000140: exit.obj (.text:_exit)9000118000000120: autoinit.obj (.text:__auto_init)900012a000000100csl_C6722.lib : csl_emifOpen.o (.text:csl_section:emif)900013a0000000e0led.obj (.text)9000148000000080rts6700.lib : boot.obj (.text:_c_int00)9000150000000060csl_C6722.lib : csl_emifGetBaseAddress.o (.text:csl_section:emif)9000156000000040rts6700.lib : args_main.obj (.text:__args_main)900015a000000020: _lock.obj (.text:__nop)900015c000000020: exit.obj (.text:_abort)900015e000000020csl_C6722.lib : csl_emifClose.o (.text:csl_section:emif)9000160000000020: csl_emifInit.o (.text:csl_section:emif)9000162000000020: csl_sysinit.o (.text:csl_section:sysInit)GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Nameaddressname ------------ 10000400$bss 10000400.bss 10000400.data 10000400.text 100015c0C$$EXIT 100015e0_CSL_emifClose 10001500_CSL_emifGetBaseAddress 10000aa0_CSL_emifHwSetup 10001600_CSL_emifInit 100012a0_CSL_emifOpen 10001620_CSL_sysInit 10000400_DEC672X_cpld_rget 10000444_DEC672X_cpld_rset 10000494_DEC672X_wait 10000510_FlashEnable 100007cc_InitEmif 100005b0_InitPll 10001ecc_LedCode 00000800__STACK_SIZE ffffffff___TI_pprof_out_hndl ffffffff___TI_prof_data_size ffffffff___TI_prof_data_start ffffffff___binit__ 10000400___bss__ ffffffff___c_args__ 10001ee0___cinit__ 10000400___data__ 10000400___edata__ 10000400___end__ 10001640___etext__ ffffffff___pinit__ 10000400___text__ 10001560__args_main 10001180__auto_init 10001ec4__cleanup_ptr 10001ec8__dtors_ptr 10001ed8__lock 100015a0__nop 10001640__stack 10001edc__unlock 100015c0_abort 10001480_c_int00 10001040_exit 100013a0_main 10000e00_memcpy ffffffffbinit 10001ee0cinit 10000400edata 10000400end 10001640etext ffffffffpinitGLOBAL SYMBOLS: SORTED BY Symbol Addressaddressname ------------ 00000800__STACK_SIZE 10000400$bss 10000400.bss 10000400.data 10000400.text 10000400_DEC672X_cpld_rget 10000400___bss__ 10000400___data__ 10000400___edata__ 10000400___end__ 10000400___text__ 10000400edata 10000400end 10000444_DEC672X_cpld_rset 10000494_DEC672X_wait 10000510_FlashEnable 100005b0_InitPll 100007cc_InitEmif 10000aa0_CSL_emifHwSetup 10000e00_memcpy 10001040_exit 10001180__auto_init 100012a0_CSL_emifOpen 100013a0_main 10001480_c_int00 10001500_CSL_emifGetBaseAddress 10001560__args_main 100015a0__nop 100015c0C$$EXIT 100015c0_abort 100015e0_CSL_emifClose 10001600_CSL_emifInit 10001620_CSL_sysInit 10001640___etext__ 10001640__stack 10001640etext 10001ec4__cleanup_ptr 10001ec8__dtors_ptr 10001ecc_LedCode 10001ed8__lock 10001edc__unlock 10001ee0___cinit__ 10001ee0cinit ffffffff___TI_pprof_out_hndl ffffffff___TI_prof_data_size ffffffff___TI_prof_data_start ffffffff___binit__ ffffffff___c_args__ ffffffff___pinit__ ffffffffbinit ffffffffpinit[51 symbols]
hang SU:
回复 Shine:
CMD文件代码:MEMORY {BOOT_RAM :o = 10000000hl = 00000400hRAM:o = 10000400hl = 00020000hSDRAM:o = 80000000hl = 08000000hFLASH_BOOT:o = 90000000hl = 00000400hFLASH_REST:o = 90000400hl = 0001fc00h}SECTIONS {.boot_load:load = FLASH_BOOT,run = BOOT_RAM.text:load = FLASH_REST,run = RAM.stack>RAM.bss>RAM.cinit>RAM.pinit>RAM.cio>RAM.const>RAM.data>RAM.switch>RAM.sysmem>RAM.far>RAM}