Git Product home page Git Product logo

Comments (4)

Rahix avatar Rahix commented on August 18, 2024

Can you share more details what exactly you were doing? How did you build the example? How did you flash it?

from avr-hal.

mckayb avatar mckayb commented on August 18, 2024

All the code is here:
https://github.com/mckayb/rust-arduino/tree/project/love-o-meter/rust-arduino-03-love-o-meter

I copied the src directly from:
https://github.com/Rahix/avr-hal/blob/master/boards/arduino-uno/examples/uno-serial.rs

To build it, I installed all of the avr tools, overrode rust to nightly, and just ran cargo build with the target set to the avr-atmega328p.json file listed in the code.

To flash it, I ran avrdude -q -patmega328p -carduino -P/dev/tty.usbmodem144301 -D -Uflash:w:"target/avr-atmega328p/debug/rust-arduino-03-love-o-meter.elf"

This was the output of both of those commands:

    Updating crates.io index
   Compiling rust-arduino-03-love-o-meter v0.1.0 (/Users/mckaybroderick/Code/rust-arduino/rust-arduino-03-love-o-meter)
    Finished dev [unoptimized + debuginfo] target(s) in 0.95s

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "target/avr-atmega328p/debug/rust-arduino-03-love-o-meter.elf"
avrdude: input file target/avr-atmega328p/debug/rust-arduino-03-love-o-meter.elf auto detected as ELF
avrdude: writing flash (23882 bytes):
avrdude: 23882 bytes of flash written
avrdude: verifying flash memory against target/avr-atmega328p/debug/rust-arduino-03-love-o-meter.elf:
avrdude: load data flash data from input file target/avr-atmega328p/debug/rust-arduino-03-love-o-meter.elf:
avrdude: input file target/avr-atmega328p/debug/rust-arduino-03-love-o-meter.elf auto detected as ELF
avrdude: input file target/avr-atmega328p/debug/rust-arduino-03-love-o-meter.elf contains 23882 bytes
avrdude: reading on-chip flash data:
avrdude: verifying ...
avrdude: 23882 bytes of flash verified

avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you.

Then when I ran screen /dev/tty.usbmodem144301 57600
I just see a blank screen. When I type, nothing happens.

Thanks for taking a look at this. Let me know if there's something else you need.

from avr-hal.

Rahix avatar Rahix commented on August 18, 2024

Hmm, so you're building a debug build:

    Finished dev [unoptimized + debuginfo] target(s) in 0.95s

and looking into your Cargo.toml, I see you've configured the compile profiles as follows:

[profile.dev]
panic = "abort"

[profile.release]
panic = "abort"

This will produce a huge bloated binary because absolutely no optimizations are done (no inlining, dead code removal, constant folding, etc.). This means, it eats a lot of the available flash memory (23.3 KiB from your output above) but will also run very slowly. I could see this massively throwing off the timing for the USART peripheral and thus nothing is working. It could also run into a lot of other issues due to the missing optimizations.

I would recommend trying to configure the compiler to more aggresively optimize, in both debug and release builds. In step 5 of Starting your own project in avr-hal's README, the settings we recommend are these:

[profile.dev]
panic = "abort"
lto = true
opt-level = "s"

[profile.release]
panic = "abort"
codegen-units = 1
debug = true
lto = true
opt-level = "s"

I'd give those a try, maybe that is all that's needed to make it work :)

from avr-hal.

mckayb avatar mckayb commented on August 18, 2024

Ha, turns out, that was all it was! Thank you so much!

from avr-hal.

Related Issues (20)

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.