diff options
author | Ayke van Laethem <[email protected]> | 2018-11-19 21:08:12 +0100 |
---|---|---|
committer | Ayke van Laethem <[email protected]> | 2018-11-19 21:08:12 +0100 |
commit | 760bc5d0a42204e6a49ebca0cb686530a671e240 (patch) | |
tree | 3a9daef7c9ce5bcaca383ea561fa715ce9aba01b /targets | |
parent | f02766265ced8b90444ce0382a6d1cc5196d7c30 (diff) | |
download | tinygo-760bc5d0a42204e6a49ebca0cb686530a671e240.tar.gz tinygo-760bc5d0a42204e6a49ebca0cb686530a671e240.zip |
targets: let specific targets inherit more general targets
This avoids a ton of duplication and makes it easier to change a generic
target (for example, the "cortex-m" target) for all boards that use it.
Also, by making it possible to inherit properties from a parent target
specification, it is easier to support out-of-tree boards that don't
have to be updated so often. A target specification for a
special-purpose board can simply inherit the specification of a
supported chip and override the properites it needs to override (like
the programming interface).
Diffstat (limited to 'targets')
-rw-r--r-- | targets/bluepill.json | 19 | ||||
-rw-r--r-- | targets/cortex-m.json | 7 | ||||
-rw-r--r-- | targets/microbit.json | 23 | ||||
-rw-r--r-- | targets/nrf51.json | 20 | ||||
-rw-r--r-- | targets/nrf52.json | 20 | ||||
-rw-r--r-- | targets/nrf52840-mdk.json | 22 | ||||
-rw-r--r-- | targets/nrf52840.json | 20 | ||||
-rw-r--r-- | targets/pca10040.json | 23 | ||||
-rw-r--r-- | targets/qemu.json | 6 |
9 files changed, 89 insertions, 71 deletions
diff --git a/targets/bluepill.json b/targets/bluepill.json index cded74dbc..3c086ec69 100644 --- a/targets/bluepill.json +++ b/targets/bluepill.json @@ -1,9 +1,18 @@ { + "inherits": ["cortex-m"], "llvm-target": "armv7m-none-eabi", - "build-tags": ["bluepill", "stm32f103xx", "stm32", "tinygo.arm", "js", "wasm"], - "linker": "arm-none-eabi-gcc", - "rtlib": "compiler-rt", - "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", "src/device/stm32/stm32f103xx.s"], - "objcopy": "arm-none-eabi-objcopy", + "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", + "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 new file mode 100644 index 000000000..71d354f45 --- /dev/null +++ b/targets/cortex-m.json @@ -0,0 +1,7 @@ +{ + "build-tags": ["tinygo.arm", "js", "wasm"], + "linker": "arm-none-eabi-gcc", + "rtlib": "compiler-rt", + "objcopy": "arm-none-eabi-objcopy", + "gdb": "arm-none-eabi-gdb" +} diff --git a/targets/microbit.json b/targets/microbit.json index e9e5ec9b3..d2cd698dc 100644 --- a/targets/microbit.json +++ b/targets/microbit.json @@ -1,26 +1,7 @@ { - "llvm-target": "armv6m-none-eabi", - "build-tags": ["microbit", "nrf51822", "nrf51", "nrf", "tinygo.arm", "js", "wasm"], - "linker": "arm-none-eabi-gcc", - "rtlib": "compiler-rt", - "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", - "-DNRF51", - "-Ilib/CMSIS/CMSIS/Include", - "lib/nrfx/mdk/system_nrf51.c", - "src/device/nrf/nrf51.s" - ], - "objcopy": "arm-none-eabi-objcopy", + "inherits": ["nrf51"], + "build-tags": ["microbit"], "flash": "openocd -f interface/cmsis-dap.cfg -f target/nrf51.cfg -c 'program {hex} reset exit'", "ocd-daemon": ["openocd", "-f", "interface/cmsis-dap.cfg", "-f", "target/nrf51.cfg"], - "gdb": "arm-none-eabi-gdb", "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] } diff --git a/targets/nrf51.json b/targets/nrf51.json new file mode 100644 index 000000000..68c6b14f3 --- /dev/null +++ b/targets/nrf51.json @@ -0,0 +1,20 @@ +{ + "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", + "-DNRF51", + "-Ilib/CMSIS/CMSIS/Include", + "lib/nrfx/mdk/system_nrf51.c", + "src/device/nrf/nrf51.s" + ] +} diff --git a/targets/nrf52.json b/targets/nrf52.json new file mode 100644 index 000000000..53ff2a47e --- /dev/null +++ b/targets/nrf52.json @@ -0,0 +1,20 @@ +{ + "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", + "-DNRF52832_XXAA", + "-Ilib/CMSIS/CMSIS/Include", + "lib/nrfx/mdk/system_nrf52.c", + "src/device/nrf/nrf52.s" + ] +} diff --git a/targets/nrf52840-mdk.json b/targets/nrf52840-mdk.json index 7be436422..388c325b1 100644 --- a/targets/nrf52840-mdk.json +++ b/targets/nrf52840-mdk.json @@ -1,25 +1,7 @@ { - "llvm-target": "armv7em-none-eabi", - "build-tags": ["nrf52840_mdk", "nrf52840", "nrf", "tinygo.arm", "js", "wasm"], - "linker": "arm-none-eabi-gcc", - "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", - "-DNRF52840_XXAA", - "-Ilib/CMSIS/CMSIS/Include", - "lib/nrfx/mdk/system_nrf52840.c", - "src/device/nrf/nrf52840.s" - ], - "objcopy": "arm-none-eabi-objcopy", + "inherits": ["nrf52840"], + "build-tags": ["nrf52840_mdk"], "flash": "openocd -f interface/cmsis-dap.cfg -f target/nrf51.cfg -c 'program {hex} reset exit'", "ocd-daemon": ["openocd", "-f", "interface/cmsis-dap.cfg", "-f", "target/nrf51.cfg"], - "gdb": "arm-none-eabi-gdb", "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] } diff --git a/targets/nrf52840.json b/targets/nrf52840.json new file mode 100644 index 000000000..8346735c2 --- /dev/null +++ b/targets/nrf52840.json @@ -0,0 +1,20 @@ +{ + "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", + "-DNRF52840_XXAA", + "-Ilib/CMSIS/CMSIS/Include", + "lib/nrfx/mdk/system_nrf52840.c", + "src/device/nrf/nrf52840.s" + ] +} diff --git a/targets/pca10040.json b/targets/pca10040.json index 0a3cbb4e9..1bff6e8cc 100644 --- a/targets/pca10040.json +++ b/targets/pca10040.json @@ -1,26 +1,7 @@ { - "llvm-target": "armv7em-none-eabi", - "build-tags": ["pca10040", "nrf52832", "nrf52", "nrf", "tinygo.arm", "js", "wasm"], - "linker": "arm-none-eabi-gcc", - "rtlib": "compiler-rt", - "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", - "-DNRF52832_XXAA", - "-Ilib/CMSIS/CMSIS/Include", - "lib/nrfx/mdk/system_nrf52.c", - "src/device/nrf/nrf52.s" - ], - "objcopy": "arm-none-eabi-objcopy", + "inherits": ["nrf52"], + "build-tags": ["pca10040"], "flash": "nrfjprog -f nrf52 --sectorerase --program {hex} --reset", "ocd-daemon": ["openocd", "-f", "interface/jlink.cfg", "-c", "transport select swd", "-f", "target/nrf51.cfg"], - "gdb": "arm-none-eabi-gdb", "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] } diff --git a/targets/qemu.json b/targets/qemu.json index cd0ecaf59..7cc23da8f 100644 --- a/targets/qemu.json +++ b/targets/qemu.json @@ -1,8 +1,7 @@ { + "inherits": ["cortex-m"], "llvm-target": "armv7m-none-eabi", - "build-tags": ["qemu", "lm3s6965", "tinygo.arm", "js", "wasm"], - "linker": "arm-none-eabi-gcc", - "rtlib": "compiler-rt", + "build-tags": ["qemu", "lm3s6965"], "pre-link-args": [ "-nostdlib", "-nostartfiles", @@ -15,6 +14,5 @@ "-Os", "targets/cortex-m.s" ], - "objcopy": "arm-none-eabi-objcopy", "emulator": ["qemu-system-arm", "-machine", "lm3s6965evb", "-semihosting", "-nographic", "-kernel"] } |