Skip to content

Commit 5cb361c

Browse files
authored
Merge pull request adafruit#510 from dhalbert/3.0_merge_2.2.0
merge from 2.2.0 + fix up board defs
2 parents 7d3bec4 + d0cc8ab commit 5cb361c

File tree

101 files changed

+2162
-600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+2162
-600
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
[submodule "frozen/Adafruit_CircuitPython_BusDevice"]
2727
path = frozen/Adafruit_CircuitPython_BusDevice
2828
url = https://github.com/adafruit/Adafruit_CircuitPython_BusDevice.git
29+
[submodule "tools/python-semver"]
30+
path = tools/python-semver
31+
url = https://github.com/k-bx/python-semver.git
2932
[submodule "lib/stm32lib"]
3033
path = lib/stm32lib
3134
url = https://github.com/micropython/stm32lib

.readthedocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
python:
2+
version: 3

docs/troubleshooting.rst

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,39 @@ This often happens on Windows when the ``CIRCUITPY`` disk is not safely ejected
1515
before being reset by the button or being disconnected from USB. This can also
1616
happen on Linux and Mac OSX but its less likely.
1717

18-
.. caution:: Delete ``CIRCUITPY`` filesystem and reload CircuitPython.
18+
.. caution:: To erase and re-create ``CIRCUITPY`` (for example, to correct a corrupted filesystem),
19+
follow one of the procedures below. It's important to note that **any files stored on the**
20+
``CIRCUITPY`` **drive will be erased**.
1921

20-
To reload CircuitPython (for example, to correct a corrupted filesystem),
21-
follow the process below. It's important to note that **any files stored on the
22-
``CIRCUITPY`` drive will be erased**.
22+
**For boards with** ``CIRCUITPY`` **stored on a separate SPI flash chip,
23+
such as Feather M0 Express, Metro M0 Express and Circuit Playground Express:**
2324

24-
#. Download the appropriate flash erase uf2 from `here <https://github.com/adafruit/Adafruit_SPIFlash/tree/master/examples/flash_erase_express>`_.
25+
26+
#. Download the appropriate flash .erase uf2 from `here <https://github.com/adafruit/Adafruit_SPIFlash/tree/master/examples/flash_erase_express>`_.
2527
#. Double-click the reset button.
2628
#. Copy the appropriate .uf2 to the xxxBOOT drive.
2729
#. The on-board NeoPixel will turn blue, indicating the erase has started.
2830
#. After about 15 seconds, the NexoPixel will start flashing green. If it flashes red, the erase failed.
2931
#. Double-click again and load the appropriate `CircuitPython .uf2 <https://github.com/adafruit/circuitpython/releases/latest>`_.
3032

33+
**For boards without SPI flash, such as Feather M0 Proto, Gemma M0 and, Trinket M0:**
34+
35+
#. Download the appropriate erase .uf2 from `here <https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/uf2_flash_erasers>`_.
36+
#. Double-click the reset button.
37+
#. Copy the appropriate .uf2 to the xxxBOOT drive.
38+
#. The boot LED will start pulsing again, and the xxxBOOT drive will appear again.
39+
#. Load the appropriate `CircuitPython .uf2 <https://github.com/adafruit/circuitpython/releases/latest>`_.
40+
3141
ValueError: Incompatible ``.mpy`` file.
3242
---------------------------------------
3343

3444
This error occurs when importing a module that is stored as a ``mpy`` binary file
3545
(rather than a ``py`` text file) that was generated by a different version of
3646
CircuitPython than the one its being loaded into. Most versions are compatible
3747
but, rarely they aren't. In particular, the ``mpy`` binary format changed between
38-
CircuitPython versions 1.x and 2.x.
48+
CircuitPython versions 1.x and 2.x, and will change again between 2.x and 3.x.
3949

40-
So, if you just upgraded to CircuitPython 2.x from 1.x you'll need to download a
50+
So, for instance, if you just upgraded to CircuitPython 2.x from 1.x you'll need to download a
4151
newer version of the library that triggered the error on ``import``. They are
4252
all available in the
4353
`Adafruit bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/latest>`_

lib/libm/nearbyintf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ float nearbyintf(float x)
1818
#pragma GCC diagnostic push
1919
#pragma GCC diagnostic ignored "-Wfloat-equal"
2020
if (y == 0)
21-
#pragma GCC diagnostic pop
2221
return s ? -0.0f : 0.0f;
22+
#pragma GCC diagnostic pop
2323
return y;
2424
}

lib/utils/pyexec.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
255255
} else if (ret == CHAR_CTRL_B) {
256256
// reset friendly REPL
257257
mp_hal_stdout_tx_str("\r\n");
258-
mp_hal_stdout_tx_str("Adafruit CircuitPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; " MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME "\r\n");
258+
mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO);
259+
mp_hal_stdout_tx_str("\r\n");
259260
// mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n");
260261
goto input_restart;
261262
} else if (ret == CHAR_CTRL_C) {
@@ -394,7 +395,9 @@ int pyexec_friendly_repl(void) {
394395
#endif
395396

396397
friendly_repl_reset:
397-
mp_hal_stdout_tx_str("\r\nAdafruit CircuitPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; " MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME "\r\n");
398+
mp_hal_stdout_tx_str("\r\n");
399+
mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO);
400+
mp_hal_stdout_tx_str("\r\n");
398401
// mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n");
399402

400403
// to test ctrl-C

ports/atmel-samd/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ BASE_CFLAGS = \
7676
-ffunction-sections \
7777
-fdata-sections \
7878
-fshort-enums \
79+
-DCIRCUITPY_SOFTWARE_SAFE_MODE=0x0ADABEEF \
80+
-DCIRCUITPY_CANARY_WORD=0xADAF00 \
81+
-DCIRCUITPY_SAFE_RESTART_WORD=0xDEADBEEF \
7982
--param max-inline-insns-single=500
8083

8184
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
@@ -312,6 +315,7 @@ SRC_BINDINGS_ENUMS = \
312315
digitalio/Direction.c \
313316
digitalio/DriveMode.c \
314317
digitalio/Pull.c \
318+
microcontroller/RunMode.c \
315319
help.c \
316320
math/__init__.c \
317321
supervisor/__init__.c \

ports/atmel-samd/boards/arduino_zero/mpconfigboard.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define USB_REPL
2-
31
#define MICROPY_HW_BOARD_NAME "Arduino Zero"
42
#define MICROPY_HW_MCU_NAME "samd21g18"
53

ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define USB_REPL
2-
31
#define MICROPY_HW_BOARD_NAME "Adafruit CircuitPlayground Express"
42
#define MICROPY_HW_MCU_NAME "samd21g18"
53

@@ -10,25 +8,37 @@
108
#define SPI_FLASH_BAUDRATE (8000000)
119

1210
// On-board flash
13-
#define SPI_FLASH_MUX_SETTING SPI_SIGNAL_MUX_SETTING_E
14-
// Use default pinmux for the chip select since we manage it ourselves.
15-
#define SPI_FLASH_PAD0_PINMUX PINMUX_PA16D_SERCOM3_PAD0 // MISO
16-
#define SPI_FLASH_PAD1_PINMUX PINMUX_UNUSED // CS
17-
#define SPI_FLASH_PAD2_PINMUX PINMUX_PA20D_SERCOM3_PAD2 // MOSI
18-
#define SPI_FLASH_PAD3_PINMUX PINMUX_PA21D_SERCOM3_PAD3 // SCK
19-
20-
#define SPI_FLASH_CS PIN_PB22
21-
#define SPI_FLASH_SERCOM SERCOM3
22-
11+
#define SPI_FLASH_MOSI_PIN PIN_PA20
12+
#define SPI_FLASH_MISO_PIN PIN_PA16
13+
#define SPI_FLASH_SCK_PIN PIN_PA21
14+
#define SPI_FLASH_CS_PIN PIN_PB22
15+
16+
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA20D_SERCOM3_PAD2
17+
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA16D_SERCOM3_PAD0
18+
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA21D_SERCOM3_PAD3
19+
#define SPI_FLASH_SERCOM SERCOM3
20+
#define SPI_FLASH_SERCOM_INDEX 5
21+
#define SPI_FLASH_MOSI_PAD 2
22+
#define SPI_FLASH_MISO_PAD 0
23+
#define SPI_FLASH_SCK_PAD 3
24+
25+
// <o> Transmit Data Pinout
26+
// <0x0=>PAD[0,1]_DO_SCK
27+
// <0x1=>PAD[2,3]_DO_SCK
28+
// <0x2=>PAD[3,1]_DO_SCK
29+
// <0x3=>PAD[0,3]_DO_SCK
30+
#define SPI_FLASH_DOPO 1
31+
#define SPI_FLASH_DIPO 0 // same as MISO PAD
32+
33+
// These are pins not to reset.
2334
// PA24 and PA25 are USB.
2435
#define MICROPY_PORT_A (PORT_PA16 | PORT_PA20 | PORT_PA21 | PORT_PA24 | PORT_PA25)
2536
#define MICROPY_PORT_B (PORT_PB22)
2637
#define MICROPY_PORT_C (0)
2738

2839
#define SPEAKER_ENABLE_PIN (&pin_PA30)
2940

30-
#include "internal_flash.h"
31-
//#include "spi_flash.h"
41+
#include "spi_flash.h"
3242

3343
// If you change this, then make sure to update the linker scripts as well to
3444
// make sure you don't overwrite code.
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
LD_FILE = boards/samd21x18-bootloader-crystalless.ld
1+
LD_FILE = boards/samd21x18-bootloader-external-flash-crystalless.ld
22
USB_VID = 0x239A
33
USB_PID = 0x8019
44
USB_PRODUCT = "CircuitPlayground Express"
55
USB_MANUFACTURER = "Adafruit Industries LLC"
66

7-
#SPI_FLASH_FILESYSTEM = 1
8-
INTERNAL_FLASH_FILESYSTEM = 1
7+
SPI_FLASH_FILESYSTEM = 1
98

109
CHIP_VARIANT = SAMD21G18A
1110
CHIP_FAMILY = samd21
1211

1312
# Include these Python libraries in firmware.
14-
### TODO(halbert): disable some of these frozen modules; they don't fit in 3.0.0 build while internalfs
15-
### is in use
16-
###FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
17-
###FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
18-
###FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
19-
###FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor
13+
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
14+
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
15+
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
16+
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor

ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// LEDs
22
//#define MICROPY_HW_LED_MSC PIN_PA17 // red
3-
// #define UART_REPL
4-
#define USB_REPL
5-
63
#define MICROPY_HW_BOARD_NAME "Adafruit Feather M0 Adalogger"
74
#define MICROPY_HW_MCU_NAME "samd21g18"
85

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy