Commit Graph

54 Commits

Author SHA1 Message Date
hathach 8c1095b268
Merge branch 'main' into add-codespell 2023-03-23 14:09:57 +07:00
hathach fecc1bdedb
fix typos (partial) detected by codepell 2023-03-18 22:17:02 +07:00
Scott Shawcroft 5bb8a7a7c6
Improve iMX RT performance
* Enable dcache for OCRAM where the VM heap lives.
* Add CIRCUITPY_SWO_TRACE for pushing program counters out over the
  SWO pin via the ITM module in the CPU. Exempt some functions from
  instrumentation to reduce traffic and allow inlining.
* Place more functions in ITCM to handle errors using code in RAM-only
  and speed up CP.
* Use SET and CLEAR registers for digitalio. The SDK does read, mask
  and write.
* Switch to 2MiB reserved for CircuitPython code. Up from 1MiB.
* Run USB interrupts during flash erase and write.
* Allow storage writes from CP if the USB drive is disabled.
* Get perf bench tests running on CircuitPython and increase timeouts
  so it works when instrumentation is active.
2023-03-14 12:30:58 -07:00
Dan Halbert d46d9d5c21 shorten safe mode messages; improve message printing; fix CIRCUITPY_SAFEMODE_PY=0 2023-02-13 21:29:57 -05:00
Dan Halbert d8231f1588 Implement safemode.py 2023-02-13 18:26:38 -05:00
Neradoc f0058774d0 add CIRCUITPY_SKIP_SAFE_MODE_WAIT to circuitpy_mpconfig.mk
use #if (also a CIRCUITPY_ULAB)
2023-01-29 00:56:16 +01:00
Neradoc 8f82db5b22 define out the safe mode message if none 2022-10-30 03:55:59 +01:00
Neradoc 0aa41fa92e change BOARD_USER_SAFE_MODE_ACTION into a separate sentence 2022-10-30 01:55:42 +02:00
Scott Shawcroft d42c811fb9
Safe mode when ESP interrupt watchdog fires
This makes us enter safe mode when sleep on the S3 fails. The
task watchdog is used for the user watchdog.
2022-06-29 12:31:18 -07:00
Scott Shawcroft 9d10a3da66
Conditionalize LTO 2022-05-27 12:59:54 -07:00
Scott Shawcroft 4363361c87
Board definition clean up
Removes:
* AUTORESET_DELAY_MS which never did anything but was introduced
  somehow.
* CIRCUITPY_BOOT_BUTTON in all but one ESP board because they all have
  them. There is a default based on the strapping pins.
* BOARD_USER_SAFE_MODE_ACTION because it was all the same for boards
  with boot buttons. Now the safe mode code manages the message.
2022-03-21 17:58:43 -07:00
Dan Halbert 3c9f7f6ae9 address review comments 2021-12-27 19:36:11 -05:00
Dan Halbert 41d494df0b go into safe mode if not CIRCUITPY available 2021-12-27 18:58:24 -05:00
Dan Halbert a911cbef51 check that boot device is interface #0; remove instrumentation 2021-10-13 12:30:01 -04:00
Radomir Dopieralski e4baefc593 Add a flag to skip waiting for safe mode
Sometimes we don't want the delay in the device's startup.

I used a simple flag, but now it also occurs to me that we could
instead make the wait time a define, and set it to 0 to disable it.
2021-08-31 09:53:30 +02:00
Scott Shawcroft 4d3a355f0a
Tweak blink and treat SWD reset like reset button 2021-07-14 16:45:47 -07:00
Scott Shawcroft dc76306cfa
Enable a BLE workflow
nRF CircuitPython boards will now provide the file transfer
service defined here: https://github.com/adafruit/Adafruit_CircuitPython_BLE_File_Transfer

USB capable boards will only advertise if previously bonded to a
device or if the reset button is pressed during the fast blue
flashes on start up. When pressed, the board will restart again but
the blue period will not flash.

Boards without USB will always advertise.

When previously bonded, the advertisement is private so that no
other peers can connect. If advertising publicly, the tx power is
lowered to reduce the likelihood of bonding from a distance.

This PR also fixes issues with loading identities of bonded peers
so that our address can now be resolved and we can resolve others'
addresses when scanning.
2021-06-24 12:59:14 -07:00
Scott Shawcroft 20946d97a1
Merge pull request #4743 from tannewt/simplify_status_led
Simplify the status LED to save power
2021-05-21 10:55:11 -07:00
Neradoc a8b6232402 don't print out "hard crash" when USER_SAFE_MODE demanded 2021-05-20 21:23:25 +02:00
Scott Shawcroft 5643355e90
Merge remote-tracking branch 'adafruit/main' into simplify_status_led 2021-05-20 08:35:15 -07:00
Scott Shawcroft 9dabe882f1
Fix safe mode on rp2040 2021-05-19 10:18:43 -07:00
Scott Shawcroft 1a0b4193b7
Simplify the status LED to save power
This also removes the need to pin share because we don't use the
status LED while user code is running.

The status flashes fallback to the HW_STATUS LED if no RGB LED is
present. Each status has a unique blink pattern as well.

One caveat is the REPL state. In order to not pin share, we set the
RGB color once. PWM and single color will be shutoff immediately but
DotStars and NeoPixels will hold the color until the user overrides
it.

Fixes #4133
2021-05-13 14:41:20 -07:00
Dan Halbert 0651ef17dd Fix endpoint checking; Clean up safe mode printing. 2021-05-12 15:53:52 -04:00
Dan Halbert fc8e1c4c2e address review comments 2021-05-05 12:35:12 -04:00
Dan Halbert c333acdbad
Merge pull request #4589 from hugodahl/feature/Remove-MicroPython-mention-in-error-messages
Make error messages platform agnostic
2021-04-10 21:30:17 -04:00
Hugo Dahl 36f3897fe3 Make error messages platform agnostic
Remove mentions of 'MicroPython' in error messages as they could lead to confusion in lesser-experienced users
2021-04-10 18:36:53 -05:00
Jonny Bergdahl 1afd204828 Changed error message to display the generic term 'system firmware' instead of the Nordic specific term 'soft device' 2021-04-02 20:34:37 +02:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Neradoc 7441625f37 allow the safe mode danse if RESET_REASON_UNKNOWN 2021-03-02 00:41:43 +01:00
Scott Shawcroft af8cc9345d
Fix ESP build 2021-01-21 10:24:21 -08:00
Scott Shawcroft 733094aead
Add initial RP2040 support
The RP2040 is new microcontroller from Raspberry Pi that features
two Cortex M0s and eight PIO state machines that are good for
crunching lots of data. It has 264k RAM and a built in UF2
bootloader too.

Datasheet: https://pico.raspberrypi.org/files/rp2040_datasheet.pdf
2021-01-20 19:16:56 -08:00
Dan Halbert 75559f35cc wip: ResetReason to microcontroller.cpu 2020-11-21 23:29:52 -05:00
Dan Halbert e4c66990e2 compiles 2020-11-20 23:33:39 -05:00
Dan Halbert 649c930536 wip 2020-11-19 15:43:39 -05:00
Dan Halbert bb77f1d130 wip: initial code changes, starting from @tannewt's sleepio branch 2020-11-16 11:56:20 -05:00
Scott Shawcroft 9a4efed8cb
Start tweaking the workflow to sleep 2020-10-27 17:55:03 -07:00
microDev 4c7d9e3aaf
Update make translate script 2020-09-29 11:14:30 +05:30
microDev 506bb097f7
Update safe_mode.c 2020-09-13 23:17:14 +05:30
microDev 36da92075b Update safe mode reason 2020-09-13 22:57:24 +05:30
microDev 4da478382d Fix serial console output & add more boards 2020-09-12 17:46:52 +05:30
microDev 305bed6d9e Added esp32s2 safe_mode & fixed user_safe_mode 2020-09-11 21:06:54 +05:30
Scott Shawcroft 99f5011d74
Fix heap without PSRAM. Never set heap_size. 2020-09-08 17:06:09 -07:00
Jeff Epler 710c2dc54b safe_mode: Exclude NORDIC_SOFT_DEVICE_ASSERT str if possible 2020-08-04 14:45:45 -05: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
Scott Shawcroft 7d8dac9211
Refine iMX RT memory layout and add three boards
Introduces a way to place CircuitPython code and data into
tightly coupled memory (TCM) which is accessible by the CPU in a
single cycle. It also frees up room in the corresponding cache for
intermittent data. Loading from external flash is slow!

The data cache is also now enabled.

Adds support for the iMX RT 1021 chip. Adds three new boards:
* iMX RT 1020 EVK
* iMX RT 1060 EVK
* Teensy 4.0

Related to #2492, #2472 and #2477. Fixes #2475.
2020-01-17 17:36:08 -08:00
Dan Halbert 1b3028bed1 make translate and remove backslash-r's 2019-12-12 14:51:50 -05:00
Dan Halbert 7889b999cc Fix flash write error handling; clean up safe mode message printing 2019-12-12 14:41:49 -05:00
Jeff Epler 7f744a2369 Supervisor: move most of systick to the supervisor
This code is shared by most parts, except where not all the #ifdefs
inside the tick function were present in all ports.  This mostly would
have broken gamepad tick support on non-samd ports.

The "ms32" and "ms64" variants of the tick functions are introduced
because there is no 64-bit atomic read.  Disabling interrupts avoids
a low probability bug where milliseconds could be off by ~49.5 days
once every ~49.5 days (2^32 ms).

Avoiding disabling interrupts when only the low 32 bits are needed is a minor
optimization.

Testing performed: on metro m4 express, USB still works and
time.monotonic_ns() still counts up
2019-11-18 11:01:23 -06:00
Scott Shawcroft b87565138e
Rework safe mode so we can trigger on all resets 2019-05-09 10:15:28 -07:00
Scott Shawcroft 837d3f57ee
Update `on_next_reset` for new safe mode.
Fixes #1831
2019-05-08 15:23:40 -07:00