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.

关于cmd文件寄存器映射编写的问题



我可以自己编写cmd,将寄存器所映射的sram部分进行分配么?若可以有什么需要注意的地方?

下面这段代码是官方cmd以及源文件中对adcregs的寄存器的映射,我可以不按照官方的来进行自己的映射么?这样可以的话,我想去除我不用的寄存器的那些sram映射从而节省sram空间,可以么?

 #ifdef __cplusplus

  #pragma DATA_SECTION("AdcRegsFile")

  #else

  #pragma DATA_SECTION(AdcRegs,"AdcRegsFile");

  #endif

  volatile struct ADC_REGS AdcRegs; //使得结构体被分配在指定的段中

MEMORY

  {

  PAGE 0: /* Program Memory */

  /* 省略不相关内容的显示 */

  PAGE 1: /* Data Memory */

  /* 省略不相关内容的显示 */

  ADC : origin = 0x007100, length = 0x000020 /* ADC registers */

 SECTIONS

  {

  /* 省略不相关内容的显示 */

  AdcRegsFile : > ADC, PAGE = 1

  /* 省略不相关内容的显示 */

  }