aboutsummaryrefslogtreecommitdiffstats
path: root/wirish
diff options
context:
space:
mode:
Diffstat (limited to 'wirish')
-rw-r--r--wirish/start.S6
-rw-r--r--wirish/start_c.c13
2 files changed, 10 insertions, 9 deletions
diff --git a/wirish/start.S b/wirish/start.S
index 2488895..8b181aa 100644
--- a/wirish/start.S
+++ b/wirish/start.S
@@ -44,9 +44,9 @@
.code 16
.thumb_func
- .globl _start
- .type _start, %function
-_start:
+ .globl __start__
+ .type __start__, %function
+__start__:
.fnstart
ldr r1,=__msp_init
mov sp,r1
diff --git a/wirish/start_c.c b/wirish/start_c.c
index 301565c..655fefb 100644
--- a/wirish/start_c.c
+++ b/wirish/start_c.c
@@ -50,8 +50,9 @@ extern int main(int, char**, char**);
extern void exit(int) __attribute__((noreturn, weak));
-extern char _data, _edata;
-extern char _bss, _ebss;
+/* The linker must ensure that these are at least 4-byte aligned. */
+extern char __data_start__, __data_end__;
+extern char __bss_start__, __bss_end__;
struct rom_img_cfg {
int *img_start;
@@ -62,20 +63,20 @@ extern char _lm_rom_img_cfgp;
void __attribute__((noreturn)) start_c(void) {
struct rom_img_cfg *img_cfg = (struct rom_img_cfg*)&_lm_rom_img_cfgp;
int *src = img_cfg->img_start;
- int *dst = (int*)&_data;
+ int *dst = (int*)&__data_start__;
int exit_code;
/* Initialize .data, if necessary. */
if (src != dst) {
- int *end = (int*)&_edata;
+ int *end = (int*)&__data_end__;
while (dst < end) {
*dst++ = *src++;
}
}
/* Zero .bss. */
- dst = (int*)&_bss;
- while (dst < (int*)&_ebss) {
+ dst = (int*)&__bss_start__;
+ while (dst < (int*)&__bss_end__) {
*dst++ = 0;
}