Giter Club home page Giter Club logo

drone-core's Introduction

crates.io maintenance

Drone Core

The core crate for Drone, an Embedded Operating System.

Documentation

Usage

Add the crate to your Cargo.toml dependencies:

[dependencies]
drone-core = { version = "0.15.0" }

Add or extend host feature as follows:

[features]
host = ["drone-core/host"]

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

drone-core's People

Contributors

valff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drone-core's Issues

drone-core does not compile with recent nightlies

It looks like the unions_with_drop_fields lint has disappeared in recent nightlies:

   Compiling drone-core v0.10.1 (/home/sam/Dev/drone-core)
warning: unknown lint: `unions_with_drop_fields`
   --> src/proc_loop.rs:123:9
    |
123 | #[allow(unions_with_drop_fields)]

This gives the following error when compiling an application:

   Compiling drone-core v0.10.1
error[E0740]: unions may not contain fields that need dropping
   --> /home/sam/.cargo/registry/src/github.com-1ecc6299db9ec823/drone-core-0.10.1/src/proc_loop.rs:126:5
    |
126 |     cmd: Cmd,
    |     ^^^^^^^^
    |
note: `std::mem::ManuallyDrop` can be used to wrap the type

A cleaner solution exist using code::mem::ManuallyDrop as suggested which clearly expresses intent.

command "just flash" failed for "hello-world" project

run "just flash", failed , show the messages:
cannot find trait AllocRef in module core::alloc
--> src/lib.rs:36:1
|
36 | / heap! {
37 | | /// A heap allocator generated from the Drone.toml.
38 | | heap => pub Heap;
39 | | }
| |_^ not found in core::alloc

Compilation error with macro (0.12.1)

Hello!

I am trying to build hello-world and got those macro errors:

   Compiling drone-core v0.12.1
error: constant expression depends on a generic parameter
   --> /home/mojo/.cargo/registry/src/github.com-1ecc6299db9ec823/drone-core-0.12.1/src/inventory.rs:301:40
    |
301 |                   pub fn $share(self) -> (Inventory<T, { C + $inc }>, $(Token<$share_token>),*) {
    |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
318 | / define_methods! {
319 | |     share1 1 => T;
320 | |     share2 2 => T T;
321 | |     share3 3 => T T T;
...   |
335 | |     merge8 8 => a b c d e f g h;
336 | | }
    | |_- in this macro invocation
    |
    = note: this may fail depending on what value the parameter takes
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: constant expression depends on a generic parameter
   --> /home/mojo/.cargo/registry/src/github.com-1ecc6299db9ec823/drone-core-0.12.1/src/inventory.rs:309:69
    |
309 |                   pub fn $merge(self, $($merge_token: Token<T>,)*) -> Inventory<T, { C - $dec }> {
    |                                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
...
318 | / define_methods! {
319 | |     share1 1 => T;
320 | |     share2 2 => T T;
321 | |     share3 3 => T T T;
...   |
335 | |     merge8 8 => a b c d e f g h;
336 | | }
    | |_- in this macro invocation
    |
    = note: this may fail depending on what value the parameter takes
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors

error: could not compile `drone-core`.

To learn more, run the command again with --verbose.
error: Recipe `build` failed on line 27 with exit code 101

rustup show command outputs:

[...]
active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (overridden by '/home/mojo/Projects/drone-os/hello-world/rust-toolchain')
rustc 1.46.0-nightly (0cd7ff7dd 2020-07-04)

PS: Thanks for the project, I really enjoyed following DroneOS book.

Can't compile Hello world

Hello.

I'm trying to compile example described in https://book.drone-os.com/hello-world.html.

Getting compile error:

cargo build --features "" --release
warning: the cargo feature `resolver` is now stable and is no longer necessary to be listed in the manifest
   Compiling drone-sandbox v0.1.0 (/home/bazhenov/Developer/drone-sandbox)
error[E0405]: cannot find trait `AllocRef` in module `core::alloc`
  --> src/lib.rs:36:1
   |
36 | / heap! {
37 | |     /// A heap allocator generated from the `Drone.toml`.
38 | |     heap => pub Heap;
39 | | }
   | |_^ not found in `core::alloc`
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0405`.
error: could not compile `drone-sandbox`

To learn more, run the command again with --verbose.
error: Recipe `build` failed on line 26 with exit code 101

AllocRef available only in nightly, AFAIK

$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/bazhenov/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-2019-02-08-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu

installed targets for active toolchain
--------------------------------------

thumbv7m-none-eabi
x86_64-unknown-linux-gnu

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (overridden by '/home/bazhenov/Developer/drone-sandbox/rust-toolchain')
rustc 1.51.0-nightly (f4eb5d9f7 2021-01-25)

Seems like I install invalid toolchain or something. Can't figure it out. Any diagnostic directions would be appreciated :)

Error while building v0.12

When building the crate with cargo build or when building a project with just build, I get the following error :

   Compiling drone-config v0.12.0 (drone-os/drone/config)
   Compiling drone-core-macros v0.12.0 (drone-os/drone-core/macros)
error[E0609]: no field `uart` on type `drone_config::config::Probe`
  --> macros/src/log_baud_rate.rs:28:42
   |
28 |         } else if let Some(uart) = probe.uart {
   |                                          ^^^^ unknown field
   |
   = note: available fields are: `gdb_client_command`, `bmp`, `jlink`, `openocd`, `swo`, `dso`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0609`.
error: could not compile `drone-core-macros`.

To learn more, run the command again with --verbose.

Changing probe.uart ligne 28 to probe.dso solves the problem.

Drone 0.14 does not compile with nightly rust

error[E0557]: feature has been removed
  --> /home/mpiechotka/.cargo/registry/src/github.com-1ecc6299db9ec823/drone-core-0.14.3/src/lib.rs:27:12
   |
27 | #![feature(const_fn)]
   |            ^^^^^^^^ feature has been removed
   |
   = note: split into finer-grained feature gates

For more information about this error, try `rustc --explain E0557`.

Memory alignment in src::fib::chain::Node cannot be guaranteed

#[repr(C)]                                                                                                                                     
pub struct Node<F> {                                                                                                                           
    advance: unsafe fn(*mut ListNode<Node<()>>) -> bool,                                                                                       
    deallocate: unsafe fn(*mut ListNode<Node<()>>),                                                                                            
    fib: F,                                                                                                                                    
}

Since F here is a closure which memory alignment is uncertain, fib should be boxed or by other means to avoid unexpected memory align.

Fail to flash hello-world project

Following the drone book
when trying to just flash get this error

drone env thumbv7m-none-eabi -- cargo build --features "" --release
    Finished release [optimized + debuginfo] target(s) in 0.08s
drone flash target/thumbv7m-none-eabi/release/hello-world-2
Black Magic Probe (Firmware v1.7.1-1-g2fdd94a) (Hardware Version 1)
Copyright (C) 2015  Black Sphere Technologies Ltd.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

Assert SRST during connect: enabled
Timeout during scan. Is target stuck in WFI?
SW-DP scan failed!
/run/user/1000/.tmpAIYBMJ:60: Error in sourced command file:
Attaching to Remote target failed
Error: `"gdb-multiarch" "target/thumbv7m-none-eabi/release/hello-world-2" "--quiet" "--nx" "--batch" "--command" "/run/user/1000/.tmpAIYBMJ"` exited with status code: 1
error: Recipe `flash` failed on line 63 with exit code 1```
what may cause this problem?

having trouble with flashing

I am following your Drone book
on the stage when we first execute command
just flash
after long compilation i get this error

   Compiling hello-world v0.1.0 (/Users/abfdogovsky/Documents/hello-world)
error: linking with `drone-ld` failed: exit code: 1
  |
  = note: "drone-ld" "-L" "/Users/abfdogovsky/.rustup/toolchains/nightly-2020-04-30-x86_64-apple-darwin/lib/rustlib/thumbv7m-none-eabi/lib" "/Users/abfdogovsky/Documents/hello-world/target/thumbv7m-none-eabi/release/deps/hello_world-a1ac9290e105fc96.hello_world.5zhwcm3y-cgu.4.rcgu.o" "-o" "/Users/abfdogovsky/Documents/hello-world/target/thumbv7m-none-eabi/release/deps/hello_world-a1ac9290e105fc96" "--gc-sections" "-L" "/Users/abfdogovsky/Documents/hello-world/target/thumbv7m-none-eabi/release/deps" "-L" "/Users/abfdogovsky/Documents/hello-world/target/release/deps" "-L" "/Users/abfdogovsky/.rustup/toolchains/nightly-2020-04-30-x86_64-apple-darwin/lib/rustlib/thumbv7m-none-eabi/lib" "--start-group" "--end-group" "-Bstatic" "/Users/abfdogovsky/.rustup/toolchains/nightly-2020-04-30-x86_64-apple-darwin/lib/rustlib/thumbv7m-none-eabi/lib/libcompiler_builtins-864f260ba82b8e34.rlib" "-Bdynamic"
  = note: Error: Couldn't find `llvm-size`
          

ITM output doesn't work when running at full speed

I've run into this both following the book and running the bluepill-blink example. After switching to the high-speed oscillator, the ITM monitor doesn't work anymore. Taking out the raise_system_frequency call is enough to get ITM working on the example.

A logic analyzer shows that the output is still there and looks valid at the higher clock rate, but the baud rate has gone up significantly. By default the baud rate is about 115200, but running off the HSE it measures at 1066666 baud.

I tried changing bmp.uart_baudrate in drone.toml, to 1066666, but then I just get:

stty: invalid argument '1066666'

I don't know if the baud rate should be changing with the clock frequency, so I don't know if this is a problem with Drone or with the ITM monitor (or maybe it's all working as it should be, and it's my old machine's fault for not being able to handle 1066666 baud ๐Ÿคทโ€โ™‚).

Strange compilation errors

I tried to compile demo for nucleo board but rustc failed to compile drone-core:

kayo@debi:~/devel/demo-core-nucleo$ RUSTC_WRAPPER=./rustc-wrapper.sh cargo build --release
   Compiling drone-core v0.8.3
error[E0599]: no method named `resume` found for type `G` in the current scope
  --> /home/kayo/.cargo/registry/src/github.com-1ecc6299db9ec823/drone-core-0.8.3/src/async/gen_future.rs:33:60
   |
33 |     __current_task().__set_cx(cx, || match unsafe { self.0.resume() } {
   |                                                            ^^^^^^
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following traits define an item `resume`, perhaps you need to implement one of them:
           candidate #1: `fib::Fiber`
           candidate #2: `stack_adapter::Stack`
           candidate #3: `core::ops::Generator`

error[E0599]: no method named `resume` found for type `G` in the current scope
  --> /home/kayo/.cargo/registry/src/github.com-1ecc6299db9ec823/drone-core-0.8.3/src/fib/generator.rs:21:21
   |
21 |     unsafe { self.0.resume().into() }
   |                     ^^^^^^
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following traits define an item `resume`, perhaps you need to implement one of them:
           candidate #1: `fib::Fiber`
           candidate #2: `stack_adapter::Stack`
           candidate #3: `core::ops::Generator`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0599`.
error: Could not compile `drone-core`.

To learn more, run the command again with --verbose.

I look sources, and see that wrapped type should implement Generator trait so resume() method should exists in any case.
I completely don't understand what wrong with it.

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.