tinygo/targets
Adrian Cole 334a12818d Allows the emulator to expand {tmpDir}
This allows you to expand {tmpDir} in the json "emulator" field, and
uses it in wasmtime instead of custom TMPDIR mapping logic.

Before, we had custom logic for wasmtime to create a separate tmpDir
when running go tests. This overwrite the TMPDIR variable when running,
after making a mount point. A simpler way to accomplish the end goal of
writing temp files is to use wasmtime's map-dir instead. When code is
compiled to wasm with the wasi target, tempDir is always /tmp, so we
don't need to add variables (since we know what it is). Further, the
test code is the same between normal go and run through wasmtime. So, we
don't need to make a separate temp dir first, and avoiding that reduces
logic, as well makes it easier to swap out the emulator (for wazero
which has no depedencies). To map the correct directory, this introduces
a {tmpDir} token whose value is the host-specific value taken from
`os.TempDir()`.

The motivation I have for this isn't so much to clean up the wasmtime
code, but allow wazero to execute the same tests. After this change, the
only thing needed to pass tests is to change the emulator, due to
differences in how wazero deals with relative lookups (they aren't
restricted by default, so there's not a huge amount of custom logic
needed).

In other words, installing wazero from main, `make tinygo-test-wasi`
works with no other changes except this PR and patching
`targets/wasi.json`.
```json
	"emulator":      "wazero run -mount=.:/ -mount={tmpDir}:/tmp {}",
```

On that note, if there's a way to override the emulator via arg or env,
this would be even better, but in any case patching json is fine.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-01-19 20:06:18 +01:00
..
arduino-leonardo.json
arduino-mega1280.json
arduino-mega2560.json
arduino-mkr1000.json
arduino-mkrwifi1010.json
arduino-nano-new.json
arduino-nano.json
arduino-nano33.json
arduino-zero.json
arduino.json
arm.ld arm: automatically determine stack sizes 2020-08-27 19:23:22 +02:00
atmega32u4.json
atmega328p.json
atmega1280.json
atmega1284p.json
atmega2560.json
atsamd21.ld
atsamd21e18a.json
atsamd21g18a.json
atsamd51.ld
atsamd51g19a.json
atsamd51j19a.json
atsamd51j20a.json
atsamd51j20a.ld sam: fix ROM / RAM size on atsamd51j20 2020-05-07 23:04:10 +02:00
atsamd51p19a.json
atsamd51p20a.json
atsamd51p20a.ld
atsame5xx19.ld
atsame5xx20-no-bootloader.ld
atsame51j19a.json
atsame54-xpro.json
atsame54p20a.json
attiny85.json
avr.json
avr.ld avr: support ThinLTO 2022-11-18 18:40:38 +01:00
avr.S
badger2040.json
badger2040.ld machine/badger2040: support for Badger 2040 2022-05-24 15:02:23 +02:00
bluepill-clone.json
bluepill.json
challenger-rp2040.json
circuitplay-bluefruit.json
circuitplay-express.json
clue-alpha.json
clue.json
cortex-m-qemu.json
cortex-m-qemu.s arm: automatically determine stack sizes 2020-08-27 19:23:22 +02:00
cortex-m.json
cortex-m0.json
cortex-m0plus.json
cortex-m3.json
cortex-m4.json
cortex-m7.json
cortex-m33.json
d1mini.json
digispark.json
esp32-coreboard-v2.json
esp32-mini32.json
esp32.json
esp32.ld
esp32c3-12f.json
esp32c3.json
esp32c3.ld
esp8266.json
esp8266.ld
fe310.json
feather-m0-express.json
feather-m0.json
feather-m4-can.json
feather-m4.json
feather-nrf52840-sense.json
feather-nrf52840.json
feather-rp2040-boot-stage2.S feather-rp2040,macropad-rp2040: fix qspi-flash settings 2022-07-05 16:37:45 +02:00
feather-rp2040.json
feather-rp2040.ld
feather-stm32f405.json
gameboy-advance.json
gameboy-advance.ld main: add initial support for (in-development) LLVM 11 2020-10-13 20:23:50 +02:00
gameboy-advance.s
gnse.json
gopherbot.json
gopherbot2.json
grandcentral-m4.json
hifive1b.json
hifive1b.ld all: add HiFive1 rev B board with RISC-V architecture 2019-07-07 14:03:24 +02:00
itsybitsy-m0.json
itsybitsy-m4.json
itsybitsy-nrf52840.json
k210.json
kb2040.json
lgt92.json
lm3s6965.ld
lorae5.json
m5stack-core2.json
m5stack.json
m5stamp-c3.json
macropad-rp2040-boot-stage2.S feather-rp2040,macropad-rp2040: fix qspi-flash settings 2022-07-05 16:37:45 +02:00
macropad-rp2040.json
maixbit.json
maixbit.ld
matrixportal-m4.json
mch2022.json
mdbt50qrx-uf2.json
metro-m4-airlift.json
microbit-s110v8.json
microbit-v2-s113v7.json
microbit-v2.json
microbit.json
mimxrt1062-teensy40.ld
nano-33-ble-s140v6-uf2.json
nano-33-ble-s140v7-uf2.json
nano-33-ble-s140v7.json
nano-33-ble.json
nano-33-ble.ld board/nano-33-ble: pins, blinking leds and serial 2021-06-14 00:06:59 +02:00
nano-rp2040.json
nicenano.json
nintendoswitch.json
nintendoswitch.ld nintendoswitch: Add env parser and removed unused stuff 2020-11-03 23:28:55 +01:00
nintendoswitch.s
nodemcu.json
nrf51-s110v8.json
nrf51-s110v8.ld
nrf51.json
nrf51.ld
nrf52-s132v6.json
nrf52-s132v6.ld
nrf52.json
nrf52.ld nrf: fix nrf52832 flash size 2020-10-20 19:13:43 +02:00
nrf52833-s113v7.json
nrf52833-s113v7.ld microbit-v2: add support for S113 SoftDevice 2021-04-14 22:55:52 +02:00
nrf52833.json
nrf52833.ld
nrf52840-mdk-usb-dongle.json
nrf52840-mdk.json
nrf52840-s140v6-uf2.json
nrf52840-s140v6-uf2.ld
nrf52840-s140v7-uf2.json
nrf52840-s140v7-uf2.ld
nrf52840-s140v7.json
nrf52840-s140v7.ld
nrf52840.json
nrf52840.ld
nucleo-f103rb.json
nucleo-f722ze.json
nucleo-l031k6.json
nucleo-l432kc.json
nucleo-l552ze.json
nucleo-wl55jc.json
nxpmk66f18.ld
p1am-100.json
particle-3rd-gen.json
particle-argon.json
particle-boron.json
particle-xenon.json
pca10031.json
pca10040-s132v6.json
pca10040.json
pca10056-s140v7.json
pca10056.json
pca10059.json
pca10059.ld
pico-boot-stage2.S
pico.json
pico.ld
pinetime-devkit0.json
pybadge.json
pygamer.json
pyportal.json
qtpy-rp2040-boot-stage2.S
qtpy-rp2040.json
qtpy-rp2040.ld
qtpy.json
reelboard-s140v7.json
reelboard.json
riscv-qemu.json
riscv-qemu.ld
riscv.json
riscv.ld riscv: align the heap to 16 bytes 2021-10-05 05:52:03 +02:00
riscv32.json
riscv64.json
rp2040-boot-stage2.S
rp2040.json
rp2040.ld
simavr.json
stm32.ld
stm32f4disco-1.json
stm32f4disco.json
stm32f7x2zetx.ld
stm32f103rb.ld
stm32f405.ld
stm32f407.ld
stm32f469.ld
stm32f469disco.json
stm32l0x2.json
stm32l4x2.ld
stm32l4x5.ld
stm32l5x2xe.ld nucleol552ze: implementation with CLOCK, LED, and UART 2021-02-16 12:48:52 +01:00
stm32l031k6.ld stm32: add nucleo-l031k6 support 2021-04-07 17:20:19 +02:00
stm32l072czt6.ld Support for STM32L0 MCUs and Dragino LGT92 device (#1561) 2021-01-08 22:27:25 +01:00
stm32wl5x_cm4.json
stm32wle5.json
stm32wlx.ld
swan.json
teensy36.json
teensy36.s
teensy40.json
teensy40.s
teensy41.json
thingplus-rp2040.json
thingplus-rp2040.ld
trinket-m0.json
trinkey-qt2040-boot-stage2.S
trinkey-qt2040.json
trinkey-qt2040.ld
tufty2040.json
tufty2040.ld
wasi.json
wasm-undefined.txt wasm: do not allow undefined symbols 2022-09-08 08:25:27 +02:00
wasm.json
wasm_exec.js
waveshare-rp2040-zero.json
waveshare-rp2040-zero.ld
wioterminal.json
x9pro.json
xiao-ble.json
xiao-esp32c3.json
xiao-rp2040.json
xiao-rp2040.ld Initial support for XIAO RP2040 2022-07-06 22:23:47 +02:00
xiao.json
xtensa.json