diff --git a/src/modules/dataman/dataman.c b/src/modules/dataman/dataman.c index b9bf402afa..e48b0b5c89 100644 --- a/src/modules/dataman/dataman.c +++ b/src/modules/dataman/dataman.c @@ -132,7 +132,7 @@ static sem_t g_sys_state_mutex; /* The data manager store file handle and file name */ static int g_fd = -1, g_task_fd = -1; -static const char *default_device_path = "/fs/microsd/dataman"; +static const char *default_device_path = PX4_ROOTFSDIR"/fs/microsd/dataman"; static char *k_data_manager_device_path = NULL; /* The data manager work queues */ diff --git a/src/modules/mavlink/mavlink_ftp.cpp b/src/modules/mavlink/mavlink_ftp.cpp index 36d2f2ff6a..44127f586e 100644 --- a/src/modules/mavlink/mavlink_ftp.cpp +++ b/src/modules/mavlink/mavlink_ftp.cpp @@ -571,7 +571,7 @@ MavlinkFTP::ErrorCode MavlinkFTP::_workTruncateFile(PayloadHeader* payload) { char file[kMaxDataLength]; - const char temp_file[] = "/fs/microsd/.trunc.tmp"; + const char temp_file[] = PX4_ROOTFSDIR"/fs/microsd/.trunc.tmp"; strncpy(file, _data_as_cstring(payload), kMaxDataLength); payload->size = 0; diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index 1b2689e6bb..ffdc0e0730 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -389,7 +389,7 @@ protected: } else if (write_err_count < write_err_threshold) { /* string to hold the path to the log */ char log_file_name[32] = ""; - char log_file_path[64] = ""; + char log_file_path[70] = ""; timespec ts; px4_clock_gettime(CLOCK_REALTIME, &ts); @@ -400,7 +400,7 @@ protected: // XXX we do not want to interfere here with the SD log app strftime(log_file_name, sizeof(log_file_name), "msgs_%Y_%m_%d_%H_%M_%S.txt", &tt); - snprintf(log_file_path, sizeof(log_file_path), "/fs/microsd/%s", log_file_name); + snprintf(log_file_path, sizeof(log_file_path), PX4_ROOTFSDIR"/fs/microsd/%s", log_file_name); fp = fopen(log_file_path, "ab"); /* write first message */ diff --git a/src/modules/navigator/geofence.h b/src/modules/navigator/geofence.h index 96764cc976..c9518872f1 100644 --- a/src/modules/navigator/geofence.h +++ b/src/modules/navigator/geofence.h @@ -49,8 +49,9 @@ #include #include #include +#include -#define GEOFENCE_FILENAME "/fs/microsd/etc/geofence.txt" +#define GEOFENCE_FILENAME PX4_ROOTFSDIR"/fs/microsd/etc/geofence.txt" class Geofence : public control::SuperBlock { diff --git a/src/modules/position_estimator_inav/position_estimator_inav_main.c b/src/modules/position_estimator_inav/position_estimator_inav_main.c index 8654a7cb11..53d6323e81 100644 --- a/src/modules/position_estimator_inav/position_estimator_inav_main.c +++ b/src/modules/position_estimator_inav/position_estimator_inav_main.c @@ -189,7 +189,7 @@ int position_estimator_inav_main(int argc, char *argv[]) static void write_debug_log(const char *msg, float dt, float x_est[2], float y_est[2], float z_est[2], float x_est_prev[2], float y_est_prev[2], float z_est_prev[2], float acc[3], float corr_gps[3][2], float w_xy_gps_p, float w_xy_gps_v) { - FILE *f = fopen("/fs/microsd/inav.log", "a"); + FILE *f = fopen(PX4_ROOTFSDIR"/fs/microsd/inav.log", "a"); if (f) { char *s = malloc(256); diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index acc4771968..f35963d885 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -179,7 +179,7 @@ static const int MIN_BYTES_TO_WRITE = 512; static bool _extended_logging = false; static bool _gpstime_only = false; -#define MOUNTPOINT "/fs/microsd" +#define MOUNTPOINT PX4_ROOTFSDIR"/fs/microsd" static const char *mountpoint = MOUNTPOINT; static const char *log_root = MOUNTPOINT "/log"; static int mavlink_fd = -1; diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index 5f2dc2df27..1bf986753d 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -695,7 +695,7 @@ param_reset_excludes(const char *excludes[], int num_excludes) param_notify_changes(); } -static const char *param_default_file = "/eeprom/parameters"; +static const char *param_default_file = PX4_ROOTFSDIR"/eeprom/parameters"; static char *param_user_file = NULL; int diff --git a/src/modules/uORB/uORBTest_UnitTest.cpp b/src/modules/uORB/uORBTest_UnitTest.cpp index 53a053dc92..e051e66efb 100644 --- a/src/modules/uORB/uORBTest_UnitTest.cpp +++ b/src/modules/uORB/uORBTest_UnitTest.cpp @@ -104,8 +104,7 @@ int uORBTest::UnitTest::pubsublatency_main(void) if (pubsubtest_print) { char fname[32]; - //sprintf(fname, "/fs/microsd/timings%u.txt", timingsgroup); - sprintf(fname, "/tmp/timings%u.txt", timingsgroup); + sprintf(fname, PX4_ROOTFSDIR"/fs/microsd/timings%u.txt", timingsgroup); FILE *f = fopen(fname, "w"); if (f == NULL) { warnx("Error opening file!\n"); diff --git a/src/modules/uavcan/uavcan_main.hpp b/src/modules/uavcan/uavcan_main.hpp index aa67972b67..dc81fb57d6 100644 --- a/src/modules/uavcan/uavcan_main.hpp +++ b/src/modules/uavcan/uavcan_main.hpp @@ -65,9 +65,9 @@ #define NUM_ACTUATOR_CONTROL_GROUPS_UAVCAN 4 #define UAVCAN_DEVICE_PATH "/dev/uavcan/esc" -#define UAVCAN_NODE_DB_PATH "/fs/microsd/uavcan.db" -#define UAVCAN_FIRMWARE_PATH "/fs/microsd/fw" -#define UAVCAN_LOG_FILE UAVCAN_NODE_DB_PATH"/trace.log" +#define UAVCAN_NODE_DB_PATH PX4_ROOTFSDIR"/fs/microsd/uavcan.db" +#define UAVCAN_FIRMWARE_PATH PX4_ROOTFSDIR"/fs/microsd/fw" +#define UAVCAN_LOG_FILE UAVCAN_NODE_DB_PATH"/trace.log" // we add two to allow for actuator_direct and busevent #define UAVCAN_NUM_POLL_FDS (NUM_ACTUATOR_CONTROL_GROUPS_UAVCAN+2) diff --git a/src/platforms/px4_defines.h b/src/platforms/px4_defines.h index e123a008c5..ba5f716945 100644 --- a/src/platforms/px4_defines.h +++ b/src/platforms/px4_defines.h @@ -92,6 +92,8 @@ typedef param_t px4_param_t; */ #if defined(__PX4_NUTTX) +#define PX4_ROOTFSDIR + /* XXX this is a hack to resolve conflicts with NuttX headers */ #if !defined(__PX4_TESTS) #define isspace(c) \ @@ -136,6 +138,12 @@ __END_DECLS #define px4_statfs_buf_f_bavail_t unsigned long +#if defined(__PX4_QURT) +#define PX4_ROOTFSDIR +#else +#define PX4_ROOTFSDIR "rootfs" +#endif + #endif @@ -198,6 +206,10 @@ __END_DECLS #endif #if defined(__PX4_QURT) + +#define PX4_ROOTFSDIR +#define DEFAULT_PARAM_FILE "/fs/eeprom/parameters" + #define SIOCDEVPRIVATE 999999 // Missing math.h defines @@ -211,7 +223,6 @@ __END_DECLS #define fminf(x, y) ((x) > (y) ? y : x) #endif - #endif /*