From 2f834d0aa2bb677eccf5b90e98f4a9eb54e37d2f Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Thu, 14 Apr 2016 17:00:59 +1000 Subject: [PATCH 1/3] bios: Use single characters for boot modes. * The function keys never really worked properly. * Also add commands for the ROM/Flash/etc. --- litex/soc/software/bios/main.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/litex/soc/software/bios/main.c b/litex/soc/software/bios/main.c index 819047a1a..d45ec8674 100644 --- a/litex/soc/software/bios/main.c +++ b/litex/soc/software/bios/main.c @@ -462,9 +462,15 @@ static int test_user_abort(void) printf("Automatic boot in 2 seconds...\n"); printf("Q/ESC: abort boot\n"); - printf("F7: boot from serial\n"); +#ifdef FLASH_BOOT_ADDRESS + printf("F: boot from flash\n"); +#endif + printf("S: boot from serial\n"); #ifdef CSR_ETHMAC_BASE - printf("F8: boot from network\n"); + printf("N: boot from network\n"); +#endif +#ifdef ROM_BOOT_ADDRESS + printf("R: boot from embedded ROM\n"); #endif timer0_en_write(0); timer0_reload_write(0); @@ -478,19 +484,31 @@ static int test_user_abort(void) while(timer0_value_read()) { if(readchar_nonblock()) { c = readchar(); - if((c == 'Q')||(c == '\e')) { + if((c == 'Q')||(c == 'q')||(c == '\e')) { puts("Aborted"); return 0; } - if(c == 0x06) { +#ifdef FLASH_BOOT_ADDRESS + if((c == 'F')||(c == 'f')) { + flashboot(); + return 0; + } +#endif + if((c == 'S')||(c == 's')) { serialboot(); return 0; } #ifdef CSR_ETHMAC_BASE - if(c == 0x07) { + if((c == 'N')||(c == 'n')) { netboot(); return 0; } +#endif +#ifdef ROM_BOOT_ADDRESS + if((c == 'R')||(c == 'r')) { + romboot(); + return 0; + } #endif } timer0_update_value_write(1); From e7f3c585b71e3829f64e2478e0cf9ed7c2e9219f Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Tue, 19 Apr 2016 13:29:07 +1000 Subject: [PATCH 2/3] Allow using gcc for or1k. * Using CLANG can set by using CLANG=1 or CLANG=0 in the environment. * or1k continues to default to CLANG if environment is not net. --- litex/soc/integration/cpu_interface.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/litex/soc/integration/cpu_interface.py b/litex/soc/integration/cpu_interface.py index 5e25f8f41..506f95d9e 100644 --- a/litex/soc/integration/cpu_interface.py +++ b/litex/soc/integration/cpu_interface.py @@ -1,3 +1,5 @@ +import os + from litex.gen import * from litex.soc.interconnect.csr import CSRStatus @@ -9,18 +11,30 @@ cpu_endianness = { } def get_cpu_mak(cpu): + clang = os.getenv("CLANG", "") + if clang != "": + clang = bool(int(clang)) + else: + clang = None + if cpu == "lm32": + assert not clang, "lm32 not supported with clang." triple = "lm32-elf" cpuflags = "-mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled" - clang = "" elif cpu == "or1k": - triple = "or1k-linux" - cpuflags = "-mhard-mul -mhard-div -mror -mffl1 -maddc" - clang = "1" + # Default to CLANG unless told otherwise + if clang is None: + clang = True + + triple = "or1k-elf" + cpuflags = "-mhard-mul -mhard-div -mror" + if clang: + triple = "or1k-linux" + cpuflags += "-mffl1 -maddc" elif cpu == "riscv32": + assert not clang, "riscv32 not supported with clang." triple = "riscv32-unknown-elf" cpuflags = "-mno-save-restore" - clang = "" else: raise ValueError("Unsupported CPU type: "+cpu) return [ @@ -28,7 +42,7 @@ def get_cpu_mak(cpu): ("CPU", cpu), ("CPUFLAGS", cpuflags), ("CPUENDIANNESS", cpu_endianness[cpu]), - ("CLANG", clang) + ("CLANG", str(int(clang))) ] From 514496d74456d6f8f5a3a95d034b1e5b693336b8 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Tue, 19 Apr 2016 14:55:01 +1000 Subject: [PATCH 3/3] libcompiler_rt: Fixing Makefile for CPU endianness. --- litex/soc/software/libcompiler_rt/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/soc/software/libcompiler_rt/Makefile b/litex/soc/software/libcompiler_rt/Makefile index 35a8b98ec..81d6a4bf4 100644 --- a/litex/soc/software/libcompiler_rt/Makefile +++ b/litex/soc/software/libcompiler_rt/Makefile @@ -1,7 +1,7 @@ include ../include/generated/variables.mak include $(SOC_DIRECTORY)/software/common.mak -ifeq ($(CPU),big) +ifeq ($(CPUENDIANNESS),big) CFLAGS+=-D_YUGA_LITTLE_ENDIAN=0 -D_YUGA_BIG_ENDIAN=1 -Wno-missing-prototypes else CFLAGS+=-D_YUGA_LITTLE_ENDIAN=1 -D_YUGA_BIG_ENDIAN=0 -Wno-missing-prototypes