Testing performed: That a card is successfully mounted on Pygamer with
the built in SD card slot
This module is enabled for most FULL_BUILD boards, but is disabled for
samd21 ("M0"), litex, and pca10100 for various reasons.
* Fix flash writes that don't end on a sector boundary. Fixes#2944
* Fix enum incompatibility with IDF.
* Fix printf output so it goes out debug UART.
* Increase stack size to 8k.
* Fix sleep of less than a tick so it doesn't crash.
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>
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>
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>
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>
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>
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>
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>
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>
If interrupts are disabled, then calling sd_* functions will hardfault.
Instead, assume that it's safe to write if interrupts are disabled.
Signed-off-by: Sean Cross <sean@xobs.io>
ARM recommends issuing a DSB instruction propr to issuing WFI, as it is
required on many parts suchas Cortex-M7. This is effectively a no-op on
the Cortex-M4 used in most NRF parts, however it ensures that we won't
be surprised when new parts come out.
See
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHICBGB.html
for more information.
Signed-off-by: Sean Cross <sean@xobs.io>
In order to ensure we don't have any outstanding requests, disable
interrupts prior to issuing `WFI`.
As part of this process, check to see if there are any pending USB
requests, and only execute the `WFI` if there is no pending data.
This fixes#2855 on NRF.
Signed-off-by: Sean Cross <sean@xobs.io>
On NRF, the `rtc_reset()` function is never called. As a result,
calls to `time.time()` return a cryptic error>
```
>>> import time
>>> time.time()
'' object has no attribute 'datetime'
>>>
```
This is because `MP_STATE_VM(rtc_time_source)` is not initialized
due to `rtc_reset()` never being called.
If `CIRCUITPY_RTC` is enabled, call `rtc_reset()` as part of the
`reset_port()` call. This ensures that `time.time()` works as expected.
Signed-off-by: Sean Cross <sean@xobs.io>
The timeout value is calculated by the common-hal layer now, so we don't
need to be quite so clever about calculating it here.
Signed-off-by: Sean Cross <sean@xobs.io>
Add a field to allow specifying a timeout when initiating advertising.
As part of this, add a new property to determine if the device is still
advertising.
Additionally, have the `anonymous` property require a timeout, and set
the timeout to the maximum possible value if no timeout is specified.
Signed-off-by: Sean Cross <sean@xobs.io>