Merge pull request #1 from mithro/master

Bunch of small fixes
This commit is contained in:
enjoy-digital 2016-04-19 07:49:24 +02:00
commit e0e56e3655
3 changed files with 44 additions and 12 deletions

View File

@ -1,3 +1,5 @@
import os
from litex.gen import * from litex.gen import *
from litex.soc.interconnect.csr import CSRStatus from litex.soc.interconnect.csr import CSRStatus
@ -9,18 +11,30 @@ cpu_endianness = {
} }
def get_cpu_mak(cpu): def get_cpu_mak(cpu):
clang = os.getenv("CLANG", "")
if clang != "":
clang = bool(int(clang))
else:
clang = None
if cpu == "lm32": if cpu == "lm32":
assert not clang, "lm32 not supported with clang."
triple = "lm32-elf" triple = "lm32-elf"
cpuflags = "-mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled" cpuflags = "-mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled"
clang = ""
elif cpu == "or1k": elif cpu == "or1k":
# 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" triple = "or1k-linux"
cpuflags = "-mhard-mul -mhard-div -mror -mffl1 -maddc" cpuflags += "-mffl1 -maddc"
clang = "1"
elif cpu == "riscv32": elif cpu == "riscv32":
assert not clang, "riscv32 not supported with clang."
triple = "riscv32-unknown-elf" triple = "riscv32-unknown-elf"
cpuflags = "-mno-save-restore" cpuflags = "-mno-save-restore"
clang = ""
else: else:
raise ValueError("Unsupported CPU type: "+cpu) raise ValueError("Unsupported CPU type: "+cpu)
return [ return [
@ -28,7 +42,7 @@ def get_cpu_mak(cpu):
("CPU", cpu), ("CPU", cpu),
("CPUFLAGS", cpuflags), ("CPUFLAGS", cpuflags),
("CPUENDIANNESS", cpu_endianness[cpu]), ("CPUENDIANNESS", cpu_endianness[cpu]),
("CLANG", clang) ("CLANG", str(int(clang)))
] ]

View File

@ -462,9 +462,15 @@ static int test_user_abort(void)
printf("Automatic boot in 2 seconds...\n"); printf("Automatic boot in 2 seconds...\n");
printf("Q/ESC: abort boot\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 #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 #endif
timer0_en_write(0); timer0_en_write(0);
timer0_reload_write(0); timer0_reload_write(0);
@ -478,19 +484,31 @@ static int test_user_abort(void)
while(timer0_value_read()) { while(timer0_value_read()) {
if(readchar_nonblock()) { if(readchar_nonblock()) {
c = readchar(); c = readchar();
if((c == 'Q')||(c == '\e')) { if((c == 'Q')||(c == 'q')||(c == '\e')) {
puts("Aborted"); puts("Aborted");
return 0; return 0;
} }
if(c == 0x06) { #ifdef FLASH_BOOT_ADDRESS
if((c == 'F')||(c == 'f')) {
flashboot();
return 0;
}
#endif
if((c == 'S')||(c == 's')) {
serialboot(); serialboot();
return 0; return 0;
} }
#ifdef CSR_ETHMAC_BASE #ifdef CSR_ETHMAC_BASE
if(c == 0x07) { if((c == 'N')||(c == 'n')) {
netboot(); netboot();
return 0; return 0;
} }
#endif
#ifdef ROM_BOOT_ADDRESS
if((c == 'R')||(c == 'r')) {
romboot();
return 0;
}
#endif #endif
} }
timer0_update_value_write(1); timer0_update_value_write(1);

View File

@ -1,7 +1,7 @@
include ../include/generated/variables.mak include ../include/generated/variables.mak
include $(SOC_DIRECTORY)/software/common.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 CFLAGS+=-D_YUGA_LITTLE_ENDIAN=0 -D_YUGA_BIG_ENDIAN=1 -Wno-missing-prototypes
else else
CFLAGS+=-D_YUGA_LITTLE_ENDIAN=1 -D_YUGA_BIG_ENDIAN=0 -Wno-missing-prototypes CFLAGS+=-D_YUGA_LITTLE_ENDIAN=1 -D_YUGA_BIG_ENDIAN=0 -Wno-missing-prototypes