aboutsummaryrefslogtreecommitdiffhomepage
path: root/targets
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2018-11-22 13:24:13 +0100
committerAyke van Laethem <[email protected]>2018-11-22 16:20:10 +0100
commit62d74d83290032480da316a9e7f4069678ee6f13 (patch)
tree83c8d069f68f729bd7ca574ba111050bb8f8301e /targets
parent4a8ced590b724ef2d3d1a9d58df2b0d795391027 (diff)
downloadtinygo-62d74d83290032480da316a9e7f4069678ee6f13.tar.gz
tinygo-62d74d83290032480da316a9e7f4069678ee6f13.zip
all: compile and link using clang, where possible
Diffstat (limited to 'targets')
-rw-r--r--targets/arduino.json13
-rw-r--r--targets/arm.ld3
-rw-r--r--targets/avr.json7
-rw-r--r--targets/bluepill.json18
-rw-r--r--targets/cortex-m.json13
-rw-r--r--targets/cortex-m.s2
-rw-r--r--targets/digispark.json13
-rw-r--r--targets/nrf51.json20
-rw-r--r--targets/nrf52.json20
-rw-r--r--targets/nrf52840.json20
-rw-r--r--targets/qemu.json18
11 files changed, 79 insertions, 68 deletions
diff --git a/targets/arduino.json b/targets/arduino.json
index 795a99564..20e592be9 100644
--- a/targets/arduino.json
+++ b/targets/arduino.json
@@ -2,14 +2,15 @@
"inherits": ["avr"],
"llvm-target": "avr-atmel-none",
"build-tags": ["arduino", "atmega328p", "atmega", "avr5"],
- "pre-link-args": [
- "-nostartfiles",
- "-mmcu=avr5",
+ "cflags": [
+ "-mmcu=atmega328p"
+ ],
+ "ldflags": [
"-Wl,--defsym=_bootloader_size=512",
"-Wl,--defsym=_stack_size=512",
- "-T", "src/device/avr/atmega328p.ld",
- "-T", "targets/avr.ld",
- "-Wl,--gc-sections",
+ "-T", "src/device/avr/atmega328p.ld"
+ ],
+ "extra-files": [
"targets/avr.S",
"src/device/avr/atmega328p.s"
],
diff --git a/targets/arm.ld b/targets/arm.ld
index 2788fddd2..c964331da 100644
--- a/targets/arm.ld
+++ b/targets/arm.ld
@@ -1,4 +1,7 @@
+/* Unused, but here to silence a linker warning. */
+ENTRY(Reset_Handler)
+
/* define output sections */
SECTIONS
{
diff --git a/targets/avr.json b/targets/avr.json
index debb54786..abe486ec3 100644
--- a/targets/avr.json
+++ b/targets/avr.json
@@ -1,5 +1,10 @@
{
"build-tags": ["avr", "js", "wasm"],
+ "compiler": "avr-gcc",
"linker": "avr-gcc",
- "objcopy": "avr-objcopy"
+ "objcopy": "avr-objcopy",
+ "ldflags": [
+ "-T", "targets/avr.ld",
+ "-Wl,--gc-sections"
+ ]
}
diff --git a/targets/bluepill.json b/targets/bluepill.json
index 3c086ec69..ef2c915ac 100644
--- a/targets/bluepill.json
+++ b/targets/bluepill.json
@@ -2,16 +2,14 @@
"inherits": ["cortex-m"],
"llvm-target": "armv7m-none-eabi",
"build-tags": ["bluepill", "stm32f103xx", "stm32"],
- "pre-link-args": [
- "-nostdlib",
- "-nostartfiles",
- "-mcpu=cortex-m3",
- "-mthumb",
- "-T", "targets/stm32.ld",
- "-Wl,--gc-sections",
- "-fno-exceptions", "-fno-unwind-tables",
- "-ffunction-sections", "-fdata-sections",
- "-Os",
+ "cflags": [
+ "--target=armv7m-none-eabi",
+ "-Qunused-arguments"
+ ],
+ "ldflags": [
+ "-T", "targets/stm32.ld"
+ ],
+ "extra-files": [
"src/device/stm32/stm32f103xx.s"
],
"flash": "openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c 'program {hex} reset exit'"
diff --git a/targets/cortex-m.json b/targets/cortex-m.json
index 71d354f45..b373ef9b4 100644
--- a/targets/cortex-m.json
+++ b/targets/cortex-m.json
@@ -1,7 +1,18 @@
{
"build-tags": ["tinygo.arm", "js", "wasm"],
- "linker": "arm-none-eabi-gcc",
+ "compiler": "clang-7",
+ "linker": "arm-none-eabi-ld",
"rtlib": "compiler-rt",
+ "cflags": [
+ "-Oz",
+ "-mthumb",
+ "-fshort-enums",
+ "-fno-exceptions", "-fno-unwind-tables",
+ "-ffunction-sections", "-fdata-sections"
+ ],
+ "ldflags": [
+ "--gc-sections"
+ ],
"objcopy": "arm-none-eabi-objcopy",
"gdb": "arm-none-eabi-gdb"
}
diff --git a/targets/cortex-m.s b/targets/cortex-m.s
index 62ed28ef6..595ff56f8 100644
--- a/targets/cortex-m.s
+++ b/targets/cortex-m.s
@@ -26,7 +26,7 @@ Default_Handler:
.set \handler, Default_Handler
.endm
-.section .isr_vector
+.section .isr_vector, "a", %progbits
.global __isr_vector
// Interrupt vector as defined by Cortex-M, starting with the stack top.
// On reset, SP is initialized with *0x0 and PC is loaded with *0x4, loading
diff --git a/targets/digispark.json b/targets/digispark.json
index 02d9b87e4..6c198f4f5 100644
--- a/targets/digispark.json
+++ b/targets/digispark.json
@@ -2,14 +2,15 @@
"inherits": ["avr"],
"llvm-target": "avr-atmel-none",
"build-tags": ["digispark", "attiny85", "attiny", "avr2", "avr25"],
- "pre-link-args": [
- "-nostartfiles",
- "-mmcu=attiny85",
+ "cflags": [
+ "-mmcu=attiny85"
+ ],
+ "ldflags": [
"-Wl,--defsym=_bootloader_size=2180",
"-Wl,--defsym=_stack_size=128",
- "-T", "src/device/avr/attiny85.ld",
- "-T", "targets/avr.ld",
- "-Wl,--gc-sections",
+ "-T", "src/device/avr/attiny85.ld"
+ ],
+ "extra-files": [
"targets/avr.S",
"src/device/avr/attiny85.s"
],
diff --git a/targets/nrf51.json b/targets/nrf51.json
index 68c6b14f3..f37db3e92 100644
--- a/targets/nrf51.json
+++ b/targets/nrf51.json
@@ -2,18 +2,16 @@
"inherits": ["cortex-m"],
"llvm-target": "armv6m-none-eabi",
"build-tags": ["nrf51822", "nrf51", "nrf"],
- "pre-link-args": [
- "-nostdlib",
- "-nostartfiles",
- "-mcpu=cortex-m0",
- "-mthumb",
- "-T", "targets/nrf51.ld",
- "-Wl,--gc-sections",
- "-fno-exceptions", "-fno-unwind-tables",
- "-ffunction-sections", "-fdata-sections",
- "-Os",
+ "cflags": [
+ "--target=armv6m-none-eabi",
+ "-Qunused-arguments",
"-DNRF51",
- "-Ilib/CMSIS/CMSIS/Include",
+ "-Ilib/CMSIS/CMSIS/Include"
+ ],
+ "ldflags": [
+ "-T", "targets/nrf51.ld"
+ ],
+ "extra-files": [
"lib/nrfx/mdk/system_nrf51.c",
"src/device/nrf/nrf51.s"
]
diff --git a/targets/nrf52.json b/targets/nrf52.json
index 53ff2a47e..6eeaf651a 100644
--- a/targets/nrf52.json
+++ b/targets/nrf52.json
@@ -2,18 +2,16 @@
"inherits": ["cortex-m"],
"llvm-target": "armv7em-none-eabi",
"build-tags": ["nrf52", "nrf"],
- "pre-link-args": [
- "-nostdlib",
- "-nostartfiles",
- "-mcpu=cortex-m4",
- "-mthumb",
- "-T", "targets/nrf52.ld",
- "-Wl,--gc-sections",
- "-fno-exceptions", "-fno-unwind-tables",
- "-ffunction-sections", "-fdata-sections",
- "-Os",
+ "cflags": [
+ "--target=armv7em-none-eabi",
+ "-Qunused-arguments",
"-DNRF52832_XXAA",
- "-Ilib/CMSIS/CMSIS/Include",
+ "-Ilib/CMSIS/CMSIS/Include"
+ ],
+ "ldflags": [
+ "-T", "targets/nrf52.ld"
+ ],
+ "extra-files": [
"lib/nrfx/mdk/system_nrf52.c",
"src/device/nrf/nrf52.s"
]
diff --git a/targets/nrf52840.json b/targets/nrf52840.json
index 8346735c2..d49a1f0a2 100644
--- a/targets/nrf52840.json
+++ b/targets/nrf52840.json
@@ -2,18 +2,16 @@
"inherits": ["cortex-m"],
"llvm-target": "armv7em-none-eabi",
"build-tags": ["nrf52840", "nrf"],
- "pre-link-args": [
- "-nostdlib",
- "-nostartfiles",
- "-mcpu=cortex-m4",
- "-mthumb",
- "-T", "targets/nrf52840.ld",
- "-Wl,--gc-sections",
- "-fno-exceptions", "-fno-unwind-tables",
- "-ffunction-sections", "-fdata-sections",
- "-Os",
+ "cflags": [
+ "--target=armv7em-none-eabi",
+ "-Qunused-arguments",
"-DNRF52840_XXAA",
- "-Ilib/CMSIS/CMSIS/Include",
+ "-Ilib/CMSIS/CMSIS/Include"
+ ],
+ "ldflags": [
+ "-T", "targets/nrf52840.ld"
+ ],
+ "extra-files": [
"lib/nrfx/mdk/system_nrf52840.c",
"src/device/nrf/nrf52840.s"
]
diff --git a/targets/qemu.json b/targets/qemu.json
index 7cc23da8f..929fb1e85 100644
--- a/targets/qemu.json
+++ b/targets/qemu.json
@@ -2,16 +2,14 @@
"inherits": ["cortex-m"],
"llvm-target": "armv7m-none-eabi",
"build-tags": ["qemu", "lm3s6965"],
- "pre-link-args": [
- "-nostdlib",
- "-nostartfiles",
- "-mcpu=cortex-m0",
- "-mthumb",
- "-T", "targets/lm3s6965.ld",
- "-Wl,--gc-sections",
- "-fno-exceptions", "-fno-unwind-tables",
- "-ffunction-sections", "-fdata-sections",
- "-Os",
+ "cflags": [
+ "--target=armv7m-none-eabi",
+ "-Qunused-arguments"
+ ],
+ "ldflags": [
+ "-T", "targets/lm3s6965.ld"
+ ],
+ "extra-files": [
"targets/cortex-m.s"
],
"emulator": ["qemu-system-arm", "-machine", "lm3s6965evb", "-semihosting", "-nographic", "-kernel"]