Reprinted, please state the author and source-papaya-Hexun
; A total of three scattered loading files: mem_a.scf, mem_ B .scf, and mem_c.scf. The difference is that the loading address is different.
In debuginexram> arm linker> scatter, select scattered as the link type.
; Image entry point must be the same as the rom_load Value
; Rom_load is the name of the loading area, followed by 0x00000000 indicates the starting address of the loading area (StorageProgramCodeStarting address)
Rom_load 0x0
{
Rom_exec describes the address of the execution zone, which is defined at the first position.
Rom_exec 0x00000000
{
From the starting address, place the vector table (that is, startup. O (vectors, + first), where startup. O is the target file of startup. s)
; + First indicates that the vector segment is placed at the beginning
Startup. O (vectors, + first)
; then place other code (that is, * (+ RO). * is a wildcard, similar to the wildcard used for searching in the window.
* (+ RO)
}< br>; the starting address of the Variable Area Iram is 0x40000000
Iram 0x40000000
{< br>; place startup. O (mystacks)
startup. O (mystacks)
}< br>; + 0 indicates the next section, and uninit indicates that the initialization is not performed.
stacks_bottom + 0 uninit
{< br>; place area stackbottom, Data, noinit
startup. O (stackbottom)
}< br>; then, from 0x40004000, place area stacks, Data, noinit, uninit indicates no initialization
stacks 0x40004000 uninit
{< br> startup. O (stacks)
}< br>; External RAM starts from 0x80000000 as the variable zone
If the ram start address is not 0x8000 0000, modify the mem _. SCF file.
Eram 0x80000000
{
* (+ RW, + zi)
}
; + 0 indicates the next section, and uninit indicates that the initialization is not performed.
Heap + 0 uninit
{
; Place the heap bottom, area heap, Data, noinit
Startup. O (HEAP)
}
Then place the heap top in the external 0x80080000
; This address is the end address of the off-board RAM, which can be modified according to the actual situation.
Heap_bottom 0x80080000 uninit
{
Startup. O (heaptop)
}
}
; Redirection _ user_initial_stackheap Function
; Assign a new bottom_of_heap address, etc. The R0-R3 is a required return value of the function and returns the value of bottom_of_heap.
The description file is loaded discretely and its location is redirected. bottom_of_heap and so on have been defined as the data type in startup. S.
_ User_initial_stackheap
LDR r0, = bottom_of_heap
; LDR R1, = stackusr
LDR R2, = top_of_heap
LDR R3, = bottom_of_stacks
MoV PC, LR
;ArticleSource: http://www.diybl.com/course/3_program/rg/200865/122670.html