-
Notifications
You must be signed in to change notification settings - Fork 188
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
no_std error #186
Comments
First of all you'll need the nightly compiler for Second, I'm not very sure where that error came from. I've pushed the latest changes into master. You can try pulling it again to see if it solves your problem. Third, from the error message, it looks like you're compiling for an ARMv7 target (
From https://gist.github.com/adamgreig/b47fe9159e721e368601 it looks like you might need to install |
Im sure nigtly is on I even set it to default. I tried new version but it didnt worked. Also when I remove rhai project builds successfully. I think problem is on core-error libary, I removed rhai and imported core-error like in rhai's cargo.toml It gave me same error. |
How about the compilation target |
I tried installing with
Edit: I tried re installing by
|
rust-embedded/cortex-m-quickstart#58 Do you have |
I have :( #![no_main]
#![no_std]
extern crate panic_halt;
use cortex_m;
use cortex_m_rt::entry;
use crate::hal::{prelude::*, stm32};
use stm32f4xx_hal as hal;
#[entry]
fn main() -> ! {
// Access the device peripherals (dp) and cortex peripherals (cp):
if let (Some(dp), Some(cp)) = (
stm32::Peripherals::take(),
cortex_m::peripheral::Peripherals::take(),
) {
// Set up the LED: it's connected to pin PA5 on the microcontroler
let gpioa = dp.GPIOA.split();
let mut led = gpioa.pa5.into_push_pull_output();
// The external LED, on the next pin down:
let mut xled = gpioa.pa6.into_push_pull_output();
// Set up the system clock. We want to run at 48MHz for this one.
let rcc = dp.RCC.constrain();
let clocks = rcc.cfgr.sysclk(48.mhz()).freeze();
// Create a delay abstraction based on SysTick
let mut delay = hal::delay::Delay::new(cp.SYST, clocks);
loop {
// On for 1s, off for 1s.
// https://doc.rust-lang.org/std/convert/enum.Infallible.html
led.set_high().unwrap();
xled.set_low().unwrap();
delay.delay_ms(1000_u32);
led.set_low().unwrap();
xled.set_high().unwrap();
delay.delay_ms(1000_u32);
}
} else {
panic!("failed to access peripherals");
}
} |
I used --verbose option maybe this can help
|
Looks like Try: core-error = { version = "0.0.0", features = ["alloc"] } |
It worked :D core-error = { version = "0.0.0", features = ["alloc"], default-features = false} using with |
That is because features are additive. Rhai only pull in |
Oh, I get it Im new in rust :D. Thank you for help. |
Just out of curiosity, may I ask what you're planning to use Rhai for on this microcontroller? |
Im trying to create a retro console which will use arm. With rhai I will give users a easy way to create games. |
You may find that Rhai doesn't run fast enough to create video games though... it is an interpreter. You might way to go with Lua or others. For text-based or other simple games which do not require lots of CPU power, Rhai should be OK. |
Games will be realy simple just like commodore games lines pixel arts etc. I actually don't know hardware is capable of doing theese. Im just prototyping it |
Sorry for asking again but, I didnt realy tried installing again. I tought if I set the |
You do not need Do you see the same error? What if you turn on verbose mode in cargo? |
I removed core-error just added rhai Cargo.toml [package]
name = "berzah"
version = "0.1.0"
authors = ["Ahmetcan Aksu <ahmetcanco@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
embedded-hal = "0.2"
nb = "0.1.2"
cortex-m = "0.6"
cortex-m-rt = "0.6"
# Panic behaviour, see https://crates.io/keywords/panic-impl for alternatives
panic-halt = "0.2"
[dependencies.rhai]
git = "https://github.com/jonathandturner/rhai/"
features = ["no_std"]
default-features = false
[dependencies.stm32f4xx-hal]
version = "0.8"
features = ["rt", "stm32f411"] # replace the model of your
[profile.release]
codegen-units = 1 # better optimizations
debug = true # symbols are nice and they don't increase the size on Flash
lto = true # better optimizations
opt-level = "z" # optimize for size Verbose:
|
For some reason |
Is it problem with |
Try compiling the I just did it on my PC and it worked. Obviously I'm not cross-compiling to ARM... |
Libary works well in my computer (nightly) but no success in |
Seems like you may need to put |
Just only main.rs available #![no_std] already in top #![deny(unsafe_code)]
#![no_main]
#![no_std]
// Halt on panic
#[allow(unused_extern_crates)] // NOTE(allow) bug rust-lang/rust#53964
extern crate panic_halt; // panic handler
use cortex_m;
use cortex_m_rt::entry;
use stm32f4xx_hal as hal;
//use rhai::{Engine, EvalAltResult};
use crate::hal::{prelude::*, stm32};
#[entry]
fn main() -> ! {
if let (Some(dp), Some(cp)) = (
stm32::Peripherals::take(),
cortex_m::peripheral::Peripherals::take(),
) {
// Set up the system clock. We want to run at 48MHz for this one.
let rcc = dp.RCC.constrain();
let clocks = rcc.cfgr.sysclk(100.mhz()).freeze();
let mut delay = hal::delay::Delay::new(cp.SYST, clocks);
loop {
}
}
loop {}
} Edit: use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
fn main() {
// Put the linker script somewhere the linker can find it
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("memory.x"))
.unwrap()
.write_all(include_bytes!("memory.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
// Only re-run the build script when memory.x is changed,
// instead of when any part of the source code changes.
println!("cargo:rerun-if-changed=memory.x");
} I tried to delete build.rs but not worked
[package]
name = "berzah"
version = "0.1.0"
authors = ["Ahmetcan Aksu <ahmetcanco@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
embedded-hal = "0.2"
nb = "0.1.2"
cortex-m = "0.6"
cortex-m-rt = "0.6"
# Panic behaviour, see https://crates.io/keywords/panic-impl for alternatives
panic-halt = "0.2"
[dependencies.rhai]
git = "https://github.com/jonathandturner/rhai/"
features = ["no_std", "no_module", "no_function"]
default-features = false
[dependencies.stm32f4xx-hal]
version = "0.8"
features = ["rt", "stm32f411"] # replace the model of your
[profile.release]
codegen-units = 1 # better optimizations
debug = true # symbols are nice and they don't increase the size on Flash
lto = true # better optimizations
opt-level = "z" # optimize for size |
This cargo.toml works well why package giving error in rhai [package]
name = "berzah"
version = "0.1.0"
authors = ["Ahmetcan Aksu <ahmetcanco@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
core-error = { version = "0.0.0", features = ["alloc"], default-features = false}
embedded-hal = "0.2"
nb = "0.1.2"
cortex-m = "0.6"
cortex-m-rt = "0.6"
# Panic behaviour, see https://crates.io/keywords/panic-impl for alternatives
panic-halt = "0.2"
[dependencies.stm32f4xx-hal]
version = "0.8"
features = ["rt", "stm32f411"] # replace the model of your
[profile.release]
codegen-units = 1 # better optimizations
debug = true # symbols are nice and they don't increase the size on Flash
lto = true # better optimizations
opt-level = "z" # optimize for size Verbose output for core-error
|
This one looks better. It doesn't pull in |
So, are you gonna change Cargo.toml in rhai? |
Rhai only pulls in But let me change it to also put in |
Can you pull from my latest and see if it works now. I've taken care not to pull in |
It works fine now Thank you a lot! |
The error seems to think that you're missing the Are you sure your Remember, pulling in rhai with Check out the |
I suggest you read up on The best thing to do is to go through a detailed online tutorial on You can also start with the |
ok! Thank you @schungx |
Frankly speaking, I myself do not use |
well, i wrote many blogs to microcontrollers, circuitpython, micropython, lua, arduino, rtos, etc; now i want to write about RUST. Yes, i will do your suggestion! |
but, please |
All I know is... So I suggest you start with something bare minimum that works, something with rhai, which compiles and runs. Then add Rhai to it. |
@tcpipchip how is this working out for you? |
hi @schungx How are you ? Still tryng to solve that problem! tryng to install probe-run |
Your error messages seem to think that In fact, the source for |
My suggestion is:
|
Hi, thanks to the feeback |
OK, closing this one for now. Feel free to open up another issue if there is a problem. |
Getting good progress in the rust programming! |
I keep getting can't find crate for
std
even with "no_std" featureHere is some of the output
The text was updated successfully, but these errors were encountered: