Skip to content

Commit

Permalink
Add UART/VFAT option to RP2 (#18)
Browse files Browse the repository at this point in the history
* fix build for RP2
  • Loading branch information
v923z committed Sep 2, 2023
1 parent a9998a0 commit ce3261b
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion scripts/esp32/generic-c3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This file is part of the micropython-builder project,
# https://github.com/v923z/micropython-builder
# The MIT License (MIT)
# Copyright (c) 2022 Zoltán Vörös
# Copyright (c) 2022-2023 Zoltán Vörös
# 2023 Zach Moshe

source ./scripts/esp32/esp32.sh
Expand Down
2 changes: 1 addition & 1 deletion scripts/esp32/generic-s2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This file is part of the micropython-builder project,
# https://github.com/v923z/micropython-builder
# The MIT License (MIT)
# Copyright (c) 2022 Zoltán Vörös
# Copyright (c) 2022-2023 Zoltán Vörös
# 2023 Zach Moshe

source ./scripts/esp32/esp32.sh
Expand Down
2 changes: 1 addition & 1 deletion scripts/esp32/generic-s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This file is part of the micropython-builder project,
# https://github.com/v923z/micropython-builder
# The MIT License (MIT)
# Copyright (c) 2022 Zoltán Vörös
# Copyright (c) 2022-2023 Zoltán Vörös
# 2023 Zach Moshe

source ./scripts/esp32/esp32.sh
Expand Down
9 changes: 9 additions & 0 deletions scripts/rp2/mpconfigport.h.patch.uart_vfat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Board and hardware specific configuration
#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico"
#define MICROPY_HW_FLASH_STORAGE_BYTES (1408 * 1024)


// useful if there is no USB
#define MICROPY_HW_ENABLE_UART_REPL (1)
// Enable USB Mass Storage with FatFS filesystem
#define MICROPY_HW_USB_MSC (1)
2 changes: 1 addition & 1 deletion scripts/rp2/pico.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

source ./scripts/rp2/rp2.sh

build_rp2 "PICO"
build_rp2 "RPI_PICO"
2 changes: 1 addition & 1 deletion scripts/rp2/pico_uart_vfat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

source ./scripts/rp2/rp2.sh

build_rp2_uart_vfat "PICO"
build_rp2_uart_vfat "RPI_PICO"
2 changes: 1 addition & 1 deletion scripts/rp2/pico_w.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

source ./scripts/rp2/rp2.sh

build_rp2 "PICO_W"
build_rp2 "RPI_PICO_W"
12 changes: 9 additions & 3 deletions scripts/rp2/rp2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@
source ./scripts/init.sh

build_rp2() {
make ${MAKEOPTS} -C ports/rp2 submodules
make ${MAKEOPTS} -C ports/rp2
make ${MAKEOPTS} -C ports/rp2 BOARD=$1 submodules
make ${MAKEOPTS} -C micropython/ports/rp2 BOARD=$1 USER_C_MODULES=../../../ulab/code/micropython.cmake CFLAGS_EXTRA=-DULAB_HASH=$ulab_hash
copy_files rp2/build-$1/firmware.uf2 $1
clean_up rp2 build-$1
}

build_rp2_uart_vfat() {
MICROPY_HW_ENABLE_UART_REPL=1
MICROPY_HW_USB_MSC=1
# hot-patch the config file here
cp ./scripts/rp2/mpconfigport.h.patch.uart_vfat ./micropython/ports/rp2/boards/RPI_PICO/mpconfigport.h
make ${MAKEOPTS} -C ports/rp2 submodules
make ${MAKEOPTS} -C ports/rp2
make ${MAKEOPTS} -C ports/rp2 BOARD=$1 submodules
make ${MAKEOPTS} -C micropython/ports/rp2 BOARD=$1 USER_C_MODULES=../../../ulab/code/micropython.cmake CFLAGS_EXTRA=-DULAB_HASH=$ulab_hash
copy_files rp2/build-$1/firmware.uf2 "$1"_UART_VFAT
copy_files rp2/build-$1/firmware.uf2 "$1"-UART-VFAT
clean_up rp2 build-$1
}

0 comments on commit ce3261b

Please sign in to comment.