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

1530 коммитов

Автор SHA1 Сообщение Дата
sago35
8fed063820 usb: add support for midi 2022-07-12 19:13:12 +02:00
sago35
7afc47d67a usb: add DTR and RTS to serialer interface 2022-07-12 16:22:16 +02:00
sago35
0bc7c2a61f
rp2040: add support for usb (#2973)
* rp2040: add support for usb
2022-07-12 15:41:56 +02:00
sago35
d434058aef
samd21,samd51,nrf52840: move usbcdc to machine/usb/cdc (#2972)
* samd21,samd51,nrf52840: move usbcdc to machine/usb/cdc
2022-07-10 11:33:52 +02:00
Kenneth Bell
1d99b1ed84 boards: add Challenger RP2040 LoRa 2022-07-08 13:01:14 +02:00
sago35
f1e6997018 atsamd21,atsamd51,nrf52840: improve usb-device initialization 2022-07-07 21:04:41 +02:00
sago35
335a7ad0b7
samd21,samd51,nrf52840: refactor handleStandardSetup and initEndpoint (#2968)
* samd21,samd51,nrf52840: refactor handleStandardSetup and initEndpoint
2022-07-07 16:43:57 +02:00
sago35
17deac116f samd21,samd51,nrf52840: change usbSetup and sendZlp to public 2022-07-07 08:25:02 +02:00
Daniel Esteban
b112477e95 Initial support for XIAO RP2040 2022-07-06 22:23:47 +02:00
sago35
2fa24ef752 samd21,samd51,nrf52840: refactor usb initialization 2022-07-06 17:55:25 +02:00
sago35
fcefcb191c samd21,samd51,nrf52840: unify bootloader entry process 2022-07-06 09:14:11 +02:00
sago35
ff7c71c99c serial: use common initialization for serial 2022-07-05 20:53:37 +02:00
sago35
401bd89664 samd21, samd51: move USB-CDC code 2022-07-05 14:41:51 +02:00
sago35
1766746c60 rp2040: add usb settings 2022-07-04 13:17:54 +02:00
Kenneth Bell
8a5ab5ab12 rp2040: fix gpio interrupts 2022-06-26 12:14:52 +02:00
Ayke van Laethem
4262f0ff1f compiler: really define runtime.mem* as LLVM intrinsic wrappers
This makes it possible to //go:linkname them from other places, like in
the reflect package. And is in my opinion a much cleaner solution.
2022-06-24 11:10:24 +02:00
ardnew
afae6b3795
board/teensy40: Add I2C support (#1471)
* teensy40: add I2C support
2022-06-22 11:28:50 +02:00
Ayke van Laethem
64d7f1e436 all: run gofmt on all source code
Some source code wasn't part of `FMT_PATHS` so wasn't checked for
correct formatting. This change includes all this source code and
excludes cgo/testdata because it contains files that can't be parsed.
2022-06-19 13:00:44 +02:00
Ayke van Laethem
9af535bf98 avr: add support for recover()
You can see that it works with the following command:

    tinygo run -target=simavr ./testdata/recover.go

This also gets the following tests to pass again:

    go test -run=Build -target=simavr -v

Adding support for AVR was a bit more compliated because it's also
necessary to save and restore the Y register.
2022-06-19 11:51:12 +02:00
Ayke van Laethem
159f0051bb runtime: move *task.DeferFrame here
This is a refactor that makes the next commit simpler. Perhaps it should
have been like this from the beginning but I didn't like all the casts.
2022-06-19 11:51:12 +02:00
Ayke van Laethem
49e22fe678 runtime: load sp and pc inside tinygo_longjmp
This is a small change to make it easier to support architectures that
need to restore more than just the sp and pc registers. In particular,
it is needed for the AVR architecture that needs to restore the frame
pointer (Y register).
2022-06-19 11:51:12 +02:00
Yurii Soldak
c119721e3b atmega2560: support UART1-3
+ example for uart
2022-06-18 09:26:12 +02:00
Ayke van Laethem
9294141d70 avr: fix race condition in stack write
If an interrupt happens between the writes to SPL and SPH, the stack
pointer is inconsistent and terrible things will happen. Therefore,
disable interrupts while updating the stack pointer.

Interrupts are restored _before_ the write to SPH. This is safe, because
interrupts are re-enabled with a one cycle delay. The avr-gcc and Clang
compilers do the same thing when they need to update the stack pointer.

It's almost impossible to test for this bug, but it should make firmware
just a little bit more reliable.
2022-06-17 19:17:21 +02:00
Damian Gryski
bcf58c0840 runtime: add comments about the hash functions 2022-06-17 08:46:41 +02:00
Damian Gryski
7a61cb1bc3 src/runtime: add leveldb memhash 2022-06-17 08:46:41 +02:00
Damian Gryski
11e1b2148f src/runtime: switch to stronger hash function
Fixes #2713
2022-06-17 08:46:41 +02:00
Ayke van Laethem
8d6b210c09 compiler: implement recover() built-in function 2022-06-16 07:59:21 +02:00
Ayke van Laethem
b31281a5b6 runtime: scan all writable program segments
Previously we used to scan between _edata and _end. This is not correct:
the .data section starts *before* _edata.

Fixing this would mean changing _edata to _etext, but that didn't quite
work either. It appears that there are inaccessible pages between _etext
and _end on ARM. Therefore, a different solution was needed.

What I've implemented is similar to Windows and MacOS: namely, finding
writable segments by parsing the program header of the currently running
program. It's a lot more verbose, but it should be correct on all
architectures. It probably also reduces the globals to scan to those
that _really_ need to be scanned.

This bug didn't result in issues in CI, but did result in a bug in the
recover branch: https://github.com/tinygo-org/tinygo/pull/2331. This
patch fixes this bug.
2022-06-16 07:59:21 +02:00
Dan Kegel
8754f64f3b syscall.Getpagesize(): add test, implement for Linux and Windows 2022-06-12 01:15:42 +02:00
Ayke van Laethem
caf405b01d reflect: add Value.UnsafePointer method
This was added in Go 1.18.
2022-06-12 01:08:02 +02:00
sago35
76bba13963
usbhid: add support for mouse buttons (#2900)
* usbhid: add support for mouse buttons
2022-06-11 16:11:04 +02:00
sago35
1b2e764835 samd21,samd51,nrf52840: add support for USBHID (keyboard / mouse) 2022-06-11 09:44:09 +02:00
sago35
906757603d wioterminal: fix I2C definition 2022-06-08 18:32:08 +02:00
Krzysztof Jagiello
5d16811199 Attach USB DP to the correct pin on Matrix Portal M4 2022-06-03 07:42:19 +02:00
Ayke van Laethem
2d61972475 gc: drop support for 'precise' globals
Precise globals require a whole program optimization pass that is hard
to support when building packages separately. This patch removes support
for these globals by converting the last use (Linux) to use
linker-defined symbols instead.

For details, see: https://github.com/tinygo-org/tinygo/issues/2870
2022-06-01 21:21:30 +02:00
Damian Gryski
5c488e3145 src/runtime: handle nil map write panics 2022-06-01 13:28:22 +02:00
Damian Gryski
e45ff9c0e8 src/runtime: add per-map hash seeds 2022-06-01 13:28:22 +02:00
sago35
39805bca45 os, runtime: enable os.Stdin for baremetal target 2022-06-01 07:56:25 +02:00
Ayke van Laethem
ea3b5dc689 nintendoswitch: scan globals conservatively
This is a step towards #2870, similar to #2867 and #2869.
2022-05-29 21:00:09 +02:00
Olaf Flebbe
3dd502a928 align api for PortMaskSet, PortMaskClear 2022-05-26 21:37:03 +02:00
Ayke van Laethem
48242ba8d6 darwin: scan globals by reading MachO header
This replaces "precise" global scanning in LLVM with conservative
scanning of writable MachO segments. Eventually I'd like to get rid of
the AddGlobalsBitmap pass, and this is one step towards that goal.
2022-05-25 12:51:31 +02:00
Ayke van Laethem
9de76fb42e avr: simplify timer-based time
Simplify the interrupt-based timer code in a few ways:

  - Do not recalibrate the timer every 100ms. Instead, rely on the fact
    that the machine package will calbrate the timer if necessary if it
    makes changes to Timer0.
  - Do not configure Timer0 and then set nanosecondsInTick based on that
    value. Instead, use a fixed value.

These two changes together mean that in code that doesn't use PWM,
nanosecondsInTick will be constant which makes the TIMER0_OVF interrupt
handler a lot smaller.

Together this reduces the code size of AVR binaries by about 1200 bytes,
making it pretty close to the pre-timer code size (only about 250 bytes
larger).

It also somehow fixes a problem with
tinygo.org/x/drivers/examples/ws2812 on the Arduino Uno. I'm not quite
sure what was going wrong, but bisecting pointed towards the timer code
(https://github.com/tinygo-org/tinygo/pull/2428) and with this
simplification the bug appears to be gone.
2022-05-25 11:53:30 +02:00
deadprogram
f308d7d28c machine/badger2040: support for Badger 2040
Signed-off-by: deadprogram <ron@hybridgroup.com>
2022-05-24 15:02:23 +02:00
Ayke van Laethem
5404c81ffd windows: scan globals conservatively
Scan globals conservatively by reading writable sections from the PE
header.

I'd like to get rid of needing to precisely scan globals eventually, and
this brings us one step closer. It also avoids a bug with ThinLTO on
Windows.
2022-05-23 21:24:14 +02:00
Dan Kegel
4ed0936c0e darwin: adjust syscall suffix for arm64 2022-05-20 18:47:30 +02:00
Ayke van Laethem
7a5d4c9537 darwin: add support for arm64 GOARCH (aka Apple Silicon)
This patch adds support for generating GOOS=darwin GOARCH=arm64
binaries. This means that it will become possible to run `go test` on
recent Macs, for example.
2022-05-20 08:35:18 +02:00
Kenneth Bell
8f40b107d9 rp2040: replace sleep 'busy loop' with timer alarm 2022-05-17 12:41:24 +02:00
Ayke van Laethem
5c23f6fb6c all: remove support for LLVM 11 and LLVM 12
This removes a lot of backwards compatibility cruft and makes it
possible to start using features that need LLVM 13 or newer.
For example:

  * https://github.com/tinygo-org/tinygo/pull/2637
  * https://github.com/tinygo-org/tinygo/pull/2830
2022-05-07 17:15:35 +02:00
Dan Kegel
1d2c39c3b9 os: skip TestDirFSPathsValid on WASI to work around #2828 on windows 2022-05-03 05:36:55 +02:00
Dan Kegel
270a2f51fd os: skip TestDirFS on wasi until #2827 is fixed 2022-05-03 05:36:55 +02:00