From 9ad96fd809c88bbef71bf99796b437abb1d21c94 Mon Sep 17 00:00:00 2001 From: Yannis Huber Date: Fri, 5 Jun 2020 09:27:45 +0200 Subject: [PATCH] Changes according to @aykevl's feedback --- compileopts/target.go | 1 - targets/fe310.json | 2 +- targets/maixbit.ld | 2 +- targets/riscv.json | 24 ++++++++++++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 targets/riscv.json diff --git a/compileopts/target.go b/compileopts/target.go index d6a30a3f..5d5e2f1b 100644 --- a/compileopts/target.go +++ b/compileopts/target.go @@ -276,7 +276,6 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) { GDB: "gdb", PortReset: "false", FlashMethod: "native", - CodeModel: "default", } if goos == "darwin" { spec.LDFlags = append(spec.LDFlags, "-Wl,-dead_strip") diff --git a/targets/fe310.json b/targets/fe310.json index bc95e8d4..76f74970 100644 --- a/targets/fe310.json +++ b/targets/fe310.json @@ -1,5 +1,5 @@ { "inherits": ["riscv32"], "features": ["+a", "+c", "+m"], - "build-tags": ["fe310", "sifive"] + "build-tags": ["fe310", "sifive"] } diff --git a/targets/maixbit.ld b/targets/maixbit.ld index 9b277a6c..e1162a38 100644 --- a/targets/maixbit.ld +++ b/targets/maixbit.ld @@ -1,7 +1,7 @@ MEMORY { - RAM (xrw) : ORIGIN = 0x80000000, LENGTH = (6 * 1024 * 1024) + RAM (xrw) : ORIGIN = 0x80000000, LENGTH = 6M } REGION_ALIAS("FLASH_TEXT", RAM); diff --git a/targets/riscv.json b/targets/riscv.json new file mode 100644 index 00000000..313aa858 --- /dev/null +++ b/targets/riscv.json @@ -0,0 +1,24 @@ +{ + "goos": "linux", + "goarch": "arm", + "build-tags": ["tinygo.riscv", "baremetal", "linux", "arm"], + "gc": "conservative", + "compiler": "clang", + "linker": "ld.lld", + "rtlib": "compiler-rt", + "libc": "picolibc", + "cflags": [ + "-Os", + "-Werror", + "-fno-exceptions", "-fno-unwind-tables", + "-ffunction-sections", "-fdata-sections" + ], + "ldflags": [ + "--gc-sections" + ], + "extra-files": [ + "src/device/riscv/start.S", + "src/runtime/scheduler_tinygoriscv.S" + ], + "gdb": "riscv64-unknown-elf-gdb" +}