Skip to content

Commit b6c69be

Browse files
authored
Merge pull request #99 from fhoedemakers/menusystem
Using a shared menu system, limited support for pico w
2 parents 085f45d + 7883b18 commit b6c69be

Some content is hidden

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

53 files changed

+174
-29516
lines changed

.github/workflows/BuildAndRelease.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ jobs:
5050
tag="${input_string#$prefix}"
5151
echo "Tag is ${tag}"
5252
sed -i "s/^[[:space:]]*pico_set_program_version(.*/pico_set_program_version(${{ env.APP_NAME }} \"$tag\")/" CMakeLists.txt
53-
sed -i "s/VX.X/$tag/" menu.h
53+
sed -i "s/VX.X/$tag/" pico_shared/menu.h
5454
else
5555
echo "The string does not start with 'refs/tags/'."
5656
fi
5757
grep "pico_set_program_version" CMakeLists.txt
58-
grep SWVERSION menu.h
58+
grep SWVERSION pico_shared/menu.h
5959
6060
# - name: Install Pico SDk
6161
# run: |
@@ -95,14 +95,7 @@ jobs:
9595
if: startsWith(github.ref, 'refs/tags/')
9696
with:
9797
files: |
98-
releases/${{ env.APP_NAME }}AdaFruitDVISD.uf2
99-
releases/${{ env.APP_NAME }}FeatherDVI.uf2
100-
releases/${{ env.APP_NAME }}PimoroniDV.uf2
101-
releases/${{ env.APP_NAME }}WsRP2040PiZero.uf2
102-
releases/pico2_${{ env.APP_NAME }}AdaFruitDVISD.uf2
103-
releases/pico2_${{ env.APP_NAME }}PimoroniDV.uf2
104-
releases/pico2_riscv_${{ env.APP_NAME }}AdaFruitDVISD.uf2
105-
releases/pico2_riscv_${{ env.APP_NAME }}PimoroniDV.uf2
98+
releases/*.uf2
10699
PCB/pico_nesPCB_v2.1.zip
107100
body_path: CHANGELOG.md
108101

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "tusb_xinput"]
55
path = tusb_xinput
66
url = https://github.com/fhoedemakers/tusb_xinput.git
7+
[submodule "pico_shared"]
8+
path = pico_shared
9+
url = https://github.com/fhoedemakers/pico_shared.git

CHANGELOG.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44

55
Binaries for each configuration and PCB design are at the end of this page.
66

7+
- For Raspberry Pi Pico (RP2040) you need to download the .uf2 files starting with pico_.
8+
- For Raspberry Pi Pico w (rp2040) you can download the .uf2 files starting with pico_w_. Although you can also use the pico_ binaries on the Pico w if you don't mind the blinking led.
9+
- For Raspberry Pi Pico 2 (w) (RP2350) you need to download the .uf2 files starting with pico2_ or pico2_riscv_ for Risc-V.
10+
711
>[!NOTE]
8-
>For Raspberry Pi Pico 2 you need to download the .uf2 files starting with pico2_ or pico2_riscv_ for Risc-V.
12+
>There is no specific build for the Pico 2 w because of issues with the display when blinking the led. Use the pico2_ binaries instead. There is no blinking led on the Pico 2 w.
13+
914

1015
[See setup section in readme how to install and wire up](https://github.com/fhoedemakers/pico-infonesPlus#pico-setup)
1116

@@ -22,6 +27,29 @@ For the latest two player PCB 2.0, you need:
2227

2328
# Release notes
2429

30+
## v0.22
31+
32+
### Features
33+
34+
### Technical changes
35+
36+
- Lots of code is now moved to git module pico_shared. This is code that can be shared between other emulators. This includes the menu system, the SD-card handling, the display handling. Also the code for controller input (NES, Wii-Classic, USB, keyboard) is moved to this module. When building from source, make sure you do a **git submodule update --init** from within the source folder to get the pico_shared module and all the other modules.
37+
38+
### Fixes
39+
40+
- Can now be built for pico w (RP2040). This makes the led blink every 60 frames or when rom is flashed. This only works for the Pico w. Pico2 w (RP2350) is not supported, because it causes screen flicker and ioctl timeouts on the uart console.
41+
42+
To build for Pico w, use the following commands:
43+
44+
```bash
45+
# Pimoroni DV Demo Base
46+
./bld.sh -c1 -w
47+
# Custom PCB/breadboard
48+
./bld.sh -c2 -w
49+
```
50+
51+
52+
2553
## v0.21
2654

2755
### Features

CMakeLists.txt

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ pico_sdk_init()
5555
# "Remove build subdirectory and use SDK 1.4.0 to build this project.\n"
5656
# "See https://github.com/fhoedemakers/pico-infonesPlus/issues/7")
5757
# ENDIF()
58-
add_subdirectory(drivers/fatfs)
59-
add_subdirectory(drivers/sdcard)
58+
6059
if (NOT HW_CONFIG)
6160
set(HW_CONFIG 1 CACHE STRING "Select the hardware configuration for your board")
6261
endif()
@@ -73,7 +72,7 @@ if ( HW_CONFIG EQUAL 1 )
7372
# This default Config is for Pimoroni Pico DV Demo Base, note uart is disabled because gpio 1 is used for NES controller
7473
set(DVICONFIG "dviConfig_PimoroniDemoDVSock" CACHE STRING
7574
"Select a default pin configuration from common_dvi_pin_configs.h")
76-
set(LED_GPIO_PIN "25" CACHE STRING "Select the GPIO pin for LED")
75+
set(LED_GPIO_PIN "0" CACHE STRING "Select the GPIO pin for LED") # use 0 for onboard LED (PICO/PICO_W)
7776
set(SD_CS "22" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
7877
set(SD_SCK "5" CACHE STRING "Specify de Clock GPIO pin for the SD card")
7978
set(SD_MOSI "18" CACHE STRING "Select the Master Out Slave In GPIO pin for the SD card")
@@ -96,7 +95,7 @@ elseif ( HW_CONFIG EQUAL 2 )
9695
# Adafruit DVI Breakout For HDMI Source Devices https://www.adafruit.com/product/4984
9796
set(DVICONFIG "dviConfig_PicoDVISock" CACHE STRING
9897
"Select a default pin configuration from common_dvi_pin_configs.h")
99-
set(LED_GPIO_PIN "25" CACHE STRING "Select the GPIO pin for LED")
98+
set(LED_GPIO_PIN "0" CACHE STRING "Select the GPIO pin for LED") # use 0 for onboard LED (PICO/PICO_W)
10099
# Adafruit Micro-SD breakout board+ https://www.adafruit.com/product/254
101100
set(SD_CS "5" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
102101
set(SD_SCK "2" CACHE STRING "Specify de Clock GPIO pin for the SD card")
@@ -118,7 +117,7 @@ elseif ( HW_CONFIG EQUAL 3 )
118117
# --------------------------------------------------------------------
119118
set(DVICONFIG "dviConfig_AdafruitFeatherDVI" CACHE STRING
120119
"Select a default pin configuration from common_dvi_pin_configs.h")
121-
set(LED_GPIO_PIN "13" CACHE STRING "Select the GPIO pin for LED")
120+
set(LED_GPIO_PIN "13" CACHE STRING "Select the GPIO pin for LED") # Adafruit Feather RP2040 onboard LED
122121
set(SD_CS "10" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
123122
set(SD_SCK "14" CACHE STRING "Specify de Clock GPIO pin for the SD card")
124123
set(SD_MOSI "15" CACHE STRING "Select the Master Out Slave In GPIO pin for the SD card")
@@ -139,7 +138,7 @@ elseif ( HW_CONFIG EQUAL 4 )
139138
# --------------------------------------------------------------------
140139
set(DVICONFIG "dviConfig_WaveShareRp2040" CACHE STRING
141140
"Select a default pin configuration from common_dvi_pin_configs.h")
142-
set(LED_GPIO_PIN "-1" CACHE STRING "Select the GPIO pin for LED")
141+
set(LED_GPIO_PIN "-1" CACHE STRING "Select the GPIO pin for LED") # No onboard LED for Waveshare RP2040-PiZero
143142
set(SD_CS "21" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
144143
set(SD_SCK "18" CACHE STRING "Specify de Clock GPIO pin for the SD card")
145144
set(SD_MOSI "19" CACHE STRING "Select the Master Out Slave In GPIO pin for the SD card")
@@ -177,14 +176,7 @@ message("Mapper 5 enabled : ${INFONES_MAPPER_5_ENABLED}")
177176

178177
add_executable(${projectname}
179178
main.cpp
180-
hid_app.cpp
181-
gamepad.cpp
182-
nespad.cpp
183-
wiipad.cpp
184-
menu.cpp
185-
RomLister.cpp
186-
FrensHelpers.cpp
187-
settings.cpp
179+
splash.cpp
188180
)
189181

190182
pico_set_program_name(${projectname} "${projectname}")
@@ -247,26 +239,31 @@ target_link_libraries(${projectname} PRIVATE
247239
dvi
248240
util
249241
infones
250-
tinyusb_host
251-
sdcard
252-
fatfs
253-
xinput_host
242+
tinyusb_host
243+
pico_shared
244+
xinput_host
254245
)
246+
if(PICO_BOARD STREQUAL "pico_w" OR PICO_BOARD STREQUAL "pico2_w")
247+
# Attention pico2_w in arm-s or risv-s mode causes the led blinking to generate red screen flicker and
248+
# multiple "[CYW43] do_ioctl(2, 263, 16): timeout" messages to the console.
249+
# pico_w does not have this issue.
250+
target_link_libraries(${projectname} PRIVATE pico_cyw43_arch_none)
251+
endif()
255252

256253
target_include_directories(${projectname}
257254
PRIVATE
258255
pico_lib
256+
pico_shared
259257
infones
260-
assets
261-
include
258+
tusb_xinput
262259
.
263260
)
264261

262+
add_subdirectory(infones)
265263
add_subdirectory(pico_lib/dvi)
266264
add_subdirectory(pico_lib/util)
267-
add_subdirectory(infones)
268-
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/tusb_xinput xinput_host)
269-
265+
add_subdirectory(pico_shared)
266+
add_subdirectory(tusb_xinput xinput_host)
270267
pico_add_extra_outputs(${projectname})
271268

272269

FrensHelpers.cpp

Lines changed: 0 additions & 37 deletions
This file was deleted.

FrensHelpers.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ Click on the link below for your specific board configuration:
167167

168168

169169
### flashing the Pico
170-
- When using a Pico, download **piconesPlusPimoroniDV.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
171-
- When using a Pico 2, download **pico2_piconesPlusPimoroniDV.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
170+
- When using a Pico / Pico W, download **pico_piconesPlusPimoroniDV.uf2** / **pico_w_piconesPlusPimoroniDV.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
171+
- When using a Pico 2 or Pico 2 W, download **pico2_piconesPlusPimoroniDV.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
172172
- Push and hold the BOOTSEL button on the Pico, then connect to your computer using a micro usb cable. Release BOOTSEL once the drive RPI-RP2 appears on your computer.
173173
- Drag and drop the UF2 file on to the RPI-RP2 drive. The Raspberry Pi Pico will reboot and will now run the emulator.
174174

@@ -262,8 +262,8 @@ NOIMAGE - TODO
262262

263263

264264
### flashing the Pico
265-
- When using a Pico, download **piconesPlusAdaFruitDVISD.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
266-
- When using a Pico 2, download **pico2_piconesPlusAdaFruitDVISD.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
265+
- When using a Pico / Pico W, download **pico_piconesPlusAdaFruitDVISD.uf2** / **pico_w_piconesPlusAdaFruitDVISD.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
266+
- When using a Pico 2 or Pico 2 W, download **pico2_piconesPlusAdaFruitDVISD.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
267267
- Push and hold the BOOTSEL button on the Pico, then connect to your computer using a micro usb cable. Release BOOTSEL once the drive RPI-RP2 appears on your computer. Or when already powered-on. Press and hold BOOTSEL, then press RUN on the board.
268268
- Drag and drop the UF2 file on to the RPI-RP2 drive. The Raspberry Pi Pico will reboot and will now run the emulator.
269269

@@ -436,7 +436,7 @@ Connect the nunchuck breakout adapter to the Feather DVI using the STEMMA QT cab
436436
![Image](assets/nes-controller-pinout.png)
437437

438438
### flashing the Feather RP2040
439-
- Download **piconesPlusFeatherDVI.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
439+
- Download **pico_piconesPlusFeatherDVI.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
440440
- Connect the feather to a USB port on your computer using the USB-C data cable.
441441
- On the feather, push and hold the BOOTSEL button, then press RESET. Release the buttons, the drive RPI-RP2 should appear on your computer.
442442
- Drag and drop the UF2 file on to the RPI-RP2 drive. The Raspberry Pi Pico will reboot and will now run the emulator.
@@ -541,7 +541,7 @@ Connections are as follows:
541541
| SCL | GPIO3 |
542542

543543
### flashing the Waveshare RP2040-PiZero Development Board
544-
- Download **piconesPlusWsRP2040PiZero.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
544+
- Download **pico_piconesPlusWsRP2040PiZero.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
545545
- Connect the USB-C port marked USB (not PIO-USB) to a USB port on your computer using the USB-C to USB-A data cable.
546546
- On the board, push and hold the BOOT button, then press RUN. Release the buttons, the drive RPI-RP2 should appear on your computer.
547547
- Drag and drop the UF2 file on to the RPI-RP2 drive. The board will reboot and will now run the emulator.
@@ -627,8 +627,8 @@ Other materials needed:
627627
- Micro USB power supply.
628628
- Optional: on/off switch, like [this](https://www.kiwi-electronics.com/en/spdt-slide-switch-410?search=KW-2467)
629629

630-
When using a Pico, Flash **piconesPlusAdaFruitDVISD.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
631-
When using a Pico 2 flash **pico2_piconesPlusAdaFruitDVISD.uf2** instead.
630+
When using a Pico / Pico W, Flash **pico_piconesPlusAdaFruitDVISD.uf2** / **pico_w_piconesPlusAdaFruitDVISD.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
631+
When using a Pico 2 or Pico 2 W, flash **pico2_piconesPlusAdaFruitDVISD.uf2** instead.
632632

633633
### Image: Two player setup using two NES controllers or a USB controller and a NES controller
634634

@@ -708,8 +708,11 @@ For games which support it, saves will be stored in the /SAVES folder of the SD
708708

709709
***
710710

711-
# Raspberry Pico W support
712-
The emulator works with the Pico W, but without the onboard blinking led. In order for the led to work on the Pico W, the cyw43 driver needs to be initialised. This causes the emulator to stop with an out of memory panic.
711+
# Raspberry Pico W and Pico2 W support
712+
The emulator works with the Pico W (RP2040). Use the pico_w_ versions of the uf2 files in the latest release. The Pico W has a built-in wifi module. The wifi module is not used by the emulator. It is only used for enabling the led to blink every 60 frames on the Pico W. If you don't mind the led blinking, you can use the pico_ versions of the uf2 files on the Pico W.
713+
714+
Although you can build them yourself, there are no pico2_w .uf2 binaries for the Pico2 W (RP2350) in the latest release, use the pico2_ versions instead.
715+
There are issues with the display on the Pico2 W when blinking the led. Also ioctl timeout errors are printed on the uart console.
713716

714717
***
715718

@@ -769,7 +772,7 @@ After flashing some bigger games, the controller might become unresponsive:
769772
- Debug printf statements over UART (GPIO0 and GPIO1) are disabled because GPIO1 is used for second nes controller port.
770773
- Due to the Pico's memory limitations, not all games will work. Games not working will show a "Mapper n is unsupported." (n is a number). For example starting Castlevania III will show the "Mapper 5 is unsupported." message.
771774
- tar file support is removed.
772-
- Pico W: The onboard led does not blink every 60 frames.
775+
- Pico2 W: Blinking the onboard led causes display issues and ioctl timeout errors on the uart console.
773776

774777
***
775778

@@ -790,19 +793,21 @@ Alternatively, you can use the [bld.sh](bld.sh) shell script:
790793
```
791794
Build script for the pico-InfoNESPlus project
792795
793-
Usage: ./bld.sh [-d] [-2 | -r] [-t path to toolchain] [-c <hwconfig>]
796+
Usage: ./pico_shared/bld.sh [-d] [-2 | -r] [-w] [-t path to toolchain] [-c <hwconfig>]
794797
Options:
795798
-d: build in DEBUG configuration
796799
-2: build for Pico 2 board (RP2350)
797800
-r: build for Pico 2 board (RP2350) with riscv core
798-
-t <path to toolchain>: only needed for riscv, specify the path to the riscv toolchain bin folder
801+
-w: build for Pico_w or Pico2_w
802+
-t <path to riscv toolchain>: only needed for riscv, specify the path to the riscv toolchain bin folder
803+
Default is $PICO_SDK_PATH/toolchain/RISCV_RPI_2_0_0_2/bin
799804
-c <hwconfig>: specify the hardware configuration
800805
1: Pimoroni Pico DV Demo Base (Default)
801806
2: Breadboard with Adafruit AdaFruit DVI Breakout Board and AdaFruit MicroSD card breakout board
802807
Custom pcb
803808
3: Adafruit Feather RP2040 DVI
804809
4: Waveshare RP2040-PiZero
805-
hwconfig 3 and 4 are RP2040-based boards, so they cannot be built for Pico 2
810+
hwconfig 3 and 4 are RP2040-based boards with no wifi, so -2 -r and -w are not allowed
806811
-h: display this help
807812
808813
To install the RISC-V toolchain:

0 commit comments

Comments
 (0)