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

3527 коммитов

Автор SHA1 Сообщение Дата
Damian Gryski
0212f0c008 compiler: limit level of pointer-to-pointer-to-... types 2023-06-09 17:30:02 +02:00
Damian Gryski
f5f4751088 compiler,transform: fix for pointer-to-pointer type switches from @aykevl 2023-06-09 17:30:02 +02:00
Damian Gryski
62fb386d57 compiler,reflect: add tagged pointers for **T etc 2023-06-09 17:30:02 +02:00
ivoszz
a59f92daf8 Add smoke test for target m5stick-c 2023-06-08 09:27:41 +02:00
ivoszz
b7508818ee Support for the M5STACK M5StickC ESP32-PICO device 2023-06-08 09:27:41 +02:00
Damian Gryski
284e1acd87 compiler: update testdata 2023-06-08 07:55:37 +02:00
Damian Gryski
37849c4897 compiler,reflect: use two bits of the meta byte for comparable/isBinary
Fixes #3683
2023-06-08 07:55:37 +02:00
deadprogram
213e73ad84 build: only make comment on sizediff job when run from the main repo, take 2
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-06-07 12:54:15 +02:00
Ayke van Laethem
4a240827cb main: add -internal-nodwarf flag
This can be useful during development to avoid generating debug
information in IR.
2023-06-06 11:46:16 +02:00
Ayke van Laethem
92d9f856ab main: rename some flags to make them explicitly internal
These flags shouldn't be used by users, but they are occasionally
helpful for developers.
2023-06-06 11:46:16 +02:00
Damian Gryski
ee5890f36f tools: use geomean for sizediff 2023-06-06 09:30:35 +02:00
soypat
744574193b machine/rp2040: fix i2c crash when getting abort while waiting for stop condition 2023-06-04 20:17:33 +02:00
soypat
bbe755fb69 fix bug in rp2040 SetPeriod implementation 2023-06-03 13:16:32 +02:00
Pierre Constantineau
635d322703
Add bluemicro840 board 2023-06-01 21:04:36 +02:00
deadprogram
ee90bdebff build: only make comment on sizediff job when run from the main repo
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-31 21:24:50 +02:00
soypat
bcdb3fc681 fix go:noinlines in volatile package 2023-05-29 22:16:35 +02:00
Ayke van Laethem
b7b23ace3f samd21: fix issue with WS2812 driver
The regular port access is around 4 cycles, instead of the usual 2
cycles for a store instruction on Cortex-M0+. The IOBUS however is
faster, I didn't measure exactly but I guess it's 2 cycles as expected.

This fixes a bug in the WS2812 driver that only happens on samd21 chips:
https://github.com/tinygo-org/drivers/issues/540
2023-05-29 20:45:31 +02:00
deadprogram
f366cd53b7 build: explicitly pass the github token to GH action
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-23 11:06:02 +02:00
Ayke van Laethem
da81784ee9 attiny1616: implement Pin.Get()
I didn't add this method in the initial PR.

Also, I found that a few of my assumptions were incorrect. I've changed
the code that configures the pin to make input (floating and pullup)
actually work. These chips really are quite different from all the older
AVRs.
2023-05-21 10:44:02 +02:00
Ayke van Laethem
481f60c5ea interp: add support for reading a pointer tag
This is necessary to get https://github.com/tinygo-org/tinygo/pull/3691
working.
2023-05-20 23:57:20 +02:00
Ayke van Laethem
cf39db36fe interp: fix subtle bug in pointer xor
If a pointer value was xor'ed with a value other than 0, it would not
have been run at runtime but instead would fall through to the generic
integer operations. This would likely result in a "cannot convert
pointer to integer" panic.

This commit fixes this subtle case.
2023-05-20 23:57:20 +02:00
Ayke van Laethem
54c07b7de8 interp: move some often-repeated code into a function 2023-05-20 23:57:20 +02:00
Ayke van Laethem
2fb866ca86 avr: add attiny1616 support
This is just support for the chip, no boards are currently supported.
However, you can use this target on a custom board.

Notes:

  - This required a new runtime and machine implementation, because the
    hardware is actually very different (and much nicer than older
    AVRs!).
  - I had to update gen-device-avr to support this chip. This also
    affects the generated output of other AVRs, but I checked all chips
    we support and there shouldn't be any backwards incompatible
    changes.
  - I did not implement peripherals like UART, I2C, SPI, etc because I
    don't need them. That is left to do in the future.

You can flash these chips with only a UART and a 1kOhm resistor, which
is really nice (no special hardware needed). Here is the program I've
used for this purpose: https://pypi.org/project/pymcuprog/
2023-05-20 21:18:02 +02:00
Ayke van Laethem
4d11d552db avr: update gen-device-avr tool to support newer AVRs
This refactors gen-device-avr to output two different formats: one for
all the existing AVR chips (that don't really have the concept of a
peripheral, just a bunch of registers), and one for all the new chips
like the ATtiny1616 (tinyAVR 1-series and 2-series) that have
peripherals like the Cortex-M chips with type structs and instances.

I checked the generated code for all the AVR chips we have support for
(atmega1280, atmega1284p, atmega2560, atmega328p, atmega32u4, attiny85)
and while the generated Go code did change, it looks safe to me.
2023-05-20 21:18:02 +02:00
Ayke van Laethem
b43bd9e62a avr: fix interrupt names for newer attiny chips
This only affects chips that aren't supported by TinyGo yet, so this
should be a safe change. Importantly, it fixes interrupts on the
ATtiny1616.
2023-05-20 21:18:02 +02:00
Rajat Jindal
572c22f66a add Settings to debug.BuildInfo
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
2023-05-20 14:49:31 +02:00
deadprogram
1b66da4dff build: add issues write permission to sizediff job
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-20 14:02:14 +02:00
Ayke van Laethem
b08ff17f6b compiler: disallow most types in //go:wasmimport
This is for compatibility with upstream Go.
See https://github.com/golang/go/issues/59149 for more context.
2023-05-20 11:24:20 +02:00
Ayke van Laethem
41e787d504 compiler: add tests for error messages
The test is currently empty, but will be used in the next commit.
2023-05-20 11:24:20 +02:00
Ayke van Laethem
6dba16f28e compiler: only calculate functionInfo once
This is a small change that's not really important in itself, but it
avoids duplicate errors in a future commit that adds error messages to
//go:wasmimport.
2023-05-20 11:24:20 +02:00
deadprogram
b336a1561f build: update GH actions-comment-pull-request to v2.3.1
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-17 17:54:47 +02:00
Ayke van Laethem
4c682680ca compileopts: don't filter build tags, use specific build tags instead
This basically reverts https://github.com/tinygo-org/tinygo/pull/3357
and replaces it with a different mechanism to get to the same goal.

I do not think filtering tags like this is a good idea: it's the wrong
part of the compiler to be concerned with such tags (that part sets
tags, but doesn't modify existing tags). Instead, I've written the
//go:build lines in such a way that it has the same effect: WASI
defaults to leveldb, everything else defaults to fnv, and it's possible
to override the default using build tags.
2023-05-17 11:21:15 +02:00
Ayke van Laethem
af76c807e2 windows: re-enable parallelism
This reverts https://github.com/tinygo-org/tinygo/pull/3525, because
that change didn't seem to stop the CI failures we have been seeing.
Instead, I've added thread support in
https://github.com/tinygo-org/tinygo/pull/3130 which IIRC fixed most of
the CI crashes.

Re-enabling parallelism should improve the performance of TinyGo a bit
on Windows.
2023-05-16 21:47:24 +02:00
sago35
cdbd850f80 machine: add DefaultUART to xiao 2023-05-16 20:10:44 +02:00
Damian Gryski
d256804af7 src/reflect: remove overflow checks from uvarint32 2023-05-16 19:02:08 +02:00
Damian Gryski
e3c96803c3 runtime: fix structField.data comment 2023-05-16 19:02:08 +02:00
Damian Gryski
f55bb8e030 builder: bump sizes_test 2023-05-16 19:02:08 +02:00
Damian Gryski
07fb3a0cad compiler,reflect: make field offsets varints
Fixes #3686
2023-05-16 19:02:08 +02:00
deadprogram
02913563df build: add write permission to sizediff GH actions job to always be able to add comments
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-16 18:41:45 +02:00
Ayke van Laethem
535e64adbc reflect: optimize Zero() a little bit
It could be expensive to call Size() three times, and it is unnecessary.
Instead, do it only once.

This results in a very small reduction of binary size if Zero() is used.
2023-05-14 18:23:23 +02:00
Ayke van Laethem
af936f3261 ci: add comment with binary size difference
This makes reviewing PRs a lot easier because I don't have to run this
myself :)

This only uses the drivers repo so far, which is a good starting point
but doesn't include binary size changes for WebAssembly for example. A
future change could add some real-world programs to get a better idea of
the real-world impact.

To be clear: the intention is not to just look at the number at the
bottom. It is important to look at the actual size difference to see the
overall pattern (like, the difference may be due to a few outlier).
2023-05-14 15:38:57 +02:00
sago35
d1a45f2efc machine/usb/hid: fix hidreport (2) 2023-05-14 12:17:01 +02:00
deadprogram
b56a263d0d machine/flash: remove FlashBuffer, modify flash example to use BlockDevice interface
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-14 10:41:03 +02:00
Ayke van Laethem
6435f62dcc builder: implement Nordic DFU file writer in Go
This avoids a dependency on nrfutil. I have verified that it creates
equivalent zip files to a wasp-os DFU zip file I downloaded here:
https://github.com/wasp-os/wasp-os/releases/
I have also tested that it produces valid DFU files that can be uploaded
using the dfu.py program here to my PineTime:
3d6fd30d33

There are some minor differences in the generated file that should not
matter in practice (JSON whitespace, firmware file name, zip
compression).
2023-05-13 09:52:42 +02:00
Ayke van Laethem
f4c8c37b7b nrf: add ADC oversampling support
This is a lot easier to support than on other chips, and results in
noticeably better output when set to a higher value.
2023-05-09 19:51:05 +02:00
Ayke van Laethem
868812717f nrf: add sample time to ADC
This is important for inputs with a high input resistance. In those
cases, the sample time needs to be longer.
2023-05-09 19:51:05 +02:00
Ayke van Laethem
e82f595f37 nrf: add ability to set the reference voltage
The reference voltage can't be 3.3V, so we pick 3.0V as this was the
previous default.
2023-05-09 19:51:05 +02:00
Ayke van Laethem
e5af121553 nrf: refactor ADC code a little bit
* Initialize the ADC in Configure() (instead of in Get()).
  * Do not set all channels to "not connected" - that's already the
    reset value.
  * Don't disable the ADC after use. It's not necessary to disable
    (current consumption appears to remain the same whether enabled or
    disabled).
2023-05-09 19:51:05 +02:00
Ayke van Laethem
20fdbc1f9d pinetime: update the target file
* Rename pinetime-devkit0 to pinetime because the production device is
    almost the same hardware (the only noticeable difference is a
    different accelerometer, which isn't part of the board file).
  * Remove the UART and set serial to none. The UART uses a lot of
    current by default, so it seems better to disable it.

This is a breaking change, but honestly I think I'm the only one who has
ever actually used TinyGo for the PineTime and I'm fine with this
change :)
2023-05-09 19:44:00 +02:00
sago35
14fed59827 machine/usb/hid: fix hidreport 2023-05-07 10:25:40 +02:00