Commit Graph

16455 Commits

Author SHA1 Message Date
Scott Shawcroft 1ed4978620
Remove NONE from mode enum and doc tweaks 2020-05-27 10:58:21 -07:00
Scott Shawcroft 9380c34cf7
Merge remote-tracking branch 'adafruit/master' into wdt-nrf 2020-05-27 10:47:08 -07:00
Scott Shawcroft 0db8b888d3
Merge pull request #2934 from hierophect/mimxrt-uart-oneway
mimxrt10xx: add one-directional UART
2020-05-27 10:38:00 -07:00
Scott Shawcroft 7cd92dd94c
Merge pull request #2899 from dherrada/extract-types
Added extract_types.py script
2020-05-27 10:35:53 -07:00
Dan Halbert 820d5092b3
Merge pull request #2963 from adafruit/hiibot-bluefi-pid-fix
Correct HiiBot BlueFi USB_PID
2020-05-27 12:49:45 -04:00
Lucian Copeland a59798ed49 Merge branch 'mimxrt-uart-oneway' into mimxrt-busio-cleanup 2020-05-27 12:31:16 -04:00
Lucian Copeland 9a9cb2e7d3 fix submodule desync 2020-05-27 11:59:13 -04:00
Lucian Copeland 2f6e1d85d2 more translations 2020-05-27 11:55:33 -04:00
Lucian Copeland 9f5520135c translations 2020-05-27 11:54:52 -04:00
Lucian Copeland a25e10ed59 Merge branch 'mimxrt-uart-oneway' of https://github.com/hierophect/circuitpython into mimxrt-uart-oneway 2020-05-27 11:49:11 -04:00
Lucian Copeland 1e914ac2b0 Change exception text and type 2020-05-27 11:48:52 -04:00
Dan Halbert d06a7c4671
Correct HiiBot BlueFi USB_PID
Donated a PID set for HiiBot BlueFi.
2020-05-27 11:47:15 -04:00
Lucian Copeland 53fb699436 Add pin resetting across boards, fix array size detection issue 2020-05-27 11:45:15 -04:00
dherrada 4e22b9a346 Better keyerror handling 2020-05-27 11:30:51 -04:00
arturo182 ad988013f0
Merge pull request #2961 from arturo182/i2c-exception
mimxrt10xx: Change exception type to match other ports
2020-05-27 11:24:46 +02:00
Sean Cross aa0445228b locale: generate strings for watchdog timer
Run `make translate` to generate strings for `shared-bindings/watchdog`.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:38:38 +08:00
Sean Cross aac5a4f178 watchdog: use common_hal_watchdog_* pattern
This pulls all common functionality into `shared-bindings` and keeps
platform-specific code inside `nrf`. Additionally, this performs most
validation in the `shared-bindings` site.

The only validation that occurs inside platform-specific `common-hal`
code is related to timeout limits that are platform-specific.

Additionally, all documentation is now inside the `shared-bindings`
directory.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:38:29 +08:00
Sean Cross dbf1bef56a watchdog: support catching the timeout
With this patch, the exception can now be caught:

    import microcontroller
    import watchdog
    import time

    wdt = microcontroller.watchdog
    wdt.timeout = 5

    while True:
        wdt.mode = watchdog.WatchDogMode.RAISE
        print("Starting loop -- should exit after five seconds")
        try:
            while True:
                time.sleep(10)
                # pass # This also works for a spinloop
        except watchdog.WatchDogTimeout as e:
            print("Watchdog Expired (PASS)")
        except Exception as e:
            print("Other exception (FAIL)")
    print("Exited loop")

This prints:

    Starting loop -- should exit after five seconds
    Watchdog Expired (PASS)
    Starting loop -- should exit after five seconds
    Watchdog Expired (PASS)
    Starting loop -- should exit after five seconds
    Watchdog Expired (PASS)

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:50 +08:00
Sean Cross e470376c12 nrf: add ticks (not subticks) to overflow count during reset
Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:50 +08:00
Sean Cross 296ba101ec nrf: set WDT priority to 2
The previous setting of `1` meant that the bluetooth system couldn't be
used when the watchdog timer was enabled.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:50 +08:00
Sean Cross d0f1b59be5 nrf: pca10100: disable some unused features to shrink image
This removes some features that are largely unused in order to get the
image to fit.

Recommended in
https://github.com/adafruit/circuitpython/pull/2933#issuecomment-632859678

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:50 +08:00
Sean Cross 33001f4e19 nrf: simmel: shrink filesystem to fit watchdog timer
The watchdog timer has increased the amount of code and text that's
required.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:50 +08:00
Sean Cross daf7c2857d nrf: port: save rtc value across reboots
As part of the reset process, save the current tick count to an
uninitialized memory location.  That way, the current tick value will be
preserved across reboots.

A reboot will cause us to lose a certain number of ticks, depending on
how long a reboot takes, however if reboots are infrequent then this
will not be a large amount of time lost.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 5edc29c6a5 nrf: microcontroller: use port reset path
For `microcontroller.reset()`, don't manually call NVIC_SystemReset().
Instead, call the `port_reset()` in case the port wants to do any
cleanup.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross c7efc94a33 watchdog: move timeout exception to shared-bindings
Make this exception globally available to all platforms that have
enabled the watchdog timer.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross c5c13a8ba1 nrf: reset watchdog as part of port_reset()
Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 108409c6cd nrf: common-hal: finish reworking exceptions
This finishes the rework of the exception handler, which is once
again stored inside the watchdog timer module.

This also implements a `watchdog_reset()` that is used to disable the
RAISE watchdog, if one is enabled.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 15530a69c7 supervisor: tick: check for watchdog exception if enabled
Check to see if the current exception is a Watchdog exception, if it's
enabled. This ensures we break out of the current sleep() if a watchdog
timeout hits.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross bd086a102e Revert "add WatchDogTimeout exception"
This reverts commit 561e7e619095869f58fc728d428f3ff20e8bfc40.
2020-05-27 11:28:49 +08:00
Sean Cross 589cb1af6d nrf: watchdog: use nrfx_wdt driver
Instead of directly poking registers, use `nrfx_wdt`.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross e738f5eaa1 nrf: boot into safe mode sometimes for watchdog reset
If the watchdog resets the system and we're plugged into USB, boot into
safe mode.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 8c5df5f732 supervisor: add a new WATCHDOG_RESET safe mode reason
This mode will be used if the board is reset due to the watchdog
expiring.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 08362c9cab watchdogtimer: refactor to new api
This refactors the WatchDogTimer API to use the format proposed in
https://github.com/adafruit/circuitpython/pull/2933#issuecomment-632268227

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross ec99dae953 tick: break on watchdog timeout exception
Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross ae950bc050 add WatchDogTimeout exception
This adds an exception to be raised when the WatchDogTimer times out.

Note that this currently causes a HardFault, and it's not clear why it's
not behaving properly.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 0169ea5155 nrf: discard arm exception sections
Since these exceptions are unused, don't include them in the output
binary.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 87737fb50a watchdog: fix documentation build error
Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 8f46133917 nrf: watchdog: implement software watchdogtimer
This adds a software WatchDogTimer implementation that can be used for
testing.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross 595f6387c2 watchdog: rename module from `wdt` and move to `microcontroller`
This also places it under the `microcontroller` object.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:49 +08:00
Sean Cross c23f151b6b nrf: enable wdt for all platforms
Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:48 +08:00
Sean Cross fbe1c05832 nrf: simmel: enable wdt support
This enables WDT support for Simmel. Other platforms cannot yet use
WDT because it overflows their flash storage.

Enable CIRCUITPY_WDT support for the nrf target.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:48 +08:00
Sean Cross abd01c5fbb nrf: add watchdog module
Add common-hal bindings to allow the watchdog module to be used
on nrf platforms.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:48 +08:00
Sean Cross f4719609f7 wdt: add watchdog support
This adds shared bindings for a watchdog timer, based on the API
provided by micropython.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:48 +08:00
Sean Cross 17ef2df2ca nrf: ld: add ARM.exidx to output image
With the WDT changes, building Circuit Python results in the following error:

/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: section .ARM.exidx LMA [00000000000621c8,00000000000621cf] overlaps section .data LMA [00000000000621c8,0000000000062383]

This is because unwinding data is getting generated, but has nowhere to go.
Re-enable this data in the linker script so it is saved.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-27 11:28:48 +08:00
Jeff Epler 739b42e3e0
Merge pull request #2960 from weblate/weblate-circuitpython-master
Translations update from Weblate
2020-05-26 19:42:42 -05:00
Hosted Weblate 51edfb992a
Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: CircuitPython/master
Translate-URL: https://hosted.weblate.org/projects/circuitpython/master/
2020-05-27 01:18:54 +02:00
Jeff Epler d8608e5229 Translated using Weblate (French)
Currently translated at 100.0% (747 of 747 strings)

Translation: CircuitPython/master
Translate-URL: https://hosted.weblate.org/projects/circuitpython/master/fr/
2020-05-27 01:18:53 +02:00
Dan Halbert 3574670226
Merge pull request #2931 from tannewt/esp32s2_digitalio
Finish digitalio and pin use tracking for ESP32S2
2020-05-26 19:18:45 -04:00
Scott Shawcroft c917270da7
Merge pull request #2956 from hathach/fix-samd-wfi
fix racing issue for SAMD when executing WFI
2020-05-26 14:54:24 -07:00
Scott Shawcroft ffe0e0edc3
Merge pull request #2938 from DavePutz/issue2894
Add an increment to tcc_refcount to allow deinit to work correctly
2020-05-26 14:39:59 -07:00