diff options
author | Ayke van Laethem <[email protected]> | 2021-04-14 03:10:25 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-04-14 09:17:54 +0200 |
commit | d919905c96dba355fd03355f322760b076268efc (patch) | |
tree | fdb49384df26c890f17f50bcc2b54c4565308cc3 | |
parent | 96b1b76483a99647cc12b1c0f1d15c95f1d54025 (diff) | |
download | tinygo-d919905c96dba355fd03355f322760b076268efc.tar.gz tinygo-d919905c96dba355fd03355f322760b076268efc.zip |
all: clean up Cortex-M target files
In this commit I've moved all core-specific flags to files for that
specific core. This is a bit of a cleanup (less duplicated JSON) but
should also help in the future when core-specific changes are made, such
as core specific build tags or when the FPU finally gets supported in
TinyGo.
Some notable specific changes:
- I've removed floating point flags from the Teensy 3.6 target. The
reason is that the FPU is not yet supported in TinyGo (in goroutine
stack switching for example) and floating point numbers would only
be supported by C files, not Go files (because the LLVM FPU feature
flags aren't used). This would create an ABI mismatch across CGo.
- I've added the "cpu":"cortex-m7" to the cortex-m7.json file to match
the configuration for the Teensy 4.0. This implies a change to the
nucleo-f722ze (because now it has its CPU field set). Somehow that
reduces the code size, so it looks like a good change.
I don't believe any of these changes should have any practical
consequences.
One issue I've found is in the Cortex-M33 target: it uses armv7m, which
is incorrect: it should be armv8m. But the chip is backwards compatible
so this should mostly work. Switching to armv8m led to a compilation
failure because PRIMASK isn't defined, this may be an actual bug.
-rw-r--r-- | targets/atsamd21e18a.json | 6 | ||||
-rw-r--r-- | targets/atsamd21g18a.json | 6 | ||||
-rw-r--r-- | targets/bluepill.json | 6 | ||||
-rw-r--r-- | targets/cortex-m-qemu.json | 6 | ||||
-rw-r--r-- | targets/cortex-m0plus.json | 7 | ||||
-rw-r--r-- | targets/cortex-m3.json | 7 | ||||
-rw-r--r-- | targets/cortex-m7.json | 5 | ||||
-rw-r--r-- | targets/nrf51.json | 4 | ||||
-rw-r--r-- | targets/nucleo-f103rb.json | 6 | ||||
-rw-r--r-- | targets/stm32l0x2.json | 6 | ||||
-rw-r--r-- | targets/teensy36.json | 9 | ||||
-rw-r--r-- | targets/teensy40.json | 8 |
12 files changed, 27 insertions, 49 deletions
diff --git a/targets/atsamd21e18a.json b/targets/atsamd21e18a.json index 3b35a7b7c..0fcf50675 100644 --- a/targets/atsamd21e18a.json +++ b/targets/atsamd21e18a.json @@ -1,10 +1,6 @@ { - "inherits": ["cortex-m"], - "llvm-target": "armv6m-none-eabi", + "inherits": ["cortex-m0plus"], "build-tags": ["atsamd21e18a", "atsamd21e18", "atsamd21", "sam"], - "cflags": [ - "--target=armv6m-none-eabi" - ], "linkerscript": "targets/atsamd21.ld", "extra-files": [ "src/device/sam/atsamd21e18a.s" diff --git a/targets/atsamd21g18a.json b/targets/atsamd21g18a.json index f9b8a540b..956afba54 100644 --- a/targets/atsamd21g18a.json +++ b/targets/atsamd21g18a.json @@ -1,10 +1,6 @@ { - "inherits": ["cortex-m"], - "llvm-target": "armv6m-none-eabi", + "inherits": ["cortex-m0plus"], "build-tags": ["atsamd21g18a", "atsamd21g18", "atsamd21", "sam"], - "cflags": [ - "--target=armv6m-none-eabi" - ], "linkerscript": "targets/atsamd21.ld", "extra-files": [ "src/device/sam/atsamd21g18a.s" diff --git a/targets/bluepill.json b/targets/bluepill.json index 1bd029a39..9f1e4b004 100644 --- a/targets/bluepill.json +++ b/targets/bluepill.json @@ -1,10 +1,6 @@ { - "inherits": ["cortex-m"], - "llvm-target": "armv7m-none-eabi", + "inherits": ["cortex-m3"], "build-tags": ["bluepill", "stm32f103", "stm32f1", "stm32"], - "cflags": [ - "--target=armv7m-none-eabi" - ], "linkerscript": "targets/stm32.ld", "extra-files": [ "src/device/stm32/stm32f103.s" diff --git a/targets/cortex-m-qemu.json b/targets/cortex-m-qemu.json index 6d384c743..1d1cfc895 100644 --- a/targets/cortex-m-qemu.json +++ b/targets/cortex-m-qemu.json @@ -1,10 +1,6 @@ { - "inherits": ["cortex-m"], - "llvm-target": "armv7m-none-eabi", + "inherits": ["cortex-m3"], "build-tags": ["qemu", "lm3s6965"], - "cflags": [ - "--target=armv7m-none-eabi" - ], "linkerscript": "targets/lm3s6965.ld", "extra-files": [ "targets/cortex-m-qemu.s" diff --git a/targets/cortex-m0plus.json b/targets/cortex-m0plus.json new file mode 100644 index 000000000..f86945b87 --- /dev/null +++ b/targets/cortex-m0plus.json @@ -0,0 +1,7 @@ +{ + "inherits": ["cortex-m"], + "llvm-target": "armv6m-none-eabi", + "cflags": [ + "--target=armv6m-none-eabi" + ] +} diff --git a/targets/cortex-m3.json b/targets/cortex-m3.json new file mode 100644 index 000000000..68ecb7fc8 --- /dev/null +++ b/targets/cortex-m3.json @@ -0,0 +1,7 @@ +{ + "inherits": ["cortex-m"], + "llvm-target": "armv7m-none-eabi", + "cflags": [ + "--target=armv7m-none-eabi" + ] +} diff --git a/targets/cortex-m7.json b/targets/cortex-m7.json index dcaa42577..f63490eb2 100644 --- a/targets/cortex-m7.json +++ b/targets/cortex-m7.json @@ -1,7 +1,10 @@ { "inherits": ["cortex-m"], "llvm-target": "armv7em-none-eabi", + "cpu": "cortex-m7", "cflags": [ - "--target=armv7em-none-eabi" + "--target=armv7em-none-eabi", + "-mcpu=cortex-m7", + "-mfloat-abi=soft" ] } diff --git a/targets/nrf51.json b/targets/nrf51.json index 2327d39f7..714e2c55f 100644 --- a/targets/nrf51.json +++ b/targets/nrf51.json @@ -1,9 +1,7 @@ { - "inherits": ["cortex-m"], - "llvm-target": "armv6m-none-eabi", + "inherits": ["cortex-m0"], "build-tags": ["nrf51822", "nrf51", "nrf"], "cflags": [ - "--target=armv6m-none-eabi", "-DNRF51", "-I{root}/lib/CMSIS/CMSIS/Include", "-I{root}/lib/nrfx/mdk" diff --git a/targets/nucleo-f103rb.json b/targets/nucleo-f103rb.json index 10c9b2a6f..1c12af847 100644 --- a/targets/nucleo-f103rb.json +++ b/targets/nucleo-f103rb.json @@ -1,10 +1,6 @@ { - "inherits": ["cortex-m"], - "llvm-target": "armv7m-none-eabi", + "inherits": ["cortex-m3"], "build-tags": ["nucleof103rb", "stm32f103", "stm32f1","stm32"], - "cflags": [ - "--target=armv7m-none-eabi" - ], "linkerscript": "targets/stm32f103rb.ld", "extra-files": [ "src/device/stm32/stm32f103.s" diff --git a/targets/stm32l0x2.json b/targets/stm32l0x2.json index 78389f379..13b42cc5c 100644 --- a/targets/stm32l0x2.json +++ b/targets/stm32l0x2.json @@ -1,16 +1,12 @@ { "inherits": [ - "cortex-m" + "cortex-m0plus" ], - "llvm-target": "armv6m-none-eabi", "build-tags": [ "stm32l0", "stm32l0x2", "stm32" ], - "cflags": [ - "--target=armv6m-none-eabi" - ], "extra-files": [ "src/device/stm32/stm32l0x2.s" ] diff --git a/targets/teensy36.json b/targets/teensy36.json index de9e6dc0f..c341511ec 100644 --- a/targets/teensy36.json +++ b/targets/teensy36.json @@ -1,13 +1,6 @@ { - "inherits": ["cortex-m"], - "llvm-target": "armv7em-none-eabi", - "cpu": "cortex-m4", + "inherits": ["cortex-m4"], "build-tags": ["teensy36", "teensy", "mk66f18", "nxp"], - "cflags": [ - "--target=armv7em-none-eabi", - "-mfloat-abi=hard", - "-mfpu=fpv4-sp-d16" - ], "linkerscript": "targets/nxpmk66f18.ld", "extra-files": [ "src/device/nxp/mk66f18.s", diff --git a/targets/teensy40.json b/targets/teensy40.json index 0ecb0353a..d08b8d1dd 100644 --- a/targets/teensy40.json +++ b/targets/teensy40.json @@ -1,14 +1,8 @@ { - "inherits": ["cortex-m"], - "llvm-target": "armv7em-none-eabi", - "cpu": "cortex-m7", + "inherits": ["cortex-m7"], "build-tags": ["teensy40", "teensy", "mimxrt1062", "nxp"], "automatic-stack-size": false, "default-stack-size": 4096, - "cflags": [ - "--target=armv7em-none-eabi", - "-mfloat-abi=soft" - ], "linkerscript": "targets/mimxrt1062-teensy40.ld", "extra-files": [ "src/device/nxp/mimxrt1062.s", |