betaflight / betaflight

Open Source Flight Controller Firmware
GNU General Public License v3.0
8.53k stars 3.01k forks source link

OMNIBUSF4 target FC locks up when disarming when blackbox_device is set to SPIFLASH (default) #7079

Closed zigphroid closed 5 years ago

zigphroid commented 5 years ago

Describe the bug The FC locks up on disarm (OSD timers stop, USB is non-responsive). I went back through the builds and tracked it down to it starting with this build: https://ci.betaflight.tech/job/Betaflight/1064/changes#75bcafb0f418c0f8054839fe027029572574752f build 1063 doesnt have the issue, 1064 does. After looking at those changes I tried doing: "set blackbox_device = NONE" that resolves the issue in 1064 & it also works in the current nightly build. Setting the blackbox device back to SPIFLASH default does cause the lockup behavior to return. This is on a ONMIBUSF4 target without any blackbox storage (EMAX MINI MAGNUM 2 6S - 20X20 V2 - MMCX VERSION).

To Reproduce Flash 4.0 nightly to EMAX MINI MAGNUM 2 6S - 20X20 V2 arm then disarm.

Flight controller configuration

Betaflight / OMNIBUSF4 (OBF4) 4.0.0 Nov 5 2018 / 23:09:40 (0d095ed) MSP API: 1.41

board_name OMNIBUSF4 manufacturer_id AIRB mcu_id 002c00493337511332343333 signature

reset configuration to default settings

defaults nosave

name

resources

mixer

servo

servo mix

feature

feature -RX_PARALLEL_PWM feature RX_SERIAL

beeper

beacon

map

map TAER1234

serial

serial 0 64 115200 57600 0 115200

led

color

mode_color

aux

aux 0 0 0 1700 2100 0 0

adjrange

rxrange

vtx

rxfail

master

set serialrx_provider = FPORT set serialrx_inverted = ON set motor_pwm_protocol = DSHOT600

profile

profile 0

profile

profile 1

profile

profile 2

restore original profile selection

profile 0

rateprofile

rateprofile 0

rateprofile

rateprofile 1

rateprofile

rateprofile 2

rateprofile

rateprofile 3

rateprofile

rateprofile 4

rateprofile

rateprofile 5

restore original rateprofile selection

rateprofile 0

save configuration

save

Setup / Versions EMAX MINI MAGNUM 2 6S - 20X20 V2 frsky R9M receiver

jflyper commented 5 years ago

It's a SIGSEGV caused by trying calling through a NULL function table.

(gdb) w
#0  flashCaptureNullcall () at ./src/main/drivers/flash.c:108 <--- inserted for debugging SIGSEGV
#1  0x0800dce8 in flashIsReady () at ./src/main/drivers/flash.c:117
#2  0x0800e45c in flashfsIsReady () at ./src/main/io/flashfs.c:113
#3  0x080316d2 in isBlackboxDeviceWorking ()
    at ./src/main/blackbox/blackbox_io.c:558
#4  0x080395cc in osdGetBlackboxStatusString (buff=buff@entry=0x1000fe28 "0\a")
    at ./src/main/io/osd.c:1479
#5  0x08039abe in osdShowStats (endBatteryVoltage=<optimized out>)
    at ./src/main/io/osd.c:1622
#6  0x0803b32a in osdRefresh (currentTimeUs=currentTimeUs@entry=19283440)
    at ./src/main/io/osd.c:1724
#7  0x0803b436 in osdUpdate (currentTimeUs=19283440)
    at ./src/main/io/osd.c:1805
#8  0x08018cb8 in scheduler () at ./src/main/scheduler/scheduler.c:334
#9  0x0800f550 in run () at ./src/main/main.c:44
#10 0x0800f560 in main () at ./src/main/main.c:36