Add firmware_node app - Step 1: Shell with reset command
- Create new Zephyr app for firmware management - Target: weact_stm32g431_core board - Features: Shell interface with custom reset command - Tested on Zephyr 4.1.99 - Flash usage: 55,400 bytes (42.27% of 128KB) - RAM usage: 12,864 bytes (39.26% of 32KB) - Black Magic Probe flash runner support
This commit is contained in:
28
software/apps/firmware_node/src/main.c
Normal file
28
software/apps/firmware_node/src/main.c
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/shell/shell.h>
|
||||
#include <zephyr/sys/reboot.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
|
||||
LOG_MODULE_REGISTER(firmware_node, LOG_LEVEL_DBG);
|
||||
|
||||
static int cmd_reset(const struct shell *shell, size_t argc, char **argv)
|
||||
{
|
||||
ARG_UNUSED(argc);
|
||||
ARG_UNUSED(argv);
|
||||
|
||||
shell_print(shell, "Rebooting system...");
|
||||
k_msleep(100); // Give time for message to be sent
|
||||
sys_reboot(SYS_REBOOT_WARM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SHELL_CMD_REGISTER(reset, NULL, "Reset the system", cmd_reset);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
LOG_INF("Firmware Node starting up");
|
||||
LOG_INF("Shell with reset command available");
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user