Simplest Zephyr module + bacnet_stack config and hello sample

This commit is contained in:
Gregory Shue
2020-08-29 13:08:08 -07:00
parent 2698b0aa41
commit 6ccc9505f3
11 changed files with 360 additions and 1 deletions
@@ -0,0 +1,25 @@
# SPDX-License-Identifier: MIT
cmake_minimum_required(VERSION 3.13.1)
get_filename_component(MY_PROJECT_BASENAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
# Find the directory of the Zephyr module
string(REGEX REPLACE
"\/zephyr\/samples\/[a-zA-Z_\-]*${MY_PROJECT_BASENAME}$" ""
MY_ZEPHYR_MODULE_SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR})
list(APPEND ZEPHYR_EXTRA_MODULES
${MY_ZEPHYR_MODULE_SOURCE_DIR}
)
# Add an absolute directory path to the CMake variable
# SYSCALL_INCLUDE_DIRS. This ensures that the syscall machinery will
# be able to find the module's syscalls.
#TODO: list(APPEND SYSCALL_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(${MY_PROJECT_BASENAME})
target_sources(app PRIVATE src/main.c)
@@ -0,0 +1,33 @@
.. _hello_bacnet_stack:
Hello BACnet-Stack
##################
Overview
********
A simple sample that can be used with any :ref:`supported board <boards>` and
prints "Hello BACnet-Stack" to the console.
Building and Running
********************
This application can be built and executed on QEMU as follows:
.. zephyr-app-commands::
:zephyr-app: samples/hello_bacnet_stack
:host-os: unix
:board: qemu_x86
:goals: run
:compact:
To build for another board, change "qemu_x86" above to that board's name.
Sample Output
=============
.. code-block:: console
Hello BACnet-Stack! x86
Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
@@ -0,0 +1,2 @@
# nothing here
CONFIG_BACNETSTACK=y
@@ -0,0 +1,15 @@
sample:
description: Hello BACnet-Stack sample, the simplest BACnet-Stack
application
name: hello BACnet-Stack
common:
tags: introduction
harness: console
harness_config:
type: one_line
regex:
- "Hello BACnet-Stack! (.*)"
tests:
sample.basic.hello_bacnet_stack:
platform_whitelist: native_posix
tags: introduction
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2020 Legrand North America, LLC.
*
* SPDX-License-Identifier: MIT
*/
#include <zephyr.h>
#include <sys/printk.h>
void main(void)
{
printk("Hello BACnet-Stack! %s\n", CONFIG_BOARD);
}