gateway: working shell on uart0 and mcumgr on usb_serial, minimal OS mgmt config\n
Signed-off-by: Eduard Iten <eduard@iten.pro>
This commit is contained in:
parent
ef966cb078
commit
fc089e5a33
|
|
@ -1,9 +1,8 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20.5)
|
||||||
|
|
||||||
# Include the main 'software' directory as a module to find boards, libs, etc.
|
|
||||||
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
|
||||||
|
|
||||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||||
project(gateway)
|
|
||||||
|
|
||||||
|
project(gateway)
|
||||||
target_sources(app PRIVATE src/main.c)
|
target_sources(app PRIVATE src/main.c)
|
||||||
|
|
||||||
|
target_include_directories(app PRIVATE include)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
# README for the Hello World Zephyr Application
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
This is a minimal Hello World application built using the Zephyr RTOS. The application demonstrates basic logging functionality by printing a message every 5 seconds, including the version number of the application.
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
The project consists of the following files:
|
||||||
|
|
||||||
|
- `src/main.c`: The entry point of the application that initializes logging and sets up a timer.
|
||||||
|
- `include/app_version.h`: Header file that defines the application version.
|
||||||
|
- `VERSION`: A text file containing the version number of the application.
|
||||||
|
- `prj.conf`: Configuration file for the Zephyr project, specifying necessary options.
|
||||||
|
- `CMakeLists.txt`: Build configuration file for CMake.
|
||||||
|
- `README.md`: Documentation for the project.
|
||||||
|
|
||||||
|
## Building the Application
|
||||||
|
|
||||||
|
To build the application, follow these steps:
|
||||||
|
|
||||||
|
1. Ensure you have the Zephyr development environment set up.
|
||||||
|
2. Navigate to the `apps/gateway` directory.
|
||||||
|
3. Run the following command to build the application:
|
||||||
|
|
||||||
|
```
|
||||||
|
west build -b <your_board> .
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `<your_board>` with the appropriate board name.
|
||||||
|
|
||||||
|
## Running the Application
|
||||||
|
|
||||||
|
After building the application, you can flash it to your board using:
|
||||||
|
|
||||||
|
```
|
||||||
|
west flash
|
||||||
|
```
|
||||||
|
|
||||||
|
Once the application is running, you will see log messages printed every 5 seconds, including the version number.
|
||||||
|
|
||||||
|
## Version
|
||||||
|
|
||||||
|
The version of this application can be found in the `VERSION` file and is also included in the log messages.
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
VERSION_MAJOR = 0
|
||||||
|
VERSION_MINOR = 0
|
||||||
|
PATCHLEVEL = 1
|
||||||
|
VERSION_TWEAK = 0
|
||||||
|
EXTRAVERSION = devel
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
&flash0 {
|
||||||
|
reg = <0x0 0x400000>; /* 4MB flash */
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "espressif/partitions_0x0_default_4M.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zephyr,shell-uart = &uart0;
|
||||||
|
zephyr,uart-mcumgr = &usb_serial;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&usb_serial {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
#include "common_4MB.dtsi"
|
||||||
|
|
@ -1,2 +1,23 @@
|
||||||
# Gateway Configuration
|
# Enable logging
|
||||||
CONFIG_NETWORKING=y
|
CONFIG_LOG=y
|
||||||
|
CONFIG_UART_CONSOLE=y
|
||||||
|
|
||||||
|
# Enable shell
|
||||||
|
CONFIG_SHELL=y
|
||||||
|
CONFIG_KERNEL_SHELL=y
|
||||||
|
CONFIG_REBOOT=y
|
||||||
|
|
||||||
|
# Enable MCUMGR
|
||||||
|
CONFIG_MCUMGR=y
|
||||||
|
|
||||||
|
# Enable MCUMGR OS management group only
|
||||||
|
CONFIG_MCUMGR_GRP_OS=y
|
||||||
|
|
||||||
|
# Configure MCUMGR transport to UART
|
||||||
|
CONFIG_MCUMGR_TRANSPORT_UART=y
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
CONFIG_NET_BUF=y
|
||||||
|
CONFIG_ZCBOR=y
|
||||||
|
CONFIG_CRC=y
|
||||||
|
CONFIG_BASE64=y
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2025 Eduard Iten
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
|
#include <zephyr/logging/log.h>
|
||||||
|
#include <app_version.h>
|
||||||
|
|
||||||
|
LOG_MODULE_REGISTER(hello_world);
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
printk("Hello from Gateway!\n");
|
LOG_INF("Hello World! Version: %s", APP_VERSION_EXTENDED_STRING);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
SB_CONFIG_BOOTLOADER_MCUBOOT=y
|
||||||
|
SB_CONFIG_MCUBOOT_MODE_SINGLE_APP=y
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
#include "../boards/common_4MB.dtsi"
|
||||||
|
|
||||||
|
/* Application Configuration - Firmware goes to slot0_partition (0x20000) */
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zephyr,code-partition = &slot0_partition;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&usb_serial {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
CONFIG_LOG=y
|
||||||
|
CONFIG_MCUBOOT_LOG_LEVEL_INF=y
|
||||||
|
CONFIG_UART_CONSOLE=n
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
#include "../boards/common_4MB.dtsi"
|
||||||
|
|
||||||
|
/* MCUboot Configuration - Bootloader goes to boot_partition (0x0) */
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
zephyr,code-partition = &boot_partition;
|
||||||
|
};
|
||||||
|
aliases {
|
||||||
|
mcuboot-button0 = &user_button1;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue