nasa / CF

The Core Flight System (cFS) CFDP application.
Apache License 2.0
86 stars 46 forks source link

`cf_tbldefs.h` in platform_inc directory #221

Closed jhnphm closed 2 years ago

jhnphm commented 2 years ago

Checklist (Please check before submitting)

Describe the bug cf_tbldefs.h in platform_inc directory instead of with source, causing tables to use the non-overridden cf_platform_cfg.h file instead of the one in *_defs at the top level, since the compiler prefers includes relative to the current file over include paths specified on the command line. This is also different than most other apps which define their table structs in fsw/src. Workaround would be to also override cf_tbldefs.h, but the table struct isn't really something that one needs to customize in the first place.

To Reproduce Steps to reproduce the behavior: Alter CF_NUM_CHANNELS in platform_cfg by copying to [mission]_defs/, modifying and using generate_config_includefile to override.

Expected behavior CF config table uses the updated cf_platform_cfg.h instead of the original one.

Code snips If applicable, add references to the software.

System observed on:

Additional context Using snippets from JSC's modified arch_custom.cmake to override platform_cfg:

 ## Add header inclusions from target_defs/<TARGET_NAME>/*.h
set(SPECIFIED_CONFIG ${BUILD_CONFIG_${TARGETSYSTEM}})
list(GET SPECIFIED_CONFIG 2 TGT_NAME)
list(GET SPECIFIED_CONFIG 0 PLATFORM_NAME)

file(GLOB headerFiles "${MISSION_DEFS}/${TGT_NAME}/*.h*")
foreach(headerFile ${headerFiles})
  get_filename_component(filename ${headerFile} NAME)
  string(FIND ${filename} "_" FPOS)
  math(EXPR SIDX "${FPOS} + 1")
  string(SUBSTRING ${filename} ${SIDX} -1 SUFX)
  string(SUBSTRING ${filename} 0 ${FPOS} PREX)
  generate_config_includefile(
    FILE_NAME           ${filename}
    MATCH_SUFFIX        ${SUFX}
    PREFIXES            ${TGT_NAME}/${PLATFORM_NAME}_${PREX} ${TGT_NAME}/${PREX}
  )
endforeach()

Reporter Info John N Pham, Northrop Grumman

skliper commented 2 years ago

Yeah, I was also surprised with cf_tbldefs.h living in platform_inc. I'm not sure if we can dig up the original rational or not, but I'm not opposed to just moving it into fsw/src.