diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2012-08-05 13:27:13 -0400 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2012-08-05 13:27:13 -0400 |
commit | d8830b1448809b84ed95047a90a6793d59527ca0 (patch) | |
tree | 019d860680b38b2e3ffc7c5f95b402a33fb31b22 /wirish | |
parent | 5b66935b6ec54d16b3536cf13d8fca53358d8777 (diff) | |
download | librambutan-d8830b1448809b84ed95047a90a6793d59527ca0.tar.gz librambutan-d8830b1448809b84ed95047a90a6793d59527ca0.zip |
Add support for ARM's GCC ARM embedded toolchain.
Based on patches provided by Hanspeter Portner:
http://forums.leaflabs.com/topic.php?id=1717#post-11812
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'wirish')
-rw-r--r-- | wirish/start.S | 6 | ||||
-rw-r--r-- | wirish/start_c.c | 13 |
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; } |