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

Noob Issue: Cant manage to get this building for the stm32f1xx_hal #168

Closed
zacck opened this issue Oct 20, 2022 · 6 comments
Closed

Noob Issue: Cant manage to get this building for the stm32f1xx_hal #168

zacck opened this issue Oct 20, 2022 · 6 comments

Comments

@zacck
Copy link

zacck commented Oct 20, 2022

  • Version of ssd1306 in use (if applicable): GME12864-42

  • MCU/other hardware in use: STM32f103

  • Display resolution and interface: [SPI/I2C], [128x64]

Description of the problem/feature request/other

My issue at the moment is that I can't get my source code to even build I run into a linker error when I try and declare the interface

My code

//! Print "Hello world!" with "Hello rust!" underneath. Uses the `embedded_graphics` crate to draw
//! the text with a 6x8 pixel font.
//!
//! This example is for the STM32F103 "Blue Pill" board using I2C1.
//!
//! Wiring connections are as follows for a CRIUS-branded display:
//!
//! ```
//!      Display -> Blue Pill
//! (black)  GND -> GND
//! (red)    +5V -> VCC
//! (yellow) SDA -> PB9
//! (green)  SCL -> PB8
//! ```
//!
//! Run on a Blue Pill with `cargo run --example text_i2c`.

#![no_std]
#![no_main]

use cortex_m_rt::{entry, exception, ExceptionFrame};
use embedded_graphics::{
    mono_font::{ascii::FONT_6X10, MonoTextStyleBuilder},
    pixelcolor::BinaryColor,
    prelude::*,
    text::{Baseline, Text},
};
use panic_halt as _;
use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306};
use stm32f1xx_hal::{
    i2c::{BlockingI2c, DutyCycle, Mode},
    prelude::*,
    stm32,
};

#[entry]
fn main() -> ! {
    let dp = stm32::Peripherals::take().unwrap();

    let mut flash = dp.FLASH.constrain();
    let mut rcc = dp.RCC.constrain();

    let clocks = rcc.cfgr.freeze(&mut flash.acr);

    let mut afio = dp.AFIO.constrain();

    let mut gpiob = dp.GPIOB.split();

    let scl = gpiob.pb8.into_alternate_open_drain(&mut gpiob.crh);
    let sda = gpiob.pb9.into_alternate_open_drain(&mut gpiob.crh);

    let i2c = BlockingI2c::i2c1(
        dp.I2C1,
        (scl, sda),
        &mut afio.mapr,
        Mode::Fast {
            frequency: 400.kHz(),
            duty_cycle: DutyCycle::Ratio2to1,
        },
        clocks,
        1000,
        10,
        1000,
        1000,
    );

    let interface = I2CDisplayInterface::new(i2c);
    let mut display = Ssd1306::new(interface, DisplaySize128x64, DisplayRotation::Rotate0)
        .into_buffered_graphics_mode();
    display.init().unwrap();

    let text_style = MonoTextStyleBuilder::new()
        .font(&FONT_6X10)
        .text_color(BinaryColor::On)
        .build();

    Text::with_baseline("Hello world!", Point::zero(), text_style, Baseline::Top)
        .draw(&mut display)
        .unwrap();

    Text::with_baseline("Hello Rust!", Point::new(0, 16), text_style, Baseline::Top)
        .draw(&mut display)
        .unwrap();

    display.flush().unwrap();

    loop {}
}

My Cargo file

[package]
authors = ["Zacck Osiemo <coderv63@gmail.com>"]
edition = "2018"
readme = "README.md"
name = "blinky"
version = "0.1.0"

[dependencies]
cortex-m = "0.7.6"
cortex-m-rt = "0.7.1"
cortex-m-semihosting = "0.5.0"
cortex-m-rtic = "1.1.3"
panic-halt = "0.2.0"
embedded-hal = "0.2.7"
nb = "0.1.2"

# screen deps
hd44780-driver = "0.4.0"
keypad2 = "0.1.1"
embedded-graphics = "0.7.1"
ssd1306 = "0.7.1"
shared-bus = {  git = "https://github.com/Rahix/shared-bus", features = ["cortex-m"] }

# low range rfid
mfrc522 = "0.3.0"

# Dev dependencies
systick-monotonic = "1.0.0"



[dependencies.stm32f1xx-hal]
version = "0.9.0"
features = ["rt", "stm32f103", "medium"]

# this lets you use `cargo fix`!
[[bin]]
name = "blinky"
test = false
bench = false

[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

The error I am running into

error: linking with `rust-lld` failed: exit status: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "/var/folders/ys/gyj5sv6x4cg9cwzjdpj_cw3r0000gn/T/rustcf3uEWJ/symbols.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.10yil6jvfxhxvoly.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.14rg6runaeuwgi7k.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.1600vbpxdlzrwaxc.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.16fhc1jljqvv2iu6.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.1e6kmwo5eq0p1koe.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.1et1trfp11lcga9x.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.1smok0bnzyrutori.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.1uqd41w13yuyxsde.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.1vglvnh2j6h44h8p.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.20yju4kyjd7bbtd2.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.22du24j83lri8bw2.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.231eymdfzodsn20x.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.24tt6o63nfdr31uh.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.267iv5ugm3it8gu8.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.29c1rc5xa1cvqykm.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.29ucdp0dbxef3atm.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.2bp1k05tvcncwxd6.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.2br78hv9lbpqlk7x.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.2bxrf0emua8temb9.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.2cr9t4t1qwfaus2i.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.2dgob5cj6gt0bf40.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.2ear8kurp4je1o5z.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.2fuvere7u14ne3dw.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.2hft6bi38pon4x1.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.2j1tjbmnjjgd14kj.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.2p45fcd4t55ms4kz.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.2r8q2zfz4uz23jb8.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.30msr3ynkl5qe4i8.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.325qjhrngn90mma7.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.3aaak54im0mfpssq.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.3cwxqxrhq06lxr5a.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.3gyu8hw0b7o4ce7g.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.3khl5q8xgknzgpsf.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.3olfjc8bjhcw6evs.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.3w4tscvgadmsrjxy.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.3w8el6xvoypypdtu.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.3y44shcw5y570pil.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.3z93cfbylqgkvbr.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.3za1bktn7oal1y5b.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.3znbpgb66v3hm2tl.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.40cty7wcdsugrezm.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.44kgpofot6awuelj.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.48b9ddn0m25bgf1t.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.4b8d7sqs76wqf2fp.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.4djrzprledj3qzvq.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.4hlk8hgd50rgux00.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.4iu14f6se8d5wdif.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.4m23b9o6d5tuik5k.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.4pa13fzhpohq643t.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.4v8bmguo3q7wpvoe.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.4xhbp54hnef89u28.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.4yghcnpyh9zx85nk.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.50qm0d7ibvbklxe6.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.52kcropifm5g2hp5.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.54i0yz6giec96u3t.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.5b62tsysf3y4o2dp.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.5bacec3vuk4wld1m.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.5bhhnv7ck39yjmpi.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.5dki9rysz698y4ru.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.5e89erf2xuujfor1.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.5mywgsa439q601x.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.6zxsrssj570m7s.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.97d89av91yar1pp.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.awx1ewd0ydlxasj.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.b1p6rwofxj52qa1.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.cjnm2i2grgxbg26.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.cyau3b5rdx595zd.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.ecq9fclqyher1yx.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.ffo7ze8caevm9dn.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.fjg2lj7595fbw00.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.ixwlwc2o76g2su3.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.iyc9jj8e6s4ichs.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.l6vlrct8y2j46za.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.xgybnz2yxd15i9j.rcgu.o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c.ydu7bjqamft31uu.rcgu.o" "--as-needed" "-L" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps" "-L" "/Users/zacck/Documents/learn_rust/blinky/target/debug/deps" "-L" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/build/blinky-4b90c90833c2634c/out" "-L" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/build/cortex-m-1715dc8a0efedd44/out" "-L" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/build/cortex-m-rt-73f1d5335b952166/out" "-L" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/build/stm32f1-1abc85f1c672a7bf/out" "-L" "/Users/zacck/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/thumbv7m-none-eabi/lib" "-Bstatic" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libstm32f1xx_hal-a124fd3e2dcdcf86.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libfugit_timer-8d2e274f69a1e41e.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libbxcan-fd8db05e8e071853.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libbitflags-ed52a36e34360d81.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libstm32_usbd-4b25e14143e5fbbe.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libusb_device-f8a0aa89fbe89c02.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libfugit-c087d5dca01ee5f9.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libgcd-d52b3a8af26e1833.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libembedded_dma-62ff58938153f7d9.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libstable_deref_trait-52b0af28d1de68d5.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libstm32f1-86690ad6dbca048a.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libcortex_m-11c81090967d9494.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libvolatile_register-fa075c106c31ffcd.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libvcell-c87b0edad0f9dc57.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libbare_metal-8d4aa70e6df416a0.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libssd1306-c9f3b846d4e52c5e.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libdisplay_interface_spi-30dad2c62527f5bf.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libbyte_slice_cast-a86bfd394b1c40ac.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libdisplay_interface_i2c-c6ac80fd5902ab64.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libembedded_hal-b36d1d1ad4a4abb8.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libvoid-df27e342674ddc16.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libnb-64ad5b722b29ab63.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libnb-833ddeb9b4a6d59b.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libdisplay_interface-d499591c66ae7184.rlib" "--start-group" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libpanic_halt-59ce7e5733747437.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libembedded_graphics-4f8c258fe73df0fa.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libbyteorder-bc12ea0087343a75.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libfloat_cmp-b80a47bd9993d83b.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libnum_traits-54c6b67736a5df6e.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libmicromath-aa9220280076249d.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libembedded_graphics_core-71ba4cf8db42720c.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libaz-dc6efe80dd5c7b2a.rlib" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/libcortex_m_rt-35348c1ccbee33a2.rlib" "/Users/zacck/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/thumbv7m-none-eabi/lib/librustc_std_workspace_core-46c2fa85efc4755c.rlib" "/Users/zacck/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/thumbv7m-none-eabi/lib/libcore-dde37187527e49e0.rlib" "--end-group" "/Users/zacck/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/thumbv7m-none-eabi/lib/libcompiler_builtins-0293eeb129523d3a.rlib" "-Bdynamic" "--eh-frame-hdr" "-znoexecstack" "-L" "/Users/zacck/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/thumbv7m-none-eabi/lib" "-o" "/Users/zacck/Documents/learn_rust/blinky/target/thumbv7m-none-eabi/debug/deps/blinky-014cac237aa8171c" "--gc-sections" "--nmagic" "-Tlink.x"
  = note: rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 52 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 74 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 100 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 186 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 254 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 316 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 358 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 380 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 398 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 432 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 460 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 470 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 486 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 522 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 530 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 578 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 602 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 612 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 648 bytes
          rust-lld: error: section '.text' will not fit in region 'FLASH': overflowed by 696 bytes
          rust-lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)

thank you so much for your time!

@jamwaffles
Copy link
Collaborator

You most likely need to run with --release - debug builds are often too large to fit in flash memory which is what the linker error is describing.

@blaa
Copy link

blaa commented Dec 27, 2022

Yes. I've just set this up with stm32f1xx_hal and --release is required pretty much all the time. Without using write!, semihosting, etc. it's possible to get this to fit without --release.

With --release I'm at 13.7k which leaves plenty of space still.

@jamwaffles
Copy link
Collaborator

Great! Glad to hear it's working :)

@blaa
Copy link

blaa commented Dec 27, 2022

Just need to add that I in fact have sh1106 oled - that almost (which is a bit confusing) works with ssd1306. Text was a bit shifted, but otherwise would be usable. I was starting to try to fix memory offsets when I found some info that it might be a different chipset.

If you have a FAQ section somewhere it might be worth noting there (?).

Still this issue is certainly worth closing. ;)

@jamwaffles
Copy link
Collaborator

Ah, in that case you might want to try the sh1106 driver which should work better with that IC.

@blaa
Copy link

blaa commented Dec 27, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants