ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
10.17k stars 16.74k forks source link

OBAL startup problem with enable dds parameter. (SIGSEGV, Segmentation fault.) #27316

Open AlexanderBVKtex opened 2 weeks ago

AlexanderBVKtex commented 2 weeks ago

Bug report

Issue details After running my compiled executable for OBAL, the following error appears: SIGSEGV, Segmentation fault. (Everything is done according to OBAL's instructions.) When debugged, it gives the following output:

RPI 4 

Program received signal SIGSEGV, Segmentation fault.
AP::rtc () at ../../libraries/AP_RTC/AP_RTC.cpp:309
309 {

Version Ardupilot 4.5.4; No problems on Ardupilot 4.3.3

Platform [?] All [ ] AntennaTracker [X] Copter [ ] Plane [ ] Rover [ ] Submarine Only checked for copter, probably applies to all types.

System Ubuntu 22.04 arm64 Compiled with clang++ 14.0.0

HefnySco commented 2 weeks ago

Please confirm that CONFIG_STRICT_DEVMEM is enabled. as mentioned here https://github.com/HefnySco/OBAL/wiki/06---Build-and-Install.

I made a fast test on RPI-Zero W2 with 2021-05-07-raspios-buster-armhf-lite.zip and every thing seems to be working fine.

HefnySco commented 1 week ago

The code crashes here.

int clock_gettime(clockid_t clockid, struct timespec *ts)
{
    //! @todo the value of clockid is ignored here.
    //! A fallback mechanism is employed against the caller's choice of clock.
    uint64_t utc_usec;
    if (!AP::rtc().get_utc_usec(utc_usec)) {
        utc_usec = AP_HAL::micros64();
    }
    ts->tv_sec = utc_usec / 1000000ULL;
    ts->tv_nsec = (utc_usec % 1000000ULL) * 1000UL;
    return 0;
}

Program received signal SIGSEGV, Segmentation fault. 0x0023844c in Linux::Scheduler::from ( scheduler=<error reading variable: Cannot access memory at address 0x7e7ffffc>) at ../../libraries/AP_HAL_Linux/Scheduler.h:24 24 ../../libraries/AP_HAL_Linux/Scheduler.h: No such file or directory. (gdb) stack Undefined command: "stack". Try "help". (gdb) backtrace

0 0x0023844c in Linux::Scheduler::from (

scheduler=<error reading variable: Cannot access memory at address 0x7e7ffffc>) at ../../libraries/AP_HAL_Linux/Scheduler.h:24

1 0x0024a320 in AP_HAL::micros64 ()

at ../../libraries/AP_HAL_Linux/system.cpp:62

2 0x002899b0 in clock_gettime (clockid=1, ts=0x7e800048)

at ../../libraries/AP_DDS/AP_DDS_Client.cpp:1169

3 0x0024a354 in AP_HAL::micros64 ()

at ../../libraries/AP_HAL_Linux/system.cpp:69

4 0x002899b0 in clock_gettime (clockid=1, ts=0x7e800088)

at ../../libraries/AP_DDS/AP_DDS_Client.cpp:1169

5 0x0024a354 in AP_HAL::micros64 ()

at ../../libraries/AP_HAL_Linux/system.cpp:69

6 0x002899b0 in clock_gettime (clockid=1, ts=0x7e8000c8)

at ../../libraries/AP_DDS/AP_DDS_Client.cpp:1169

7 0x0024a354 in AP_HAL::micros64 ()

at ../../libraries/AP_HAL_Linux/system.cpp:69

8 0x002899b0 in clock_gettime (clockid=1, ts=0x7e800108)

at ../../libraries/AP_DDS/AP_DDS_Client.cpp:1169

9 0x0024a354 in AP_HAL::micros64 ()

at ../../libraries/AP_HAL_Linux/system.cpp:69

10 0x002899b0 in clock_gettime (clockid=1, ts=0x7e800148)

at ../../libraries/AP_DDS/AP_DDS_Client.cpp:1169

--Type for more, q to quit, c to continue without paging--

const Linux::Scheduler* scheduler = Linux::Scheduler::from(hal.scheduler);