diff --git a/.github/workflows/codeql-build.yml b/.github/workflows/codeql-build.yml index 5b641b56..69a424f7 100644 --- a/.github/workflows/codeql-build.yml +++ b/.github/workflows/codeql-build.yml @@ -7,7 +7,7 @@ on: jobs: codeql: name: Codeql - uses: nasa/cFS/.github/workflows/codeql-build.yml@main + uses: nasa/cFS/.github/workflows/codeql-reusable.yml@main with: - make-prep: 'make prep' - make: 'make psp-pc-linux && make native/default_cpu1/psp/unit-test-coverage/ && make native/default_cpu1/psp/ut-stubs/' \ No newline at end of file + component-path: psp + make: 'make -C build/native/default_cpu1/psp' diff --git a/README.md b/README.md index be4c50f4..35121843 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,14 @@ This is a collection of APIs abstracting platform specific functionality to be l ## Version History + +### Development Build: v1.6.0-rc4+34 + +- Update codeql workflow for reusable updates +- Add cpu affinity example +- Update RTEMS CMake Platform File +- See and + ### Development Build: v1.6.0-rc4+dev21 - Standardize version.h diff --git a/cmake/Modules/Platform/RTEMS.cmake b/cmake/Modules/Platform/RTEMS.cmake index b5b4b5e3..577adff3 100644 --- a/cmake/Modules/Platform/RTEMS.cmake +++ b/cmake/Modules/Platform/RTEMS.cmake @@ -24,21 +24,17 @@ set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") set(CMAKE_SHARED_MODULE_C_FLAGS "") set(CMAKE_SHARED_MODULE_CXX_FLAGS "") -# Set the CMAKE_EXE_EXPORTS_C_FLAG which is for executables -# using dynamic loading/linking -set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") - - # Include the system specs directly within the COMPILE_OBJECT definitions # This way it does not need to be done via CMAKE_C_FLAGS and it simplifies # the process in general. -set(RTEMS_SYS_SPECS_FLAGS "-B${RTEMS_TARGET_PATH}/${RTEMS_BSP}/lib -specs bsp_specs -qrtems") +# Note that the specs vary between RTEMS 5, RTEMS 6, and the Gaisler RCC version of RTEMS 5 +# These differences are accounted for in the toolchain file in the RTEMS_BSP_SPECS macro +set(RTEMS_SYS_SPECS_FLAGS "-B${RTEMS_TARGET_PATH}/${RTEMS_BSP}/lib ${RTEMS_BSP_SPECS_FLAGS} -qrtems") # Basic command templates for compiling C and C++ code set(CMAKE_C_COMPILE_OBJECT " ${RTEMS_SYS_SPECS_FLAGS} ${RTEMS_BSP_C_FLAGS} -o -c ") set(CMAKE_CXX_COMPILE_OBJECT " ${RTEMS_SYS_SPECS_FLAGS} ${RTEMS_BSP_CXX_FLAGS} -o -c ") - # This creates a simple relocatable object file, not a shared library set(CMAKE_SHARED_OBJECT_LINKER_FLAGS -r) set(CMAKE_C_CREATE_SHARED_MODULE " -o ${CMAKE_SHARED_OBJECT_LINKER_FLAGS} ") @@ -46,23 +42,36 @@ set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_MODULE}) set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_MODULE}) set(CMAKE_CXX_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_MODULE}) -# Additional link flags for entry point and relocation address -# RTEMS uses "Init" rather than "main" as its entry point -# This flag ensures that the Init symbol is not dropped at link time. -set(RTEMS_SYS_LINKFLAGS "-u Init") -if (RTEMS_RELOCADDR) - set(RTEMS_SYS_LINKFLAGS "${RTEMS_SYS_LINKFLAGS} -Wl,-Ttext,${RTEMS_RELOCADDR}") -endif (RTEMS_RELOCADDR) - -# The link procedure to support dynamic loading using the RTEMS dlopen() -# First create a "prelink" executable using a typical link procedure -# Then run "rtems-syms" and re-link the output into a final executable -set(CMAKE_C_LINK_EXECUTABLE - " ${RTEMS_SYS_SPECS_FLAGS} ${RTEMS_BSP_C_FLAGS} ${RTEMS_SYS_LINKFLAGS} -o -prelink " - "${RTEMS_TOOLS_PREFIX}/bin/rtems-syms -v -e -c ${RTEMS_BSP_C_FLAGS} -C -o -dl-sym.o -prelink" - " ${RTEMS_SYS_SPECS_FLAGS} ${RTEMS_BSP_C_FLAGS} ${RTEMS_SYS_LINKFLAGS} -o -dl-sym.o ") - -set(RTEMS_TARGET_PATH +# If RTEMS_DYNAMIC_LOAD is defined in the toolchain file, the executable will be a loadable object +# similar to vxWorks. This allows the system to be built, then loaded on an RTEMS runtime image using +# the RTEMS dynamic loader +# If RTEMS_DYNAMIC_LOAD is not defined, then a traditional linked executable will be created. +if(RTEMS_DYNAMIC_LOAD) + # Dynamic load is just a shared library + set(CMAKE_C_LINK_EXECUTABLE " -o ${CMAKE_SHARED_OBJECT_LINKER_FLAGS} ") +else() + # Set the CMAKE_EXE_EXPORTS_C_FLAG which is for executables + # using dynamic loading/linking + set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") + + # Additional link flags for entry point and relocation address + # RTEMS uses "Init" rather than "main" as its entry point + # This flag ensures that the Init symbol is not dropped at link time. + set(RTEMS_SYS_LINKFLAGS "-u Init") + if (RTEMS_RELOCADDR) + set(RTEMS_SYS_LINKFLAGS "${RTEMS_SYS_LINKFLAGS} -Wl,-Ttext,${RTEMS_RELOCADDR}") + endif (RTEMS_RELOCADDR) + + # The link procedure to support dynamic loading using the RTEMS dlopen() + # First create a "prelink" executable using a typical link procedure + # Then run "rtems-syms" and re-link the output into a final executable + set(CMAKE_C_LINK_EXECUTABLE + " ${RTEMS_SYS_SPECS_FLAGS} ${RTEMS_BSP_C_FLAGS} ${RTEMS_SYS_LINKFLAGS} -o -prelink " + "${RTEMS_TOOLS_PREFIX}/bin/rtems-syms -v -e -c ${RTEMS_BSP_C_FLAGS} -C -o -dl-sym.o -prelink" + " ${RTEMS_SYS_SPECS_FLAGS} ${RTEMS_BSP_C_FLAGS} ${RTEMS_SYS_LINKFLAGS} -o -dl-sym.o ") +endif(RTEMS_DYNAMIC_LOAD) + +SET(RTEMS_TARGET_PATH "${RTEMS_BSP_PREFIX}/${CMAKE_SYSTEM_PROCESSOR}-rtems${CMAKE_SYSTEM_VERSION}") set(RTEMS_TOOLS_PATH diff --git a/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index 8dbfaf48..e9066bac 100644 --- a/fsw/mcp750-vxworks/inc/psp_version.h +++ b/fsw/mcp750-vxworks/inc/psp_version.h @@ -27,7 +27,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 21 +#define CFE_PSP_IMPL_BUILD_NUMBER 34 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.6.0-rc4" /* diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index 8dbfaf48..e9066bac 100644 --- a/fsw/pc-linux/inc/psp_version.h +++ b/fsw/pc-linux/inc/psp_version.h @@ -27,7 +27,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 21 +#define CFE_PSP_IMPL_BUILD_NUMBER 34 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.6.0-rc4" /* diff --git a/fsw/pc-linux/src/cfe_psp_start.c b/fsw/pc-linux/src/cfe_psp_start.c index a7c906f3..10911460 100644 --- a/fsw/pc-linux/src/cfe_psp_start.c +++ b/fsw/pc-linux/src/cfe_psp_start.c @@ -151,7 +151,8 @@ static const struct option longOpts[] = {{"reset", required_argument, NULL, 'R'} */ int32 CFE_PSP_OS_EventHandler(OS_Event_t event, osal_id_t object_id, void *data) { - char taskname[OS_MAX_API_NAME]; + char taskname[OS_MAX_API_NAME]; + cpu_set_t cpuset; switch (event) { @@ -170,6 +171,21 @@ int32 CFE_PSP_OS_EventHandler(OS_Event_t event, osal_id_t object_id, void *data) /* Get the name from OSAL and propagate to the pthread/system layer */ if (OS_GetResourceName(object_id, taskname, sizeof(taskname)) == OS_SUCCESS) { + /* + * Example mechanism for setting thread affinity + * + * Could assign based on task name, pattern within name (CFE_* on 0, + * *_CN where N is desired core), round robin or whatever the requrements are. + * + * Just assigning all "CFE_*" tasks to core zero and let the rest float. + */ + if (strncmp(taskname, "CFE_", 4) == 0) + { + CPU_ZERO(&cpuset); + CPU_SET(0, &cpuset); + pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset); + } + /* * glibc/kernel has an internal limit for this name. * If the OSAL name is longer, just truncate it. diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index 8dbfaf48..e9066bac 100644 --- a/fsw/pc-rtems/inc/psp_version.h +++ b/fsw/pc-rtems/inc/psp_version.h @@ -27,7 +27,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 21 +#define CFE_PSP_IMPL_BUILD_NUMBER 34 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.6.0-rc4" /*