Linking OS and BSP implementation files into BSP and PSP #769
Unanswered
spaceusername
asked this question in
Q&A
Replies: 1 comment
-
My apologies on the formatting of the file tree that I wrote |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a continuation off of the original thread located at this link:
How to link OS and BSP implementation
In my previous question I had received several great responses detailing the locations within the cmakelists where I should link the libraries.
I've been working on getting the linking correct on and off since then and have now reached a point where I need to clarify a few things.
For a little background on my current setup:
I have structured the directories as such
cFS Root
-- cfe
-- osal
--- inc
--- src
---- bsp
------ generic-linux
------ generic-myrtos
---- external-dependencies
------ my_bsp_source
------ fs_impl_lib
------ os_kernel_impl_lib
------ os_network_impl_lib
---- os
------ posix
------ myrtos
------ inc
------ portable
------ shared
-- psp
---- fsw
------ pc-linux
------ generic-myrtos
I'm running into a few issues which I have not been able to figure out.
Foremost is that files in the src/bsp and psp/fsw directories which are associated with the osal and psp-targetname libraries are not able to see the header files from the os_kernel_impl_lib when including.
I have setup my *_lib directories with appropriate CMakelists
The content of these generally follows the pattern of:
add_library(libname STATIC)
add_subdirectory(include)
add_subdirectory(portable)
target_sources(libname PRIVATE
source1.c
source2.c
source3.c
)
target_link_libraries(libname
PUBLIC
libname_include
libname_port_headers
PRIVATE
libname_port
)
A similar format is followed for my filesystem and network implementation
At this juncture I'm confused as to where to link it. I suspect that I need some clarification of the link location as well as on include paths. It is my understanding that target_include_directories should be sufficient within the target cmakelist and I should not need to re-add include directories anywhere else provided that I use target_link_libraries correctly.
I have attempted to link the os library in several locations, none of which I have success with. First, I tried linking it in at the BSP, as was suggested before, in the generic-myrtos cmakelist. After not having success with that, I then attempted to link it with the top level osal cmakelist and later the psp cmakelist.
Linking was performed using:
target_link_libraries(osal_public_api INTERFACE libname)
for the kernel. I have attempt this link with PUBLIC scoping as well
I also attempted to link in the source bsp files using:
target_link_libraries(osal_generic-myrtos_impl PRIVATE bsp_src)
where bsp_src is a library target containing bsp source files and headers for my processor
It is my understanding that I should be able to use includes of the form:
#include "headername.h"
I did read that perhaps I needed to include in the form:
#include "lib_name/path/to/header.h"
but this didn't work either
Please let me know if this isn't correct.
At a high level what I'm looking for answers to:
Am I placing my external source code in an ok place directory-wise?
Am I linking the libraries to the greater cFS build correctly?
Is there something that I am missing when it comes to the format of the include paths?
Where should bsp source files for low level interaction be linked in?
Beta Was this translation helpful? Give feedback.
All reactions