"// pico_cmake_set" not seen in included header files. #2112
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#2112
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
If a board header file includes other header files, then CMake does not see any pico_cmake_set directives in the secondary header file.
This particularly affects the vgaboard.h header file, which includes pico.h. None of the pico settings are seen by CMake. This does not matter in this case as all the settings are default values anyway.
However, it is not possible to simply change pico.h to pico2.h for a VGA board with pico2 installed, as CMake will still think it is compiling for RP2040 rather than RP2350.
Interesting.
pico_cmake_set(andpico_cmake_set_default) is implemented in https://github.com/raspberrypi/pico-sdk/blob/develop/cmake/generic_board.cmake so I guess it might be a bit tricky to update it to also look at any#incluefiles?ping @will-v-pi to see if he has any ideas, as he recently tweaked this in #2034
FWIW, https://github.com/raspberrypi/pico-sdk/blob/develop/tools/check_board_header.py does look at
#incluefiles 😆We could add parsing for the
#includelines togeneric_board.cmake- for example create aPICO_BOARD_HEADER_FILESvariable and run the currentif (EXISTS ${PICO_BOARD_HEADER_FILE})on all of them in order?I think the search for
#includelines would need to be recursive though, since you might well have nested#includes?That's true - in which case maybe add the parsing into the
while(HEADER_FILE_CONTENTS)loop, and append toHEADER_FILE_CONTENTSwhen you see an include directive. This would also have the effect of processing thecmake_set_defaults from the included header after the new header, which I think is the preferred way round (so you can override them in the new header)?I guess appending to
HEADER_FILE_CONTENTS(rather than doing an "in-place insert") might theoretically cause a problem if you had something like:file1.hfile2.hI think you'd "expect"
VAR1=VAL1, VAR2=VAL4, VAR3=VAL3, VAR4=VAL6but if you only appended toHEADER_FILE_CONTENTSwhen encountering an#includethen you'd actually end up withVAR1=VAL1, VAR2=VAL4, VAR3=VAL5, VAR4=VAL6?But this may not actually be a problem, and doing a simple append-only approach might be "good enough" for the cases where
pico_cmake_setis actually used?That's very true (with the opposite expected for
cmake_set_default) - so it would be better to pre-pend the new file toHEADER_FILE_CONTENTS(the same as inserting in-place as we're popping from the front), which should be simple enough.I'll steal your regex from
check_board_header.pyand whip up a PRI have wondered whether BOARD could optionally be a list, rather than a single filename.
In that way, a pico2_w on a VGA board might be defined as:
That would save having to have multiple definitions for any of the boards which will accept any flavour of pico.
Ugh no. That might lead to people thinking that
BOARD=pico2,pico_wis the same thing asBOARD=pico2_w.I guess some concept of
CARRIER_BOARDmight be useful (see e.g. #696 and #837 ), but I guess that's a much bigger change.@Memotech-Bill Would you like to give #2113 a try please, and see if it behaves as you expect?
Yes, on a quick test it seems to work as expected.
vgaboard_cut_2w.h
Start of build process, confirming that RP2350 has been selected:
And confirmation that the resulting executable is for RP2350:
I will have to wait until the change reaches the master branch of the SDK before I can make use of it in my repositories. Otherwise anyone else attempting to build my code will fail to get the intended CMake configuration.
sort of collapsing replies to lots of things above:
This is a known issue (perhaps not well documented)... w.r.t. vgaboard (and others), we intend to make a PICO_CARRIER_BOARD (or CARRIED board) to cover those, which could have helped, but will think about recursion too... In this case probably a good idea
This should perhaps be PICO_ADDON_BOARDS, and should probably have the capability to be a list. Unlike the RPi, Pico addon boards do not have configuration EEPROMs, so it is straightforward to stack multiple addon boards.
I can't call them HATs as the usually go underneath the Pico, not on top.
We've hit this problem in MicroPython, trying to extend the definition of a pico-sdk provided board header (so, include the base header and add a few defines). The derived board header fails to pick up the
pico_cmake_set/etc directives in the base board header.At the moment the workaround we have is to copy the
pico_cmake_setdirectives manually to the derived board header. But that's pretty ugly.IMO it'd be much simpler to have a board defined at the cmake level, eg
pico.cmake, instead of at the C level and needing to duplicate config lines, eg for flash size with both a#defineandpico_cmake_set. And that cmake config file sets all the relevant values at the cmake level, with the build system then propagating those cmake variables into C defines viatarget_compile_definitions. That's a big change though...@will-v-pi What happened to #2113 ?
Looks like I accidentally closed it - re-opened as #2968
Fixed by #2968