Skip to content

Document "pico_generate_pio_header" parameters usable in CMake. #2155

Open
@VBHunt

Description

@VBHunt

There are only usage examples for pico_generate_pio_header. and it is unclear the semantic circumstances that are required to use the various parameters. For example the pio/ws2812/CMakeLists.txt shows, in part, the following:

add_executable(pio_ws2812)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/generated)
# generate the header file into the source tree as it is included in the RP2040 datasheet
pico_generate_pio_header(pio_ws2812 ${CMAKE_CURRENT_LIST_DIR}/ws2812.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/generated)
target_sources(pio_ws2812 PRIVATE ws2812.c)
target_link_libraries(pio_ws2812 PRIVATE pico_stdlib hardware_pio)
pico_add_extra_outputs(pio_ws2812)

Yet a similar identical in structure CMakeLists.txt file fails:

set(FTCHIP FT245)
#set(FTCHIP FT232H)

set(PIOFILE ${PROJECT}_${FTCHIP}.pio)

file(MAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/generated)

# Generate PIO header
pico_generate_pio_header(${PROJECT}
${CMAKE_CURRENT_LIST_DIR}/${PIOFILE}
OUTPUT_DIR
${CMAKE_CURRENT_LIST_DIR}/generated
)

[cmake] CMake Error at /home/vbh/.pico-sdk/sdk/2.1.0/tools/CMakeLists.txt:182 (add_custom_target):
[cmake] add_custom_target called with invalid target name
[cmake] "/home/vbh/PicoProjects/vtpusb/picoSrc/sft/vtpRead/_FT245.pio_OUTPUT_DIR_pio_h".
[cmake] Target names may not contain a slash. Use ADD_CUSTOM_COMMAND to generate
[cmake] files.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:44 (pico_generate_pio_header)

Note that "OUTPUT_DIR" is apparently used to place the generated .h file in a directory in the 2812 case while in the latter case it is appended to the 2nd parameter of pico_generate_pio_header() along with _pio.h
Since there is no documentation defining the acceptable parameters and their ranges, it is difficult to understand without forensic programming what the circumstances are for the use of "OUTPUT_DIR" or any other parameters that may not have examples.

In summary, the CMake functions used to access features of the PICO family may need to be fully documented as to semantic function together with parameters and their ranges so as to minimize both developer effort and support requests.
vtpRead.zip

Enclosed are the following files: vtpRead.c, vtpRead_FT245.pio, vtpRead_FT232H.pio, include/vtpRead.h and CMakeLists.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions