diff options
author | Ayke van Laethem <[email protected]> | 2021-06-01 13:27:58 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-06-25 17:58:39 +0200 |
commit | 96e863f0f37cef0e8f36cb0d5f1c94fe062bc03d (patch) | |
tree | f4044fca721e0d1f58f64e7a312b6fb92215f64f /compileopts/target.go | |
parent | 75298bb84bcb966998ca00f3cc5506a9757a5038 (diff) | |
download | tinygo-96e863f0f37cef0e8f36cb0d5f1c94fe062bc03d.tar.gz tinygo-96e863f0f37cef0e8f36cb0d5f1c94fe062bc03d.zip |
all: add a flag to the command line to select the serial implementation
This can be very useful for some purposes:
* It makes it possible to disable the UART in cases where it is not
needed or needs to be disabled to conserve power.
* It makes it possible to disable the serial output to reduce code
size, which may be important for some chips. Sometimes, a few kB can
be saved this way.
* It makes it possible to override the default, for example you might
want to use an actual UART to debug the USB-CDC implementation.
It also lowers the dependency on having machine.Serial defined, which is
often not defined when targeting a chip. Eventually, we might want to
make it possible to write `-target=nrf52` or `-target=atmega328p` for
example to target the chip itself with no board specific assumptions.
The defaults don't change. I checked this by running `make smoketest`
before and after and comparing the results.
Diffstat (limited to 'compileopts/target.go')
-rw-r--r-- | compileopts/target.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compileopts/target.go b/compileopts/target.go index 4fb62fce3..ba5f73826 100644 --- a/compileopts/target.go +++ b/compileopts/target.go @@ -31,6 +31,7 @@ type TargetSpec struct { BuildTags []string `json:"build-tags"` GC string `json:"gc"` Scheduler string `json:"scheduler"` + Serial string `json:"serial"` // which serial output to use (uart, usb, none) Linker string `json:"linker"` RTLib string `json:"rtlib"` // compiler runtime library (libgcc, compiler-rt) Libc string `json:"libc"` |