From 54f084e84f86a64e94b20b4a025f4aedfb390cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Rivi=C3=A8re?= Date: Wed, 7 Nov 2012 19:17:10 +0000 Subject: [PATCH] Moved *_before_copy labels in a separate paragraph. --- bas.lk.in | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bas.lk.in b/bas.lk.in index 67d0114..f294a49 100644 --- a/bas.lk.in +++ b/bas.lk.in @@ -75,8 +75,6 @@ SECTIONS { #endif } > flash -#define BAS_LABEL_LMA(x) ((x) + (ABSOLUTE(__BAS_LMA) - ABSOLUTE(__BAS_VMA))) - .bas _Bas_base : AT (ADDR(.text) + SIZEOF(.text)) { objs/BaS.o(.text) @@ -84,10 +82,7 @@ SECTIONS { objs/sd_card_asm.o(.text) objs/bas_printf.o(.text) objs/printf_helper.o(.text) - _xprintf_before_copy = BAS_LABEL_LMA(_xprintf); - _display_progress_before_copy = BAS_LABEL_LMA(_display_progress); objs/cache.o(.text) - _flush_and_invalidate_caches_before_copy = BAS_LABEL_LMA(_flush_and_invalidate_caches); objs/sd_card.o(.text) objs/mmu.o(.text) objs/exceptions.o(.text) @@ -104,4 +99,14 @@ SECTIONS { __BAS_LMA = LOADADDR(.bas); __BAS_VMA = ADDR(.bas); __BAS_SIZE = SIZEOF(.bas); + + /* The following labels are BaS routines in the flash, + * before they are copied to their final location in the RAM. + * This is to allow using them before and after the actual copy. + * Hence they must contain only pc-relative code (compiled with -mpcrel). + */ +#define BAS_LABEL_LMA(x) ((x) + (ABSOLUTE(__BAS_LMA) - ABSOLUTE(__BAS_VMA))) + _xprintf_before_copy = BAS_LABEL_LMA(_xprintf); + _display_progress_before_copy = BAS_LABEL_LMA(_display_progress); + _flush_and_invalidate_caches_before_copy = BAS_LABEL_LMA(_flush_and_invalidate_caches); }