summaryrefslogtreecommitdiff
path: root/firmware/target/sh
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/sh')
-rw-r--r--firmware/target/sh/archos/app.lds22
-rw-r--r--firmware/target/sh/crt0.S23
2 files changed, 24 insertions, 21 deletions
diff --git a/firmware/target/sh/archos/app.lds b/firmware/target/sh/archos/app.lds
index 02ed6bef77..225f11f705 100644
--- a/firmware/target/sh/archos/app.lds
+++ b/firmware/target/sh/archos/app.lds
@@ -90,6 +90,7 @@ SECTIONS
90 } > IRAM AT> DRAM 90 } > IRAM AT> DRAM
91 91
92 _iramcopy = LOADADDR(.iram); 92 _iramcopy = LOADADDR(.iram);
93 _noloaddram = LOADADDR(.iram);
93 94
94 .ibss (NOLOAD) : 95 .ibss (NOLOAD) :
95 { 96 {
@@ -98,18 +99,16 @@ SECTIONS
98 . = ALIGN(0x4); 99 . = ALIGN(0x4);
99 _iend = .; 100 _iend = .;
100 } > IRAM 101 } > IRAM
101 102
102 /* TRICK ALERT! We want 0x2000 bytes of stack, but we set the section 103 .stack _noloaddram (NOLOAD) :
103 size smaller, and allow the stack to grow into the .iram copy */
104 .stack ADDR(.data) + SIZEOF(.data) + SIZEOF(.iram):
105 { 104 {
106 *(.stack) 105 *(.stack)
107 _stackbegin = . - SIZEOF(.iram); 106 _stackbegin = .;
108 . += 0x2000 - SIZEOF(.iram); 107 . += 0x2000;
109 _stackend = .; 108 _stackend = .;
110 } > DRAM 109 } > DRAM
111 110
112 .bss : 111 .bss (NOLOAD) :
113 { 112 {
114 _edata = .; 113 _edata = .;
115 *(.bss*) 114 *(.bss*)
@@ -118,25 +117,26 @@ SECTIONS
118 _end = .; 117 _end = .;
119 } > DRAM 118 } > DRAM
120 119
121 .audiobuf ALIGN(4) : 120 .audiobuf (NOLOAD) :
122 { 121 {
122 . = ALIGN(4);
123 _audiobuffer = .; 123 _audiobuffer = .;
124 audiobuffer = .; 124 audiobuffer = .;
125 } > DRAM 125 } > DRAM
126 126
127 .audiobufend ENDAUDIOADDR: 127 .audiobufend ENDAUDIOADDR (NOLOAD) :
128 { 128 {
129 audiobufend = .; 129 audiobufend = .;
130 _audiobufend = .; 130 _audiobufend = .;
131 } > DRAM 131 } > DRAM
132 132
133 .codec ENDAUDIOADDR: 133 .codec ENDAUDIOADDR (NOLOAD) :
134 { 134 {
135 codecbuf = .; 135 codecbuf = .;
136 _codecbuf = .; 136 _codecbuf = .;
137 } 137 }
138 138
139 .plugin ENDADDR: 139 .plugin ENDADDR (NOLOAD) :
140 { 140 {
141 _pluginbuf = .; 141 _pluginbuf = .;
142 pluginbuf = .; 142 pluginbuf = .;
diff --git a/firmware/target/sh/crt0.S b/firmware/target/sh/crt0.S
index a87bee899f..0e8bbfdd68 100644
--- a/firmware/target/sh/crt0.S
+++ b/firmware/target/sh/crt0.S
@@ -98,16 +98,8 @@ start:
98 mov #0,r0 98 mov #0,r0
99 ldc r0,gbr 99 ldc r0,gbr
100 100
101 /* zero out .ibss */ 101 /* .iram copy is done first since it is reclaimed for other
102 mov.l .iedata_k,r0 102 * uninitialized sections */
103 mov.l .iend_k,r1
104 bra .iedatastart
105 mov #0,r2
106.iedataloop: /* backwards is faster and shorter */
107 mov.l r2,@-r1
108.iedatastart:
109 cmp/hi r0,r1
110 bt .iedataloop
111 103
112 /* copy the .iram section */ 104 /* copy the .iram section */
113 mov.l .iramcopy_k,r0 105 mov.l .iramcopy_k,r0
@@ -127,6 +119,17 @@ start:
127 bt .iramloop 119 bt .iramloop
128.noiramcopy: 120.noiramcopy:
129 121
122 /* zero out .ibss */
123 mov.l .iedata_k,r0
124 mov.l .iend_k,r1
125 bra .iedatastart
126 mov #0,r2
127.iedataloop: /* backwards is faster and shorter */
128 mov.l r2,@-r1
129.iedatastart:
130 cmp/hi r0,r1
131 bt .iedataloop
132
130 /* zero out bss */ 133 /* zero out bss */
131 mov.l .edata_k,r0 134 mov.l .edata_k,r0
132 mov.l .end_k,r1 135 mov.l .end_k,r1