Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples: add a sample #268

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CODEOWNERS for autoreview assigning in github

Check failure on line 1 in CODEOWNERS

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

CODEOWNERS

New files added that are not covered in CODEOWNERS:

# https://help.github.com/en/articles/about-code-owners#codeowners-syntax
# Order is important; the last matching pattern takes the most
Expand Down Expand Up @@ -163,7 +163,7 @@
/modules/coremark/ @nrfconnect/ncs-si-bluebagel

# Samples
/samples/ @nrfconnect/ncs-code-owners
#/samples/ @nrfconnect/ncs-code-owners
/samples/CMakeLists.txt @nrfconnect/ncs-co-build-system
/samples/net/ @nrfconnect/ncs-cia @nrfconnect/ncs-modem
/samples/sensor/bh1749/ @nrfconnect/ncs-cia
Expand Down
8 changes: 8 additions & 0 deletions samples/hello/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0

Check failure on line 1 in samples/hello/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / call-workflow / Run license checks on patch series (PR)

License Problem

"APACHE-2.0" license is not allowed for this file.

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(hello_world)

target_sources(app PRIVATE src/main.c)
36 changes: 36 additions & 0 deletions samples/hello/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.. zephyr:code-sample:: hello_world
:name: Hello World

Print "Hello World" to the console.

Hello World
###########

Overview
********

A simple sample that can be used with any :ref:`supported board <boards>` and
prints "Hello World" to the console.

Building and Running
********************

This application can be built and executed on QEMU as follows:

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
: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 World! x86

Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
1 change: 1 addition & 0 deletions samples/hello/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# nothing here
16 changes: 16 additions & 0 deletions samples/hello/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sample:
description: Hello World sample, the simplest Zephyr
application
name: hello world
common:
tags: introduction
integration_platforms:
- native_sim
harness: console
harness_config:
type: one_line
regex:
- "Hello World! (.*)"
tests:
sample.basic.helloworld:
tags: introduction
14 changes: 14 additions & 0 deletions samples/hello/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*

Check failure on line 1 in samples/hello/src/main.c

View workflow job for this annotation

GitHub Actions / call-workflow / Run license checks on patch series (PR)

License Problem

"APACHE-2.0" license is not allowed for this file.
* Copyright (c) 2012-2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <stdio.h>

int main(void)
{
printf("Hello World! %s\n", CONFIG_BOARD_TARGET);

return 0;
}
Loading