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

Cannot build fprime-zephyr reference project #3192

Open
ReggieMarr opened this issue Feb 10, 2025 · 0 comments
Open

Cannot build fprime-zephyr reference project #3192

ReggieMarr opened this issue Feb 10, 2025 · 0 comments
Labels

Comments

@ReggieMarr
Copy link

I was trying to follow along with the zephyr reference project so as to add support for more boards and I ran into this issue:

Alternatively when I adjust the cmakelists.txt like so

restrict_platforms(Zephyr)

add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Top/")
set(SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Stub.cpp")
set(MOD_DEPS ${FPRIME_CURRENT_MODULE}/Top)
register_fprime_deployment()

target_sources(app PRIVATE
    "${CMAKE_CURRENT_LIST_DIR}/Main.cpp"
)

target_link_libraries(LedBlinker_Top PUBLIC zephyr_interface)

add_dependencies(LedBlinker zephyr)
target_link_libraries(LedBlinker PUBLIC zephyr_interface)
target_link_libraries(LedBlinker PUBLIC zephyr)
set_target_properties(LedBlinker PROPERTIES
    ENABLE_EXPORTS ON
)

# Use Zephyr's link group mechanism
target_link_libraries(app PUBLIC
    LedBlinker_Top
    LedBlinker
)

set_target_properties(Svc_FatalHandler PROPERTIES EXCLUDE_FROM_ALL TRUE)

and build manually I encounter this error:

FAILED: bin/zephyr/LedBlinker 
: && ccache /home/user/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++  -gdwarf-4 LedBlinker/CMakeFiles/LedBlinker.dir/Stub.cpp.obj LedBlinker/CMakeFiles/LedBlinker.dir/__/fprime/Os/Stub/DefaultFile.cpp.obj LedBlinker/CMakeFiles/LedBlinker.dir/__/fprime-baremetal/fprime-baremetal/Os/Baremetal/DefaultCpu.cpp.obj LedBlinker/CMakeFiles/LedBlinker.dir/__/fprime-baremetal/fprime-baremetal/Os/Baremetal/DefaultMemory.cpp.obj LedBlinker/CMakeFiles/LedBlinker.dir/__/fprime-zephyr/Zephyr/Os/DefaultQueue.cpp.obj LedBlinker/CMakeFiles/LedBlinker.dir/__/fprime-zephyr/Zephyr/Os/DefaultMutex.cpp.obj LedBlinker/CMakeFiles/LedBlinker.dir/__/fprime-zephyr/Zephyr/Os/DefaultTask.cpp.obj LedBlinker/CMakeFiles/LedBlinker.dir/__/fprime-zephyr/Zephyr/Os/DefaultConsole.cpp.obj LedBlinker/CMakeFiles/LedBlinker.dir/__/fprime-zephyr/Zephyr/Os/DefaultRawTime.cpp.obj -o bin/zephyr/LedBlinker  lib/zephyr/libconfig.a  lib/zephyr/libFw_Cfg.a  lib/zephyr/libFw_Types.a  lib/zephyr/libFw_Logger.a  lib/zephyr/libFw_Obj.a  lib/zephyr/libFw_Port.a  lib/zephyr/libFw_Time.a  lib/zephyr/libFw_Comp.a  lib/zephyr/libZephyr_Svc_ZephyrTime.a  lib/zephyr/libFw_Com.a  lib/zephyr/libFw_Tlm.a  lib/zephyr/libFw_Log.a  lib/zephyr/libFw_Cmd.a  lib/zephyr/libFw_Prm.a  lib/zephyr/libFw_Buffer.a  lib/zephyr/libDrv_Ports.a  lib/zephyr/libSvc_Sched.a  lib/zephyr/libComponents_Led.a  lib/zephyr/libSvc_Fatal.a  lib/zephyr/libfprime-baremetal_Svc_FatalHandler.a  lib/zephyr/libZephyr_Drv_ZephyrGpioDriver.a  lib/zephyr/libOs.a  lib/zephyr/libSvc_Cycle.a  lib/zephyr/libZephyr_Drv_ZephyrRateDriver.a  lib/zephyr/libDrv_ByteStreamDriverModel.a  lib/zephyr/libZephyr_Drv_ZephyrUartDriver.a  lib/zephyr/libSvc_Ping.a  lib/zephyr/libFw_CompQueued.a  lib/zephyr/libSvc_ActiveLogger.a  lib/zephyr/libSvc_AssertFatalAdapter.a  lib/zephyr/libSvc_CmdDispatcher.a  lib/zephyr/libUtils_Hash.a  lib/zephyr/libUtils_Types.a  lib/zephyr/libSvc_FramingProtocol.a  lib/zephyr/libSvc_Deframer.a  lib/zephyr/libFw_Ports_SuccessCondition.a  lib/zephyr/libSvc_Framer.a  lib/zephyr/libSvc_PassiveConsoleTextLogger.a  lib/zephyr/libSvc_PassiveRateGroup.a  lib/zephyr/libSvc_RateGroupDriver.a  lib/zephyr/libSvc_StaticMemory.a  lib/zephyr/libSvc_SystemResources.a  lib/zephyr/libSvc_TlmChan.a  lib/zephyr/libLedBlinker_Top.a  lib/zephyr/libOs_File_Stub.a  lib/zephyr/libOs_Cpu_Baremetal.a  lib/zephyr/libOs_Memory_Baremetal.a  lib/zephyr/libOs_Queue_Zephyr.a  lib/zephyr/libOs_Mutex_Zephyr.a  lib/zephyr/libOs_Task_Zephyr.a  lib/zephyr/libOs_Console_Zephyr.a  lib/zephyr/libOs_RawTime_Zephyr.a  zephyr/libzephyr.a  lib/zephyr/libZephyr_Svc_ZephyrTime.a  lib/zephyr/libComponents_Led.a  lib/zephyr/libfprime-baremetal_Svc_FatalHandler.a  lib/zephyr/libZephyr_Drv_ZephyrGpioDriver.a  lib/zephyr/libZephyr_Drv_ZephyrRateDriver.a  lib/zephyr/libDrv_Ports.a  lib/zephyr/libZephyr_Drv_ZephyrUartDriver.a  lib/zephyr/libSvc_ActiveLogger.a  lib/zephyr/libSvc_Fatal.a  lib/zephyr/libSvc_AssertFatalAdapter.a  lib/zephyr/libSvc_CmdDispatcher.a  lib/zephyr/libSvc_Deframer.a  lib/zephyr/libSvc_Framer.a  lib/zephyr/libDrv_ByteStreamDriverModel.a  lib/zephyr/libSvc_FramingProtocol.a  lib/zephyr/libUtils_Types.a  lib/zephyr/libFw_Ports_SuccessCondition.a  lib/zephyr/libSvc_PassiveConsoleTextLogger.a  lib/zephyr/libSvc_PassiveRateGroup.a  lib/zephyr/libSvc_RateGroupDriver.a  lib/zephyr/libSvc_Cycle.a  lib/zephyr/libSvc_StaticMemory.a  lib/zephyr/libSvc_SystemResources.a  lib/zephyr/libSvc_TlmChan.a  lib/zephyr/libSvc_Sched.a  lib/zephyr/libSvc_Ping.a  lib/zephyr/libFw_CompQueued.a  lib/zephyr/libFw_Comp.a  lib/zephyr/libOs.a  lib/zephyr/libOs_File_Common.a  lib/zephyr/libUtils_Hash.a  lib/zephyr/libOs_Cpu_Common.a  lib/zephyr/libOs_Memory_Common.a  lib/zephyr/libOs_Queue_Common.a  lib/zephyr/libOs_Mutex_Common.a  lib/zephyr/libOs_Task_Common.a  lib/zephyr/libOs_Console_Common.a  lib/zephyr/libOs_RawTime_Common.a  lib/zephyr/libFw_Buffer.a  lib/zephyr/libFw_Prm.a  lib/zephyr/libFw_Cmd.a  lib/zephyr/libFw_Log.a  lib/zephyr/libFw_Tlm.a  lib/zephyr/libFw_Com.a  lib/zephyr/libFw_Time.a  lib/zephyr/libFw_Port.a  lib/zephyr/libFw_Obj.a  lib/zephyr/libFw_Logger.a  lib/zephyr/libFw_Types.a  lib/zephyr/libFw_Cfg.a  lib/zephyr/libconfig.a  zephyr/kernel/libkernel.a  lib/zephyr/libOs_Zephyr_Shared.a  -mcpu=cortex-m7  -mthumb  -mabi=aapcs  -mfpu=fpv5-d16  -mfloat-abi=hard  -mfp16-format=ieee  -fuse-ld=bfd  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--no-relax  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie  -L"/home/user/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi"/lib/thumb/v7e-m+dp/hard && cd /fprime-zephyr-reference/build/LedBlinker && /usr/bin/cmake -DCMAKE_INSTALL_COMPONENT=LedBlinker -P /fprime-zephyr-reference/build/cmake_install.cmake
/home/user/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: warning: cannot find entry symbol _start; defaulting to 0000000000008000
/home/user/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: lib/zephyr/libOs_Task_Common.a(Task.cpp.obj): in function `_GLOBAL__sub_I__ZN2Os13TaskInterface9ArgumentsC2ERKN2Fw10StringBaseEPFvPvES6_jjjj':
/fprime-zephyr-reference/fprime/Os/Task.cpp:54: undefined reference to `Os::Mutex::Mutex()'
/home/user/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: lib/zephyr/libOs_Task_Common.a(Task.cpp.obj): in function `__static_initialization_and_destruction_0':
/fprime-zephyr-reference/fprime/Os/Task.cpp:54: undefined reference to `__dso_handle'
/home/user/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /fprime-zephyr-reference/fprime/Os/Task.cpp:54: undefined reference to `Os::Mutex::~Mutex()'
/home/user/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /fprime-zephyr-reference/fprime/Os/Task.cpp:54: undefined reference to `__aeabi_atexit'
/home/user/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: bin/zephyr/LedBlinker: hidden symbol `__dso_handle' isn't defined
/home/user/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: final link failed: bad value

It seems as though the executable must be the zephyr executable and then use the fprime build as a library.

I looked a bit into the "How-To: Develop an F´ Library" but it doesn't really seem applicable for this case where we want to expose the deployment as a library.

If there's any other suggestions here I'd appreciate it.

@ReggieMarr ReggieMarr added the bug label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant