Skip to content

Commit 83d0bdc

Browse files
committed
doc: Create a separate docgen app
Although this is started identically to the hello_world app, this will be an app where we can enable as many features as possible to try and build up the docs as fully as possible. Signed-off-by: David Brown <[email protected]>
1 parent 2bb960f commit 83d0bdc

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

docgen/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.20.0)
4+
5+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6+
7+
project(hello_rust_world)
8+
rust_cargo_application()

docgen/Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (c) 2024 Linaro LTD
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
[package]
5+
# This must be rustapp for now.
6+
name = "rustapp"
7+
version = "0.1.0"
8+
edition = "2021"
9+
description = "A sample hello world application in Rust"
10+
license = "Apache-2.0 or MIT"
11+
12+
[lib]
13+
crate-type = ["staticlib"]
14+
15+
[dependencies]
16+
zephyr = "0.1.0"

docgen/prj.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2024 Linaro LTD
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_RUST=y

docgen/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2024 Linaro LTD
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#![no_std]
5+
6+
use zephyr::printkln;
7+
8+
// Reference the Zephyr crate so that the panic handler gets used. This is only needed if no
9+
// symbols from the crate are directly used.
10+
extern crate zephyr;
11+
12+
#[no_mangle]
13+
extern "C" fn rust_main() {
14+
printkln!("Hello world from Rust on {}",
15+
zephyr::kconfig::CONFIG_BOARD);
16+
}

0 commit comments

Comments
 (0)