Skip to content

Commit

Permalink
Merge pull request #4446 from tannewt/rp2040_flash
Browse files Browse the repository at this point in the history
Switch RP2040 flash settings to nvm.toml
  • Loading branch information
dhalbert authored Mar 23, 2021
2 parents f8cea3b + 36edc4b commit c81007a
Show file tree
Hide file tree
Showing 40 changed files with 474 additions and 95 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y eatmydata
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy
pip install -r requirements-dev.txt
- name: Versions
run: |
gcc --version
Expand Down Expand Up @@ -132,15 +132,6 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Install dependencies
run: |
brew install gettext
echo >>$GITHUB_PATH /usr/local/opt/gettext/bin
- name: Versions
run: |
gcc --version
python3 --version
msgfmt --version
- uses: actions/checkout@v2.2.0
with:
submodules: true
Expand All @@ -150,6 +141,15 @@ jobs:
run: |
git describe --dirty --tags
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
- name: Install dependencies
run: |
brew install gettext
echo >>$GITHUB_PATH /usr/local/opt/gettext/bin
- name: Versions
run: |
gcc --version
python3 --version
msgfmt --version
- name: Build mpy-cross
run: make -C mpy-cross -j2
- uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -178,6 +178,7 @@ jobs:
- "TG-Watch"
- "adafruit_feather_rp2040"
- "adafruit_itsybitsy_rp2040"
- "adafruit_qtpy_rp2040"
- "aloriumtech_evo_m51"
- "aramcon_badge_2019"
- "arduino_mkr1300"
Expand Down Expand Up @@ -299,7 +300,6 @@ jobs:
- "pyruler"
- "qtpy_m0"
- "qtpy_m0_haxpress"
- "qtpy_rp2040"
- "raspberry_pi_pico"
- "raytac_mdbt50q-db-40"
- "robohatmm1_m4"
Expand Down Expand Up @@ -355,22 +355,22 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: actions/checkout@v2.2.0
with:
submodules: true
fetch-depth: 0
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
- name: Install deps
run: |
sudo apt-get install -y gettext
pip install requests sh click setuptools awscli
pip install -r requirements-dev.txt
wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
- name: Versions
run: |
gcc --version
arm-none-eabi-gcc --version
python3 --version
- uses: actions/checkout@v2.2.0
with:
submodules: true
fetch-depth: 0
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
- name: mpy-cross
run: make -C mpy-cross -j2
- name: build
Expand Down Expand Up @@ -404,6 +404,11 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: actions/checkout@v2.2.0
with:
submodules: true
fetch-depth: 0
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
- name: Install deps
run: |
sudo apt-get install -y gettext
Expand All @@ -415,11 +420,6 @@ jobs:
gcc --version
riscv64-unknown-elf-gcc --version
python3 --version
- uses: actions/checkout@v2.2.0
with:
submodules: true
fetch-depth: 0
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
- name: mpy-cross
run: make -C mpy-cross -j2
- name: build
Expand Down Expand Up @@ -500,7 +500,7 @@ jobs:
- name: Install CircuitPython deps
run: |
source $IDF_PATH/export.sh
pip install requests sh click setuptools awscli
pip install -r requirements-dev.txt
sudo apt-get install -y gettext ninja-build
env:
IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create_website_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
python-version: 3.8
- name: Install deps
run: |
pip install requests sh click
pip install -r requirements-dev.txt
- name: Versions
run: |
gcc --version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: |
sudo apt-add-repository -y -u ppa:pybricks/ppa
sudo apt-get install -y black gettext uncrustify
pip3 install polib
pip3 install -r requirements-dev.txt
- name: Populate selected submodules
run: git submodule update --init extmod/ulab
- name: Set PY
Expand Down
6 changes: 5 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,8 @@
url = https://github.com/adafruit/Adafruit_CircuitPython_LC709203F
[submodule "ports/raspberrypi/sdk"]
path = ports/raspberrypi/sdk
url = https://github.com/raspberrypi/pico-sdk.git
url = https://github.com/adafruit/pico-sdk.git
[submodule "data/nvm.toml"]
path = data/nvm.toml
url = https://github.com/adafruit/nvm.toml.git
branch = main
1 change: 1 addition & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
".env",
".venv",
".direnv",
"data",
"docs/autoapi",
"docs/README.md",
"drivers",
Expand Down
1 change: 1 addition & 0 deletions data/nvm.toml
Submodule nvm.toml added at 9b4a52
17 changes: 11 additions & 6 deletions ports/raspberrypi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ INC += -I. \
-I$(BUILD)

# Pico specific configuration
CFLAGS += -DPICO_ON_DEVICE=1 -DPICO_NO_BINARY_INFO=0 -DPICO_TIME_DEFAULT_ALARM_POOL_DISABLED=1 -DPICO_DIVIDER_CALL_IDIV0=0 -DPICO_DIVIDER_CALL_LDIV0=0 -DPICO_DIVIDER_HARDWARE=1 -DPICO_DOUBLE_ROM=1 -DPICO_FLOAT_ROM=1 -DPICO_MULTICORE=1 -DPICO_BITS_IN_RAM=0 -DPICO_DIVIDER_IN_RAM=0 -DPICO_DOUBLE_PROPAGATE_NANS=0 -DPICO_DOUBLE_IN_RAM=0 -DPICO_MEM_IN_RAM=0 -DPICO_FLOAT_IN_RAM=0 -DPICO_FLOAT_PROPAGATE_NANS=1 -DPICO_NO_FLASH=0 -DPICO_COPY_TO_RAM=0 -DPICO_DISABLE_SHARED_IRQ_HANDLERS=0 -DPICO_NO_BI_BOOTSEL_VIA_DOUBLE_RESET=0
CFLAGS += -DRASPBERRYPI -DPICO_ON_DEVICE=1 -DPICO_NO_BINARY_INFO=0 -DPICO_TIME_DEFAULT_ALARM_POOL_DISABLED=1 -DPICO_DIVIDER_CALL_IDIV0=0 -DPICO_DIVIDER_CALL_LDIV0=0 -DPICO_DIVIDER_HARDWARE=1 -DPICO_DOUBLE_ROM=1 -DPICO_FLOAT_ROM=1 -DPICO_MULTICORE=1 -DPICO_BITS_IN_RAM=0 -DPICO_DIVIDER_IN_RAM=0 -DPICO_DOUBLE_PROPAGATE_NANS=0 -DPICO_DOUBLE_IN_RAM=0 -DPICO_MEM_IN_RAM=0 -DPICO_FLOAT_IN_RAM=0 -DPICO_FLOAT_PROPAGATE_NANS=1 -DPICO_NO_FLASH=0 -DPICO_COPY_TO_RAM=0 -DPICO_DISABLE_SHARED_IRQ_HANDLERS=0 -DPICO_NO_BI_BOOTSEL_VIA_DOUBLE_RESET=0
OPTIMIZATION_FLAGS ?= -O3
# TinyUSB defines
CFLAGS += -DTUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX=1 -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
Expand Down Expand Up @@ -169,7 +169,7 @@ SRC_SDK := \
src/rp2_common/hardware_irq/irq.c \
src/rp2_common/hardware_pio/pio.c \
src/rp2_common/hardware_pll/pll.c \
src/rp2_common/hardware_rtc/rtc.c \
src/rp2_common/hardware_rtc/rtc.c \
src/rp2_common/hardware_spi/spi.c \
src/rp2_common/hardware_sync/sync.c \
src/rp2_common/hardware_timer/timer.c \
Expand Down Expand Up @@ -233,7 +233,6 @@ SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE))
SRC_COMMON_HAL_SHARED_MODULE_EXPANDED = $(sort $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED))

SRC_S = supervisor/$(CHIP_FAMILY)_cpu.s
BOOT2_S_UPPER ?= sdk/src/rp2_common/boot_stage2/boot2_generic_03h.S
BOOT2_S_CFLAGS ?= -DPICO_FLASH_SPI_CLKDIV=4
SRC_S_UPPER = sdk/src/rp2_common/hardware_divider/divider.S \
sdk/src/rp2_common/hardware_irq/irq_handler_chain.S \
Expand Down Expand Up @@ -270,9 +269,15 @@ $(BUILD)/boot2.bin: $(BUILD)/boot2.elf
$(STEPECHO) "OBJCOPY $<"
$(Q)$(OBJCOPY) -O binary $< $@

$(BUILD)/boot2.elf: $(BOOT2_S_UPPER) | $(BUILD)/

$(BUILD)/stage2.c: stage2.c.jinja gen_stage2.py | $(BUILD)/
$(STEPECHO) "GEN $<"
$(Q)$(PYTHON3) gen_stage2.py $< $@ $(EXTERNAL_FLASH_DEVICES)

$(BUILD)/boot2.elf: $(BUILD)/stage2.c
$(STEPECHO) "BOOT $<"
$(Q)$(CC) $(CFLAGS) $(BOOT2_S_CFLAGS) -Isdk/src/rp2_common/boot_stage2/asminclude --specs=nosys.specs -nostartfiles -Wl,-T,sdk/src/rp2_common/boot_stage2/boot_stage2.ld -o $@ $<
$(Q)$(CC) $(CFLAGS) $(BOOT2_S_CFLAGS) -Os -ggdb3 -I. -fPIC --specs=nosys.specs -nostartfiles -Wl,-T,boot_stage2.ld -Wl,-Map=$@.map -o $@ $<
$(Q)$(SIZE) $@

SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)

Expand All @@ -285,7 +290,7 @@ $(BUILD)/firmware.elf: $(OBJ) link.ld

$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
$(STEPECHO) "Create $@"
$(Q)$(OBJCOPY) -O binary $^ $@
$(Q)$(OBJCOPY) -O binary -R .dtcm_bss $^ $@

$(BUILD)/firmware.uf2: $(BUILD)/firmware.bin
$(STEPECHO) "Create $@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@

#define DEFAULT_UART_BUS_RX (&pin_GPIO1)
#define DEFAULT_UART_BUS_TX (&pin_GPIO0)

// Flash chip is GD25Q64 connected over QSPI
#define TOTAL_FLASH_SIZE (8 * 1024 * 1024)
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ USB_MANUFACTURER = "Adafruit"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

INTERNAL_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "GD25Q64C"
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@

#define DEFAULT_UART_BUS_RX (&pin_GPIO1)
#define DEFAULT_UART_BUS_TX (&pin_GPIO0)

// Flash chip is W25Q64 connected over QSPI
#define TOTAL_FLASH_SIZE (8 * 1024 * 1024)
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ USB_MANUFACTURER = "Adafruit"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

INTERNAL_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ"
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@

#define DEFAULT_UART_BUS_RX (&pin_GPIO5)
#define DEFAULT_UART_BUS_TX (&pin_GPIO20)

// Flash chip is GD25Q64 connected over QSPI
#define TOTAL_FLASH_SIZE (8 * 1024 * 1024)
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ USB_MANUFACTURER = "Adafruit"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

INTERNAL_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ"
File renamed without changes.
2 changes: 0 additions & 2 deletions ports/raspberrypi/boards/pimoroni_keybow2040/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#define DEFAULT_UART_BUS_RX (&pin_GPIO1)
#define DEFAULT_UART_BUS_TX (&pin_GPIO0)

#define TOTAL_FLASH_SIZE (2 * 1024 * 1024)

// These pins are unconnected
#define IGNORE_PIN_GPIO2 1
#define IGNORE_PIN_GPIO22 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ USB_MANUFACTURER = "Pimoroni"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

INTERNAL_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ"

CIRCUITPY__EVE = 1
2 changes: 0 additions & 2 deletions ports/raspberrypi/boards/pimoroni_picosystem/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
#define DEFAULT_UART_BUS_RX (&pin_GPIO1)
#define DEFAULT_UART_BUS_TX (&pin_GPIO0)

#define TOTAL_FLASH_SIZE (16 * 1024 * 1024)

// These pins are unconnected
#define IGNORE_PIN_GPIO3 1
#define IGNORE_PIN_GPIO10 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ USB_MANUFACTURER = "Pimoroni"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

INTERNAL_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q128JVxQ"

CIRCUITPY__EVE = 1
2 changes: 0 additions & 2 deletions ports/raspberrypi/boards/pimoroni_tiny2040/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

#define MICROPY_HW_USER_SW (&pin_GPIO23)

#define TOTAL_FLASH_SIZE (8 * 1024 * 1024)

// These pins are unconnected
#define IGNORE_PIN_GPIO8 1
#define IGNORE_PIN_GPIO9 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ USB_MANUFACTURER = "Pimoroni"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

INTERNAL_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ"

CIRCUITPY__EVE = 1
16 changes: 0 additions & 16 deletions ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,2 @@
// LEDs
// #define MICROPY_HW_LED_STATUS (&pin_PA17)

#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico"
#define MICROPY_HW_MCU_NAME "rp2040"

// #define DEFAULT_I2C_BUS_SCL (&pin_PA23)
// #define DEFAULT_I2C_BUS_SDA (&pin_PA22)

// #define DEFAULT_SPI_BUS_SCK (&pin_PB11)
// #define DEFAULT_SPI_BUS_MOSI (&pin_PB10)
// #define DEFAULT_SPI_BUS_MISO (&pin_PA12)

// #define DEFAULT_UART_BUS_RX (&pin_PA11)
// #define DEFAULT_UART_BUS_TX (&pin_PA10)

// Flash chip is W25Q16JVUXIQ connected over QSPI
#define TOTAL_FLASH_SIZE (2 * 1024 * 1024)
4 changes: 1 addition & 3 deletions ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ USB_MANUFACTURER = "Raspberry Pi"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

INTERNAL_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ"

CIRCUITPY__EVE = 1

BOOT2_S_UPPER = sdk/src/rp2_common/boot_stage2/boot2_w25q080.S
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@

#define DEFAULT_UART_BUS_RX (&pin_GPIO1)
#define DEFAULT_UART_BUS_TX (&pin_GPIO0)

// Flash chip is GD25Q128 connected over QSPI
#define TOTAL_FLASH_SIZE (16 * 1024 * 1024)
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ USB_MANUFACTURER = "SparkFun"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

INTERNAL_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q128JVxM"
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@

#define DEFAULT_UART_BUS_RX (&pin_GPIO1)
#define DEFAULT_UART_BUS_TX (&pin_GPIO0)

// Flash chip is GD25Q128 connected over QSPI
#define TOTAL_FLASH_SIZE (16 * 1024 * 1024)
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ USB_MANUFACTURER = "SparkFun"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

INTERNAL_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q128JVxM"
13 changes: 13 additions & 0 deletions ports/raspberrypi/boot_stage2.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
MEMORY {
/* We are loaded to the top 256 bytes of SRAM, which is above the bootrom
stack. Note 4 bytes occupied by checksum. */
SRAM(rx) : ORIGIN = 0x20041f00, LENGTH = 252
}

SECTIONS {
. = ORIGIN(SRAM);
.text : {
*(.entry.*)
*(.text.*)
} >SRAM
}
Loading

0 comments on commit c81007a

Please sign in to comment.