Skip to content

Commit

Permalink
Merge pull request #4481 from tannewt/external_devices
Browse files Browse the repository at this point in the history
Switch devices.h to nvm.toml data
  • Loading branch information
tannewt authored Mar 25, 2021
2 parents 0105b30 + 01c153c commit 5810461
Show file tree
Hide file tree
Showing 32 changed files with 189 additions and 748 deletions.
2 changes: 1 addition & 1 deletion ports/atmel-samd/boards/8086_commander/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q128JV_SQ"
EXTERNAL_FLASH_DEVICES = "W25Q128JVxQ"

LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD51G19A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q16JV_IQ"
EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q16JVxQ"
LONGINT_IMPL = MPZ

# No I2S on SAMD51G
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q32JV_IQ"
EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ"
LONGINT_IMPL = MPZ

CIRCUITPY_BITBANGIO = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD51J19A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, S25FL064L"
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, S25FL064L"
LONGINT_IMPL = MPZ

CIRCUITPY_PS2IO = 1
2 changes: 1 addition & 1 deletion ports/atmel-samd/boards/cp32-m4/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD51J20A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q128JV_PM"
EXTERNAL_FLASH_DEVICES = "W25Q128JVxM"

# No I2S on SAMD51G.
CIRCUITPY_AUDIOBUSIO = 0
2 changes: 1 addition & 1 deletion ports/atmel-samd/boards/datalore_ip_m4/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ CHIP_VARIANT = SAMD51J19A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q16JV_IQ, W25Q16JV_IM"
EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q16JVxQ, W25Q16JVxM"
LONGINT_IMPL = MPZ
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD51P20A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"
LONGINT_IMPL = MPZ

CIRCUITPY_SDIOIO = 1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"
LONGINT_IMPL = NONE

# To keep the build small
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD51G19A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q16JV_IM, W25Q16JV_IQ"
EXTERNAL_FLASH_DEVICES = "W25Q16JVxM, W25Q16JVxQ"
LONGINT_IMPL = MPZ

# No I2S on SAMD51G
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/boards/pyportal/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ CHIP_VARIANT = SAMD51J20A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"
LONGINT_IMPL = MPZ
2 changes: 1 addition & 1 deletion ports/atmel-samd/boards/pyportal_titano/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ CHIP_VARIANT = SAMD51J20A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"
LONGINT_IMPL = MPZ
2 changes: 1 addition & 1 deletion ports/atmel-samd/boards/robohatmm1_m4/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CHIP_FAMILY = samd51
#QSPI_FLASH_FILESYSTEM = 0

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ"
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ"
LONGINT_IMPL = MPZ

# No I2S on SAMD51G
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD51P19A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q32JV_IQ"
EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ"
LONGINT_IMPL = MPZ

CIRCUITPY_VECTORIO = 1
2 changes: 1 addition & 1 deletion ports/atmel-samd/boards/snekboard/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q16JV_IQ"
EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ"
LONGINT_IMPL = MPZ

CIRCUITPY_BITBANGIO = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ"
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ"
LONGINT_IMPL = MPZ


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHIP_VARIANT = SAMD51G19A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"
LONGINT_IMPL = MPZ

# No I2S on SAMD51G
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/boards/uartlogger2/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ CHIP_VARIANT = SAMD51J19A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q32JV_IQ"
EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ"
LONGINT_IMPL = MPZ
2 changes: 1 addition & 1 deletion ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CHIP_VARIANT = SAMD51J20A
CHIP_FAMILY = samd51

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "GD25Q64C, W25Q32JV_IQ"
EXTERNAL_FLASH_DEVICES = "GD25Q64C, W25Q32JVxQ"
LONGINT_IMPL = MPZ

# Disable modules that are unusable on this special-purpose board.
Expand Down
2 changes: 1 addition & 1 deletion ports/nrf/boards/TG-Watch/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ USB_MANUFACTURER = "TG-Techie"
MCU_CHIP = nrf52840

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JV_SQ"
EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JVxQ"

FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register
Expand Down
2 changes: 1 addition & 1 deletion ports/nrf/boards/hiibot_bluefi/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ USB_MANUFACTURER = "HiiBot"
MCU_CHIP = nrf52840

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q16JV_IQ"
EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ"
2 changes: 1 addition & 1 deletion ports/nrf/boards/ohs2020_badge/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ USB_MANUFACTURER = "OSHWA"
MCU_CHIP = nrf52840

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q128JV_SQ"
EXTERNAL_FLASH_DEVICES = "W25Q128JVxQ"
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ MCU_CHIP = nrf52840

QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "W25Q128JV_PM"
EXTERNAL_FLASH_DEVICES = "W25Q128JVxM"
2 changes: 1 addition & 1 deletion ports/stm/boards/meowbit_v121/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ USB_PRODUCT = "Meowbit"
USB_MANUFACTURER = "Kittenbot"

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = W25Q16JV_IQ
EXTERNAL_FLASH_DEVICES = W25Q16JVxQ
# INTERNAL_FLASH_FILESYSTEM = 1

BOOTLOADER_OFFSET = 0x8010000
Expand Down
2 changes: 1 addition & 1 deletion ports/stm/boards/pyb_nano_v2/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ USB_PRODUCT = "PYB LR Nano V2"
USB_MANUFACTURER = "MicroPython Chinese Community"

SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = W25Q64JV_IQ
EXTERNAL_FLASH_DEVICES = W25Q64JVxQ

MCU_SERIES = F4
MCU_VARIANT = STM32F411xE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ USB_MANUFACTURER = "Unknown"

SPI_FLASH_FILESYSTEM = 1
#See supervisor/shared/external_flash/devices.h for options
EXTERNAL_FLASH_DEVICES = GD25Q16C,W25Q64FV,W25Q64JV_IQ
EXTERNAL_FLASH_DEVICES = GD25Q16C,W25Q64FV,W25Q64JVxQ
LONGINT_IMPL = MPZ

INTERNAL_FLASH_FILESYSTEM = 0
Expand Down
78 changes: 78 additions & 0 deletions supervisor/shared/external_flash/device.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries LLC
*
* 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.
*/
#ifndef MICROPY_INCLUDED_SUPERVISOR_SHARED_EXTERNAL_FLASH_DEVICE_H
#define MICROPY_INCLUDED_SUPERVISOR_SHARED_EXTERNAL_FLASH_DEVICE_H

#include <stdbool.h>
#include <stdint.h>

typedef struct {
uint32_t total_size;
uint16_t start_up_time_us;

// Three response bytes to 0x9f JEDEC ID command.
uint8_t manufacturer_id;
uint8_t memory_type;
uint8_t capacity;

// Max clock speed for all operations and the fastest read mode.
uint8_t max_clock_speed_mhz;

// Bitmask for Quad Enable bit if present. 0x00 otherwise. This is for the highest byte in the
// status register.
uint8_t quad_enable_bit_mask;

bool has_sector_protection : 1;

// Supports the 0x0b fast read command with 8 dummy cycles.
bool supports_fast_read : 1;

// Supports the fast read, quad output command 0x6b with 8 dummy cycles.
bool supports_qspi : 1;

// Supports the quad input page program command 0x32. This is known as 1-1-4 because it only
// uses all four lines for data.
bool supports_qspi_writes : 1;

// Requires a separate command 0x31 to write to the second byte of the status register.
// Otherwise two byte are written via 0x01.
bool write_status_register_split : 1;

// True when the status register is a single byte. This implies the Quad Enable bit is in the
// first byte and the Read Status Register 2 command (0x35) is unsupported.
bool single_status_byte : 1;

// Does not support using a ready bit within the status register
bool no_ready_bit : 1;

// Does not support the erase command (0x20)
bool no_erase_cmd : 1;

// Device does not have a reset command
bool no_reset_cmd : 1;
} external_flash_device;

#endif // MICROPY_INCLUDED_SUPERVISOR_SHARED_EXTERNAL_FLASH_DEVICE_H
Loading

0 comments on commit 5810461

Please sign in to comment.