Fixed issues with config and tracing
This commit is contained in:
+34
-7
@@ -11,13 +11,16 @@ fi
|
||||
|
||||
# 2. Paths
|
||||
MARTE_EX="${MARTe2_DIR}/Build/${TARGET}/App/MARTeApp.ex"
|
||||
DEBUG_LIB="$(pwd)/Build/libmarte_dev.so"
|
||||
BUILD_DIR="$(pwd)/Build/${TARGET}"
|
||||
|
||||
# Our plugin libraries
|
||||
DEBUG_LIB="${BUILD_DIR}/Components/Interfaces/DebugService/libDebugService.so"
|
||||
TCPLOGGER_LIB="${BUILD_DIR}/Components/Interfaces/TCPLogger/libTcpLogger.so"
|
||||
|
||||
# Component library base search path
|
||||
COMPONENTS_BUILD_DIR="${MARTe2_Components_DIR}/Build/${TARGET}/Components"
|
||||
|
||||
# DYNAMICALLY FIND ALL COMPONENT DIRS
|
||||
# MARTe2 Loader needs the specific directories containing .so files in LD_LIBRARY_PATH
|
||||
# DYNAMICALLY FIND ALL COMPONENT DIRS and add to LD_LIBRARY_PATH
|
||||
ALL_COMPONENT_DIRS=$(find "$COMPONENTS_BUILD_DIR" -type d)
|
||||
for dir in $ALL_COMPONENT_DIRS; do
|
||||
if ls "$dir"/*.so >/dev/null 2>&1; then
|
||||
@@ -26,15 +29,39 @@ for dir in $ALL_COMPONENT_DIRS; do
|
||||
done
|
||||
|
||||
# Ensure our build dir and core dir are included
|
||||
export LD_LIBRARY_PATH="$(pwd)/Build:${MARTe2_DIR}/Build/${TARGET}/Core:${LD_LIBRARY_PATH}"
|
||||
export LD_LIBRARY_PATH="${BUILD_DIR}/Components/Interfaces/DebugService:${BUILD_DIR}/Components/Interfaces/TCPLogger:${MARTe2_DIR}/Build/${TARGET}/Core:${LD_LIBRARY_PATH}"
|
||||
|
||||
# 3. Cleanup
|
||||
echo "Cleaning up lingering processes..."
|
||||
pkill -9 MARTeApp.ex
|
||||
sleep 1
|
||||
|
||||
# 4. Launch Application
|
||||
# 4. Validate libraries exist
|
||||
for lib in "$DEBUG_LIB" "$TCPLOGGER_LIB"; do
|
||||
if [ ! -f "$lib" ]; then
|
||||
echo "ERROR: Library not found: $lib"
|
||||
echo "Run: make -f Makefile.gcc core"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# 5. Launch Application
|
||||
echo "Launching standard MARTeApp.ex with debug_test.cfg..."
|
||||
# PRELOAD ensures our DebugService class is available to the registry early
|
||||
export LD_PRELOAD="${DEBUG_LIB}"
|
||||
# LD_PRELOAD ensures our classes are registered before the config is parsed.
|
||||
# MARTeApp.ex does not use dlopen for plugins — preloading is the standard approach.
|
||||
# All required component .so files are collected via the find loop into LD_PRELOAD too.
|
||||
PRELOAD_LIBS="${DEBUG_LIB}:${TCPLOGGER_LIB}"
|
||||
|
||||
# Collect any additional component .so files referenced by the config
|
||||
for lib in \
|
||||
"${COMPONENTS_BUILD_DIR}/DataSources/RealTimeThreadSynchronisation/RealTimeThreadSynchronisation.so" \
|
||||
"${COMPONENTS_BUILD_DIR}/DataSources/LinuxTimer/LinuxTimer.so" \
|
||||
"${COMPONENTS_BUILD_DIR}/DataSources/LoggerDataSource/LoggerDataSource.so" \
|
||||
"${COMPONENTS_BUILD_DIR}/GAMs/IOGAM/IOGAM.so"; do
|
||||
if [ -f "$lib" ]; then
|
||||
PRELOAD_LIBS="${PRELOAD_LIBS}:${lib}"
|
||||
fi
|
||||
done
|
||||
|
||||
export LD_PRELOAD="${PRELOAD_LIBS}"
|
||||
"$MARTE_EX" -f Test/Configurations/debug_test.cfg -l RealTimeLoader -s State1
|
||||
|
||||
Reference in New Issue
Block a user