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

Add the first libtock2 example. #356

Merged
merged 1 commit into from
Jan 14, 2022
Merged
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
4 changes: 4 additions & 0 deletions libtock2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ version = "0.1.0"
libtock_platform = { path = "../platform" }
libtock_runtime = { path = "../runtime" }
libtock_low_level_debug = { path = "../apis/low_level_debug" }

# TODO: Implement a panic handler with more debugging functionality, then
# replace libtock_small_panic with the debug-heavy panic handler here.
libtock_small_panic = { path = "../panic_handlers/small_panic" }
16 changes: 16 additions & 0 deletions libtock2/examples/low_level_debug.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! An extremely simple libtock-rs example. Just prints out a few numbers using
//! the LowLevelDebug capsule then terminates.

#![no_main]
#![no_std]

use libtock2::low_level_debug::LowLevelDebug;
use libtock2::runtime::{set_main, stack_size};

set_main! {main}
stack_size! {0x100}

fn main() {
LowLevelDebug::print_1(1);
LowLevelDebug::print_2(2, 3);
}
2 changes: 2 additions & 0 deletions libtock2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![forbid(unsafe_code)]
#![no_std]

extern crate libtock_small_panic;

pub use libtock_platform as platform;
pub use libtock_runtime as runtime;

Expand Down