mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 21:53:34 +08:00
Add an option to the systemreset() call and to the reboot command (-b) to reboot into the bootloader.
The system will remain in the bootloader until it's reset, or until an upload is completed.
This commit is contained in:
@@ -40,14 +40,31 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include <systemlib/systemlib.h>
|
||||
#include <systemlib/err.h>
|
||||
|
||||
__EXPORT int reboot_main(int argc, char *argv[]);
|
||||
|
||||
int reboot_main(int argc, char *argv[])
|
||||
{
|
||||
systemreset();
|
||||
int ch;
|
||||
bool to_bootloader = false;
|
||||
|
||||
while ((ch = getopt(argc, argv, "b")) != -1) {
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
to_bootloader = true;
|
||||
break;
|
||||
default:
|
||||
errx(1, "usage: reboot [-b]\n"
|
||||
" -b reboot into the bootloader");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
systemreset(to_bootloader);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user