This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS中,#pragma CODE_SECTION(boot,".bootload")语句不起作用



所用版本为CCS3.3.83;程序编译通过,但是load后(未运行)发现该语句没有起到任何效果。

CMD文件已经修改。
在做bootloader时用C语言(非汇编)直接写的程序,拿来用,结果发现#pragma CODE_SECTION(boot,".bootload")语句不起作用,未能够达到预期的分配效果。

所用版本为CCS3.3.83,程序编译能够通过,但是load后(未运行)发现该语句没有起到任何效果,boot()函数未被分配到boot函数代码段空间。

请各位专业人士指教问题原因
另:使用CCS3.3.38编译正常,代码段分配正常
  • 你到.map文件里看一下.bootload段有没有分配到指定的段?

  • .map文件中,boot_ram段占用量为零

  • 能把相关的code_section代码和cmd文件贴出来么?

  • 换回低版本了,现在编译正常了,.map文件编译后被覆盖了,当时的存储空间占用就是上图的那个情况

  • 谢谢分享解决办法!

  • 在另一台上装了一下,编译后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 int   addr; 
        register unsigned int   boot_ep; 
        register unsigned int   boot_cnt; 
      	register char	  page;
    
      	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 2015
    
    OUTPUT FILE NAME:   <./Debug/led.out>
    ENTRY POINT SYMBOL: "_c_int00"  address: 10001480
    
    
    MEMORY CONFIGURATION
    
             name            origin    length      used     unused   attr    fill
    ----------------------  --------  ---------  --------  --------  ----  --------
      BOOT_RAM 10000000 00000400 00000000 00000400 RWIX   RAM                   10000400   00020000  00001b4c  0001e4b4  RWIX
      SDRAM                 80000000   08000000  00000000  08000000  RWIX
      FLASH_BOOT            90000000   00000400  00000000  00000400  RWIX
      FLASH_REST            90000400   0001fc00  00001240  0001e9c0  RWIX
    
    
    SECTION ALLOCATION MAP
    
     output                                  attributes/
    section   page    origin      length       input sections
    --------  ----  ----------  ----------   ----------------
    .pinit     0    10000400    00000000     UNINITIALIZED
    
    .bss       0    10000400    00000000     UNINITIALIZED
    
    .data      0    10000400    00000000     UNINITIALIZED
    
    .stack     0    10001640    00000800     UNINITIALIZED
                      10001640    00000008     rts6700.lib : boot.obj (.stack)
                      10001648    000007f8     --HOLE--
    
    .far       0    10001e40    000000a0     UNINITIALIZED
                      10001e40    0000008c     rts6700.lib : exit.obj (.far)
                      10001ecc    00000009     led.obj (.far)
                      10001ed5    00000003     --HOLE--
                      10001ed8    00000008     rts6700.lib : _lock.obj (.far)
    
    .cinit     0    10001ee0    0000006c     
                      10001ee0    0000002c     rts6700.lib : exit.obj (.cinit)
                      10001f0c    00000004     --HOLE-- [fill = 0]
                      10001f10    0000001c                 : _lock.obj (.cinit)
                      10001f2c    00000004     --HOLE-- [fill = 0]
                      10001f30    00000011     led.obj (.cinit)
                      10001f41    00000007     --HOLE-- [fill = 0]
                      10001f48    00000004     (.pad.cinit) [fill = 0]
    
    .text      0    90000400    00001240     RUN ADDR = 10000400
                      90000400    000006a0     dec672x.obj (.text)
                      90000aa0    00000360     csl_C6722.lib : csl_emifHwSetup.o (.text:csl_section:emif)
                      90000e00    00000240     rts6700.lib : memcpy62.obj (.text:_memcpy)
                      90001040    00000140                 : exit.obj (.text:_exit)
                      90001180    00000120                 : autoinit.obj (.text:__auto_init)
                      900012a0    00000100     csl_C6722.lib : csl_emifOpen.o (.text:csl_section:emif)
                      900013a0    000000e0     led.obj (.text)
                      90001480    00000080     rts6700.lib : boot.obj (.text:_c_int00)
                      90001500    00000060     csl_C6722.lib : csl_emifGetBaseAddress.o (.text:csl_section:emif)
                      90001560    00000040     rts6700.lib : args_main.obj (.text:__args_main)
                      900015a0    00000020                 : _lock.obj (.text:__nop)
                      900015c0    00000020                 : exit.obj (.text:_abort)
                      900015e0    00000020     csl_C6722.lib : csl_emifClose.o (.text:csl_section:emif)
                      90001600    00000020                   : csl_emifInit.o (.text:csl_section:emif)
                      90001620    00000020                   : csl_sysinit.o (.text:csl_section:sysInit)
    
    
    GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name 
    
    address    name
    --------   ----
    10000400   $bss
    10000400   .bss
    10000400   .data
    10000400   .text
    100015c0   C$$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
    ffffffff   binit
    10001ee0   cinit
    10000400   edata
    10000400   end
    10001640   etext
    ffffffff   pinit
    
    
    GLOBAL SYMBOLS: SORTED BY Symbol Address 
    
    address    name
    --------   ----
    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__
    10000400   edata
    10000400   end
    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
    100015c0   C$$EXIT
    100015c0   _abort
    100015e0   _CSL_emifClose
    10001600   _CSL_emifInit
    10001620   _CSL_sysInit
    10001640   ___etext__
    10001640   __stack
    10001640   etext
    10001ec4   __cleanup_ptr
    10001ec8   __dtors_ptr
    10001ecc   _LedCode
    10001ed8   __lock
    10001edc   __unlock
    10001ee0   ___cinit__
    10001ee0   cinit
    ffffffff   ___TI_pprof_out_hndl
    ffffffff   ___TI_prof_data_size
    ffffffff   ___TI_prof_data_start
    ffffffff   ___binit__
    ffffffff   ___c_args__
    ffffffff   ___pinit__
    ffffffff   binit
    ffffffff   pinit
    
    [51 symbols]
    


     

  • CMD文件代码:
    MEMORY
    {
        BOOT_RAM :       o = 10000000h   l = 00000400h
        RAM:             o = 10000400h   l = 00020000h
        SDRAM:           o = 80000000h   l = 08000000h
        FLASH_BOOT:	     o = 90000000h   l = 00000400h
        FLASH_REST:	     o = 90000400h   l = 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
    
                                  
    }