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

3777 коммитов

Автор SHA1 Сообщение Дата
deadprogram
d331aca296 machine/rp2040: correct write block size for flash
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-07 00:49:10 +02:00
deadprogram
7e8a2e8934 machine/rp2040: correct param for number of bytes to be erased by flash
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-07 00:49:10 +02:00
deadprogram
e7363966a5 machine/atsam*, nrf, rp2040, stm32: correct error flashBlockDevice pad() function
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-06 23:24:01 +02:00
Daz Wilkin
373ab34492 Add dummy package for runtime/metrics to that modules that depend upon it (e.g. [Prometheus Go client library](https://github.com/prometheus/client_golang/blob/main/prometheus/internal/go_runtime_metrics.go)) will compile.
Avoids:
```console
package runtime/metrics is not in GOROOT
```

Fixes #3705
2023-05-06 14:55:17 +02:00
Achille
602f35a5ca
os: implement os.(*File).WriteAt (#3697)
os: implement os.(*File).WriteAt

Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
2023-05-05 09:40:15 +02:00
deadprogram
1d5c5ca2ef machine/usb/descriptor: further refactor HID report creation
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-05 07:44:03 +02:00
deadprogram
90935703e6 machine/usb/descriptor: rename and export Append() to make it easier to create new descriptors in user code
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-05 07:44:03 +02:00
deadprogram
d8ee520bdc machine/usb/descriptor: refactor HID report creation
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-05-05 07:44:03 +02:00
Ayke van Laethem
e4da35486b tools: add sizediff tool
This tool can be very useful to compare binary sizes as output by
`-size=short`.

This is a tool I wrote a while ago. It's not perfect (we should probably
use a geomean) but it works well enough to get a good idea on the binary
size impact of a change.
2023-05-04 21:46:53 +02:00
Edoardo Vacchi
4e41e9084a cgo: allow LDFLAGS: --export=...
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-05-04 20:45:02 +02:00
Achille Roussel
ee3af40cab os: implement os.(*File).ReadDir for -target=wasi
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
2023-05-03 21:24:11 +02:00
Achille Roussel
666312f63f implement Sync on stdioFileHandle
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
2023-05-03 19:37:53 +02:00
Achille Roussel
ccfe92a58c os: add os.(*File).Sync
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
2023-05-03 19:37:53 +02:00
Achille Roussel
4fa6a132e2 syscall: add fsync using libc
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
2023-05-03 19:37:53 +02:00
deadprogram
1a67795fd3 examples/usb-midi: remove serial communication from MIDI example
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-04-29 10:06:52 +02:00
deadprogram
c70daa2497 machine/usb: move MIDI under usb/adc (Audio Device Class) package
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-04-29 10:06:52 +02:00
sago35
d28b58e4dd machine/usb/hid/mouse: add support for mouse back and forward 2023-04-28 17:41:00 +02:00
deadprogram
25b03414dc machine/usb/hid/joystick: handle case where we cannot find the correct HID descriptor
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-04-28 15:15:54 +02:00
deadprogram
2ab7ee6a8a machine/usb: refactoring descriptors into subpackage for modularity
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-04-28 15:15:54 +02:00
Damian Gryski
6a2dd35fe6 builder: bump sizes test values 2023-04-27 11:15:41 +02:00
Damian Gryski
4c0fbbfc7f add struct size and field offsets to reflect data 2023-04-27 11:15:41 +02:00
deadprogram
36bd66a858 docs: update README for brevity and to add further info about webassembly
also, add links to guides about OS-specific development on website
      for macOS and Windows.

Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-04-27 09:08:37 +02:00
deadprogram
9d7dd3dd4b docs: update LICENSE year
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-04-27 09:08:37 +02:00
Ayke van Laethem
9bf5d6a4aa builder: add link to compatibility matrix
For context, see: https://github.com/tinygo-org/tinygo-site/pull/327

It only needs to be updated every half year, so it's not too bad, and it
could be very useful to some people.
2023-04-27 02:44:58 +02:00
Ayke van Laethem
839edec64c cortexm: fix stack size offset
The old code was broken and led to a HardFault in a rather convoluted
way:

 1. The CFA offset was incorrect, in fact it was not aligned (the stack
    is supposed to always be aligned to 4 bytes at least).
 2. This unaligned size was then used for stack size calculations.
 3. A stack that wasn't a multiple of 4 was allocated.
 4. The calleeSavedRegs struct (in `(internal/task.state).archInit`) was
    not correctly aligned.
 5. Writing to this struct resulted in a HardFault.
2023-04-27 00:11:53 +02:00
Ayke van Laethem
7e05c92420 cortexm: add "gdb" as a debugger
At least on Arch Linux ARM, there is no gdb-multiarch or something, just
"gdb" and it works for 32-bit ARM as well.
2023-04-26 23:07:52 +02:00
Ayke van Laethem
0b2aec1164 runtime: improve panic message when heap allocating in an interrupt
The old message may have been confusing. With the new message, it should
be more clear that we mean a _heap_ allocation.
2023-04-26 20:04:06 +02:00
Ayke van Laethem
ae381e74a5 main: print source location when a panic happens in -monitor
The previous commit started printing the instruction address for runtime
panics. This commit starts using this address to print the source
location.

Here is an example where this feature is very useful. There is a heap
allocation in the Bluetooth package, but we don't know where exactly.
Printing the instruction address of the panic is already useful, but
what is even more useful is looking up this address in the DWARF debug
information that's part of the binary:

    $ tinygo flash -target=circuitplay-bluefruit -monitor ./examples/heartrate
    Connected to /dev/ttyACM0. Press Ctrl-C to exit.
    tick 00:00.810
    tick 00:01.587
    tick 00:02.387
    tick 00:03.244
    panic: runtime error at 0x00027c4d: alloc in interrupt
    [tinygo: panic at /home/ayke/src/tinygo/bluetooth/adapter_sd.go:74:4]

To be clear, this path isn't stored on the microcontroller. It's stored
as part of the build, and `-monitor` just looks up the path from the
panic message.

Possible enhancements:

  - Print such an address for regular panics as well. I'm not sure
    that's so useful, as it's usually a lot easier to look up panics
    just by their message.
  - Use runtimePanicAt (instead of runtimePanic) in other locations, if
    that proves to be beneficial.
  - Print the TinyGo-generated output in some other color, to
    distinguish it from the regular console output.
  - Print more details when panicking (registers, stack values), and
    print an actual backtrace.
2023-04-26 18:40:35 +02:00
Ayke van Laethem
3392827c3e runtime: print the address where a panic happened
This is not very useful in itself, but makes it possible to detect this
address in the output. See the next commit.

This adds around 50 bytes to each binary (except for AVR and wasm). This
is unfortunate, but I think this feature is quite useful still.
A future enhancement might be to create a build tag for extended panic
information that's not set by default.
2023-04-26 18:40:35 +02:00
Scott Feldman
59838338ba
Add machine.CPUReset() (#3595)
machine: Add machine.CPUReset() for cortexm
2023-04-25 19:10:47 +02:00
Ron Evans
76303f9db4 Revert "all: better errors when multiple mcus share VID/PID"
This reverts commit af9f19615b.
2023-04-25 18:18:23 +02:00
Ron Evans
4bf8b618e5 Revert "all: honour port for -monitor flash flag"
This reverts commit 7aac1a1391.
2023-04-25 18:18:23 +02:00
deadprogram
c89a684ad2 machine/gba: rename display and make pointer receivers
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-04-25 16:43:29 +02:00
Kenneth Bell
7aac1a1391 all: honour port for -monitor flash flag 2023-04-25 11:21:16 +02:00
Kenneth Bell
af9f19615b all: better errors when multiple mcus share VID/PID 2023-04-25 11:21:16 +02:00
deadprogram
79b63dd041 device/gba: additional IO mapping for sound, DMA, SIO, and sprites
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-04-24 18:11:29 +02:00
Damian Gryski
06e34caa5f builder: print the status of the job that just completed 2023-04-22 10:01:02 +02:00
cui fliter
4e9f9e2773 fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-04-18 22:51:49 +02:00
Ayke van Laethem
64957c5254 samd51: fix ADC multisampling
Multisampling/averaging (using the Samples configuration property) was
returning incorrect values. When I investigated this, I found that the
samd51 gives erratic values when using multisampling together with fewer
than 16 bits resolution.

I fixed this by forcing 16 bit resolution when multisampling, and
adjusting the output to account for multisampling.

Found while reading the battery value on a pybadge, which gave
non-sensible values with Samples set to a value larger than 1.
2023-04-18 19:00:11 +02:00
Kenneth Bell
1bba5f5d7b targets: make msd-volume-name an array 2023-04-17 18:56:32 +02:00
deadprogram
48ef68dd86 examples: replace fmt with encoding/hex in usb-midi example
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-04-17 08:54:06 +02:00
Damian Gryski
8b9bee4cad main: don't print ok for a successful compile-only 2023-04-16 03:38:33 +02:00
Elliott Sales de Andrade
b4c9b579b8 Switch interp tests to opaque pointers 2023-04-16 03:34:46 +02:00
Damian Gryski
2b1dc4fee5 testing: add -test.shuffle to order randomize test and benchmark order 2023-04-12 20:43:41 +02:00
Damian Gryski
0244bed033 testdata: add test for else/defer bug 2023-04-11 18:54:05 -07:00
Damian Gryski
60b23a7035 compiler: update test outputs 2023-04-11 18:54:05 -07:00
Damian Gryski
4326c8f10e compiler: ensure all defers have been seen before creating rundefers
Fixes #3643
2023-04-11 18:54:05 -07:00
Damian Gryski
1672610749 testing: move runtime.GC() call to runN to match upstream 2023-04-11 12:16:25 +02:00
Damian Gryski
e00a2395d9 testing: fix benchmark logging output 2023-04-11 12:16:25 +02:00
sago35
42175496eb machine/atsamd51: remove extra BK0RDY clear 2023-04-10 09:16:52 +02:00