GithubHelp home page GithubHelp logo

sourcebox / rtt-log-rs Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 10 KB

Rust crate providing a log facade implementation for the Segger RTT protocol.

License: MIT License

Rust 100.00%
rust logging cortex-m embedded risc-v

rtt-log-rs's Introduction

rtt-log

This Rust crate provides a log facade implementation for the Segger RTT protocol supported by the J-Link, ST-Link and other debug probes. It currently supports ARM Cortex-M and RISC-V targets via the rtt-target crate.

Usage

// Init the logger with maximum level (Trace).
rtt_log::init();

// Alternatively, init the logger with specific level.
rtt_log::init_with_level(log::LevelFilter::Debug);

// Log something.
log::debug!("Application started");

Note:

RTT uses a global symbol _SEGGER_RTT that can only appear once in a compiled binary. Therefore, if you want to use functions from rtt-target directly, import them from rtt-log instead of adding rtt-target as a separate dependency. Otherwise, a linker error about duplicate symbols will occur.

use rtt_log::rtt_target::rprintln;

rprintln!("Hello, world!");

Use a tool like probe-rs on the host to print the messages.

License

Published under the MIT license.

Author: Oliver Rockstedt [email protected]

rtt-log-rs's People

Contributors

sourcebox avatar

Stargazers

Gyungmin Myung avatar Aaron Holtzman avatar

Watchers

James Cloos avatar  avatar

rtt-log-rs's Issues

Use rtt_log with rtt_target

This linker error shows up when trying to use rtt_target with rtt_log. Is there a way to use regular rprintln with rtt-log?

  = note: rust-lld: error: duplicate symbol: _SEGGER_RTT
          >>> defined at eerie_embedded.7c2001f6d11f5a70-cgu.0
          >>>            /Users/gmmyung/Developer/eerie-embedded/target/thumbv7em-none-eabihf/release
/deps/eerie_embedded-b5a2d1bcc30af02c.eerie_embedded.7c2001f6d11f5a70-cgu.0.rcgu.o:(_SEGGER_RTT)
          >>> defined at rtt_log.c37f8a5fd759f351-cgu.0
          >>>            rtt_log-ade76af0363c4fae.rtt_log.c37f8a5fd759f351-cgu.0.rcgu.o:(.bss._SEGGER
_RTT+0x0) in archive /Users/gmmyung/Developer/eerie-embedded/target/thumbv7em-none-eabihf/release/dep
s/librtt_log-ade76af0363c4fae.rlib

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.