From 9f2d125faff9cedfb244fc1157b01915b875a9af Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Mon, 16 Dec 2024 20:21:47 +0000 Subject: [PATCH] Add board and platform to build script --- CMakeLists.txt | 25 ++++++++++++++++++++++++- src/version.h.in | 4 +++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33e9484..9deb079 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,29 @@ project(picoboot LANGUAGES C CXX ASM VERSION ${CMAKE_GIT_REPO_VERSION}) # Initialise the Raspberry Pi Pico SDK pico_sdk_init() +# Target board pico, pico_w, pico2, pico2_w +if(DEFINED PICO_BOARD) + message("PICO_BOARD is defined as ${PICO_BOARD}") +else() + message("PICO_BOARD not defined, defaulting to 'pico'") + set(PICO_BOARD pico) +endif() + +# Target platform rp2040, rp2350 (rp2350-arm-s) +if(DEFINED PICO_PLATFORM) + message("PICO_PLATFORM is defined as ${PICO_PLATFORM}") +else() + if(DEFINED PICO_BOARD) + if(PICO_BOARD STREQUAL "pico2") + set(PICO_PLATFORM rp2350-arm-s) + message("PICO_PLATFORM not defined, board is ${PICO_BOARD} setting PICO_PLATFORM to ${PICO_PLATFORM}") + endif() + else() + message("PICO_PLATFORM not defined, defaulting to 'rp2040'") + set(PICO_PLATFORM rp2040) + endif() +endif() + add_executable(picoboot src/picoboot.c src/pio.c @@ -32,7 +55,7 @@ pico_generate_pio_header(picoboot ) pico_set_program_name(picoboot "PicoBoot") -pico_set_program_description(picoboot "RP2040 based modchip for Nintendo GameCube") +pico_set_program_description(picoboot "RP2040/RP2350 based modchip for Nintendo GameCube") pico_set_program_version(picoboot ${GIT_REPO_VERSION}) pico_set_program_url(picoboot "https://github.com/webhdx/PicoBoot") diff --git a/src/version.h.in b/src/version.h.in index c4e94c9..4d270eb 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -1,3 +1,5 @@ #pragma once -#define PICOBOOT_VERSION "${GIT_REPO_VERSION}" \ No newline at end of file +#define PICOBOOT_VERSION "${GIT_REPO_VERSION}" +#define PICOBOOT_BOARD "${PICO_BOARD}" +#define PICOBOOT_PLATFORM "${PICO_PLATFORM}" \ No newline at end of file