Skip to content

Commit

Permalink
Fix non-determinstic boot hang with crashdumps
Browse files Browse the repository at this point in the history
On boot, if board_hardfault_init finds a hardfault stored in BBSRAM, it
checks if there is any data available on stdin to see if there is
somebody there to respond to a prompt. But on boards such as cubeorange
where there is not a serial console by default, the ioctl fails and
bytesWaiting is uninitialized. So it will non-deterministally hang the
boot process with no outside feedback if that value is not zero.

Signed-off-by: Alex Mikhalev <[email protected]>
  • Loading branch information
amikhalev authored and dagar committed Nov 12, 2020
1 parent 9ae6fd4 commit 68e60ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion platforms/nuttx/src/px4/common/board_crashdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ int board_hardfault_init(int display_to_console, bool allow_prompt)

/* Also end the misery for a user that holds for a key down on the console */

int bytesWaiting;
int bytesWaiting = 0;
ioctl(fileno(stdin), FIONREAD, (unsigned long)((uintptr_t) &bytesWaiting));

if (reboots > display_to_console || bytesWaiting != 0) {
Expand Down

0 comments on commit 68e60ba

Please sign in to comment.