Skip to content

Commit

Permalink
Fix compilation issues with clang on Linux
Browse files Browse the repository at this point in the history
Additionally enhances cross platform support of posix port.

Change-Id: I9ab8720ad49de2f2d8375795e27d242c566b0da0
  • Loading branch information
ThoFrank committed Feb 7, 2025
1 parent fda81b1 commit 86c0f9c
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion executables/referenceApp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ endif ()

message(STATUS "Target platform: <${BUILD_TARGET_PLATFORM}>")

if (BUILD_TARGET_PLATFORM STREQUAL "POSIX")
if (BUILD_TARGET_PLATFORM STREQUAL "POSIX" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(PLATFORM_SUPPORT_CAN
ON
CACHE BOOL "Turn CAN support on or off" FORCE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace
{
uint32_t const TIMEOUT_DOCAN_SYSTEM = 10U;
size_t const TICK_DELTA_TICKS = 2U; // Tick delta
size_t const TICK_100MS = 100U; // 100us ticks
uint16_t const ALLOCATE_TIMEOUT = 1000U;
uint16_t const RX_TIMEOUT = 1000U;
uint16_t const TX_CALLBACK_TIMEOUT = 1000U;
Expand Down
6 changes: 4 additions & 2 deletions executables/referenceApp/platforms/posix/main/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
#include "systems/CanSystem.h"
#endif // PLATFORM_SUPPORT_CAN

void terminal_setup(void);
void terminal_cleanup(void);
extern void terminal_setup(void);
extern void terminal_cleanup(void);
extern void main_thread_setup(void);
extern void app_main();

namespace platform
Expand Down Expand Up @@ -51,6 +52,7 @@ void intHandler(int sig)
int main()
{
signal(SIGINT, intHandler);
main_thread_setup();
terminal_setup();
app_main(); // entry point for the generic part
return (1); // we never reach this point
Expand Down
5 changes: 3 additions & 2 deletions libs/bsw/asyncFreeRtos/freeRtosConfiguration/async/Hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
#ifndef GUARD_4B5334A0_F8B0_47F4_A981_CF83833F946D
#define GUARD_4B5334A0_F8B0_47F4_A981_CF83833F946D

#include <platform/estdint.h>

#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

#include <stddef.h>
#include <stdint.h>

void asyncEnterTask(size_t taskIdx);
void asyncLeaveTask(size_t taskIdx);
void asyncEnterIsrGroup(size_t isrGroupIdx);
Expand Down
1 change: 1 addition & 0 deletions libs/bsw/lifecycle/include/lifecycle/LifecycleManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class LifecycleManager
, _transition(transition)
, _isPending(true)
{}
virtual ~ComponentTransitionExecutor() = default;

void execute() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class IncomingDiagConnection : public transport::ITransportMessageProcessedListe
UNCOPYABLE(IncomingDiagConnection);

public:
virtual ~IncomingDiagConnection() = default;
void setDiagSessionManager(IDiagSessionManager& diagSessionManager)
{
fpDiagSessionManager = &diagSessionManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ManagedOutgoingDiagConnection

void processResponseQueue();

void terminate();
void terminate() override;

void responseProcessed() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@
#include <FreeRTOS.h>
#include <task.h>
#include <unistd.h>
#include <pthread.h>

OldIntEnabledStatusValueType getOldIntEnabledStatusValueAndSuspendAllInterrupts(void)
static pthread_t MAIN_THREAD_ID;

void main_thread_setup(void)
{
static pid_t mainThreadTid = getpid();
MAIN_THREAD_ID = pthread_self();
}

if (gettid() == mainThreadTid)
OldIntEnabledStatusValueType getOldIntEnabledStatusValueAndSuspendAllInterrupts(void)
{
if (pthread_self() == MAIN_THREAD_ID)
{
// We will reach this place in two cases:
// 1. The main thread still haven't entered vTaskStartScheduler() - or already exited it.
Expand Down

0 comments on commit 86c0f9c

Please sign in to comment.