Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/abcouwer/cmake baremetal fixes #821

Merged
merged 2 commits into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Drv/BlockDriver/BlockDriverComponentAi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
16 changes: 11 additions & 5 deletions Drv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion Fw/Cfg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
55 changes: 55 additions & 0 deletions Fw/Types/BasicTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Os/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
8 changes: 6 additions & 2 deletions Svc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ 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/")
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()

9 changes: 8 additions & 1 deletion Svc/ComLogger/ComLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand Down Expand Up @@ -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:
Expand Down
11 changes: 10 additions & 1 deletion Svc/FatalHandler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Svc/FileDownlink/FileDownlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion cmake/platform/Linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion cmake/platform/platform.cmake.template
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down