aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime/runtime_atsamd51.go
AgeCommit message (Collapse)Author
2024-04-19Run Nick G's spellchecker github.com/client9/misspell, carefuly fix what it ↵dkegel-fastly
found (#4235)
2023-03-09machine/samd51: implement Flash interfacedeadprogram
Signed-off-by: deadprogram <[email protected]>
2023-02-27runtime/atsamd51: enable CMCC cache for greatly improved performance on SAMD51deadprogram
Signed-off-by: deadprogram <[email protected]>
2022-12-19build: drop deprecated build tagsYurii Soldak
2022-07-10samd21,samd51,nrf52840: move usbcdc to machine/usb/cdc (#2972)sago35
* samd21,samd51,nrf52840: move usbcdc to machine/usb/cdc
2022-07-06samd21,samd51,nrf52840: refactor usb initializationsago35
2022-07-05serial: use common initialization for serialsago35
2022-06-01os, runtime: enable os.Stdin for baremetal targetsago35
2022-03-10samd21,samd51: fix usbcdc initialization when -serial=uart (#2631)sago35
machine/samd21,samd51: fix usbcdc initialization when -serial=uart by using machine.USB.Configured()
2022-02-04all: update build constraints to Go 1.17Ayke van Laethem
Do it all at once in preparation for Go 1.18 support. To make this commit, I've simply modified the `fmt-check` Makefile target to rewrite files instead of listing the differences. So this is a fully mechanical change, it should not have introduced any errors.
2022-01-02avr: fix time.Sleep() in init codeAyke van Laethem
In the early days of TinyGo, the idea of `postinit` was to enable interrupts only after initializers have run. Which kind of makes sense... except that `time.Sleep` is allowed in init code and `time.Sleep` requires interrupts to be enabled. Therefore, interrupts must be enabled while initializers are being run. This commit simply moves the enabling of interrupts to a point right before running package initializers. It also removes `runtime.postinit`, which is not necessary anymore (and was only used on AVR).
2021-10-06qemu: signal correct exit code to QEMUAyke van Laethem
There were a few issues that were causing qemu-system-arm and qemu-system-riscv to give the wrong exit codes. They are in fact capable of exiting with 0 or 1 signalled from the running application, but this functionality wasn't used. This commit changes this in the following ways: * It fixes SemiHosting codes, which were incorrectly written in decimal while they should have been written in hexadecimal (oops!). * It modifies all the baremetal main functions (aka reset handlers) to exit with `exit(0)` instead of `abort()`. * It changes `syscall.Exit` to call `exit(code)` instead of `abort()` on baremetal targets. * It adds these new exit functions where necessary, implemented in a way that signals the correct exit status if running under QEMU. All in all, this means that `tinygo test` doesn't have to look at the output of a test to determine the outcome. It can simply look at the exit code.
2021-05-13machine: define Serial as the default outputAyke van Laethem
Previously, the machine.UART0 object had two meanings: - it was the first UART on the chip - it was the default output for println These two meanings conflict, and resulted in workarounds like: - Defining UART0 to refer to the USB-CDC interface (atsamd21, atsamd51, nrf52840), even though that clearly isn't an UART. - Defining NRF_UART0 to avoid a conflict with UART0 (which was redefined as a USB-CDC interface). - Defining aliases like UART0 = UART1, which refer to the same hardware peripheral (stm32). This commit changes this to use a new machine.Serial object for the default serial port. It might refer to the first or second UART depending on the board, or even to the USB-CDC interface. Also, UART0 now really refers to the first UART on the chip, no longer to a USB-CDC interface. The changes in the runtime package are all just search+replace. The changes in the machine package are a mixture of search+replace and manual modifications. This commit does not affect binary size, in fact it doesn't affect the resulting binary at all.
2021-05-08runtime: remove the asyncScheduler constantAyke van Laethem
There is no reason to specialize this per chip as it is only ever used for JavaScript. Not only that, it is causing confusion and is yet another quirk to learn when porting the runtime to a new microcontroller.
2021-05-08runtime: improve timers on nrf, and samd chipsAyke van Laethem
This commit improves the timers on various microcontrollers to better deal with counter wraparound. The result is a reduction in RAM size of around 12 bytes and a small effect (sometimes positive, sometimes negative) on flash consumption. But perhaps more importantly: getting the current time is now interrupt-safe (it previously could result in a race condition) and the timer will now be correct when the timer isn't retrieved for a long duration. Before this commit, a call to `time.Now` more than 8 minutes after the previous call could result in an incorrect time. For more details, see: https://www.eevblog.com/forum/microcontrollers/correct-timing-by-timer-overflow-count/msg749617/#msg749617
2021-04-29atsamd51, atsame5x: unify samd51 and same5xsago35
2021-04-24cortexm: disable FPU on Cortex-M4Ayke van Laethem
On some boards the FPU is already enabled on startup, probably as part of the bootloader. On other chips it was enabled as part of the runtime startup code. In all these cases, enabling the FPU is currently unsupported: the automatic stack sizing of goroutines assumes that the processor won't need to reserve space for FPU registers. Enabling the FPU therefore can lead to a stack overflow. This commit either removes the code that enables the FPU, or simply disables it in startup code. A future change should fully enable the FPU so that operations on float32 can be performed by the FPU instead of in software, greatly speeding up such code.
2020-08-30machine/atsamd51x,runtime/atsamd51x: fixes needed for full support for all ↵deadprogram
PWM pins. Also adds some useful constants to clarify peripheral clock usage Signed-off-by: deadprogram <[email protected]>
2020-08-24nrf: call sd_app_evt_wait when the SoftDevice is enabledAyke van Laethem
This reduces current consumption from 500-1000µA to very low (<10µA) current consumption. This change is important for battery powered devices, especially devices that may be running for long periods of time.
2020-08-24runtime: use waitForEvents when appropriateAyke van Laethem
This is better than using the wfe or wfi instruction directly as it can be replaced with build tags.
2020-07-04runtime (atsamd51): allow interrupts to wake the schedulerJaden Weiss
2020-05-25runtime: refactor time handlingAyke van Laethem
This commit refactors both determining the current time and sleeping for a given time. It also improves precision for many chips. * The nrf chips had a long-standing TODO comment about a slightly inaccurate clock. This should now be fixed. * The SAM D2x/D5x chips may have a slightly more accurate clock, although probably within the error margin of the RTC. Also, by working with RTC ticks and converting in the least number of places, code size is often slightly reduced (usually just a few bytes, up to around 1kB in some cases). * I believe the HiFive1 rev B timer was slightly wrong (32768Hz vs 30517.6Hz). Because the datasheet says the clock runs at 32768Hz, I've used the same conversion code here as in the nrf and sam cases. * I couldn't test both stm32 timers, so I kept them as they currently are. It may be possible to make them more efficient by using the native tick frequency instead of using microseconds everywhere.
2020-04-05all: change //go:export to //exportAyke van Laethem
This is the kind that is used in Go (actually CGo) for exporting functions. I think it's best to use //export instead of our custom //go:export pragma, for consistency (they are equivalent in TinyGo). Therefore I've updated all instances to the standard format (except for two that are updated in https://github.com/tinygo-org/tinygo/pull/1024). No smoke tests changed (when comparing the output hash), except for some wasm tests that include DWARF debug info and tend to be flaky anyway.
2020-03-17generalize -scheduler=none to support most platformsJaden Weiss
2020-03-17refactor coroutine lowering and tasksJaden Weiss
2020-01-20all: add compiler support for interruptsAyke van Laethem
This commit lets the compiler know about interrupts and allows optimizations to be performed based on that: interrupts are eliminated when they appear to be unused in a program. This is done with a new pseudo-call (runtime/interrupt.New) that is treated specially by the compiler.
2020-01-05runtime: fix atsamd51 volatile usageAyke van Laethem
It was still using the (long removed) //go:volatile pragma for volatile variables, thus it was only accidentally working.
2019-10-25runtime/samd51: correct initialization for RTCRon Evans
Signed-off-by: Ron Evans <[email protected]>
2019-10-24runtime/atsamd51: fix clock init code (#650)Infinoid
* runtime/atsamd51: fix clock init code The DPLL0 initialization should set LDRFRAC and LDR, not LDRFRAC twice. Also explain what the magic numbers are doing.
2019-10-09machine/samd51: update to accomodate differences in updated SVD files for ↵Ron Evans
from main CMSIS-SVD repo Signed-off-by: Ron Evans <[email protected]>
2019-09-18runtime/samd51: set minimum sleep to 260us due to minimum delay in register ↵Ron Evans
synchronization Signed-off-by: Ron Evans <[email protected]>
2019-09-14machine/atsamd51: add support for ATSAMD51 processor using Adafruit ↵Ron Evans
ItsyBitsy-M4 board Signed-off-by: Ron Evans <[email protected]>