rp2: Add temporary workaround for GCC 15.1 build failure.

This is a workaround for this upstream issue:
https://github.com/raspberrypi/pico-sdk/issues/2448

Can be removed after the next pico-sdk update.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
Angus Gratton
2025-05-09 14:01:48 +10:00
committed by Angus Gratton
parent d01a981a9b
commit 3fa77bdc7d
2 changed files with 61 additions and 0 deletions

View File

@@ -84,6 +84,9 @@ endif()
list(APPEND GIT_SUBMODULES lib/mbedtls)
list(APPEND GIT_SUBMODULES lib/tinyusb)
# Workaround for pico-sdk host toolchain issue, see directory for details
list(APPEND CMAKE_MODULE_PATH "${MICROPY_PORT_DIR}/tools_patch")
# Include component cmake fragments
include(${MICROPY_DIR}/py/py.cmake)
include(${MICROPY_DIR}/extmod/extmod.cmake)

View File

@@ -0,0 +1,58 @@
# Finds (or builds) the pioasm executable
#
# This will define the following imported targets
#
# pioasm
#
# This is a temporary patched copy of pico-sdk file Findpioasm.cmake to work around
# a host toolchain issue with GCC 15.1:
# https://github.com/raspberrypi/pico-sdk/issues/2448
if (NOT TARGET pioasm)
# todo we would like to use pckgconfig to look for it first
# see https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
include(ExternalProject)
set(PIOASM_SOURCE_DIR ${PICO_SDK_PATH}/tools/pioasm)
set(PIOASM_BINARY_DIR ${CMAKE_BINARY_DIR}/pioasm)
set(PIOASM_INSTALL_DIR ${CMAKE_BINARY_DIR}/pioasm-install CACHE PATH "Directory where pioasm has been installed" FORCE)
set(pioasmBuild_TARGET pioasmBuild)
set(pioasm_TARGET pioasm)
if (NOT TARGET ${pioasmBuild_TARGET})
pico_message_debug("PIOASM will need to be built")
# message("Adding external project ${pioasmBuild_Target} in ${CMAKE_CURRENT_LIST_DIR}}")
ExternalProject_Add(${pioasmBuild_TARGET}
PREFIX pioasm
SOURCE_DIR ${PIOASM_SOURCE_DIR}
BINARY_DIR ${PIOASM_BINARY_DIR}
INSTALL_DIR ${PIOASM_INSTALL_DIR}
CMAKE_ARGS
"--no-warn-unused-cli"
"-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}"
"-DPIOASM_FLAT_INSTALL=1"
"-DCMAKE_INSTALL_PREFIX=${PIOASM_INSTALL_DIR}"
"-DCMAKE_RULE_MESSAGES=OFF" # quieten the build
"-DCMAKE_INSTALL_MESSAGE=NEVER" # quieten the install
# Toolchain workaround follows
"-DCMAKE_CXX_FLAGS=-include cstdint"
CMAKE_CACHE_ARGS "-DPIOASM_EXTRA_SOURCE_FILES:STRING=${PIOASM_EXTRA_SOURCE_FILES}"
BUILD_ALWAYS 1 # force dependency checking
EXCLUDE_FROM_ALL TRUE
)
endif()
if (CMAKE_HOST_WIN32)
set(pioasm_EXECUTABLE ${PIOASM_INSTALL_DIR}/pioasm/pioasm.exe)
else()
set(pioasm_EXECUTABLE ${PIOASM_INSTALL_DIR}/pioasm/pioasm)
endif()
add_executable(${pioasm_TARGET} IMPORTED GLOBAL)
set_property(TARGET ${pioasm_TARGET} PROPERTY IMPORTED_LOCATION
${pioasm_EXECUTABLE})
add_dependencies(${pioasm_TARGET} ${pioasmBuild_TARGET})
endif()