Skip to content

Commit 065e820

Browse files
committed
merge from 2.2.0 + fix up board defs
1 parent ce81c8d commit 065e820

File tree

96 files changed

+3107
-196
lines changed

Some content is hidden

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

96 files changed

+3107
-196
lines changed

.gitmodules

+3
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

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
python:
2+
version: 3

docs/troubleshooting.rst

+17-7
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

+1-1
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

+5-2
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

+4
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/circuitplayground_express/mpconfigboard.h

+24-12
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,37 @@
1010
#define SPI_FLASH_BAUDRATE (8000000)
1111

1212
// 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-
13+
#define SPI_FLASH_MOSI_PIN PIN_PA20
14+
#define SPI_FLASH_MISO_PIN PIN_PA16
15+
#define SPI_FLASH_SCK_PIN PIN_PA21
16+
#define SPI_FLASH_CS_PIN PIN_PB22
17+
18+
#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA20D_SERCOM3_PAD2
19+
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA16D_SERCOM3_PAD0
20+
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA21D_SERCOM3_PAD3
21+
#define SPI_FLASH_SERCOM SERCOM3
22+
#define SPI_FLASH_SERCOM_INDEX 5
23+
#define SPI_FLASH_MOSI_PAD 2
24+
#define SPI_FLASH_MISO_PAD 0
25+
#define SPI_FLASH_SCK_PAD 3
26+
27+
// <o> Transmit Data Pinout
28+
// <0x0=>PAD[0,1]_DO_SCK
29+
// <0x1=>PAD[2,3]_DO_SCK
30+
// <0x2=>PAD[3,1]_DO_SCK
31+
// <0x3=>PAD[0,3]_DO_SCK
32+
#define SPI_FLASH_DOPO 1
33+
#define SPI_FLASH_DIPO 0 // same as MISO PAD
34+
35+
// These are pins not to reset.
2336
// PA24 and PA25 are USB.
2437
#define MICROPY_PORT_A (PORT_PA16 | PORT_PA20 | PORT_PA21 | PORT_PA24 | PORT_PA25)
2538
#define MICROPY_PORT_B (PORT_PB22)
2639
#define MICROPY_PORT_C (0)
2740

2841
#define SPEAKER_ENABLE_PIN (&pin_PA30)
2942

30-
#include "internal_flash.h"
31-
//#include "spi_flash.h"
43+
#include "spi_flash.h"
3244

3345
// If you change this, then make sure to update the linker scripts as well to
3446
// make sure you don't overwrite code.

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

+5-8
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ 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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "boards/board.h"
28+
29+
void board_init(void)
30+
{
31+
}
32+
33+
bool board_requests_safe_mode(void) {
34+
return false;
35+
}
36+
37+
void reset_board(void) {
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/**
2+
* \file
3+
*
4+
* \brief Memory access control configuration file.
5+
*
6+
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
7+
*
8+
* \asf_license_start
9+
*
10+
* \page License
11+
*
12+
* Redistribution and use in source and binary forms, with or without
13+
* modification, are permitted provided that the following conditions are met:
14+
*
15+
* 1. Redistributions of source code must retain the above copyright notice,
16+
* this list of conditions and the following disclaimer.
17+
*
18+
* 2. Redistributions in binary form must reproduce the above copyright notice,
19+
* this list of conditions and the following disclaimer in the documentation
20+
* and/or other materials provided with the distribution.
21+
*
22+
* 3. The name of Atmel may not be used to endorse or promote products derived
23+
* from this software without specific prior written permission.
24+
*
25+
* 4. This software may only be redistributed and used in connection with an
26+
* Atmel microcontroller product.
27+
*
28+
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29+
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31+
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38+
* POSSIBILITY OF SUCH DAMAGE.
39+
*
40+
* \asf_license_stop
41+
*
42+
*/
43+
/*
44+
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
45+
*/
46+
47+
#ifndef _CONF_ACCESS_H_
48+
#define _CONF_ACCESS_H_
49+
50+
#include "compiler.h"
51+
#include "board.h"
52+
53+
54+
/*! \name Activation of Logical Unit Numbers
55+
*/
56+
//! @{
57+
#define LUN_0 ENABLE //!< On-Chip Virtual Memory.
58+
#define LUN_1 DISABLE //!< AT45DBX Data Flash.
59+
#define LUN_2 DISABLE //!< SD/MMC Card over SPI.
60+
#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0.
61+
#define LUN_4 DISABLE
62+
#define LUN_5 DISABLE
63+
#define LUN_6 DISABLE
64+
#define LUN_7 DISABLE
65+
#define LUN_USB DISABLE //!< Host Mass-Storage Memory.
66+
//! @}
67+
68+
/*! \name LUN 0 Definitions
69+
*/
70+
//! @{
71+
#define LUN_0_INCLUDE "access_vfs.h"
72+
#define Lun_0_test_unit_ready vfs_test_unit_ready
73+
#define Lun_0_read_capacity vfs_read_capacity
74+
#define Lun_0_unload NULL
75+
#define Lun_0_wr_protect vfs_wr_protect
76+
#define Lun_0_removal vfs_removal
77+
#define Lun_0_usb_read_10 vfs_usb_read_10
78+
#define Lun_0_usb_write_10 vfs_usb_write_10
79+
#define LUN_0_NAME "\"CircuitPython VFS[0]\""
80+
//! @}
81+
82+
#define MEM_USB LUN_USB
83+
84+
/*! \name Actions Associated with Memory Accesses
85+
*
86+
* Write here the action to associate with each memory access.
87+
*
88+
* \warning Be careful not to waste time in order not to disturb the functions.
89+
*/
90+
//! @{
91+
#define memory_start_read_action(nb_sectors)
92+
#define memory_stop_read_action()
93+
#define memory_start_write_action(nb_sectors)
94+
#define memory_stop_write_action()
95+
//! @}
96+
97+
/*! \name Activation of Interface Features
98+
*/
99+
//! @{
100+
#define ACCESS_USB true //!< MEM <-> USB interface.
101+
#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface.
102+
#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface.
103+
#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode.
104+
#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface.
105+
#define ACCESS_CODEC false //!< Codec interface.
106+
//! @}
107+
108+
/*! \name Specific Options for Access Control
109+
*/
110+
//! @{
111+
#define GLOBAL_WR_PROTECT false //!< Management of a global write protection.
112+
//! @}
113+
114+
115+
#endif // _CONF_ACCESS_H_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* \file
3+
*
4+
* \brief User board configuration template
5+
*
6+
*/
7+
/*
8+
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
9+
*/
10+
11+
#ifndef CONF_BOARD_H
12+
#define CONF_BOARD_H
13+
14+
#endif // CONF_BOARD_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "conf_clocks_external_32k.h"

0 commit comments

Comments
 (0)