Граф коммитов

452 коммитов

Автор SHA1 Сообщение Дата
Ayke van Laethem
d441f0152f riscv: use LLVM tools instead of GNU toolchain
Now that we use LLVM 9, RISC-V support in LLVM has far fewer bugs and we
can avoid the GNU toolchain.

  * replace GNU linker with lld
  * replace GCC with clang

Additionally, RISC-V was promoted to stable so it can be enabled by
default in CI.
2019-12-07 16:27:10 +01:00
Ayke van Laethem
2f932a9eee riscv: fix heap corruption
The .sdata and .sbss sections are created by the compiler, but were not
present in the linker script. That means that the linker put them after
all other data/bss section, which happens to be where the heap also
resides.

This commit adds the .sdata and .sbss sections to the linker script,
which gets the blinky examples to work again on RISC-V.
2019-12-05 20:27:28 +01:00
Nikolas Sepos
c09724bfc5 nrf: support for SoftDevice s140 PCA10056 board 2019-11-20 16:43:55 +01:00
Ayke van Laethem
3cedebd299 nrf: fix nrf52-s132v6 config
In my excitement to get the SoftDevice PR ready, I made two mistakes.
They're fixed in this commit.

  * Add the `s132v6` build tag.
  * Remove the (old) `ldscript` property.

This fixes the following issue:
https://github.com/aykevl/go-bluetooth/issues/1
2019-11-16 21:57:18 +01:00
BCG
009b27350e Adding Support for Adafruit Metro M4 Express Airlift (#694)
* machine/metro-m4: add support for Adafruit Metro M4 Express Airlift board
2019-11-15 09:52:54 +01:00
Ayke van Laethem
c6255e4d0a targets: explicitly mark the stack as NOLOAD
This prevents it from being of type PROGBITS in lld 9, it should always
be NOBITS. It should fix the following error in lld 9:

    ROM segments are non-contiguous
2019-11-12 17:10:13 +01:00
Ayke van Laethem
16fbf53ae2 nrf: add support for SoftDevices to PCA10040 board 2019-11-08 13:08:59 +01:00
BCG
0db403dc0c Adding Board: Feather M4 Express (#688)
* machine/feather-m4: Adding Feather M4
2019-11-05 15:34:46 +01:00
Ayke van Laethem
1cbe09ee89 compileopts: add linkerscript key
Setting the linker script as one property (instead of as part of the
generic ldflags property) allows it to be overriden.

This is important for the SoftDevice on Nordic chips, because the
SoftDevice takes up a fixed part of the flash/RAM and the application
must be flashed at a different position. With this linkerscript option,
it is possible to create (for example) a pca10040-s132v6 that overrides
the default linker script.
2019-11-04 16:21:59 +01:00
Ayke van Laethem
2a5ab2500d machine: add support for the X9 Pro smartwatch
This is a Chinese smart watch sold on AliExpress etc. It is based on a
nrf52832. More information:
https://github.com/curtpw/nRF5x-device-reverse-engineering/tree/master/X9-nrf52832-activity-tracker
2019-11-03 17:28:32 +01:00
Ayke van Laethem
071f863e5d qemu: rename assembly file
The name was cortex-m.s which looks like it is a generic assembly file
for all cortex-m targets. However, it really is only for qemu
simulation, because every chip has a slightly different interrupt vector
table.
2019-11-01 16:25:41 +01:00
Ayke van Laethem
b884db81ea cortexm: move SemihostingCall impl to the right asm file
This is the more correct location. The targets/cortex-m.s file is really
just for qemu, not for Cortex-M in general.
2019-11-01 16:25:41 +01:00
Ayke van Laethem
ceece08959 nrf: add support for the PineTime64 devkit
This smartwatch doesn't have an on-board debugger, so I picked the one I
was using while getting this smartwatch to run Go programs (the J-Link
EDU Mini).
2019-10-28 07:17:39 +01:00
Ayke van Laethem
2a71aa90bc targets: refactor flash/gdb target configuration
Instead of specifying explicit commands, most of these commands have
been replaced by more specific properties.

This is work that will be necessary for an eventual -programmer flag to
the compiler, with which it is possible to select which programmer to
use to flash or debug a chip. That's not very useful for boards that
already include a programmer or bootloader for that purpose, but is very
useful for novel boards or single-purpose boards that are not already
included in TinyGo.
2019-10-14 16:44:33 +02:00
Ron Evans
ba49148644 flash: support flashing boards using Mass Storage Device (MSD) operation for uf2 and daplink bootloaders
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-10-13 15:11:21 +02:00
Ron Evans
02facb8568 flash: add ability to perform 1200baud port reset for MCUs that can detect this in order to go into bootloader mode for flashing without pressing any buttons. Also add support for this to the Arduino Nano33 IoT board target
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-10-13 00:43:00 +02:00
cn
9d35c1197f machine/stm32f103xx/nucleo-f103rb: add support for NUCLEO-F103RB STM32F1-based board
Compared to the already supported stm32f103xx "bluepill" board this:

- features 128 KiB flash memory size ("RB" suffix) instead of 64 KiB, see `targets/stm32f103rb.ld`
- has onboard ST-LINK/V2-1 programmer and debugger requiring different OpenOCD configuration file
- uses USART2 connected to ST-LINK/V2-1 debugger as virtual COM port over USB for `putchar()`
- has a user-accessible button besides the reset button
2019-09-17 13:26:26 +02:00
Konstantin Itskov
4eb34b36f8 Add syscall/js.valueInvoke support 2019-09-16 13:36:37 +02:00
Konstantin Itskov
61750be9aa Add syscall/js.valueSetIndex support 2019-09-16 13:32:31 +02:00
Ron Evans
02c4020228 machine/atsamd51: add support for ATSAMD51 processor using Adafruit ItsyBitsy-M4 board
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 17:56:14 +02:00
Ayke van Laethem
542135c357 compiler,runtime: implement stack-based scheduler
This scheduler is intended to live along the (stackless) coroutine based
scheduler which is needed for WebAssembly and unsupported platforms. The
stack based scheduler is somewhat simpler in implementation as it does
not require full program transform passes and supports things like
function pointers and interface methods out of the box with no changes.

Code size is reduced in most cases, even in the case where no scheduler
scheduler is used at all. I'm not exactly sure why but these changes
likely allowed some further optimizations somewhere. Even RAM is
slightly reduced, perhaps some global was elminated in the process as
well.
2019-08-15 17:31:54 +02:00
Kyle Lemons (Loon, LLC)
92206558fb
gameboy-advance: don't crash copying unaligned strings
Strings are emitted in .rodata sections, which are not yet mentioned in the linker script.

I can't exactly explain why it didn't work before, as these sections should have been included in .bss and thus properly aligned, but it appears to work reliably.
2019-08-09 20:14:17 +02:00
Ayke van Laethem
9846c062b3 targets: add support for GameBoy Advance
Only tested in an emulator (mGBA). Almost nothing is supported, but
drawing to the screen works.
2019-08-05 09:19:49 +02:00
Ayke van Laethem
54169c714f all: use baremetal build tag
This simplifies adding more baremetal targets, like a GameBoy Advance,
or baremetal x86 for unikernels.
2019-08-04 17:12:07 +02:00
Trevor Rosen
64597de344 Device path at flash time for several boards 2019-07-25 10:17:16 -07:00
Ayke van Laethem
00cc486619 wasm: set the stack at the start of linear memory
This makes sure that a stack overflow will cause a "memory access out of
bounds" error instead of a corruption of a global variable.

Here is more background on a very similar stack overflow protection:
https://blog.japaric.io/stack-overflow-protection/
2019-07-08 00:09:59 +02:00
Ron Evans
fc9188a298 machine/samd21/arduino-nano33: adds support for Arduino Nano33 IoT along with mapping to NINA-W102 WiFi chip.
Also adds DTR and RTS functions along with timeouts to USBCDC functions to prevent lockups.

Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-07-07 18:09:05 +02:00
Ayke van Laethem
ffa38b183b all: add HiFive1 rev B board with RISC-V architecture
This page has been a big help in adding support for this new chip:
https://wiki.osdev.org/HiFive-1_Bare_Bones
2019-07-07 14:03:24 +02:00
Ayke van Laethem
385d1d0a5d
compiler,runtime: implement a portable conservative GC 2019-07-01 16:30:33 +02:00
Ayke van Laethem
00e91ec569
all: rename garbage collectors
dumb -> leaking:
  make it more clear what this "GC" does: leak everything.
marksweep -> conservative:
  "marksweep" is too generic, use "conservative" to differentiate
  between future garbage collectors: precise marksweep / mark-compact /
  refcounting.
2019-07-01 13:03:07 +02:00
Ayke van Laethem
eb1d834dd4 wasm: add support for js.FuncOf 2019-05-27 13:35:59 +02:00
Ayke van Laethem
f7687c43aa wasm: fix wasm-ld hang
See the following bugs for more information:
https://bugs.llvm.org/show_bug.cgi?id=41508
https://bugs.llvm.org/show_bug.cgi?id=37064
2019-05-25 18:25:46 +02:00
Ayke van Laethem
ba85c82fbb arm: print an error when a HardFault occurs
This is very useful for debugging. It differentiates between a stack
overflow and other errors (because it's easy to see when a stack
overflow occurs) and prints the old stack pointer and program counter if
available.
2019-05-20 11:39:17 +02:00
Anthony Elder
4cd151faf5 Add Feather M0 Board (#356)
* Add Feather M0 Board
2019-05-19 17:10:17 +02:00
Martin Treml
fc2ed2bdd0 [Board] Adafruit Trinket (#333)
* Add support for Adafruit Trinket-M0 board
2019-05-14 19:30:39 +02:00
Ayke van Laethem
1f0595438e main: do not set working directory for Clang invocation
This commit avoids setting the working directory to the TinyGo root when
invocating Clang. This helps to weed out issues before we add support
for bundling Clang in a release.
2019-05-03 11:36:24 +02:00
Ayke van Laethem
1d59a960bc main: allow changing the clang command name 2019-04-30 20:04:04 +02:00
Ayke van Laethem
2f2d62cc0c cgo: support builtin #include headers
Add support for header files bundled with the compiler by copying them
into the release tarball.
2019-04-25 12:55:52 +02:00
Yusuke Mitsuki
1322f404a6
stm32: add support for the STM32F4Discovery
Signed-off-by: Yusuke Mitsuki <mickey.happygolucky@gmail.com>
2019-04-13 13:32:05 +02:00
Ayke van Laethem
2523772b5d arm: use the lld linker
LLD version 8 has added support for armv6m:
    https://reviews.llvm.org/D55555
This means we can use LLD instead of arm-none-eabi-ld, eliminating our
dependency on GNU binutils.

There are small differences in code size, but never more than a few
bytes.
2019-04-04 12:50:15 +02:00
Ayke van Laethem
31d57fd3d1 main: use wasm-ld instead of wasm-ld-8 on macOS
This commit does a few things:
  * remove the -8 suffix on macOS, where it is not necessary
  * add smoke tests for compiling wasm files on Linux and macOS
2019-04-04 12:50:15 +02:00
Ayke van Laethem
a2d0f79be3 all: pretend to be linux/arm in baremetal targets
So far, we've pretended to be js/wasm in baremetal targets to make the
stdlib happy. Unfortunately, this has various problems because
syscall/js (a dependency of many stdlib packages) thinks it can do JS
calls, and emulating them gets quite hard with all changes to the
syscall/js packages in Go 1.12.

This commit does a few things:
  * It lets baremetal targets pretend to be linux/arm instead of
    js/wasm.
  * It lets the loader only select particular packages from the src
    overlay, instead of inserting them just before GOROOT. This makes it
    possible to pick which packages to overlay for a given target.
  * It adds a baremetal-only syscall package that stubs out almost all
    syscalls.
2019-03-23 22:58:26 +01:00
Ayke van Laethem
9c41011e17 all: switch to LLVM 8 2019-03-22 22:55:11 +01:00
Ayke van Laethem
4ad9bd8643 wasm: ignore arguments and environment variables
The wasm_exec.js file copied from the main Go repository did write those
values to address 4096 in linear memory, which led to memory corruption
in linear memory. Remove these things for now, until they're actually
supported, if support is ever added.
2019-03-07 13:13:11 +01:00
Ayke van Laethem
41e093d7bb wasm: switch emulator to node.js
Unfortunately, the olin/cwa emulator does not handle floats correctly.
Node.js does, and because it is also supported by the Go WebAssembly
implementation it has better support in general.
2019-03-04 21:58:40 +01:00
Ayke van Laethem
4f932b6e66 all: use internal objcopy implementation
This lessens the dependency on binutils (e.g. arm-none-eabi-objcopy).
2019-03-04 21:17:56 +01:00
Ron Evans
4424fe087d machine/circuitplay_express: add basic support for Adafruit Circuit Playground express pin mappings
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-02-24 23:01:22 +01:00
Ron Evans
942d4903ce
machine/atsamd21: extracts functionality for processor family into shared files.
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-02-20 14:16:09 +01:00
Ayke van Laethem
4b477fad55 all: update Travis CI to Ubuntu Xenial
This lets us test with a more recent base, and should fix various
issues.
2019-02-05 19:39:33 +01:00
Ayke van Laethem
25cd982263
main: optionally build with LLD
When building statically against LLVM, LLD is also included now. When
included, the built in wasm-ld will automatically be used instead of the
external command.

There is also support for linking ELF files but because lld does not
fully support armv6m this is not yet enabled (it produces a warning).
2019-02-01 13:26:32 +01:00