mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 00:44:37 -06:00
Dev/abcouwer/cmake baremetal fixes (#821)
* Flexibility modifications for doing an out of source baremetal build. Add MIN and MAX size #defs for integers in Basic types. Use U32MAX from basic types in FileDownlink, instead of __UINT32_MAX__. Change interrupt to interrupt_val in BlockDriver (prevented build). Guard on system type and don't include Ip socket using components or LinuxTime in baremetal build. Add Baremetal/Mutex.cpp to Os/CMakeLists.txt. Switchup fatal handler files based on system type. Allow for missing PATH_MAX in ComLogger. Change all instances of FPRIME_USE_BAREMETAL_SCHEDULE to FPRIME_USE_BAREMETAL_SCHEDULER. * Cast MIN and MAX types for proper comparisons. Co-authored-by: Neil Abcouwer <neil.abcouwer@jpl.nasa.gov>
This commit is contained in:
parent
5cdfcebd50
commit
2a9678567b
@ -60,7 +60,7 @@
|
||||
Internal interrupt reporting interface
|
||||
</comment>
|
||||
<args>
|
||||
<arg name="interrupt" type="U32">
|
||||
<arg name="interrupt_val" type="U32">
|
||||
<comment>The interrupt register value</comment>
|
||||
</arg>
|
||||
</args>
|
||||
|
||||
@ -14,8 +14,14 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriver/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxSerialDriver/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxSpiDriver/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxI2cDriver/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Ip/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TcpClient/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TcpServer/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Udp/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/SocketIpDriver/")
|
||||
|
||||
# IP Socket is only supported for Linux, Darwin, VxWorks
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR ${CMAKE_SYSTEM_NAME} STREQUAL "VxWorks")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Ip/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TcpClient/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TcpServer/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Udp/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/SocketIpDriver/")
|
||||
else()
|
||||
message(STATUS "Cannot use IP sockets with platform ${CMAKE_SYSTEM_NAME}. Skipping.")
|
||||
endif()
|
||||
|
||||
@ -9,7 +9,7 @@ set(SOURCE_FILES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ConfigCheck.cpp"
|
||||
)
|
||||
register_fprime_module()
|
||||
if (FPRIME_USE_BAREMETAL_SCHEDULE)
|
||||
if (FPRIME_USE_BAREMETAL_SCHEDULER)
|
||||
target_compile_definitions(Fw_Cfg PUBLIC FW_BAREMETAL_SCHEDULER=1)
|
||||
else()
|
||||
target_compile_definitions(Fw_Cfg PUBLIC FW_BAREMETAL_SCHEDULER=0)
|
||||
|
||||
@ -100,6 +100,61 @@ typedef float F32; //!< 32-bit floating point
|
||||
#define NULL (0) //!< NULL
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef I8_MAX
|
||||
#define I8_MAX (I8)(127)
|
||||
#endif
|
||||
|
||||
#ifndef I8_MIN
|
||||
#define I8_MIN (I8)(-128)
|
||||
#endif
|
||||
|
||||
#ifndef U8_MAX
|
||||
#define U8_MAX (U8)(255)
|
||||
#endif
|
||||
|
||||
#if FW_HAS_16_BIT
|
||||
#ifndef I16_MAX
|
||||
#define I16_MAX (I16)(32767)
|
||||
#endif
|
||||
|
||||
#ifndef I16_MIN
|
||||
#define I16_MIN (I16)(-32768)
|
||||
#endif
|
||||
|
||||
#ifndef U16_MAX
|
||||
#define U16_MAX (U16)(65535)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if FW_HAS_32_BIT
|
||||
#ifndef I32_MAX
|
||||
#define I32_MAX (I32)(2147483647)
|
||||
#endif
|
||||
|
||||
#ifndef I32_MIN
|
||||
#define I32_MIN (I32)(-2147483648)
|
||||
#endif
|
||||
|
||||
#ifndef U32_MAX
|
||||
#define U32_MAX (U32)(4294967295)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if FW_HAS_64_BIT
|
||||
#ifndef I64_MAX
|
||||
#define I64_MAX (I64)(9223372036854775807)
|
||||
#endif
|
||||
|
||||
#ifndef I64_MIN
|
||||
#define I64_MIN (I64)(-9223372036854775808)
|
||||
#endif
|
||||
|
||||
#ifndef U64_MAX
|
||||
#define U64_MAX (U64)(18446744073709551615)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define FW_NUM_ARRAY_ELEMENTS(a) (sizeof(a)/sizeof((a)[0])) //!< number of elements in an array
|
||||
|
||||
#define FW_MAX(a,b) (((a) > (b))?(a):(b)) //!< MAX macro
|
||||
|
||||
@ -80,6 +80,7 @@ if (FPRIME_USE_BAREMETAL_SCHEDULER)
|
||||
endif()
|
||||
endforeach()
|
||||
list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Baremetal/Task.cpp")
|
||||
list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Baremetal/Mutex.cpp")
|
||||
endif()
|
||||
register_fprime_module()
|
||||
|
||||
|
||||
@ -31,8 +31,6 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/GroundInterface/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Framer/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FramingProtocol/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Health/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxTime/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxTimer/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PassiveConsoleTextLogger/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PolyDb/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/PrmDb/")
|
||||
@ -40,3 +38,9 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/RateGroupDriver/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/StaticMemory/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Time/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TlmChan/")
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxTime/")
|
||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxTimer/")
|
||||
endif()
|
||||
|
||||
@ -17,6 +17,13 @@
|
||||
#include <stdio.h>
|
||||
#include <cstdarg>
|
||||
|
||||
// some limits.h don't have PATH_MAX
|
||||
#ifdef PATH_MAX
|
||||
#define COMLOGGER_PATH_MAX PATH_MAX
|
||||
#else
|
||||
#define COMLOGGER_PATH_MAX 255
|
||||
#endif
|
||||
|
||||
namespace Svc {
|
||||
|
||||
class ComLogger :
|
||||
@ -75,7 +82,7 @@ namespace Svc {
|
||||
// The maximum size of a filename
|
||||
enum {
|
||||
MAX_FILENAME_SIZE = NAME_MAX, // as defined in limits.h
|
||||
MAX_PATH_SIZE = PATH_MAX
|
||||
MAX_PATH_SIZE = COMLOGGER_PATH_MAX
|
||||
};
|
||||
|
||||
// The filename data:
|
||||
|
||||
@ -6,11 +6,20 @@
|
||||
#
|
||||
# Note: using PROJECT_NAME as EXECUTABLE_NAME
|
||||
####
|
||||
|
||||
set(SOURCE_FILES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/FatalHandlerComponentAi.xml"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/FatalHandlerComponentCommonImpl.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/FatalHandlerComponentLinuxImpl.cpp"
|
||||
)
|
||||
|
||||
if(FPRIME_USE_BAREMETAL_SCHEDULER)
|
||||
list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/FatalHandlerComponentBaremetalImpl.cpp")
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "VxWorks")
|
||||
list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/FatalHandlerComponentVxWorksImpl.cpp")
|
||||
else()
|
||||
list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/FatalHandlerComponentLinuxImpl.cpp")
|
||||
endif()
|
||||
|
||||
set(MOD_DEPS
|
||||
Os
|
||||
Fw/Logger
|
||||
|
||||
@ -179,7 +179,7 @@ namespace Svc {
|
||||
Os::Queue::QueueStatus status = fileQueue.send((U8 *) &entry, sizeof(entry), 0, Os::Queue::QUEUE_NONBLOCKING);
|
||||
|
||||
if(status != Os::Queue::QUEUE_OK) {
|
||||
return SendFileResponse(SendFileStatus::ERROR, __UINT32_MAX__);
|
||||
return SendFileResponse(SendFileStatus::ERROR, U32_MAX);
|
||||
}
|
||||
return SendFileResponse(SendFileStatus::OK, entry.context);
|
||||
}
|
||||
@ -241,7 +241,7 @@ namespace Svc {
|
||||
.source = FileDownlink::COMMAND,
|
||||
.opCode = opCode,
|
||||
.cmdSeq = cmdSeq,
|
||||
.context =__UINT32_MAX__
|
||||
.context = U32_MAX
|
||||
};
|
||||
|
||||
FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
|
||||
@ -274,7 +274,7 @@ namespace Svc {
|
||||
.source = FileDownlink::COMMAND,
|
||||
.opCode = opCode,
|
||||
.cmdSeq = cmdSeq,
|
||||
.context = __UINT32_MAX__
|
||||
.context = U32_MAX
|
||||
};
|
||||
|
||||
FW_ASSERT(sourceFilename.length() < sizeof(entry.srcFilename));
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
####
|
||||
# Set platform default for baremetal scheduler drivers
|
||||
if (NOT DEFINED FPRIME_USE_BAREMETAL_SCHEDULER)
|
||||
set(FPRIME_USE_BAREMETAL_SCHEDULE OFF)
|
||||
set(FPRIME_USE_BAREMETAL_SCHEDULER OFF)
|
||||
message(STATUS "Requiring thread library")
|
||||
FIND_PACKAGE ( Threads REQUIRED )
|
||||
endif()
|
||||
|
||||
@ -62,7 +62,7 @@ set(CMAKE_CXX_FLAGS
|
||||
# directory. NOTE: when running without threads, remove this line.
|
||||
# Here there is a check for the using baremetal scheduler
|
||||
if (NOT DEFINED FPRIME_USE_BAREMETAL_SCHEDULER)
|
||||
set(FPRIME_USE_BAREMETAL_SCHEDULE OFF)
|
||||
set(FPRIME_USE_BAREMETAL_SCHEDULER OFF)
|
||||
message(STATUS "Requiring thread library")
|
||||
FIND_PACKAGE ( Threads REQUIRED )
|
||||
endif()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user