diff --git a/Makefile b/Makefile index b384b3e..dd2202e 100644 --- a/Makefile +++ b/Makefile @@ -99,6 +99,8 @@ $(OBJDIR)/init_fpga.o: CFLAGS += -mbitfield # compile printf pc-relative so it can be used as well before and after copy of BaS $(OBJDIR)/printf.o: CFLAGS += -mpcrel +# the same for flush_and_invalidate_cache() +$(OBJDIR)/cache.c: CFLAGS += -mpcrel $(OBJDIR)/%.o:$(SRCDIR)/%.c $(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@ diff --git a/bas.lk.in b/bas.lk.in index 7e7a5a3..0ad968e 100644 --- a/bas.lk.in +++ b/bas.lk.in @@ -68,7 +68,6 @@ SECTIONS { objs/startcf.o(.text) /* this one is the entry point so it must be the first */ objs/sysinit.o(.text) objs/init_fpga.o(.text) - objs/cache.o(.text) #if (FORMAT == elf32-m68k) *(.rodata) *(.rodata.*) @@ -85,6 +84,8 @@ SECTIONS { objs/printf_helper.o(.text) _xprintf_before_copy = _xprintf - (_BaS - LOADADDR(.bas)); _display_progress_before_copy = _display_progress - (_BaS - LOADADDR(.bas)); + objs/cache.o(.text) + _flush_and_invalidate_caches_before_copy = _flush_and_invalidate_caches - (_BaS - LOADADDR(.bas)); objs/sd_card.o(.text) objs/mmu.o(.text) objs/exceptions.o(.text) diff --git a/sources/sysinit.c b/sources/sysinit.c index 4d59483..673360a 100644 --- a/sources/sysinit.c +++ b/sources/sysinit.c @@ -14,6 +14,8 @@ extern void xprintf_before_copy(const char *fmt, ...); #define xprintf xprintf_before_copy +extern void flush_and_invalidate_caches_before_copy(void); +#define flush_and_invalidate_caches flush_and_invalidate_caches_before_copy #define UNUSED(x) (void)(x) /* Unused variable */