Adding cpp-check fixes

This commit is contained in:
M Starch 2025-03-28 16:42:05 -07:00
parent 70b941e48d
commit 528f4560ea
18 changed files with 167 additions and 18 deletions

View File

@ -19,5 +19,5 @@ do
cp $base.ref.hpp $base.hpp
cp $base.ref.cpp $base.cpp
echo "compiling $base.cpp"
$fprime_gcc -Iinclude -I ../fprime/config -c $base.cpp
$fprime_gcc -Iinclude -I ../fprime -c $base.cpp
done

View File

@ -26,5 +26,5 @@ do
cp $base.template.ref.hpp $base.hpp
cp $base.template.ref.cpp $base.cpp
echo "compiling $base.cpp"
$fprime_gcc -I../../../.. -I.. -I../.. -I../../fprime/config $warning_flags -c $base.cpp
$fprime_gcc -I../../../.. -I.. -I../.. -I../../fprime $warning_flags -c $base.cpp
done

View File

@ -15,7 +15,7 @@ include_flags="
-I../base
-I../impl
-I../test-base
-I../../fprime/config
-I../../fprime
"
define_flags="-DPROTECTED="public" -DBUILD_UT=1"

View File

@ -18,5 +18,5 @@ do
cp $base.$suffix $dest_base.$suffix
done
echo "compiling $dest_base.cpp"
$fprime_gcc -I../../.. -I ../fprime/config -c $dest_base.cpp
$fprime_gcc -I../../.. -I ../fprime -c $dest_base.cpp
done

View File

@ -14,5 +14,5 @@ do
cp $base.ref.hpp $base.hpp
cp $base.ref.cpp $base.cpp
echo "compiling $base.cpp"
$fprime_gcc -I../fprime/config -c $base.cpp
$fprime_gcc -I../fprime -c $base.cpp
done

View File

@ -0,0 +1,31 @@
#####
# PlatformTypes.fpp:
#
# Define platform type alias within this file. To maintain C-compatibility
# leave definitions in global scope.
####
@ The unsigned type of larger sizes internal to the software,
@ e.g., memory buffer sizes, file sizes. Must be unsigned.
@ Supplied by platform, overridable by project.
type PlatformSizeType = U64
@ The signed type of larger sizes internal to the software, used
@ for signed offsets, e.g., file seek offsets. Must be signed.
type PlatformSignedSizeType = I64
@ The type of smaller indicies internal to the software, used
@ for array indicies, e.g., port indicies. Must be signed.
type PlatformIndexType = I16
@ The type of arguments to assert functions. Supplied by platform,
@ overridable by project.
type PlatformAssertArgType = I32
@ The type of task priorities used. Supplied by platform,
@ overridable by project.
type PlatformTaskPriorityType = U8
@ The type of queue priorities used. Supplied by platform,
@ overridable by project.
type PlatformQueuePriorityType = U8

View File

@ -0,0 +1,54 @@
/**
* \brief PlatformTypes.h C-compatible type definitions for Linux/Darwin
*
* PlatformTypes.h is typically published by platform developers to define
* the standard available arithmetic types for use in fprime. This standard
* types header is designed to support standard Linux/Darwin (unix) distributions
* running on x86, x86_64, arm, and arm64 machines and using the standard gcc/clang
* compilers shipped with the operating system.
*/
#ifndef PLATFORM_TYPES_H_
#define PLATFORM_TYPES_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
typedef int PlatformIntType;
#define PRI_PlatformIntType "d"
typedef unsigned int PlatformUIntType;
#define PRI_PlatformUIntType "u"
// Linux/Darwin definitions for pointer have various sizes across platforms
// and since these definitions need to be consistent we must ask the size.
// Check for __SIZEOF_POINTER__ or cause error
#ifndef __SIZEOF_POINTER__
#error "Compiler does not support __SIZEOF_POINTER__, cannot use Linux/Darwin types"
#endif
// Pointer sizes are determined by compiler
#if __SIZEOF_POINTER__ == 8
typedef uint64_t PlatformPointerCastType;
#define PRI_PlatformPointerCastType PRIx64
#elif __SIZEOF_POINTER__ == 4
typedef uint32_t PlatformPointerCastType;
#define PRI_PlatformPointerCastType PRIx32
#elif __SIZEOF_POINTER__ == 2
typedef uint16_t PlatformPointerCastType;
#define PRI_PlatformPointerCastType PRIx16
#elif __SIZEOF_POINTER__ == 1
typedef uint8_t PlatformPointerCastType;
#define PRI_PlatformPointerCastType PRIx8
#else
#error "Expected __SIZEOF_POINTER__ to be one of 8, 4, 2, or 1"
#endif
#ifdef __cplusplus
}
#endif
#endif // PLATFORM_TYPES_H_

View File

@ -1,3 +1,49 @@
# ======================================================================
# \title Fw/FPrimeBasicTypes.hpp
# \author tumbar, mstarch
# \brief FPP alias configuration file
#
# \copyright
# Copyright 2025, by the California Institute of Technology.
# ALL RIGHTS RESERVED. United States Government Sponsorship
# acknowledged.
#
# FPrime uses FPP to define a set of type aliases for various named types
# used throughout the system. This file is used to configure those types.
# ======================================================================
####
# Interger type aliases:
# Used for the project to override types supplied by the platform for things like sizes, indicies, etc.
####
@ The unsigned type of larger sizes internal to the software,
@ e.g., memory buffer sizes, file sizes. Must be unsigned.
type FwSizeType = PlatformSizeType
@ The signed type of larger sizes internal to the software, used
@ for signed offsets, e.g., file seek offsets. Must be signed.
type FwSignedSizeType = PlatformSignedSizeType
@ The type of smaller indicies internal to the software, used
@ for array indicies, e.g., port indicies. Must be signed.
type FwIndexType = PlatformIndexType
@ The type of arguments to assert functions.
type FwAssertArgType = PlatformAssertArgType
@ The type of task priorities used.
type FwTaskPriorityType = PlatformTaskPriorityType;
@ The type of queue priorities used.
type FwQueuePriorityType = PlatformQueuePriorityType
####
# GDS type aliases:
# Used for the project to override types shared with GDSes and other remote systems.
####
@ The type of a telemetry channel identifier
type FwChanIdType = U32
@ -22,10 +68,6 @@ type FwPrmIdType = U32
@ The type used to serialize a size value
type FwSizeStoreType = U16
@ The unsigned type of larger sizes internal to the software,
@ e.g., memory buffer sizes, file sizes
type FwSizeType = U32
@ The type used to serialize a time base value
type FwTimeBaseStoreType = U16

View File

@ -22,21 +22,34 @@ done
# Move Fw aliases (FpConfig.h dependencies) into config
fp_config_aliases="
FwAssertArgType
FwChanIdType
FwDpIdType
FwDpPriorityType
FwEnumStoreType
FwEventIdType
FwIndexType
FwOpcodeType
FwPacketDescriptorType
FwPrmIdType
FwQueuePriorityType
FwSignedSizeType
FwSizeStoreType
FwSizeType
FwTaskPriorityType
FwTimeBaseStoreType
FwTimeContextStoreType
FwTlmPacketizeIdType
FwTraceIdType
"
fp_platform_aliases="
PlatformSizeType
PlatformSignedSizeType
PlatformIndexType
PlatformAssertArgType
PlatformTaskPriorityType
PlatformQueuePriorityType
"
for base in ${fp_config_aliases}
do
@ -46,6 +59,14 @@ do
done
done
for base in ${fp_platform_aliases}
do
for suffix in hpp h
do
mv ${base}AliasAc.$suffix Platform
done
done
# Move files into place by name prefix
for dir in Buffer Cmd Dp Log Prm Time Tlm
do

View File

@ -15,5 +15,5 @@ do
cp $base.ref.hpp $base.hpp
cp $base.ref.cpp $base.cpp
echo "compiling $base.cpp"
$fprime_gcc -DFW_PORT_TRACING=1 -DFW_PORT_SERIALIZATION=1 -I../fprime/config -c $base.cpp
$fprime_gcc -DFW_PORT_TRACING=1 -DFW_PORT_SERIALIZATION=1 -I../fprime -c $base.cpp
done

View File

@ -12,5 +12,5 @@ do
cp $base.ref.hpp $base.hpp
cp $base.ref.cpp $base.cpp
echo "compiling $base.cpp"
$fprime_gcc -Wno-unused-parameter -I../.. -I../../fprime/config -c $base.cpp
$fprime_gcc -Wno-unused-parameter -I../.. -I../../fprime -c $base.cpp
done

View File

@ -2,9 +2,10 @@
cd `dirname $0`
fpp_to_cpp=../../../../../bin/fpp-to-cpp
echo "generating C++ files for harness"
state_machine=`dirname $PWD`
harness=$state_machine/harness
fpp_flags="-p $state_machine"
fpp-to-cpp $fpp_flags harness.fpp
$fpp_to_cpp $fpp_flags harness.fpp

View File

@ -10,5 +10,5 @@ do
cp $base.ref.hpp $base.hpp
cp $base.ref.cpp $base.cpp
echo "compiling $base.cpp"
$fprime_gcc -I../../fprime/config -c $base.cpp
$fprime_gcc -I../../fprime -c $base.cpp
done

View File

@ -12,5 +12,5 @@ do
cp $base.ref.hpp $base.hpp
cp $base.ref.cpp $base.cpp
echo "compiling $base.cpp"
$fprime_gcc -Wno-unused-parameter -I../.. -I../../fprime/config -c $base.cpp
$fprime_gcc -Wno-unused-parameter -I../.. -I../../fprime -c $base.cpp
done

View File

@ -16,5 +16,5 @@ do
cp $base.ref.hpp $base.hpp
cp $base.ref.cpp $base.cpp
echo "compiling $base.cpp"
$fprime_gcc -I../fprime/config -c $base.cpp
$fprime_gcc -I../fprime -c $base.cpp
done

View File

@ -10,7 +10,7 @@ dir=`cd ../..; echo $PWD`
fprime_dir=../../../fprime
echo ' generating C++'
fpp-to-cpp -p $dir -i $fprime_dir/config/FpConfig.fpp,$fprime_dir/Fw/Prm/Prm.fpp,../../phases.fpp \
$fpp_to_cpp -p $dir -i $fprime_dir/config/FpConfig.fpp,$fprime_dir/Platform/PlatformTypes.fpp,$fprime_dir/Fw/Prm/Prm.fpp,../../phases.fpp \
$fprime_dir/Fw/Cmd/Cmd.fpp ../../commands.fpp
for suffix in hpp cpp
do

View File

@ -9,7 +9,7 @@ echo ' removing old files'
dir=`cd ../..; echo $PWD`
echo ' generating C++'
fpp-to-cpp -p $dir -i ../../builtin.fpp ../../health.fpp
$fpp_to_cpp -p $dir -i ../../builtin.fpp ../../health.fpp
for suffix in hpp cpp
do

View File

@ -10,7 +10,7 @@ dir=`cd ../..; echo $PWD`
fprime_dir=../../../fprime
echo ' generating C++'
fpp-to-cpp -p $dir -i $fprime_dir/config/FpConfig.fpp,$fprime_dir/Fw/Prm/Prm.fpp,../../phases.fpp \
$fpp_to_cpp -p $dir -i $fprime_dir/config/FpConfig.fpp,$fprime_dir/Platform/PlatformTypes.fpp,$fprime_dir/Fw/Prm/Prm.fpp,../../phases.fpp \
$fprime_dir/Fw/Cmd/Cmd.fpp ../../params.fpp
for suffix in hpp cpp
do