Comments (4)
Can you share more details what exactly you were doing? How did you build the example? How did you flash it?
from avr-hal.
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.
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.
Ha, turns out, that was all it was! Thank you so much!
from avr-hal.
Related Issues (20)
- Panic while trying to write to serial using `ufmt::uwriteln` HOT 4
- Add configurable board options to ravedude HOT 3
- Get pin number HOT 6
- Program freezes if compiled in debug mode.
- ravedude should check rust target against selected MCU HOT 3
- Document clock type design in more detail HOT 1
- cargo build - error[E0658] - proc_macro::Literal::byte_character(byte) HOT 9
- can't find crate for `core` HOT 12
- cargo build - error[E0658] - proc_macro::Literal::byte_character(byte) HOT 4
- Very weird error when compiling a very basic program: __addsf3 multiple defenitions HOT 9
- Ravedude freezes on programmer uploading HOT 5
- Arduino Nano: avrdude error: programmer is not responding HOT 11
- Watchdog intterupt mode HOT 1
- [Solved] Cannot find `pwm` in `embedded_hal` HOT 2
- peripherals type alias HOT 2
- Enhance `avr_hal_generic::renamed_pins! {}` to also generate type aliases for each pin
- tier 3 target and broken HOT 4
- Utilising the `atmega2560`'s "USART in SPI Mode" HOT 10
- Issue with math calculations with floats to serial port output HOT 5
- Incorrect ADC readings after toolchain bump HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avr-hal.