minimal working example, still fails shutdown
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.cache
|
||||
.vscode
|
||||
build
|
||||
10
CMakeLists.txt
Normal file
10
CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
|
||||
project(beagle-mcu-hello-world C CXX)
|
||||
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
target_compile_options(app PRIVATE -O0 -g)
|
||||
|
||||
add_subdirectory(src)
|
||||
11
boards/beagleplay_am6254_m4.overlay
Normal file
11
boards/beagleplay_am6254_m4.overlay
Normal file
@@ -0,0 +1,11 @@
|
||||
/ {
|
||||
chosen {
|
||||
mikrobus,uart = &main_uart5;
|
||||
zephyr,console = "";
|
||||
};
|
||||
};
|
||||
|
||||
&main_uart5 {
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
};
|
||||
17
config.yaml
Normal file
17
config.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
sample:
|
||||
description: Hello World
|
||||
name: beagleplay_mcu_hello_world
|
||||
common:
|
||||
min_ram: 1
|
||||
min_flash: 4
|
||||
tags: rproc
|
||||
integration_platforms:
|
||||
- beagleplay/am6254/m4
|
||||
harness: console
|
||||
harness_config:
|
||||
type: one_line
|
||||
regex:
|
||||
- "Hello World! (.*)"
|
||||
tests:
|
||||
sample.basic.helloworld:
|
||||
tags: introduction
|
||||
37
prj.conf
Normal file
37
prj.conf
Normal file
@@ -0,0 +1,37 @@
|
||||
# c version
|
||||
CONFIG_MAIN_STACK_SIZE=8192
|
||||
|
||||
# logging
|
||||
CONFIG_LOG=n
|
||||
CONFIG_CONSOLE=n
|
||||
CONFIG_EARLY_CONSOLE=n
|
||||
CONFIG_PRINTK=n
|
||||
|
||||
# gpio support
|
||||
CONFIG_GPIO=y
|
||||
|
||||
# uart
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_INTERRUPT_DRIVEN=n
|
||||
CONFIG_UART_NS16550=y
|
||||
|
||||
# i2c
|
||||
CONFIG_I2C=y
|
||||
|
||||
# OpenAMP support
|
||||
CONFIG_OPENAMP=y
|
||||
CONFIG_OPENAMP_RSC_TABLE=y
|
||||
|
||||
# IPC/Mailbox
|
||||
CONFIG_IPM=y
|
||||
CONFIG_MBOX=y
|
||||
|
||||
# Optional: RPMsg for communication
|
||||
CONFIG_RPMSG_SERVICE=y
|
||||
|
||||
# build
|
||||
CONFIG_NO_OPTIMIZATIONS=n
|
||||
CONFIG_SIZE_OPTIMIZATIONS=n
|
||||
CONFIG_SPEED_OPTIMIZATIONS=n
|
||||
CONFIG_DEBUG_OPTIMIZATIONS=y
|
||||
CONFIG_DEBUG_THREAD_INFO=y
|
||||
7
src/CMakeLists.txt
Normal file
7
src/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
target_include_directories(app PRIVATE ./)
|
||||
|
||||
target_sources(app PRIVATE
|
||||
main.cpp
|
||||
)
|
||||
26
src/main.cpp
Normal file
26
src/main.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/drivers/uart.h>
|
||||
#include <string.h>
|
||||
#include <openamp/open_amp.h>
|
||||
|
||||
const struct device *uart_dev = DEVICE_DT_GET(DT_CHOSEN(mikrobus_uart));
|
||||
|
||||
int main(void) {
|
||||
const char *message = "Hello World from mikroBUS UART!\r\n";
|
||||
int msg_len = strlen(message);
|
||||
|
||||
if (!device_is_ready(uart_dev)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
k_sleep(K_SECONDS(1));
|
||||
|
||||
for (int i = 0; i < msg_len; i++) {
|
||||
uart_poll_out(uart_dev, message[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user