diff options
Diffstat (limited to 'firmware/target/arm/rk27xx')
-rw-r--r-- | firmware/target/arm/rk27xx/app.lds | 35 | ||||
-rw-r--r-- | firmware/target/arm/rk27xx/crt0.S | 14 |
2 files changed, 40 insertions, 9 deletions
diff --git a/firmware/target/arm/rk27xx/app.lds b/firmware/target/arm/rk27xx/app.lds index 1675da491c..fb2cc54db6 100644 --- a/firmware/target/arm/rk27xx/app.lds +++ b/firmware/target/arm/rk27xx/app.lds | |||
@@ -22,6 +22,10 @@ STARTUP(target/arm/rk27xx/crt0.o) | |||
22 | #define ENDAUDIOADDR (DRAMORIG + DRAMSIZE) | 22 | #define ENDAUDIOADDR (DRAMORIG + DRAMSIZE) |
23 | #define CODECORIG (ENDAUDIOADDR) | 23 | #define CODECORIG (ENDAUDIOADDR) |
24 | 24 | ||
25 | /* .init is copied to codec buffer */ | ||
26 | #define INITORIG CODECORIG | ||
27 | #define INITSIZE CODECSIZE | ||
28 | |||
25 | /* Where the codec buffer ends, and the plugin buffer starts */ | 29 | /* Where the codec buffer ends, and the plugin buffer starts */ |
26 | #define ENDADDR (ENDAUDIOADDR + CODECSIZE) | 30 | #define ENDADDR (ENDAUDIOADDR + CODECSIZE) |
27 | 31 | ||
@@ -29,21 +33,14 @@ MEMORY | |||
29 | { | 33 | { |
30 | DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE | 34 | DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE |
31 | IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE | 35 | IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE |
36 | INIT : ORIGIN = INITORIG, LENGTH = INITSIZE | ||
32 | } | 37 | } |
33 | 38 | ||
34 | SECTIONS | 39 | SECTIONS |
35 | { | 40 | { |
36 | loadaddress = DRAMORIG; | 41 | loadaddress = DRAMORIG; |
37 | 42 | ||
38 | .intvect : { | ||
39 | _intvectstart = . ; | ||
40 | KEEP(*(.intvect)) | ||
41 | _intvectend = . ; | ||
42 | } > IRAM AT > DRAM | ||
43 | _intvectcopy = LOADADDR(.intvect); | ||
44 | |||
45 | .text : { | 43 | .text : { |
46 | *(.init.text) | ||
47 | *(.text*) | 44 | *(.text*) |
48 | *(.icode*) | 45 | *(.icode*) |
49 | *(.glue_7*) | 46 | *(.glue_7*) |
@@ -61,7 +58,27 @@ SECTIONS | |||
61 | . = ALIGN(0x4); | 58 | . = ALIGN(0x4); |
62 | } > DRAM | 59 | } > DRAM |
63 | 60 | ||
64 | .stack (NOLOAD) : | 61 | /* NOLOAD sections at end start here. Any part of the binary image past |
62 | * this point is discarded or copied elsewhere. */ | ||
63 | _noloaddram = .; | ||
64 | |||
65 | .intvect : { | ||
66 | _intvectstart = . ; | ||
67 | KEEP(*(.intvect)) | ||
68 | _intvectend = . ; | ||
69 | } > IRAM AT > DRAM | ||
70 | _intvectcopy = LOADADDR(.intvect); | ||
71 | |||
72 | .init : { | ||
73 | . = ALIGN(4); | ||
74 | _initstart = .; | ||
75 | *(.init*) | ||
76 | *(.initdata*) | ||
77 | _initend = .; | ||
78 | } > INIT AT > DRAM | ||
79 | _initcopy = LOADADDR(.init); | ||
80 | |||
81 | .stack _noloaddram (NOLOAD) : | ||
65 | { | 82 | { |
66 | *(.stack) | 83 | *(.stack) |
67 | _stackbegin = .; | 84 | _stackbegin = .; |
diff --git a/firmware/target/arm/rk27xx/crt0.S b/firmware/target/arm/rk27xx/crt0.S index 2a6b2cc329..fb5f02dbdc 100644 --- a/firmware/target/arm/rk27xx/crt0.S +++ b/firmware/target/arm/rk27xx/crt0.S | |||
@@ -149,6 +149,20 @@ entry_point: | |||
149 | strhi r1, [r2], #4 | 149 | strhi r1, [r2], #4 |
150 | bhi 1b | 150 | bhi 1b |
151 | 151 | ||
152 | #ifdef HAVE_INIT_ATTR | ||
153 | /* Copy init section to the codec buffer | ||
154 | * before .bss zeroing | ||
155 | */ | ||
156 | ldr r2, =_initstart | ||
157 | ldr r3, =_initend | ||
158 | ldr r4, =_initcopy | ||
159 | 1: | ||
160 | cmp r3, r2 | ||
161 | ldrhi r1, [r4], #4 | ||
162 | strhi r1, [r2], #4 | ||
163 | bhi 1b | ||
164 | #endif | ||
165 | |||
152 | /* Initialise bss, ibss section to zero */ | 166 | /* Initialise bss, ibss section to zero */ |
153 | ldr r2, =_edata | 167 | ldr r2, =_edata |
154 | ldr r3, =_end | 168 | ldr r3, =_end |