From aa0c449d3744ab40102938e008e0b8f7d2b07bf9 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 13 Sep 2019 14:22:41 -0400 Subject: [PATCH 1/2] Fix #10, Add CMakeLists.txt This allows it to be tied into the main CFE mission build and correctly reference the same header files as the FSW does. --- CMakeLists.txt | 15 +++++++++++++++ Makefile | 23 ----------------------- 2 files changed, 15 insertions(+), 23 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ca8b630 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,15 @@ +# CMake recipe for building tblCRCTool +# + +# This tool references the definitions of the CFE_TBL_FileHdr_t and CFE_FS_Header_t +# structures, which are defined in the CFE header files. This, in turn, requires +# the common_types.h file from OSAL and the global cfe_mission_cfg.h file. +include_directories(${MISSION_BINARY_DIR}/inc) +include_directories(${osal_MISSION_DIR}/src/os/inc) +include_directories(${cfe-core_MISSION_DIR}/src/inc) + +add_executable(cfe_ts_crc cfe_ts_crc.c) + +install(TARGETS cfe_ts_crc DESTINATION host) + + diff --git a/Makefile b/Makefile deleted file mode 100644 index 1bed5b6..0000000 --- a/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -############################################################################### -# File: cFE Application Makefile -# -# -# History: -# -############################################################################### -# -# Subsystem produced by this makefile. -# - -## -## If this subsystem needs include files from another app, add the path here. -## -INCLUDE_PATH = \ --I.. - -all: - gcc $(INCLUDE_PATH) -g -o cfe_ts_crc cfe_ts_crc.c - -clean: - rm cfe_ts_crc - From d995f5e49be57a27b98d1d8bb422d9944a6899b5 Mon Sep 17 00:00:00 2001 From: Jake Hageman Date: Mon, 16 Sep 2019 17:36:48 -0400 Subject: [PATCH 2/2] Fix #1, fix #2: Close file, add includes --- cfe_ts_crc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cfe_ts_crc.c b/cfe_ts_crc.c index eff9ff2..ad911a2 100644 --- a/cfe_ts_crc.c +++ b/cfe_ts_crc.c @@ -42,7 +42,8 @@ #include #include #include - +#include +#include #define CFE_ES_CRC_8 1 /**< \brief CRC ( 8 bit additive - returns 32 bit total) (Currently not implemented) */ #define CFE_ES_CRC_16 2 /**< \brief CRC (16 bit additive - returns 32 bit total) */ @@ -177,7 +178,14 @@ int main( int argc, char **argv ) if (readSize != 100) done=1; } /* print the size/CRC results */ - printf("\nTable File Name: %s\nTable Size: %d Bytes\nExpected TS Validation CRC: 0x%08X\n\n", argv[1], fileSize, fileCRC); + printf("\nTable File Name: %s\nTable Size: %d Bytes\nExpected TS Validation CRC: 0x%08X\n\n", argv[1], fileSize, fileCRC); + + /* Close file and check*/ + if( close(fd) != 0 ) + { + printf("\nerror: Cannot close file!\n"); + exit(0); + } - return(fileCRC); + return(fileCRC); }