aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYannis Huber <[email protected]>2020-06-01 14:44:12 +0200
committerRon Evans <[email protected]>2020-07-08 00:21:59 +0200
commit875d36cba0f49a62a208411c0b3777f4f7a9267d (patch)
tree3df29526731a8814e6b91ae7753e68f5ae35fb3c
parent1a6bed330554fb591860c97b3b546ce7c2280f3e (diff)
downloadtinygo-875d36cba0f49a62a208411c0b3777f4f7a9267d.tar.gz
tinygo-875d36cba0f49a62a208411c0b3777f4f7a9267d.zip
Add new kendryte k210 target definition
-rw-r--r--.gitignore2
-rw-r--r--.gitmodules2
-rw-r--r--Makefile6
m---------lib/cmsis-svd0
-rw-r--r--targets/fe310.json16
-rw-r--r--targets/k210.json19
-rw-r--r--targets/maix-bit-mic.json6
-rw-r--r--targets/maix-bit-mic.ld10
8 files changed, 58 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 81ed9b664..84f90ddbc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,8 @@ src/device/sifive/*.go
src/device/sifive/*.s
src/device/stm32/*.go
src/device/stm32/*.s
+src/device/kendryte/*.go
+src/device/kendryte/*.s
vendor
llvm-build
llvm-project
diff --git a/.gitmodules b/.gitmodules
index af6e1809a..cbab142b2 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -9,7 +9,7 @@
url = https://github.com/avr-rust/avr-mcu.git
[submodule "lib/cmsis-svd"]
path = lib/cmsis-svd
- url = https://github.com/posborne/cmsis-svd
+ url = https://github.com/yannishuber/cmsis-svd
[submodule "lib/compiler-rt"]
path = lib/compiler-rt
url = https://github.com/llvm-mirror/compiler-rt.git
diff --git a/Makefile b/Makefile
index 9a0b64e60..dc1c7070d 100644
--- a/Makefile
+++ b/Makefile
@@ -118,7 +118,7 @@ fmt-check:
@unformatted=$$(gofmt -l $(FMT_PATHS)); [ -z "$$unformatted" ] && exit 0; echo "Unformatted:"; for fn in $$unformatted; do echo " $$fn"; done; exit 1
-gen-device: gen-device-avr gen-device-nrf gen-device-sam gen-device-sifive gen-device-stm32
+gen-device: gen-device-avr gen-device-nrf gen-device-sam gen-device-sifive gen-device-stm32 gen-device-kendryte
gen-device-avr:
$(GO) build -o ./build/gen-device-avr ./tools/gen-device-avr/
@@ -141,6 +141,10 @@ gen-device-sifive: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/SiFive-Community -interrupts=software lib/cmsis-svd/data/SiFive-Community/ src/device/sifive/
GO111MODULE=off $(GO) fmt ./src/device/sifive
+gen-device-kendryte: build/gen-device-svd
+ ./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/Kendryte-Community -interrupts=software lib/cmsis-svd/data/Kendryte-Community/ src/device/kendryte/
+ GO111MODULE=off $(GO) fmt ./src/device/kendryte
+
gen-device-stm32: build/gen-device-svd
./build/gen-device-svd -source=https://github.com/posborne/cmsis-svd/tree/master/data/STMicro lib/cmsis-svd/data/STMicro/ src/device/stm32/
GO111MODULE=off $(GO) fmt ./src/device/stm32
diff --git a/lib/cmsis-svd b/lib/cmsis-svd
-Subproject 15b462f152af86f3d15b952e1a5cf1bb9e2693e
+Subproject a155cfd832c9e6ddf193244d8d90489f4d089cc
diff --git a/targets/fe310.json b/targets/fe310.json
index 76f749705..636b4f2d9 100644
--- a/targets/fe310.json
+++ b/targets/fe310.json
@@ -1,5 +1,19 @@
{
"inherits": ["riscv32"],
"features": ["+a", "+c", "+m"],
- "build-tags": ["fe310", "sifive"]
+ "build-tags": ["fe310", "sifive"],
+ "llvm-target": "riscv32--none",
+ "cflags": [
+ "--target=riscv32--none",
+ "-march=rv32imac",
+ "-mabi=ilp32",
+ "-Os",
+ "-Werror",
+ "-fno-exceptions", "-fno-unwind-tables",
+ "-ffunction-sections", "-fdata-sections"
+ ],
+ "ldflags": [
+ "-melf32lriscv",
+ "--gc-sections"
+ ]
}
diff --git a/targets/k210.json b/targets/k210.json
new file mode 100644
index 000000000..d5772b66b
--- /dev/null
+++ b/targets/k210.json
@@ -0,0 +1,19 @@
+{
+ "inherits": ["riscv"],
+ "features": ["+a", "+c", "+m", "+f", "+d"],
+ "build-tags": ["k210", "kendryte"],
+ "llvm-target": "riscv64--none",
+ "cflags": [
+ "--target=riscv64--none",
+ "-march=rv64gc",
+ "-mabi=lp64d",
+ "-Os",
+ "-Werror",
+ "-fno-exceptions", "-fno-unwind-tables",
+ "-ffunction-sections", "-fdata-sections"
+ ],
+ "ldflags": [
+ "-melf64lriscv",
+ "--gc-sections"
+ ]
+}
diff --git a/targets/maix-bit-mic.json b/targets/maix-bit-mic.json
new file mode 100644
index 000000000..31d6df568
--- /dev/null
+++ b/targets/maix-bit-mic.json
@@ -0,0 +1,6 @@
+{
+ "inherits": ["k210"],
+ "build-tags": ["maix-bit-mic"],
+ "linkerscript": "targets/maix-bit-mic.ld",
+ "flash-command": "kflash -p /dev/ttyUSB0 {hex}"
+}
diff --git a/targets/maix-bit-mic.ld b/targets/maix-bit-mic.ld
new file mode 100644
index 000000000..733152a26
--- /dev/null
+++ b/targets/maix-bit-mic.ld
@@ -0,0 +1,10 @@
+
+MEMORY
+{
+ FLASH_TEXT (rw) : ORIGIN = 0x80000000, LENGTH = (6 * 1024 * 1024)
+ RAM (xrw) : ORIGIN = 0x80000000, LENGTH = (6 * 1024 * 1024)
+}
+
+_stack_size = 2K;
+
+INCLUDE "targets/riscv.ld"