Commit Graph

198 Commits

Author SHA1 Message Date
Dan Halbert 104a089677 deep sleep working; deep sleep delay when connected 2020-11-26 22:06:37 -05:00
Dan Halbert a0f1ec3c4a wip 2020-11-22 19:10:09 -05:00
Dan Halbert 75559f35cc wip: ResetReason to microcontroller.cpu 2020-11-21 23:29:52 -05:00
Dan Halbert cd436bad1a Merge remote-tracking branch 'adafruit/main' into sleep 2020-11-19 15:43:49 -05:00
Kamil Tomaszewski 76d4824728 spresense: Return fixed stack 2020-11-19 15:04:52 +01:00
microDev 930cf14dce
Add check for invalid io, function to disable all alarms 2020-10-27 16:17:26 -07:00
microDev e35938971a
Add description of alarm modules 2020-10-27 16:16:55 -07:00
Dan Halbert f51e75c1d2 cxd56 needed more precise include for __packed; needed SRC_C += on some ports 2020-10-15 15:24:24 -04:00
Jeff Epler 726dcdb60a Add some NORETURN attributes
I have a function where it should be impossible to reach the end, so I put in a safe-mode reset at the bottom:
```
int find_unused_slot(void) {
    // precondition: you already verified that a slot was available
    for (int i=0; i<NUM_SLOTS; i++) {
        if( slot_free(i)) {
            return i;
        }
    }
    safe_mode_reset(MICROPY_FATAL_ERROR);
}
```
However, the compiler still gave a diagnostic, because safe_mode_reset was not declared NORETURN.

So I started by teaching the compiler that reset_into_safe_mode never returned.  This leads at least one level deeper due to reset_cpu needing to be a NORETURN function.  Each port is a little different in this area.  I also marked reset_to_bootloader as NORETURN.
Additional notes:

 * stm32's reset_to_bootloader was not implemented, but now does a bare reset.  Most stm32s are not fitted with uf2 bootloaders anyway.
 * ditto cxd56
 * esp32s2 did not implement reset_cpu at all.  I used esp_restart().  (not tested)
 * litex did not implement reset_cpu at all.  I used reboot_ctrl_write.  But notably this is what reset_to_bootloader already did, so one or the other must be incorrect (not tested).  reboot_ctrl_write cannot be declared NORETURN, as it returns unless the special value 0xac is written), so a new unreachable forever-loop is added.
 * cxd56's reset is via a boardctl() call which can't generically be declared NORETURN, so a new unreacahble "for(;;)" forever-loop is added.
 * In several places, NVIC_SystemReset is redeclared with NORETURN applied.  This is accepted just fine by gcc.  I chose this as preferable to editing the multiple copies of CMSIS headers where it is normally declared.
 * the stub safe_mode reset simply aborts.  This is used in mpy-cross.
2020-09-28 18:55:56 -05:00
Kamil Tomaszewski 61687c81d8 camera: Pass width and height to take_picture() 2020-09-16 13:55:57 +02:00
Kamil Tomaszewski ce7ee58e92 camera: Update camera module 2020-09-14 13:12:20 +02:00
Kamil Tomaszewski c2fc592c2c camera: Change API 2020-09-14 13:11:15 +02:00
Kamil Tomaszewski 143a1ff94a spresense: change the GC to do 32-byte blocks 2020-09-14 13:11:15 +02:00
Kamil Tomaszewski 1fde8ef9bc spresense: Add support for camera 2020-09-14 13:11:15 +02:00
Lucian Copeland 8021da08d3 Fix problematic whitespace on pulseout parameter errors 2020-08-27 11:07:47 -04:00
Scott Shawcroft 1527a3ce92
Merge remote-tracking branch 'adafruit/main' into add_pwmio 2020-08-24 18:25:18 -07:00
Scott Shawcroft 644d2ba7a2 Add more "extern" declarations for gcc10 compat
gcc has tightened the restrictions on forward declarations that lack
"extern".  Fix them up.
2020-08-21 14:39:37 -05:00
Scott Shawcroft 83deea0e03
Fix copy pasta and stub build 2020-08-21 11:17:42 -07:00
Scott Shawcroft a5b01f7361
Merge remote-tracking branch 'adafruit/main' into add_pwmio 2020-08-21 11:13:53 -07:00
Scott Shawcroft 400701004b
Merge pull request #3279 from hierophect/esp32-pulseinout
ESP32-S2: Add PulseOut and PulseIn
2020-08-20 11:24:08 -07:00
Kamil Tomaszewski e2891bc7d4 spresense: call usb_background function 2020-08-20 16:21:25 +02:00
Scott Shawcroft 6857f98426
Split pulseio.PWMOut into pwmio
This gives us better granularity when implementing new ports because
PWMOut is commonly implemented before PulseIn and PulseOut.

Fixes #3211
2020-08-18 13:08:33 -07:00
Lucian Copeland da75445cd5 Style changes, reposition runtime errors 2020-08-18 11:42:06 -04:00
Lucian Copeland 0fc730bc5a Expand PulseOut API, debug cleanup 2020-08-14 16:36:02 -04:00
Jeff Epler 93b373d617 "pop from empty %q"
Saves 12 bytes code on trinket m0
2020-08-04 18:42:09 -05:00
Jeff Epler c849b781c0 Combine 'index out of range' messages 2020-08-04 14:45:45 -05:00
Jeff Epler dddd25a776 Combine similar strings to reduce size of translations
This is a slight trade-off with code size, in places where a "_varg"
mp_raise variant is now used.  The net savings on trinket_m0 is
just 32 bytes.

It also means that the translation will include the original English
text, and cannot be translated.  These are usually names of Python
types such as int, set, or dict or special values such as "inf" or
"Nan".
2020-08-04 13:34:29 -05:00
hathach b6724e843c
update CDC/MIDI bufsize to at least 512 for highspeed port 2020-07-29 16:22:27 +07:00
hathach 6063828279 replace USB_MSC_MAX_PACKET_SIZE with USB_HIGHSPEED in descriptor gen tool 2020-07-29 15:38:55 +07:00
root 778e8bfda9 Changes to optimization option 2020-07-23 19:27:02 -05:00
root d83a4ac72d Changes to add compiler optimization option 2020-07-22 12:44:41 -05:00
root 49decf90c9 Add option for higher optimization levels 2020-07-21 10:11:08 -05:00
Jeff Epler 1df48176ce supervisor: factor supervisor_background_tasks from sundry ports 2020-07-15 11:49:44 -05:00
Kamil Tomaszewski 97355f8fb7 spresense: update SDK to 2.0.1 2020-07-06 17:13:28 +02:00
Kamil Tomaszewski f4a2474447 spresense: Add support for sdioio 2020-07-02 15:26:59 +02:00
Jeff Epler fcddfd0f39
Merge pull request #3083 from tannewt/esp32s2_busio
Add busio support for the ESP32-S2
2020-07-01 21:02:08 -05:00
Jeff Epler 3a17a79bf2
Merge pull request #3094 from kamtom480/mkspk
spresense: add elf32.h for mkspk
2020-07-01 06:58:40 -05:00
Scott Shawcroft 965a40b6a1
Fix cxd56 function signature 2020-06-29 17:17:46 -07:00
Jeff Epler 1d2cc0b968 I2CPeripheral: Rename class and its module
This is an incompatible change.
2020-06-25 11:44:19 -05:00
Kamil Tomaszewski 436b15e558 spresense: add elf32.h for mkspk 2020-06-25 10:26:33 +02:00
Scott Shawcroft d768d4d37a
Merge branch 'main' into gnss 2020-06-24 17:17:43 -07:00
Scott Shawcroft a26102607e
Add UART support 2020-06-24 12:47:58 -07:00
Kamil Tomaszewski ab4c09cea7 gnss: Add timestamp 2020-06-24 11:14:44 +02:00
Kamil Tomaszewski 3509dad5b3 gnss: Remove start and stop 2020-06-24 11:14:44 +02:00
Kamil Tomaszewski 343f093ead spresense: Add support for GNSS 2020-06-24 11:14:44 +02:00
Jeff Epler f232aef786 supervisor.mk: Compute USB_DEVICES; remove from boards and ports
Since Actions passed on the previous commit, where this computed value
was checked against the specified value (if any), this is no net change,
except that we no longer need to specify it for particular boards or
ports.
2020-06-23 12:59:01 -05:00
Jeff Epler 9d5ccccf7d cxd56: Disable HID and MIDI
These are already disabled via the USB_DEVICES setting, but the code is
included anyway.
2020-06-15 15:22:45 -05:00
Jeff Epler a9614bb964 cxd56: Sort the configuration settings 2020-06-15 15:22:45 -05:00
Diego Elio Pettenò dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
Kamil Tomaszewski ce337eaa27 Fix port_get_raw_ticks 2020-06-01 11:35:46 +02:00
Scott Shawcroft ba724fffb4
Merge remote-tracking branch 'adafruit/master' into esp32s2_digitalio 2020-05-20 10:48:27 -07:00
Scott Shawcroft fd0420d432
Update digitalio api for other ports 2020-05-20 09:23:42 -07:00
Scott Shawcroft 916ca9f8a6
Merge pull request #2910 from tannewt/esp32s2
Add initial ESP32S2 support
2020-05-19 12:53:23 -07:00
Scott Shawcroft 2c2b53303d
Merge pull request #2837 from k0d/serial-debug
Add support for a debug console, such as ST-Link VCP.
2020-05-18 18:13:31 -07:00
Mark Olsson 007c92ee6a Enable showing the console on a debug uart 2020-05-19 02:02:52 +02:00
Scott Shawcroft a57da6b808
Add port_fixed_stack for more spresence 2020-05-15 17:22:41 -07:00
Daniel Pollard bfa5cd9c13 refactor countio based on feedback 2020-05-05 15:23:38 +10:00
Scott Shawcroft b580b34cbf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-14 17:14:44 -07:00
Jeff Epler db01f88cc3 enable MICROPY_PY_REVERSE_SPECIAL_METHODS where ulab is enabled 2020-04-13 19:58:52 -05:00
Scott Shawcroft c0ba2a839f
Updates based on feedback from jepler 2020-04-06 16:03:31 -07:00
Scott Shawcroft 6db11cf68b
Fix up Spresense build. It doesn't sleep. 2020-03-17 14:21:45 -07:00
Dan Halbert 6363b5ad06
Merge pull request #2693 from jepler/ulab-enable
ulab: enable on most builds
2020-03-10 09:48:46 -04:00
Jeff Epler e128d770f1 cdx56: prepare to enable ulab
This involves fixing support for SRC_MOD and enabling INTERNAL_LIBM
including adding support for SRC_LIBM.
2020-03-09 15:54:40 -05:00
Dan Halbert b6206406de new pin validation routines; don't use mp_const_none if NULL will do 2020-02-28 23:43:04 -05:00
Dave Marples 24405cabaf Edits as a result of review 2020-02-19 00:07:01 +00:00
Dave Marples 490a808bf6 Addition of stubs for rs485/CTS/RTS handling on non-implemented chips 2020-02-18 23:16:40 +00:00
Dan Halbert 005c4caf8c fix function defs for compiler 2020-02-07 10:32:37 -05:00
Dan Halbert 857d8ab40a improve time.monotonic_ns() accuracy from ms to us 2020-02-07 10:02:50 -05:00
Scott Shawcroft 1c39606345
Fix other builds missing new heap bounds functions 2020-01-18 18:06:56 -08:00
Kamil Tomaszewski 402f6f66bd Add mkspk source files 2020-01-13 07:53:24 +01:00
Kamil Tomaszewski 357506dd9a Fix board_timerhook 2020-01-10 13:59:52 +01:00
Dan Halbert 013c840862 working on all ports 2019-12-10 20:27:30 -05:00
Jeff Epler 95d9c49e43 Merge remote-tracking branch 'origin/master' into tick-refactor 2019-11-29 11:27:09 -06:00
Dan Halbert dd6dfeb30a Squeeze pyruler zh_Latn_pinyin 2019-11-27 14:47:35 -05:00
Dan Halbert b32a9192df make UART.write be blocking on SAMD; add timeout property 2019-11-27 13:05:29 -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
Dan Halbert 1d7d9043c1 CXD56 is a better platform name 2019-10-28 10:47:09 -04:00
Dan Halbert 358920db0e Use MICROPY_PY_SYS_PLATFORM in mpconfigport.h only 2019-10-28 10:40:10 -04:00
Dan Halbert af1fab1915
Merge pull request #2226 from kamtom480/circuitpython-device-open
Do not open the same PWM device if it is already open
2019-10-23 15:08:40 -04:00
Kamil Tomaszewski e4574fa3bf Clean UART on reset 2019-10-21 13:17:51 +02:00
Kamil Tomaszewski e2cb29f2a0 Change default stack size to 64kiB for Spresense 2019-10-18 15:43:06 +02:00
Kamil Tomaszewski 3ad13e14d8 Do not open the same UART device again 2019-10-18 12:39:52 +02:00
Kamil Tomaszewski b39ca3f8be Do not open the same PWM device again 2019-10-18 12:39:22 +02:00
Kamil Tomaszewski 1decd111d5 Do not open the same ADC device again 2019-10-18 12:38:39 +02:00
Kamil Tomaszewski 4338511b28 Add get top and limit functions for Spresense 2019-10-18 11:10:22 +02:00
Kamil Tomaszewski 96756b3945 Add functions to get top and limit stack 2019-10-18 11:04:45 +02:00
Kamil Tomaszewski 30c9ad2b2a Update Spresense SDK to 1.4.1 2019-10-18 10:29:32 +02:00
Dan Halbert a0d18ac4e6 add dummy common_hal_mcu_processor_get_voltage() for spresense 2019-10-15 09:07:12 -04:00
Kamil Tomaszewski b750ed3a0f Change Spresense firmware download link 2019-10-14 08:42:10 +02:00
Kamil Tomaszewski 8dfc8b584f Change Spresense reference_voltage to 0.0 (None) 2019-10-14 08:22:14 +02:00
Kamil Tomaszewski 6b9375804c Rename circuitpython.spk to firmware.spk 2019-10-11 17:15:25 +02:00
Kamil Tomaszewski 771f43591a Add links to serial drivers 2019-10-11 12:57:43 +02:00
Kamil Tomaszewski eb1dfd2312 Add .gitignore 2019-10-11 12:11:48 +02:00
Kamil Tomaszewski 0d139e4eca Add a way to change serial device name 2019-10-11 12:09:51 +02:00
Kamil Tomaszewski c062990830 Make Makefile work across OS 2019-10-11 12:09:51 +02:00
Kamil Tomaszewski 8f653d6238 Use CXD56 pin names 2019-10-11 12:09:51 +02:00
Kamil Tomaszewski 5f09609d41 Add Spresense board folder 2019-10-11 12:09:51 +02:00
Kamil Tomaszewski 1fa8841d20 Change port name to cxd56 2019-10-11 08:23:51 +02:00