Skip to content

Commit

Permalink
samples: add a sample
Browse files Browse the repository at this point in the history
Testing sample addition.

Signed-off-by: Carles Cufi <[email protected]>
  • Loading branch information
carlescufi committed Oct 10, 2024
1 parent f67ca0f commit 47fbd31
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
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;
}

0 comments on commit 47fbd31

Please sign in to comment.