From d3d4acaadf6c5414f4434dde2594605d3261b332 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 10 Feb 2021 23:48:18 +0100 Subject: [PATCH] esp: add picolibc With this change, it is possible to fully use CGo on ESP32/ESP8266 chips. The following will work: tinygo flash -target=d1mini -port=/dev/ttyUSB0 ./testdata/cgo/ tinygo flash -target=esp32-mini32 -port=/dev/ttyUSB0 ./testdata/cgo/ Previously it would produce output like the following: /tmp/tinygo905539688/main.o:(.literal.runtime.run$1$gowrapper+0x150): undefined reference to `strcpy' /tmp/tinygo905539688/main.o:(.literal.runtime.run$1$gowrapper+0x154): undefined reference to `strlen' --- targets/esp32.json | 1 + targets/esp8266.json | 1 + 2 files changed, 2 insertions(+) diff --git a/targets/esp32.json b/targets/esp32.json index 897ae33a..3559e892 100644 --- a/targets/esp32.json +++ b/targets/esp32.json @@ -9,6 +9,7 @@ "-mcpu=esp32" ], "rtlib": "compiler-rt", + "libc": "picolibc", "linkerscript": "targets/esp32.ld", "extra-files": [ "src/device/esp/esp32.S", diff --git a/targets/esp8266.json b/targets/esp8266.json index 593d0769..e1304d24 100644 --- a/targets/esp8266.json +++ b/targets/esp8266.json @@ -9,6 +9,7 @@ "-mcpu=esp8266" ], "rtlib": "compiler-rt", + "libc": "picolibc", "linkerscript": "targets/esp8266.ld", "extra-files": [ "src/device/esp/esp8266.S",