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:
parent
d48281436e
commit
8255b2a672
|
|
@ -0,0 +1,8 @@
|
||||||
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||||
|
|
||||||
|
project(firmware_node LANGUAGES C)
|
||||||
|
zephyr_include_directories(../../include)
|
||||||
|
add_subdirectory(../../lib lib)
|
||||||
|
target_sources(app PRIVATE src/main.c)
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Firmware Node Application
|
||||||
|
|
||||||
|
This Zephyr application provides firmware management capabilities for the irrigation system.
|
||||||
|
|
||||||
|
**Tested on Zephyr 4.1.99**
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
### Step 1: Shell with Reset Command
|
||||||
|
- Shell interface with custom "reset" command
|
||||||
|
- Warm reboot functionality
|
||||||
|
|
||||||
|
### Planned Features
|
||||||
|
- MCUboot support with partition manager
|
||||||
|
- Firmware version display
|
||||||
|
- MCUmgr support for OTA updates
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
```bash
|
||||||
|
west build -p auto -b weact_stm32g431_core apps/firmware_node -- -DBOARD_FLASH_RUNNER=blackmagicprobe
|
||||||
|
```
|
||||||
|
|
||||||
|
## Flashing
|
||||||
|
|
||||||
|
```bash
|
||||||
|
west flash
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Connect to the device via serial console and use the shell:
|
||||||
|
- `reset` - Reboot the system
|
||||||
|
- `help` - Show available commands
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
# Board specific configuration for weact_stm32g431_core
|
||||||
|
# This file can be used for board-specific overrides if needed
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Enable Console and printk for logging
|
||||||
|
CONFIG_CONSOLE=y
|
||||||
|
CONFIG_LOG=y
|
||||||
|
|
||||||
|
# Enable Shell
|
||||||
|
CONFIG_SHELL=y
|
||||||
|
CONFIG_REBOOT=y
|
||||||
|
|
||||||
|
# Enable the reset command
|
||||||
|
CONFIG_KERNEL_SHELL=y
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
# Enable MCUboot
|
||||||
|
set(SB_CONFIG_BOOTLOADER_MCUBOOT y)
|
||||||
|
|
||||||
|
# MCUboot configuration
|
||||||
|
set(SB_CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY y)
|
||||||
|
set(SB_CONFIG_MCUBOOT_SIGNATURE_KEY_FILE "bootloader/mcuboot/root-rsa-2048.pem")
|
||||||
|
set(SB_CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE y)
|
||||||
|
set(SB_CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE y)
|
||||||
|
|
||||||
|
# Enable USB CDC ACM for MCUboot console
|
||||||
|
set(SB_CONFIG_MCUBOOT_USB_SUPPORT y)
|
||||||
|
set(SB_CONFIG_MCUBOOT_SERIAL y)
|
||||||
Loading…
Reference in New Issue