我希望自定義user section .dlm,並將dlm section的內容放到DLM中
sag 內容如下:
Code:
USER_SECTIONS .ilm, .dlm
BINARY_PART1 0x00000000 0x00010000
{
ILM 0x00000000 0x00010000
{
VAR _ILM_BASE = 0x00000000 ; ILM base address
VAR _ILM_SIZE = 0x00010000 ; 64Kb
LOADADDR __ilm_lmastart
ADDR __ilm_start
* (.nds32_init)
* (.ilm) ; functions to be put in ILM
LOADADDR __ilm_lmaend
ADDR __ilm_end
}
}
BINARY_PART2 0x00010000 0x00100000
{
FLASH +0x0
{
* (.text) ; program
* (+RO) ; const global variables
}
SRAM 0x08000000 0x00010000
{
LOADADDR __lma_start_data
ADDR __start_data
* (+RW) ; initialized global variables
ADDR __end_data
ADDR __start_bss
* (+ZI) ; uninitialized global variables
ADDR __end_bss
STACK = 0x08010000
}
DLM 0x08010000 0x00010000
{
VAR _DLM_BASE = 0x08010000 ; DLM base address
VAR _DLM_SIZE = 0x00010000 ; 64Kb
LOADADDR __dlm_lmastart
ADDR __dlm_start
* (.dlm) ; data to be put in DLM
LOADADDR __dlm_lmaend
ADDR __dlm_end
}
}
在其中一個source file定義dlm variable
Code:
extern unsigned int TIMER_BASE[4] __attribute__((section(".dlm")));
extern unsigned int PWM_BASE[1] __attribute__((section(".dlm")));
extern unsigned int UART_BASE[2] __attribute__((section(".dlm")));
extern unsigned int SPI_BASE[2] __attribute__((section(".dlm")));
extern unsigned int I2C_BASE[3] __attribute__((section(".dlm")));
extern unsigned int DDC_BASE[3] __attribute__((section(".dlm")));
但在linking時出現錯誤
Code:
section .dlm [00011c14 -> 00011c4f] overlaps section .data1 [00011c14 -> 00011c17]
map.txt內容為
Code:
.dlm 0x08000138 0x3c load address 0x00011c14
.dlm 0x08000138 0x3c ./codebase/main.o
0x0800014c UART_BASE
0x08000168 DDC_BASE
0x08000148 PWM_BASE
0x08000138 TIMER_BASE
0x08000154 SPI_BASE
0x0800015c I2C_BASE
.data1 0x08000174 0x4 load address 0x00011c14
*(.data1)
0x08000178 . = ALIGN (0x8)
*fill* 0x08000174 0x4 00
請問是否sag有那邊寫錯?