MDK scatter file, define the external SDRAM becomes zero

 

1.sct file

LR_IROM1 0x08000000 0x00100000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00100000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
  
  
  RW_IRAM1 0x24000000 0x00080000  {  ; 内部SRAM
	.ANY (+RW +ZI)			;其余的RW/ZI-data都分配到这里
  }
  
  RW_ERAM1 0xD0000000 0x04000000 {  ; 外部sdram
   *.o(HEAP)            	;堆     *.o(stack) 栈
   .ANY (EXRAM)			;选择外部节区,新增的节节区
  }
}

In the run field, add the * .o (HEAP); heap * .o (stack) stack

 

2. After sct in the new section area, change the use of zero

//设置变量定义到“EXRAM”节区的宏
#define __EXRAM  __attribute__ ((section ("EXRAM")))
//定义变量到SDRAM
uint32_t testValue __EXRAM =7 ;
//上述语句等效于:
//uint32_t testValue  __attribute__ ((section ("EXRAM"))) =7 ;

//定义变量到SRAM
uint32_t testValue2  =7 ;

//定义数组到SDRAM
uint8_t testGrup[3] __EXRAM ={1,2,3};
//uint8_t testGrup[3] __EXRAM ;    也可以不初始化
//定义数组到SRAM
uint8_t testGrup2[3] ={1,2,3};

__EXRAM = back to the initialized value

3. Place a file in either one of the variable region

RW_IRAM2 0x10000000 0x00010000  {
  main.o  (+RW +ZI)
  
  queue.o (+RW +ZI)
  tasks.o (+RW +ZI)
 
  ; 
}

 

Released six original articles · won praise 0 · Views 513

Guess you like

Origin blog.csdn.net/qq_34492122/article/details/104874628