Skip to content

Commit

Permalink
Merge pull request #99 from fhoedemakers/menusystem
Browse files Browse the repository at this point in the history
Using a shared menu system, limited support for pico w
  • Loading branch information
fhoedemakers authored Dec 14, 2024
2 parents 085f45d + 7883b18 commit b6c69be
Show file tree
Hide file tree
Showing 53 changed files with 174 additions and 29,516 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/BuildAndRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ jobs:
tag="${input_string#$prefix}"
echo "Tag is ${tag}"
sed -i "s/^[[:space:]]*pico_set_program_version(.*/pico_set_program_version(${{ env.APP_NAME }} \"$tag\")/" CMakeLists.txt
sed -i "s/VX.X/$tag/" menu.h
sed -i "s/VX.X/$tag/" pico_shared/menu.h
else
echo "The string does not start with 'refs/tags/'."
fi
grep "pico_set_program_version" CMakeLists.txt
grep SWVERSION menu.h
grep SWVERSION pico_shared/menu.h
# - name: Install Pico SDk
# run: |
Expand Down Expand Up @@ -95,14 +95,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
releases/${{ env.APP_NAME }}AdaFruitDVISD.uf2
releases/${{ env.APP_NAME }}FeatherDVI.uf2
releases/${{ env.APP_NAME }}PimoroniDV.uf2
releases/${{ env.APP_NAME }}WsRP2040PiZero.uf2
releases/pico2_${{ env.APP_NAME }}AdaFruitDVISD.uf2
releases/pico2_${{ env.APP_NAME }}PimoroniDV.uf2
releases/pico2_riscv_${{ env.APP_NAME }}AdaFruitDVISD.uf2
releases/pico2_riscv_${{ env.APP_NAME }}PimoroniDV.uf2
releases/*.uf2
PCB/pico_nesPCB_v2.1.zip
body_path: CHANGELOG.md

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "tusb_xinput"]
path = tusb_xinput
url = https://github.com/fhoedemakers/tusb_xinput.git
[submodule "pico_shared"]
path = pico_shared
url = https://github.com/fhoedemakers/pico_shared.git
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

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

- For Raspberry Pi Pico (RP2040) you need to download the .uf2 files starting with pico_.
- 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.
- For Raspberry Pi Pico 2 (w) (RP2350) you need to download the .uf2 files starting with pico2_ or pico2_riscv_ for Risc-V.

>[!NOTE]
>For Raspberry Pi Pico 2 you need to download the .uf2 files starting with pico2_ or pico2_riscv_ for Risc-V.
>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.

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

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

# Release notes

## v0.22

### Features

### Technical changes

- 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.

### Fixes

- 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.

To build for Pico w, use the following commands:

```bash
# Pimoroni DV Demo Base
./bld.sh -c1 -w
# Custom PCB/breadboard
./bld.sh -c2 -w
```



## v0.21

### Features
Expand Down
43 changes: 20 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ pico_sdk_init()
# "Remove build subdirectory and use SDK 1.4.0 to build this project.\n"
# "See https://github.com/fhoedemakers/pico-infonesPlus/issues/7")
# ENDIF()
add_subdirectory(drivers/fatfs)
add_subdirectory(drivers/sdcard)

if (NOT HW_CONFIG)
set(HW_CONFIG 1 CACHE STRING "Select the hardware configuration for your board")
endif()
Expand All @@ -73,7 +72,7 @@ if ( HW_CONFIG EQUAL 1 )
# This default Config is for Pimoroni Pico DV Demo Base, note uart is disabled because gpio 1 is used for NES controller
set(DVICONFIG "dviConfig_PimoroniDemoDVSock" CACHE STRING
"Select a default pin configuration from common_dvi_pin_configs.h")
set(LED_GPIO_PIN "25" CACHE STRING "Select the GPIO pin for LED")
set(LED_GPIO_PIN "0" CACHE STRING "Select the GPIO pin for LED") # use 0 for onboard LED (PICO/PICO_W)
set(SD_CS "22" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
set(SD_SCK "5" CACHE STRING "Specify de Clock GPIO pin for the SD card")
set(SD_MOSI "18" CACHE STRING "Select the Master Out Slave In GPIO pin for the SD card")
Expand All @@ -96,7 +95,7 @@ elseif ( HW_CONFIG EQUAL 2 )
# Adafruit DVI Breakout For HDMI Source Devices https://www.adafruit.com/product/4984
set(DVICONFIG "dviConfig_PicoDVISock" CACHE STRING
"Select a default pin configuration from common_dvi_pin_configs.h")
set(LED_GPIO_PIN "25" CACHE STRING "Select the GPIO pin for LED")
set(LED_GPIO_PIN "0" CACHE STRING "Select the GPIO pin for LED") # use 0 for onboard LED (PICO/PICO_W)
# Adafruit Micro-SD breakout board+ https://www.adafruit.com/product/254
set(SD_CS "5" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
set(SD_SCK "2" CACHE STRING "Specify de Clock GPIO pin for the SD card")
Expand All @@ -118,7 +117,7 @@ elseif ( HW_CONFIG EQUAL 3 )
# --------------------------------------------------------------------
set(DVICONFIG "dviConfig_AdafruitFeatherDVI" CACHE STRING
"Select a default pin configuration from common_dvi_pin_configs.h")
set(LED_GPIO_PIN "13" CACHE STRING "Select the GPIO pin for LED")
set(LED_GPIO_PIN "13" CACHE STRING "Select the GPIO pin for LED") # Adafruit Feather RP2040 onboard LED
set(SD_CS "10" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
set(SD_SCK "14" CACHE STRING "Specify de Clock GPIO pin for the SD card")
set(SD_MOSI "15" CACHE STRING "Select the Master Out Slave In GPIO pin for the SD card")
Expand All @@ -139,7 +138,7 @@ elseif ( HW_CONFIG EQUAL 4 )
# --------------------------------------------------------------------
set(DVICONFIG "dviConfig_WaveShareRp2040" CACHE STRING
"Select a default pin configuration from common_dvi_pin_configs.h")
set(LED_GPIO_PIN "-1" CACHE STRING "Select the GPIO pin for LED")
set(LED_GPIO_PIN "-1" CACHE STRING "Select the GPIO pin for LED") # No onboard LED for Waveshare RP2040-PiZero
set(SD_CS "21" CACHE STRING "Specify the Chip Select GPIO pin for the SD card")
set(SD_SCK "18" CACHE STRING "Specify de Clock GPIO pin for the SD card")
set(SD_MOSI "19" CACHE STRING "Select the Master Out Slave In GPIO pin for the SD card")
Expand Down Expand Up @@ -177,14 +176,7 @@ message("Mapper 5 enabled : ${INFONES_MAPPER_5_ENABLED}")

add_executable(${projectname}
main.cpp
hid_app.cpp
gamepad.cpp
nespad.cpp
wiipad.cpp
menu.cpp
RomLister.cpp
FrensHelpers.cpp
settings.cpp
splash.cpp
)

pico_set_program_name(${projectname} "${projectname}")
Expand Down Expand Up @@ -247,26 +239,31 @@ target_link_libraries(${projectname} PRIVATE
dvi
util
infones
tinyusb_host
sdcard
fatfs
xinput_host
tinyusb_host
pico_shared
xinput_host
)
if(PICO_BOARD STREQUAL "pico_w" OR PICO_BOARD STREQUAL "pico2_w")
# Attention pico2_w in arm-s or risv-s mode causes the led blinking to generate red screen flicker and
# multiple "[CYW43] do_ioctl(2, 263, 16): timeout" messages to the console.
# pico_w does not have this issue.
target_link_libraries(${projectname} PRIVATE pico_cyw43_arch_none)
endif()

target_include_directories(${projectname}
PRIVATE
pico_lib
pico_shared
infones
assets
include
tusb_xinput
.
)

add_subdirectory(infones)
add_subdirectory(pico_lib/dvi)
add_subdirectory(pico_lib/util)
add_subdirectory(infones)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/tusb_xinput xinput_host)

add_subdirectory(pico_shared)
add_subdirectory(tusb_xinput xinput_host)
pico_add_extra_outputs(${projectname})


Expand Down
37 changes: 0 additions & 37 deletions FrensHelpers.cpp

This file was deleted.

15 changes: 0 additions & 15 deletions FrensHelpers.h

This file was deleted.

33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ Click on the link below for your specific board configuration:


### flashing the Pico
- When using a Pico, download **piconesPlusPimoroniDV.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
- When using a Pico 2, download **pico2_piconesPlusPimoroniDV.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
- 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).
- 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).
- 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.
- Drag and drop the UF2 file on to the RPI-RP2 drive. The Raspberry Pi Pico will reboot and will now run the emulator.

Expand Down Expand Up @@ -262,8 +262,8 @@ NOIMAGE - TODO


### flashing the Pico
- When using a Pico, download **piconesPlusAdaFruitDVISD.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
- When using a Pico 2, download **pico2_piconesPlusAdaFruitDVISD.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
- 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).
- 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).
- 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.
- Drag and drop the UF2 file on to the RPI-RP2 drive. The Raspberry Pi Pico will reboot and will now run the emulator.

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

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

### flashing the Waveshare RP2040-PiZero Development Board
- Download **piconesPlusWsRP2040PiZero.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
- Download **pico_piconesPlusWsRP2040PiZero.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
- 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.
- On the board, push and hold the BOOT button, then press RUN. Release the buttons, the drive RPI-RP2 should appear on your computer.
- Drag and drop the UF2 file on to the RPI-RP2 drive. The board will reboot and will now run the emulator.
Expand Down Expand Up @@ -627,8 +627,8 @@ Other materials needed:
- Micro USB power supply.
- Optional: on/off switch, like [this](https://www.kiwi-electronics.com/en/spdt-slide-switch-410?search=KW-2467)

When using a Pico, Flash **piconesPlusAdaFruitDVISD.uf2** from the [releases page](https://github.com/fhoedemakers/pico-infonesPlus/releases/latest).
When using a Pico 2 flash **pico2_piconesPlusAdaFruitDVISD.uf2** instead.
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).
When using a Pico 2 or Pico 2 W, flash **pico2_piconesPlusAdaFruitDVISD.uf2** instead.

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

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

***

# Raspberry Pico W support
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.
# Raspberry Pico W and Pico2 W support
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.

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.
There are issues with the display on the Pico2 W when blinking the led. Also ioctl timeout errors are printed on the uart console.

***

Expand Down Expand Up @@ -769,7 +772,7 @@ After flashing some bigger games, the controller might become unresponsive:
- Debug printf statements over UART (GPIO0 and GPIO1) are disabled because GPIO1 is used for second nes controller port.
- 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.
- tar file support is removed.
- Pico W: The onboard led does not blink every 60 frames.
- Pico2 W: Blinking the onboard led causes display issues and ioctl timeout errors on the uart console.

***

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

0 comments on commit b6c69be

Please sign in to comment.