Merge pull request #12517 from miri64/native/enh/reset-command
native: allow for native to be resetable via SIGUSR1
This commit is contained in:
commit
2f74d9d644
@ -11,6 +11,7 @@ else
|
|||||||
DEBUGGER ?= gdb
|
DEBUGGER ?= gdb
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
RESET ?= $(RIOTBOARD)/$(BOARD)/dist/reset.sh
|
||||||
FLASHER = true
|
FLASHER = true
|
||||||
FLASHFILE ?= $(ELFFILE)
|
FLASHFILE ?= $(ELFFILE)
|
||||||
|
|
||||||
|
|||||||
18
boards/native/dist/reset.sh
vendored
Executable file
18
boards/native/dist/reset.sh
vendored
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2019 Freie Universität Berlin
|
||||||
|
#
|
||||||
|
# This file is subject to the terms and conditions of the GNU Lesser
|
||||||
|
# General Public License v2.1. See the file LICENSE in the top level
|
||||||
|
# directory for more details.
|
||||||
|
|
||||||
|
case ${DEBUG_ADAPTER_ID} in
|
||||||
|
# check if ${DEBUG_ADAPTER_ID} is empty or contains a number
|
||||||
|
''|*[!0-9]*)
|
||||||
|
echo "Please provide native instance's PID using DEBUG_ADAPTER_ID" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
kill -USR1 "${DEBUG_ADAPTER_ID}"
|
||||||
@ -44,6 +44,7 @@
|
|||||||
#include "tty_uart.h"
|
#include "tty_uart.h"
|
||||||
|
|
||||||
#include "periph/init.h"
|
#include "periph/init.h"
|
||||||
|
#include "periph/pm.h"
|
||||||
|
|
||||||
#define ENABLE_DEBUG (0)
|
#define ENABLE_DEBUG (0)
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
@ -390,6 +391,11 @@ extern init_func_t __init_array_start;
|
|||||||
extern init_func_t __init_array_end;
|
extern init_func_t __init_array_end;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void _reset_handler(void)
|
||||||
|
{
|
||||||
|
pm_reboot();
|
||||||
|
}
|
||||||
|
|
||||||
__attribute__((constructor)) static void startup(int argc, char **argv, char **envp)
|
__attribute__((constructor)) static void startup(int argc, char **argv, char **envp)
|
||||||
{
|
{
|
||||||
_native_init_syscalls();
|
_native_init_syscalls();
|
||||||
@ -577,6 +583,8 @@ __attribute__((constructor)) static void startup(int argc, char **argv, char **e
|
|||||||
periph_init();
|
periph_init();
|
||||||
board_init();
|
board_init();
|
||||||
|
|
||||||
|
register_interrupt(SIGUSR1, _reset_handler);
|
||||||
|
|
||||||
puts("RIOT native hardware initialization complete.\n");
|
puts("RIOT native hardware initialization complete.\n");
|
||||||
irq_enable();
|
irq_enable();
|
||||||
kernel_init();
|
kernel_init();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user