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

3630 коммитов

Автор SHA1 Сообщение Дата
Ayke van Laethem
568c2a4363 rp2040: remove SPI DataBits property
As discussed on Slack, I believe this property does more harm than good:

  * I don't think it's used anywhere. None of the drivers use it.
  * It is not fully implemented. While values <= 8 might work fine,
    values larger than 8 result in extra zero bits (instead of anything
    sensible).
  * Worse, it doesn't return an error when it's out of range. This is
    not an optional property: if the SPI peripheral doesn't support a
    particular number of bits, it should return an error instead of
    silently limiting the number of bits. This will be confusing to
    users.

Therefore, I propose we drop it. Maybe there are good uses for it
(perhaps for displays that use big endian 16-bit values?), but without a
good use case like a driver in tinygo.org/x/drivers, I think it's more
trouble than it's worth.
2023-03-29 09:30:16 +02:00
Kenneth Bell
c611c72526 build: test net on linux & mac only (random CI fails on windows) 2023-03-29 07:57:55 +02:00
deadprogram
dfb8c996a1 machine/lorae5: correct mapping for I2C bus, add pin mapping to enable power
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-03-28 15:28:14 +02:00
Achille Roussel
85da9a0aac fix resource leak in os.(*File).Close
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
2023-03-28 13:12:21 +02:00
Ayke van Laethem
17bc0d6663 compiler: only support //go:wasmimport on declared functions
Don't support this pragma on defined functions. It is only meant for
importing, not for exporting.
2023-03-28 09:31:09 +02:00
Ayke van Laethem
31043628d8 reflect: use direct calls to runtime string functions
The runtime.stringFromBytesTyped and runtime.stringToBytesTyped
functions aren't really necessary, because they have the same LLVM IR
signature. Therefore, remove them and link directly to the functions
that the compiler uses internally.
2023-03-27 22:24:20 +02:00
Damian Gryski
2c0f61cad1 reflect: fix bug found by Convert() tests on wasi 2023-03-27 18:53:37 +02:00
Damian Gryski
97ece754f6 reflect: add missing Uintptr type and some numerical tests 2023-03-27 18:53:37 +02:00
Damian Gryski
39f76f43fc reflect: fix indirect issues with makeInt/makeUint/makeFloat 2023-03-27 18:53:37 +02:00
Damian Gryski
f239e8e2d9 reflect: typo in uint test 2023-03-27 18:53:37 +02:00
Damian Gryski
6b73b5e486 reflect: document which Convert() cases are still unimplemented 2023-03-27 18:53:37 +02:00
Damian Gryski
855e12df51 reflect: Convert(): add Float() conversions 2023-03-27 18:53:37 +02:00
Damian Gryski
0b6bb12e9e reflect: add Convert() for string -> []byte and []byte -> string 2023-03-27 18:53:37 +02:00
Damian Gryski
72c7adf94a reflect: Convert() for integer and float types 2023-03-27 18:53:37 +02:00
waj334
13fb5aa7e7 Update task_stack_cortexm.c
Added build tag.
2023-03-27 12:35:39 +02:00
Justin A. Wilson
a3fdbec13d Refactor SystemStack function for arm targets.
Removing usage of AsmFull in favor of writing inline assembly in C.
2023-03-27 12:35:39 +02:00
Damian Gryski
360f6904f5 reflect: add test for map[interface{}]T 2023-03-25 22:32:29 +01:00
Damian Gryski
7201b13085 reflect: fix key type logic for maps 2023-03-25 22:32:29 +01:00
Damian Gryski
9c0bf8bd2c reflect: Value.Set: fix direction of assignment check 2023-03-25 22:32:29 +01:00
Damian Gryski
63c7a41337 reflect: convert non-interface to interface in Set() 2023-03-25 22:32:29 +01:00
Damian Gryski
c0f8f129c0 reflect: convert map elements to an interface, if needed 2023-03-25 22:32:29 +01:00
Damian Gryski
adaa7ca27a reflect: SetMapIndex: use AssignableTo() instead of type equality 2023-03-25 22:32:29 +01:00
Damian Gryski
a5ddc68845 reflect: unpack interfaces in MapKeys() if needed 2023-03-25 22:32:29 +01:00
Damian Gryski
f7880e73d8 reflect: tweak v.typecode.Key().(*rawType) -> v.typecode.key() 2023-03-25 22:32:29 +01:00
Damian Gryski
3aa8c8e0d1 reflect: fix typo in unit test 2023-03-25 22:32:29 +01:00
Damian Gryski
6cb7f29d9b reflect: add tests for map interface lookup fixes 2023-03-25 22:32:29 +01:00
Damian Gryski
21527353f7 compiler: for interface maps, use the original named type if available 2023-03-25 22:32:29 +01:00
Damian Gryski
bedd27b20e reflect: handle map-keys-as-interfaces for MapIter() 2023-03-25 22:32:29 +01:00
Damian Gryski
3612b7749e reflect: uncomment all(?) the tests that pass 2023-03-25 13:57:00 +01:00
Damian Gryski
45c916f5c0 reflect: rename tests in value_test to avoid conflicts upstream tests 2023-03-25 13:57:00 +01:00
Damian Gryski
688a5dbf8d reflct: reenable DeepEqual tests 2023-03-25 13:57:00 +01:00
Damian Gryski
35dcf135c0 reflect: comment out all tests but keep imports 2023-03-25 13:57:00 +01:00
Damian Gryski
c482d65397 reflect: replace all_test with copy from upstream 2023-03-25 13:57:00 +01:00
shivay
d73e12db63 feat: fix typos 2023-03-24 09:22:38 -07:00
Daniel Esteban
4b0e56cbec Added Gopher Badge support 2023-03-22 16:17:12 +01:00
Ayke van Laethem
62e1c3ebb7 wasm: implement the //go:wasmimport directive
It is implemented upstream and looks pretty stable.
2023-03-22 11:29:26 +01:00
deadprogram
a4a1001dd3 examples: use hid-keyboard example to show how to to override default USB VID, PID, manufacturer name, and product name
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-03-22 08:35:42 +01:00
deadprogram
e8f6df928c machine/usb: add ability to override default VID, PID, manufacturer name, and product name
Signed-off-by: deadprogram <ron@hybridgroup.com>
2023-03-22 08:35:42 +01:00
Ayke van Laethem
f180339d6b compiler: add alloc attributes to runtime.alloc
This gives a small improvement now, and is needed to be able to use the
Heap2Stack transform that's available in the Attributor pass. This
Heap2Stack transform could replace our custom OptimizeAllocs pass.

Most of the changes are just IR that changed, the actual change is
relatively small.

To give an example of why this is useful, here is the code size before
this change:

    $ tinygo build -o test -size=short ./testdata/stdlib.go
       code    data     bss |   flash     ram
      95620    1812     968 |   97432    2780

    $ tinygo build -o test -size=short ./testdata/stdlib.go
       code    data     bss |   flash     ram
      95380    1812     968 |   97192    2780

That's a 0.25% reduction. Not a whole lot, but nice for such a small
patch.
2023-03-22 00:34:43 +01:00
Ayke van Laethem
5ed0cecf0d nrf: fix memory issue in ADC read
There was a very subtle bug in the ADC read code: it stores a pointer to
a variable in a register, waits for the hardware to complete the read,
and then reads the value again from the local variable. Unfortunately,
the compiler doesn't know there is some form of synchronization
happening in between.

This can be fixed in roughly two ways:
  * Introduce some sort of synchronization.
  * Do a volatile read from the variable.

I chose the second one as it is probably the least intrusive. We
certainly don't need atomic instructions (the chip is single threaded),
we just need to tell the compiler the value could have changed by making
the read volatile.
2023-03-22 00:34:43 +01:00
Ayke van Laethem
523c6c0e3b compiler: correctly generate code for local named types
It is possible to create function-local named types:

    func foo() any {
        type named int
        return named(0)
    }

This patch makes sure they don't alias with named types declared at the
package scope.

Bug originally found by Damian Gryski while working on reflect support.
2023-03-21 22:22:03 +01:00
Damian Gryski
17f5fb1071 reflect; SetLen() requires an addressable value 2023-03-21 20:53:37 +01:00
Damian Gryski
4d43df75d5 reflect: fix some vet issues 2023-03-21 20:53:37 +01:00
Damian Gryski
57b0c21492 reflect: tweak Type.String() for interfaces to make encoding/xml happy 2023-03-19 13:50:38 -07:00
Damian Gryski
8fb5877d9e reflect: fix isBinary() for float types 2023-03-19 13:49:55 -07:00
Damian Gryski
6fbe6fa2ae reflect: tweak Type.String() to match what encoding/json expects for empty structs 2023-03-19 20:37:57 +01:00
Damian Gryski
24b4dc31a4 reflect: stub MapOf() 2023-03-19 19:12:34 +01:00
Damian Gryski
4f8127d0bf builder: bump sizes tests 2023-03-19 17:45:43 +01:00
Damian Gryski
e0329b25de transform: fix OptimizeReflectImplements pass for new named elem offset 2023-03-19 17:45:43 +01:00
Damian Gryski
229f479a7d reflect: make sure pointerTo() works for named types 2023-03-19 17:45:43 +01:00