Git Product home page Git Product logo

embedded-in-rust's People

Contributors

cldershem avatar elpiel avatar fauxfaux avatar jamesmunns avatar japaric avatar jdburnet 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

embedded-in-rust's Issues

quickstart.md lldb

In the quickstart post you mention lldb not having a load command. For a workaround for devices that support st-link you can use st-flash to load. You have to use arm-none-eabi-objcopy to convert the elf to a bin first, but it's pretty easy to automate with a makefile or script.

Linker overlapping errors when adding sections to linker script

I get the following linker issues when I add sections to the linker script:
(I used the linker script successfully in a C project)

>   = note: rust-lld: error: section .vector_table file range overlaps with .text
>           >>> .vector_table range is [0x1000, 0x10BF]
>           >>> .text range is [0x1000, 0x6D07]
>           
>           rust-lld: error: section .text file range overlaps with .debug_str
>           >>> .text range is [0x1000, 0x6D07]
>           >>> .debug_str range is [0x2000, 0x36DE7]
>           
>           rust-lld: error: section .text virtual address range overlaps with .vector_table
>           >>> .text range is [0x8000000, 0x8005D07]
>           >>> .vector_table range is [0x8000000, 0x80000BF]
>           
>           rust-lld: error: section .text load address range overlaps with .vector_table
>           >>> .text range is [0x8000000, 0x8005D07]
>           >>> .vector_table range is [0x8000000, 0x80000BF]

Linker script:

MEMORY {
  FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K
  RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K
}
SECTIONS
{
 .text : {
     *(.vectors)                                                                             
     *(.text*)
     . = ALIGN(4);
     *(.rodata*)
     . = ALIGN(4);
 } >FLASH
}

Application source (blink)

extern crate cortex_m_semihosting as sh;
extern crate panic_semihosting;
extern crate stm32l0;
extern crate cortex_m;
use stm32l0::stm32l0x3;

use core::fmt::Write;

use rt::ExceptionFrame;
use sh::hio;
use cortex_m::asm;

entry!(main);

fn main() -> ! {
    let mut stdout = hio::hstdout().unwrap();
    writeln!(stdout, "REL STINKT!").unwrap();
    let per = stm32l0x3::Peripherals::take().unwrap();
    let gpioa = &per.GPIOA;
    let rcc = &per.RCC;

    rcc.iopenr.write(|w| w.iopaen().set_bit());
    unsafe {
        gpioa.moder.write(|w| w.mode5().bits(1));
    }
    loop {
        gpioa.odr.write(|w| {
            w.od5().bit(gpioa.odr.read().od5().bit_is_clear())
        });
        for i in 0..1000 {
            asm::nop()
        }
    }
}

exception!(HardFault, hard_fault);

fn hard_fault(ef: &ExceptionFrame) -> ! {
    panic!("HardFault at {:#?}", ef);
}

exception!(*, default_handler);

fn default_handler(irqn: i16) {
    panic!("Unhandled exception (IRQn = {})", irqn);
}

Environment:

o blink cargo -V
cargo 1.30.0-nightly (2fb77a49b 2018-09-07)
o blink rustup -V
rustup 1.13.0
o blink cat Cargo.toml
[package]
name = "cortex-m-blink"
version = "0.3.4"
authors = ["roel0"]
description = "a simple blink app"
keywords = ["arm", "cortex-m", "template"]
categories = ["embedded", "no-std"]

[profile.release]
lto = true
codegen-units = 1
debug = false

[dependencies.cortex-m]
version = "0.5.6"

[dependencies.cortex-m-rt]
version = "0.5.3"

[dependencies.cortex-m-semihosting]
version = "0.3.1"

[dependencies.panic-semihosting]
version = "0.3.0"

[dependencies.stm32l0]
version = "0.2.3"
features = ["stm32l0x3", "rt"]

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.