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.

自定义 段



我自定义一个段

      #pragma CODE_SECTION(led1,"p1");

void led1(void)
{
Uint16 a=0;
a++;
 GpioDataRegs.GPADAT.bit.GPIO0=0;

}        
cmd 文件是这样的(部分)
  ramfuncs            : LOAD = FLASHA,
                         RUN = PRAML0,
                         LOAD_START(_RamfuncsLoadStart),
                         LOAD_END(_RamfuncsLoadEnd),
                         RUN_START(_RamfuncsRunStart),
                         PAGE = 0

 /* p1                 : > FLASHC       PAGE = 0  */

   p1                : LOAD = FLASHC,
                       RUN = FLASHC,
                       LOAD_START(_p1_LoadStart),
                       LOAD_END(_p1_LoadEnd),
                       RUN_START(_p1_RunStart),
                       PAGE = 0
编译时通过的 但是运行出错;如果把cmd 改为
  p1                 : > FLASHC       PAGE = 0 

  /*   p1                : LOAD = FLASHC,
                       RUN = FLASHC,
                       LOAD_START(_p1_LoadStart),
                       LOAD_END(_p1_LoadEnd),
                       RUN_START(_p1_RunStart),
                       PAGE = 0
  */
运行就正确。 我想把 p1  copy到 ram运行,怎么弄?
                            
  • ZAIWU,

    你把p1 load 在FLASHC,但是还run在FLASHC就错了。

     p1                : LOAD = FLASHC,                    

        RUN = PRAML0,                    

        LOAD_START(_p1_LoadStart),                   

         LOAD_END(_p1_LoadEnd),                       

     RUN_START(_p1_RunStart),                      

      PAGE = 0

    记得跟ramfuc一样,要声明p1_LoadStart,p1_LoadEnd, p1_RunStart等外部变量,然后在main中调用memcpy函数。

    Eric