pico: add 2350 device id
diff --git a/32blit-pico/CMakeLists.txt b/32blit-pico/CMakeLists.txt index 3c6ab0f..f0675c4 100644 --- a/32blit-pico/CMakeLists.txt +++ b/32blit-pico/CMakeLists.txt
@@ -8,6 +8,11 @@ set(32BLIT_PICO 1 PARENT_SCOPE) +if(PICO_PLATFORM MATCHES "^rp2350") + set(32BLIT_PICO_2350 1) + set(32BLIT_PICO_2350 ${32BLIT_PICO_2350} PARENT_SCOPE) +endif() + # prevent find_package errors in pico_add_uf2_output later set(PICO_SDK_VERSION_MAJOR ${PICO_SDK_VERSION_MAJOR} PARENT_SCOPE) set(PICO_SDK_VERSION_MINOR ${PICO_SDK_VERSION_MINOR} PARENT_SCOPE) @@ -179,7 +184,7 @@ set(BLIT_BOARD_DEFINITIONS ${BLIT_BOARD_DEFINITIONS} PARENT_SCOPE) # some file paths we need later -if(PICO_PLATFORM MATCHES "^rp2350") +if(32BLIT_PICO_2350) set(LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/memmap_blit_2350.ld.in PARENT_SCOPE) else() set(LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/memmap_blit.ld.in PARENT_SCOPE) @@ -236,7 +241,13 @@ target_compile_definitions(${NAME} PRIVATE ${BLIT_BOARD_DEFINITIONS}) # need these for framebuffer config target_compile_options(${NAME} PRIVATE -ffunction-sections -fdata-sections) - set_source_files_properties(${STARTUP_SRC} PROPERTIES COMPILE_DEFINITIONS DEVICE_ID=2) + + # set device id in header, these should match the BlitDevice enum + if(32BLIT_PICO_2350) + set_source_files_properties(${STARTUP_SRC} PROPERTIES COMPILE_DEFINITIONS DEVICE_ID=3) + else() + set_source_files_properties(${STARTUP_SRC} PROPERTIES COMPILE_DEFINITIONS DEVICE_ID=2) + endif() # minimal pico-sdk libs target_link_libraries(${NAME} boot_picobin_headers pico_bit_ops pico_clib_interface pico_cxx_options pico_divider pico_double pico_int64_ops pico_float pico_malloc pico_mem_ops pico_runtime_headers)
diff --git a/32blit-pico/blit-launch.cpp b/32blit-pico/blit-launch.cpp index e2a7537..27f4a15 100644 --- a/32blit-pico/blit-launch.cpp +++ b/32blit-pico/blit-launch.cpp
@@ -11,6 +11,12 @@ #include "engine/engine.hpp" #include "engine/file.hpp" +#ifdef PICO_RP2350 +#define DEVICE_ID BlitDevice::RP2350 +#else +#define DEVICE_ID BlitDevice::RP2040 +#endif + // code related to blit files and launching extern int (*do_tick)(uint32_t time); @@ -87,7 +93,7 @@ auto header = (BlitGameHeader *)(XIP_NOCACHE_NOALLOC_BASE + flash_offset); // check header magic + device - if(header->magic != blit_game_magic || header->device_id != BlitDevice::RP2040) + if(header->magic != blit_game_magic || header->device_id != DEVICE_ID) return false; if(!header->init || !header->render || !header->tick) @@ -120,7 +126,7 @@ auto bytes_read = read_file(file, 0, sizeof(header), (char *)&header); - if(bytes_read == sizeof(header) && header.magic == blit_game_magic && header.device_id == BlitDevice::RP2040) { + if(bytes_read == sizeof(header) && header.magic == blit_game_magic && header.device_id == DEVICE_ID) { close_file(file); return blit::CanLaunchResult::Success; } @@ -159,7 +165,7 @@ auto header = (BlitGameHeader *)(XIP_NOCACHE_NOALLOC_BASE + offset); // check header magic + device - if(header->magic != blit_game_magic || header->device_id != BlitDevice::RP2040) + if(header->magic != blit_game_magic || header->device_id != DEVICE_ID) return 0; auto size = header->end; @@ -270,7 +276,7 @@ bool BlitWriter::prepare_write(const uint8_t *buf) { auto header = (BlitGameHeader *)buf; - if(header->magic != blit_game_magic || header->device_id != BlitDevice::RP2040) { + if(header->magic != blit_game_magic || header->device_id != DEVICE_ID) { blit::debugf("Invalid blit header!"); return false; }
diff --git a/launcher-shared/executable.hpp b/launcher-shared/executable.hpp index f34cd54..428b575 100644 --- a/launcher-shared/executable.hpp +++ b/launcher-shared/executable.hpp
@@ -17,6 +17,7 @@ STM32H7_32BlitOld = 0, // 32blit hw, old header STM32H7_32Blit = 1, // 32blit hw RP2040 = 2, // any RP2040-based device + RP2350 = 3, }; // should match the layout in startup_user.s