Merge pull request #31 from mithro/bios-fix

Couple of small fixes.
This commit is contained in:
enjoy-digital 2017-10-07 08:46:38 +02:00 committed by GitHub
commit eecd6a156e
5 changed files with 20 additions and 6 deletions

View File

@ -17,7 +17,10 @@ class GenericProgrammer:
fullname = os.path.join(fulldir, self.flash_proxy_basename)
if os.path.exists(fullname):
return fullname
raise OSError("Failed to find flash proxy bitstream")
raise OSError(
"Failed to find flash proxy bitstream %s, searched:\n %s\n" % (
self.flash_proxy_basename,
"\n ".join(self.flash_proxy_dirs)))
# must be overloaded by specific programmer
def load_bitstream(self, bitstream_file):

View File

@ -12,8 +12,8 @@ all: bios.bin
bios.elf: $(BIOS_DIRECTORY)/linker.ld $(OBJECTS)
%.elf:
$(LD) $(LDFLAGS) -T $< -N -o $@ \
%.elf: ../libbase/crt0-$(CPU).o ../libnet/libnet.a ../libbase/libbase-nofloat.a ../libcompiler_rt/libcompiler_rt.a
$(LD) $(LDFLAGS) -T $(BIOS_DIRECTORY)/linker.ld -N -o $@ \
../libbase/crt0-$(CPU).o \
$(OBJECTS) \
-L../libnet \

View File

@ -18,7 +18,7 @@ extern void boot_helper(unsigned int r1, unsigned int r2, unsigned int r3, unsig
static void __attribute__((noreturn)) boot(unsigned int r1, unsigned int r2, unsigned int r3, unsigned int addr)
{
printf("Executing booted program.\n");
printf("Executing booted program at 0x%08x\n", addr);
uart_sync();
irq_setmask(0);
irq_setie(0);

View File

@ -42,7 +42,7 @@ DEPFLAGS += -MD -MP
# Toolchain options
#
INCLUDES = -I$(SOC_DIRECTORY)/software/include/base -I$(SOC_DIRECTORY)/software/include -I$(SOC_DIRECTORY)/common -I$(BUILDINC_DIRECTORY)
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES)
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES)
CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
CXXFLAGS = $(COMMONFLAGS) -std=c++11 -I$(SOC_DIRECTORY)/software/include/basec++ -fexceptions -fno-rtti -ffreestanding
LDFLAGS = -nostdlib -nodefaultlibs -L$(BUILDINC_DIRECTORY)

View File

@ -19,7 +19,18 @@
#include <spr-defs.h>
#define EXCEPTION_STACK_SIZE (4*32)
/*
* OR1K Architecture has a 128 byte "red zone" after the stack that can not be
* touched by exception handlers. GCC uses this red zone for locals and
* temps without needing to change the stack pointer.
*/
#define OR1K_RED_ZONE_SIZE 128
/*
* We need 4 bytes (32 bits) * 32 registers space on the stack to save all the
* registers.
*/
#define EXCEPTION_STACK_SIZE ((4*32) + OR1K_RED_ZONE_SIZE)
#define HANDLE_EXCEPTION ; \
l.addi r1, r1, -EXCEPTION_STACK_SIZE ; \