Skip to content

Commit

Permalink
merge from 2.2.0 + fix up board defs
Browse files Browse the repository at this point in the history
  • Loading branch information
dhalbert committed Jan 3, 2018
1 parent ce81c8d commit 065e820
Show file tree
Hide file tree
Showing 96 changed files with 3,107 additions and 196 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -26,6 +26,9 @@
[submodule "frozen/Adafruit_CircuitPython_BusDevice"]
path = frozen/Adafruit_CircuitPython_BusDevice
url = https://github.com/adafruit/Adafruit_CircuitPython_BusDevice.git
[submodule "tools/python-semver"]
path = tools/python-semver
url = https://github.com/k-bx/python-semver.git
[submodule "lib/stm32lib"]
path = lib/stm32lib
url = https://github.com/micropython/stm32lib
Expand Down
2 changes: 2 additions & 0 deletions .readthedocs.yml
@@ -0,0 +1,2 @@
python:
version: 3
24 changes: 17 additions & 7 deletions docs/troubleshooting.rst
Expand Up @@ -15,29 +15,39 @@ This often happens on Windows when the ``CIRCUITPY`` disk is not safely ejected
before being reset by the button or being disconnected from USB. This can also
happen on Linux and Mac OSX but its less likely.

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

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

#. Download the appropriate flash erase uf2 from `here <https://github.com/adafruit/Adafruit_SPIFlash/tree/master/examples/flash_erase_express>`_.

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

**For boards without SPI flash, such as Feather M0 Proto, Gemma M0 and, Trinket M0:**

#. Download the appropriate erase .uf2 from `here <https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/uf2_flash_erasers>`_.
#. Double-click the reset button.
#. Copy the appropriate .uf2 to the xxxBOOT drive.
#. The boot LED will start pulsing again, and the xxxBOOT drive will appear again.
#. Load the appropriate `CircuitPython .uf2 <https://github.com/adafruit/circuitpython/releases/latest>`_.

ValueError: Incompatible ``.mpy`` file.
---------------------------------------

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

So, if you just upgraded to CircuitPython 2.x from 1.x you'll need to download a
So, for instance, if you just upgraded to CircuitPython 2.x from 1.x you'll need to download a
newer version of the library that triggered the error on ``import``. They are
all available in the
`Adafruit bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/latest>`_
Expand Down
2 changes: 1 addition & 1 deletion lib/libm/nearbyintf.c
Expand Up @@ -18,7 +18,7 @@ float nearbyintf(float x)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
if (y == 0)
#pragma GCC diagnostic pop
return s ? -0.0f : 0.0f;
#pragma GCC diagnostic pop
return y;
}
7 changes: 5 additions & 2 deletions lib/utils/pyexec.c
Expand Up @@ -255,7 +255,8 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
} else if (ret == CHAR_CTRL_B) {
// reset friendly REPL
mp_hal_stdout_tx_str("\r\n");
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");
mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO);
mp_hal_stdout_tx_str("\r\n");
// mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n");
goto input_restart;
} else if (ret == CHAR_CTRL_C) {
Expand Down Expand Up @@ -394,7 +395,9 @@ int pyexec_friendly_repl(void) {
#endif

friendly_repl_reset:
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");
mp_hal_stdout_tx_str("\r\n");
mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO);
mp_hal_stdout_tx_str("\r\n");
// mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n");

// to test ctrl-C
Expand Down
4 changes: 4 additions & 0 deletions ports/atmel-samd/Makefile
Expand Up @@ -76,6 +76,9 @@ BASE_CFLAGS = \
-ffunction-sections \
-fdata-sections \
-fshort-enums \
-DCIRCUITPY_SOFTWARE_SAFE_MODE=0x0ADABEEF \
-DCIRCUITPY_CANARY_WORD=0xADAF00 \
-DCIRCUITPY_SAFE_RESTART_WORD=0xDEADBEEF \
--param max-inline-insns-single=500

# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
Expand Down Expand Up @@ -312,6 +315,7 @@ SRC_BINDINGS_ENUMS = \
digitalio/Direction.c \
digitalio/DriveMode.c \
digitalio/Pull.c \
microcontroller/RunMode.c \
help.c \
math/__init__.c \
supervisor/__init__.c \
Expand Down
36 changes: 24 additions & 12 deletions ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h
Expand Up @@ -10,25 +10,37 @@
#define SPI_FLASH_BAUDRATE (8000000)

// On-board flash
#define SPI_FLASH_MUX_SETTING SPI_SIGNAL_MUX_SETTING_E
// Use default pinmux for the chip select since we manage it ourselves.
#define SPI_FLASH_PAD0_PINMUX PINMUX_PA16D_SERCOM3_PAD0 // MISO
#define SPI_FLASH_PAD1_PINMUX PINMUX_UNUSED // CS
#define SPI_FLASH_PAD2_PINMUX PINMUX_PA20D_SERCOM3_PAD2 // MOSI
#define SPI_FLASH_PAD3_PINMUX PINMUX_PA21D_SERCOM3_PAD3 // SCK

#define SPI_FLASH_CS PIN_PB22
#define SPI_FLASH_SERCOM SERCOM3

#define SPI_FLASH_MOSI_PIN PIN_PA20
#define SPI_FLASH_MISO_PIN PIN_PA16
#define SPI_FLASH_SCK_PIN PIN_PA21
#define SPI_FLASH_CS_PIN PIN_PB22

#define SPI_FLASH_MOSI_PIN_FUNCTION PINMUX_PA20D_SERCOM3_PAD2
#define SPI_FLASH_MISO_PIN_FUNCTION PINMUX_PA16D_SERCOM3_PAD0
#define SPI_FLASH_SCK_PIN_FUNCTION PINMUX_PA21D_SERCOM3_PAD3
#define SPI_FLASH_SERCOM SERCOM3
#define SPI_FLASH_SERCOM_INDEX 5
#define SPI_FLASH_MOSI_PAD 2
#define SPI_FLASH_MISO_PAD 0
#define SPI_FLASH_SCK_PAD 3

// <o> Transmit Data Pinout
// <0x0=>PAD[0,1]_DO_SCK
// <0x1=>PAD[2,3]_DO_SCK
// <0x2=>PAD[3,1]_DO_SCK
// <0x3=>PAD[0,3]_DO_SCK
#define SPI_FLASH_DOPO 1
#define SPI_FLASH_DIPO 0 // same as MISO PAD

// These are pins not to reset.
// PA24 and PA25 are USB.
#define MICROPY_PORT_A (PORT_PA16 | PORT_PA20 | PORT_PA21 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (PORT_PB22)
#define MICROPY_PORT_C (0)

#define SPEAKER_ENABLE_PIN (&pin_PA30)

#include "internal_flash.h"
//#include "spi_flash.h"
#include "spi_flash.h"

// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code.
Expand Down
Expand Up @@ -4,16 +4,13 @@ USB_PID = 0x8019
USB_PRODUCT = "CircuitPlayground Express"
USB_MANUFACTURER = "Adafruit Industries LLC"

#SPI_FLASH_FILESYSTEM = 1
INTERNAL_FLASH_FILESYSTEM = 1
SPI_FLASH_FILESYSTEM = 1

CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

# Include these Python libraries in firmware.
### TODO(halbert): disable some of these frozen modules; they don't fit in 3.0.0 build while internalfs
### is in use
###FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
###FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
###FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
###FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor
38 changes: 38 additions & 0 deletions ports/atmel-samd/boards/feather_m0_supersized/board.c
@@ -0,0 +1,38 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "boards/board.h"

void board_init(void)
{
}

bool board_requests_safe_mode(void) {
return false;
}

void reset_board(void) {
}
115 changes: 115 additions & 0 deletions ports/atmel-samd/boards/feather_m0_supersized/conf_access.h
@@ -0,0 +1,115 @@
/**
* \file
*
* \brief Memory access control configuration file.
*
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/

#ifndef _CONF_ACCESS_H_
#define _CONF_ACCESS_H_

#include "compiler.h"
#include "board.h"


/*! \name Activation of Logical Unit Numbers
*/
//! @{
#define LUN_0 ENABLE //!< On-Chip Virtual Memory.
#define LUN_1 DISABLE //!< AT45DBX Data Flash.
#define LUN_2 DISABLE //!< SD/MMC Card over SPI.
#define LUN_3 DISABLE //!< SD/MMC Card over MCI Slot 0.
#define LUN_4 DISABLE
#define LUN_5 DISABLE
#define LUN_6 DISABLE
#define LUN_7 DISABLE
#define LUN_USB DISABLE //!< Host Mass-Storage Memory.
//! @}

/*! \name LUN 0 Definitions
*/
//! @{
#define LUN_0_INCLUDE "access_vfs.h"
#define Lun_0_test_unit_ready vfs_test_unit_ready
#define Lun_0_read_capacity vfs_read_capacity
#define Lun_0_unload NULL
#define Lun_0_wr_protect vfs_wr_protect
#define Lun_0_removal vfs_removal
#define Lun_0_usb_read_10 vfs_usb_read_10
#define Lun_0_usb_write_10 vfs_usb_write_10
#define LUN_0_NAME "\"CircuitPython VFS[0]\""
//! @}

#define MEM_USB LUN_USB

/*! \name Actions Associated with Memory Accesses
*
* Write here the action to associate with each memory access.
*
* \warning Be careful not to waste time in order not to disturb the functions.
*/
//! @{
#define memory_start_read_action(nb_sectors)
#define memory_stop_read_action()
#define memory_start_write_action(nb_sectors)
#define memory_stop_write_action()
//! @}

/*! \name Activation of Interface Features
*/
//! @{
#define ACCESS_USB true //!< MEM <-> USB interface.
#define ACCESS_MEM_TO_RAM false //!< MEM <-> RAM interface.
#define ACCESS_STREAM false //!< Streaming MEM <-> MEM interface.
#define ACCESS_STREAM_RECORD false //!< Streaming MEM <-> MEM interface in record mode.
#define ACCESS_MEM_TO_MEM false //!< MEM <-> MEM interface.
#define ACCESS_CODEC false //!< Codec interface.
//! @}

/*! \name Specific Options for Access Control
*/
//! @{
#define GLOBAL_WR_PROTECT false //!< Management of a global write protection.
//! @}


#endif // _CONF_ACCESS_H_
14 changes: 14 additions & 0 deletions ports/atmel-samd/boards/feather_m0_supersized/conf_board.h
@@ -0,0 +1,14 @@
/**
* \file
*
* \brief User board configuration template
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/

#ifndef CONF_BOARD_H
#define CONF_BOARD_H

#endif // CONF_BOARD_H
@@ -0,0 +1 @@
#include "conf_clocks_external_32k.h"

0 comments on commit 065e820

Please sign in to comment.