Clean up BaS linker script symbols.
This commit is contained in:
4
bas.lk.S
4
bas.lk.S
@@ -70,7 +70,6 @@ SECTIONS {
|
|||||||
objs/supervisor.o(.text)
|
objs/supervisor.o(.text)
|
||||||
objs/ewf.o(.text)
|
objs/ewf.o(.text)
|
||||||
objs/illegal_instruction.o(.text)
|
objs/illegal_instruction.o(.text)
|
||||||
_bas = .;
|
|
||||||
} > flash
|
} > flash
|
||||||
|
|
||||||
.bas _Bas_base : AT (ADDR(.text) + SIZEOF(.text))
|
.bas _Bas_base : AT (ADDR(.text) + SIZEOF(.text))
|
||||||
@@ -79,4 +78,7 @@ SECTIONS {
|
|||||||
_bas_end = ABSOLUTE(.);
|
_bas_end = ABSOLUTE(.);
|
||||||
} > ram
|
} > ram
|
||||||
|
|
||||||
|
__BAS_LMA = LOADADDR(.bas);
|
||||||
|
__BAS_VMA = ADDR(.bas);
|
||||||
|
__BAS_SIZE = SIZEOF(.bas);
|
||||||
}
|
}
|
||||||
@@ -665,13 +665,21 @@ livo:
|
|||||||
uart_out_word(0x0a0d);
|
uart_out_word(0x0a0d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize_hardware(void) {
|
/* Symbols from the linker script */
|
||||||
extern uint32_t bas; /* source address to copy bas from (from linker script) FIXME: beware of possible alignment */
|
|
||||||
extern uint32_t bas_end; /* end of BaS code to copy (from linker script) */
|
|
||||||
extern uint32_t BaS; /* BaS routine to jump to after copy */
|
|
||||||
|
|
||||||
|
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_SIZE[];
|
||||||
|
#define BAS_SIZE ((uint32_t)_BAS_SIZE) /* size of the BaS, in bytes */
|
||||||
|
|
||||||
|
void initialize_hardware(void) {
|
||||||
/* used in copy loop */
|
/* used in copy loop */
|
||||||
uint32_t *src; /* src address to read from flash */
|
uint32_t *src; /* src address to read from flash */
|
||||||
|
uint32_t *end; /* end address to read from flash */
|
||||||
uint32_t *dst; /* destination address to copy to */
|
uint32_t *dst; /* destination address to copy to */
|
||||||
uint32_t *jmp; /* address of BaS() routine to jmp at after copy */
|
uint32_t *jmp; /* address of BaS() routine to jmp at after copy */
|
||||||
|
|
||||||
@@ -698,16 +706,18 @@ void initialize_hardware(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* copy the BaS code contained in flash to its final location */
|
/* copy the BaS code contained in flash to its final location */
|
||||||
src = (uint32_t *)&bas;
|
src = (uint32_t *)BAS_LMA;
|
||||||
dst = jmp = (uint32_t *)&BaS;
|
end = (uint32_t *)(BAS_LMA + BAS_SIZE);
|
||||||
|
dst = jmp = (uint32_t *)BAS_VMA;
|
||||||
|
|
||||||
|
/* FIXME: beware of possible alignment */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
} while (dst < &bas_end);
|
} while (src < end);
|
||||||
|
|
||||||
/* we have copied a code area, so flush the caches */
|
/* we have copied a code area, so flush the caches */
|
||||||
flush_and_invalidate_caches();
|
flush_and_invalidate_caches();
|
||||||
|
|||||||
Reference in New Issue
Block a user