Assembling compile_time_choice.S does not respect PICO_BOARD_HEADER_DIRS #2114
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#2114
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?
A board header file may include another (secondary) header file.
Providing the secondary header file is in pico-sdk/src/boards/include, then everything works.
However if the secondary header file is in a user defined folder, which is specified in PICO_BOARD_HEADER_DIRS, then the compilation of compile_time_choice.S fails:
My user defined directory:
config_autogen.h
@will-v-pi Would a similar thing also affect #2113 ?
I don't think so. If it did I would have obtained a failure in CMake before getting to compiling compile_time_choice.S.
I assumed that you weren't testing #2113 with custom header files in a user-defined
PICO_BOARD_HEADER_DIRSlocation? 🤷Perhaps I should have made the question in my previous comment more explicit: if there's an
#includeof a custom header file in a user-definedPICO_BOARD_HEADER_DIRSlocation, and that custom header file contains// pico_cmake_setdeclaations, will those declarations get included or ignored by the code in #2113 ?For my first test, the primary board header file was in a user defined location, but the secondary board header file was pico2_w.h in the standard location. That all worked, hence my report of success.
I then went on to do a test with both primary and secondary board header files in a user defined location. I could see from the CMake output that this had correctly picked up the pico_cmake_set declarations from the secondary header file but then failed on compiling compile_time_choice.
They will still be included by #2113 - it searches all of
PICO_BOARD_HEADER_DIRSin the same way that the SDK currently does when searching for included board files.I think you should just use
#include "pico2+w.h"Interesting.
I had used the
boards/prefix because the stock vgaboard.h file has:A quick test suggests that omitting the
boards/prefix works whether the nested include file is in either the SDK default folder or the user defined one.My test is not definitive because I have re-arranged my code to avoid the need of having nested includes, and quickly hacking one back in results in a compilation failure for other causes. But I don't get any "No such file or directory" errors for the nested include file.
My test was too quick. If the nested include file is in the SDK default directory, then you do have to prefix the file name by the
boards/path, whereas if in the user defined folder, the prefix should be omitted.It would be nice if the behaviour was consistent between the two locations.
IMHO that makes sense.
Do you get the consistency you're after if you create a
boardsdirectory inside your user-defined folder?No, because cmake does not look in $(PICO_BOARD_HEADER_DIRS)/boards
My CMakeLists.txt file contains the line:
And the files are located at:
The way to make the custom board files consistent with the SDK, without breaking any existing builds would be:
$(PICO_BOARD_HEADER_DIRS)/include/boardsand then$(PICO_BOARD_HEADER_DIRS)for board header files.$(PICO_BOARD_HEADER_DIRS)/includeand$(PICO_BOARD_HEADER_DIRS).If you don't mind me asking, why is this "consistency" so important to you? Perhaps the different include-styles of:
makes it more obvious that
pico.his getting included from the SDK, butpico2+w.his getting included from your user-defined directory? 🤷♂I suppose just because I got bitten by it not being obvious that I needed to use the different style when including files from my user defined directory.
If it was not obvious to me, how many others will encounter the same issue?
But on further thought, my proposal of having
boards/include/boards, while being consistent, is not obvious either.The hack that would probably work for most people who make the same mistake as I did would be to have
$(PICO_BOARD_HEADER_DIRS)/..as an include folder.