Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing headers leading to #include failing when pulling in hardware_irq and pico_bootrom #1956

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

aabizri
Copy link

@aabizri aabizri commented Sep 26, 2024

As suggested by @kilograham (in #1929 (comment)), add pico_runtime_init as well as pico_runtime and boot_picobin_headers to the CMakeLists.txts defining hardware_irq and pico_bootrom_headers.

While the issue initially was reported only for hardware_irq missing pico_runtime_init, the same issue affect the other mentionned.

Fixes #1929

@aabizri aabizri changed the title Fix missing headers when including hardware_irq and pico_bootrom Fix missing headers leading to #include failing when pulling in hardware_irq and pico_bootrom Oct 7, 2024
Replace `pico_runtime_init` by `pico_runtime_init_headers`

From discussion on PR raspberrypi#1956 (raspberrypi#1956 (comment))
@kilograham kilograham added this to the 2.0.1 milestone Nov 4, 2024
@jaymin1328
Copy link

/usr/lib/gcc/arm-none-eabi/12.2.1/../../../arm-none-eabi/bin/ld: cannot find -lboot_bootrom_headers: No such file or directory

I used your changes and could remove error in compilation but at the time of linking I had the same error

@aabizri
Copy link
Author

aabizri commented Nov 7, 2024

I'm not able to reproduce the linking error. boot_bootrom_headers should not even be involved in linking as it's an INTERFACE library.

This looks like the CMake definition of boot_bootrom_headers is not being reached, which should not happen as rp2_common.cmake adds the relevant subdirectory in the same way as any other required for building.

Are you (@jaymin1328) calling pico_sdk_init as required ? Did you clear the CMake cache/build directory since the upgrade to 2.0.0 ? Do you have a code reproduction to share ?

@peterharperuk
Copy link
Contributor

cannot find -lboot_bootrom_headers: No such file or directory

You'll get this if the sdk doesn't know about boot_bootrom_headers, which would indicate you're not using the latest sdk.

@jaymin1328
Copy link

jaymin1328 commented Nov 7, 2024

cannot find -lboot_bootrom_headers: No such file or directory

You'll get this if the sdk doesn't know about boot_bootrom_headers, which would indicate you're not using the latest sdk.

@peterharperuk I am using SDK git tag 2.0.0 , look the output of git log command

commit 2f1d186769a7f070cd2b193d580827c8d75e3e11 (HEAD, master)
Author: jaymin patel <[email protected]>
Date:   Tue Nov 5 14:50:51 2024 +0000

    added fixes to work with 2.0.0 from internet didn't working

commit efe2103f9b28458a1615ff096054479743ade236 (tag: 2.0.0, origin/master, origin/HEAD)
Author: graham sanderson <[email protected]>
Date:   Thu Aug 8 06:02:04 2024 -0500

    SDK 2.0.0 release

commit 45984e276f85aa24d33aa0ab62ed1e6df96a0784

@peterharperuk
Copy link
Contributor

Have you deleted your build folder?

@jaymin1328
Copy link

Have you deleted your build folder?

Yes!

What I did was setup a RaspberryPi5 with pico_setup.sh and git clone my code and trying to compile

@aabizri This is my cmakelist.txt

cmake_minimum_required(VERSION 3.15)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(PICO_BOARD pico)
set(CMAKE_BUILD_TYPE Debug)
# Set the Pico SDK path if not already set
# set(PICO_SDK_PATH "/path/to/pico-sdk")

# Pull in Raspberry Pi Pico SDK (must be before project)
include($ENV{PICO_SDK_PATH}/pico_sdk_init.cmake)

# # Project node -----------------------------------------------------------------------------------------
# set(PROJECT_NODE node)
# project(${PROJECT_NODE} C CXX ASM)
# pico_sdk_init()

# # Include subdirectories for the node project
# add_subdirectory(sensors/SCD41)
# add_subdirectory(sensors/AS7331)
# add_subdirectory(sensors/BME688)
# add_subdirectory(sensors/ICS43434)
# add_subdirectory(sensors/ONEWIRE)
# add_subdirectory(sensors/dht)
# add_subdirectory(sensors/VEML7700)
# add_subdirectory(sensors/STHS34)
# add_subdirectory(sensors/SENSIRION)
# add_subdirectory(sensors/multiSensor)
# add_subdirectory(CAN)
# add_subdirectory(SEREEPROM)
# add_subdirectory(CMD)
# add_subdirectory(FS)
# add_subdirectory(FS/littlefs-lib)
# add_subdirectory(FS/stdinit-lib)
# add_subdirectory(WIZNET)
# add_subdirectory(SEGGER)
# add_subdirectory(MQTT_LWIP)

# add_executable(${PROJECT_NODE} main_node.cpp)

# target_include_directories(${PROJECT_NODE} PRIVATE ${CMAKE_CURRENT_LIST_DIR})

# pico_set_program_name(${PROJECT_NODE} "${PROJECT_NODE}")
# pico_set_program_version(${PROJECT_NODE} "0.1")

# pico_enable_stdio_uart(${PROJECT_NODE} 0)
# pico_enable_stdio_usb(${PROJECT_NODE} 1)

# target_link_libraries(${PROJECT_NODE} PRIVATE
# pico_stdlib
# # pico_runtime_init
# # pico_runtime_init_headers
# # pico_runtime
# # boot_picoboot_headers
# # boot_bootrom_headers
# # boot_picobin_headers
# # pico_runtime_init_headers
# hardware_rtc
# hardware_i2c
# hardware_spi
# segger
# SCD41
# AS7331
# BME680
# VEML7700
# STHS34
# MIC
# pico_one_wire
# CAN
# EEPROM
# CMD
# littlefs-lib
# stdinit-lib
# FS
# SENSIRION
# BME680
# multiSensor
# )

# pico_add_extra_outputs(${PROJECT_NODE})

# Project gateway --------------------------------------------------------------------------------------
set(PROJECT_GATEWAY gateway)
project(${PROJECT_GATEWAY} C CXX ASM)
pico_sdk_init()

set(CMAKE_C_FLAGS_DEBUG "-Og -g")      # Debugging info with some optimization
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")    # C++ Debug flags

# Include subdirectories for the node project
add_subdirectory(sensors/SCD41)
add_subdirectory(sensors/AS7331)
add_subdirectory(sensors/BME688)
add_subdirectory(sensors/ICS43434)
add_subdirectory(sensors/ONEWIRE)
add_subdirectory(sensors/dht)
add_subdirectory(sensors/VEML7700)
add_subdirectory(sensors/STHS34)
add_subdirectory(sensors/multiSensor)
add_subdirectory(CAN)
add_subdirectory(SEREEPROM)
add_subdirectory(CMD)
add_subdirectory(FS)
add_subdirectory(FS/littlefs-lib)
add_subdirectory(FS/stdinit-lib)
add_subdirectory(WIZNET)
add_subdirectory(SEGGER)
add_subdirectory(MQTT_LWIP)

add_executable(${PROJECT_GATEWAY} main_gw.cpp)

target_include_directories(${PROJECT_GATEWAY} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

pico_set_program_name(${PROJECT_GATEWAY} "${PROJECT_GATEWAY}")
pico_set_program_version(${PROJECT_GATEWAY} "0.1")

pico_enable_stdio_uart(${PROJECT_GATEWAY} 0)
pico_enable_stdio_usb(${PROJECT_GATEWAY} 1)

target_link_libraries(${PROJECT_GATEWAY} PRIVATE
        pico_stdlib
        #pico_runtime_init
        hardware_spi
        hardware_i2c
        hardware_dma
        hardware_adc
        hardware_pio
        hardware_clocks
        pico_multicore
        CMD
        CAN
        segger
        STHS34
        AS7331
        EEPROM
        FS
        littlefs-lib
        stdinit-lib
        MIC
        dht
        TEGMQTT
        BME680
        VEML7700
        multiSensor
)

pico_add_extra_outputs(${PROJECT_GATEWAY})

@jaymin1328
Copy link

I'm not able to reproduce the linking error. boot_bootrom_headers should not even be involved in linking as it's an INTERFACE library.

This looks like the CMake definition of boot_bootrom_headers is not being reached, which should not happen as rp2_common.cmake adds the relevant subdirectory in the same way as any other required for building.

Are you (@jaymin1328) calling pico_sdk_init as required ? Did you clear the CMake cache/build directory since the upgrade to 2.0.0 ? Do you have a code reproduction to share ?

@aabizri Here is the full code . I am trying to build BOTH folder
BOTH.zip

@peterharperuk
Copy link
Contributor

@jaymin1328 Make sure you have these two commits (the fix for this defect) in pico-sdk. Your code builds for me.

bc8ded18 (HEAD -> fix-missing-interface-links) Adjust targets being included
49a2a01c Fix compilation issues when including in hardware_irq and pico_bootrom (#1929)

@jaymin1328
Copy link

jaymin1328 commented Nov 7, 2024

@jaymin1328 Make sure you have these two commits (the fix for this defect) in pico-sdk. Your code builds for me.

bc8ded18 (HEAD -> fix-missing-interface-links) Adjust targets being included 49a2a01c Fix compilation issues when including in hardware_irq and pico_bootrom (#1929)

Thanks a lot for the help @peterharperuk !
However, I could not see the commits in my local repo

j@raspberrypi:~/pico/pico-sdk $ git log --format="%h" | grep bc8ded18
j@raspberrypi:~/pico/pico-sdk $ git log --format="%h" | grep 49a2a01c

can you send me the links of the commits like this one ?
https://github.com/raspberrypi/pico-sdk/pull/1956/commits/29b1fa99382cd512021f3773fcf2a97a85efd226

@peterharperuk
Copy link
Contributor

The changes are in this PR - see the commit tab...

29b1fa9
56efb28

@jaymin1328
Copy link

jaymin1328 commented Nov 8, 2024

The changes are in this PR - see the commit tab...

29b1fa9 56efb28

Error still persists ... @peterharperuk
After incorporating changes mentioned in 56efb28
CMakeOutput.log
make.log

After incorporating changes mentioned in 29b1fa9
CMakeOutput.log
make.log

Also you mentioned first bc8ded18 and 49a2a01c
and now you mentioned second time 29b1fa99 and 56efb281

Are they both same things or am I seeing things wrongly ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants