diff --git a/bas.lk.in b/bas.lk.in index 5defd63..bd443a0 100644 --- a/bas.lk.in +++ b/bas.lk.in @@ -21,10 +21,10 @@ SECTIONS { /* FastRAM */ __FASTRAM = 0x10000000; - __FASTRAM_END = _Bas_base; + __FASTRAM_END = __BAS_IN_RAM; /* BaS */ - _Bas_base = 0x1FE00000; + __BAS_IN_RAM = 0x1FE00000; /* Flash components */ __FIRETOS = 0xe0400000; @@ -86,7 +86,7 @@ SECTIONS { #endif } > flash - .bas _Bas_base : + .bas __BAS_IN_RAM : /* The BaS is stored in the flash, just after the init part. * Then it will be copied to its final location in the RAM. * This data must be aligned for optimal copy loop speed. @@ -115,7 +115,6 @@ SECTIONS { } > ram __BAS_LMA = LOADADDR(.bas); - __BAS_VMA = ADDR(.bas); __BAS_SIZE = SIZEOF(.bas); /* The following labels are BaS routines in the flash, @@ -123,7 +122,7 @@ SECTIONS { * 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) + (__BAS_LMA - __BAS_VMA)) +#define BAS_LABEL_LMA(x) ((x) + (__BAS_LMA - __BAS_IN_RAM)) _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); diff --git a/sources/BaS.c b/sources/BaS.c index 5eba248..3a93e37 100644 --- a/sources/BaS.c +++ b/sources/BaS.c @@ -10,8 +10,6 @@ #include "cache.h" #include "bas_printf.h" -extern uint32_t Bas_base[]; - /* imported routines */ extern int mmu_init(); extern int vec_init(); @@ -28,6 +26,8 @@ extern uint8_t _STRAM_END[]; #define STRAM_END ((uint32_t)_STRAM_END) extern uint8_t _TOS[]; #define TOS ((uint32_t)_TOS) /* final TOS location */ +extern uint8_t _FASTRAM_END[]; +#define FASTRAM_END ((uint32_t)_FASTRAM_END) extern uint8_t _EMUTOS[]; #define EMUTOS ((uint32_t)_EMUTOS) /* where EmuTOS is stored in flash */ extern uint8_t _EMUTOS_SIZE[]; @@ -171,7 +171,7 @@ void BaS(void) /* TT-RAM */ - * (uint32_t *) 0x5a4 = (uint32_t) Bas_base; /* ramtop TOS system variable */ + * (uint32_t *) 0x5a4 = (uint32_t) FASTRAM_END; /* ramtop TOS system variable */ * (uint32_t *) 0x5a8 = 0x1357bd13; /* ramvalid TOS system variable */ xprintf("init ACIA: "); diff --git a/sources/sysinit.c b/sources/sysinit.c index 4ad22e9..b5edd8f 100644 --- a/sources/sysinit.c +++ b/sources/sysinit.c @@ -756,8 +756,8 @@ extern uint8_t _FIRETOS[]; extern uint8_t _BAS_LMA[]; #define BAS_LMA ((uint32_t)_BAS_LMA) /* where the BaS is stored in flash */ -extern uint8_t _BAS_VMA[]; -#define BAS_VMA ((uint32_t)_BAS_VMA) /* where the BaS is run in RAM */ +extern uint8_t _BAS_IN_RAM[]; +#define BAS_IN_RAM ((uint32_t)_BAS_IN_RAM) /* where the BaS is run in RAM */ extern uint8_t _BAS_SIZE[]; #define BAS_SIZE ((uint32_t)_BAS_SIZE) /* size of the BaS, in bytes */ @@ -808,7 +808,7 @@ void initialize_hardware(void) { /* copy the BaS code contained in flash to its final location */ src = (uint32_t *)BAS_LMA; end = (uint32_t *)(BAS_LMA + BAS_SIZE); - dst = jmp = (uint32_t *)BAS_VMA; + dst = jmp = (uint32_t *)BAS_IN_RAM; /* The linker script will ensure that the Bas size * is a multiple of the following.