profile
viewpoint
Dylan McKay dylanmckay @fluxfederation Wellington, New Zealand dylanmckay.io

avr-rust/awesome-avr-rust 54

A list of useful AVR libraries and cool projects, PRs welcome!

dylanmckay/avr 13

An AVR emulator

dylanmckay/compiler 11

A [not-really-working] compiler from the ground-up

4ntoine/clang 9

AVR frontend for the LLVM project

avr-rust/delay 5

arduino-like delay routines based on busy-wait loops

avr-rust/template-bin 4

A template for AVR executable (non-library) projects

dylanmckay/avr-compiler-integration-tests 2

AVR compiler test suite

dylanmckay/delay 2

Compile-time delays for Rust on AVR

dylanmckay/c-parser 1

An [very imcomplete] C parser in Rust

push eventavr-rust/blog.avr-rust.com

Dylan McKay

commit sha 8afe7d9065973c29d50b78f4b3baa83160f00e2f

Set theme jekyll-theme-minimal

view details

push time in a month

push eventavr-rust/blog.avr-rust.com

Dylan McKay

commit sha 3ea9c86a7fbf369f5d90a097f2aa5edb9c465099

Set theme jekyll-theme-cayman

view details

push time in a month

push eventavr-rust/blog.avr-rust.com

Dylan McKay

commit sha 7927d6760b9efa5e0e9a14151146c61363dc4288

Initial commit

view details

push time in a month

delete branch avr-rust/book.avr-rust.com

delete branch : document-avr-unknown-gnu-atmega328-target

delete time in a month

push eventavr-rust/book.avr-rust.com

Dylan McKay

commit sha 33bd7bc17f4cbf404c8c1a3cee54825013d36962

Shift the page numbers under step '3' up one

view details

Dylan McKay

commit sha 9fa5566254ebeb5e7908c53dadb02c106054e58c

Add documentation for the new builtin 'avr-unknown-gnu-atmega328' target This was added to Rust in https://github.com/rust-lang/rust/pull/74941

view details

push time in a month

push eventavr-rust/book.avr-rust.com

Gabriel Grant

commit sha a268ed960b9f3eee79b105419be52de9ad228d5d

Add note about slower baud rate on older Arduinos

view details

push time in a month

PullRequestReviewEvent

push eventavr-rust/book.avr-rust.com

Gabriel Grant

commit sha 043ad3b51c1a1163a36ec97b61bd92f942ef0ed8

Add command to install the nightly toolchain Existing command to add component fails if nightly isn't already installed

view details

push time in a month

PR merged avr-rust/book.avr-rust.com

Add command to install the nightly toolchain

Existing command to add component fails if nightly isn't already installed:

$ rustup component add rust-src --toolchain nightly
error: toolchain 'nightly-x86_64-unknown-linux-gnu' is not installed 
+2 -0

1 comment

1 changed file

gabrielgrant

pr closed time in a month

pull request commentavr-rust/book.avr-rust.com

Add command to install the nightly toolchain

Thanks!

gabrielgrant

comment created time in a month

PullRequestReviewEvent

pull request commentrust-lang/rust

[AVR] Replace broken 'avr-unknown-unknown' target with 'avr-unknown-gnu-atmega328' target

Strange, seemingly unrelated "command not found" error from bors https://github.com/rust-lang-ci/rust/runs/1032158434#step:23:22604 ([run-make] run-make-fulldeps\pgo-indirect-call-promotion)

dylanmckay

comment created time in a month

push eventdylanmckay/avr-compiler-integration-tests

Dylan McKay

commit sha bd3152a74f7d03cb96e7b14e83fcd88aac88e25e

Add tests for bit shifting

view details

push time in a month

pull request commentrust-lang/rust

[AVR] Replace broken 'avr-unknown-unknown' target with 'avr-unknown-gnu-atmega328' target

The branch has now been rebased.

dylanmckay

comment created time in a month

pull request commentavr-rust/ruduino

Export ClockSource and WaveformGenerationMode for each timer

Published 0.2.6.

Nashenas88

comment created time in a month

created tagavr-rust/ruduino

tag0.2.6

Reusable components for the Arduino Uno.

created time in a month

push eventavr-rust/ruduino

Dylan McKay

commit sha 41967edeb2fb5c875f2616e24030ca524cde5a21

Bump patch version to 0.2.6

view details

push time in a month

pull request commentavr-rust/ruduino

Export ClockSource and WaveformGenerationMode for each timer

Thanks @Nashenas88!

Nashenas88

comment created time in a month

push eventavr-rust/ruduino

Paul Daniel Faria

commit sha c11738600f7f37f6287ceff267dc07727c5d5d08

Export ClockSource and WaveformGenerationMode for each timer

view details

push time in a month

issue closedavr-rust/ruduino

WaveformGenerationMode / ClockSource are private

image

This makes it hard to use :-)

closed time in a month

shepmaster

push eventdylanmckay/rust

Dylan McKay

commit sha c9ead8c895593452677a229fd19909c83283b33f

[AVR] Replace 'avr-unknown-unknown' with 'avr-unknown-gnu-atmega328' in platform-support.md

view details

push time in a month

push eventllvm/llvm-project

Julien Etienne

commit sha 0f0be3fb8ddeca4bbcffc7b22319254c360ca24b

Add support for AVR attiny441 and attiny841 Reviewed By: dylanmckay Differential Revision: https://reviews.llvm.org/D85589 Patch by Julien Etienne

view details

push time in a month

push eventdylanmckay/rust

Bastian Kauschke

commit sha 644c8949121da0c16f65b772bf6e217748d94530

test min_const_generics using revisions

view details

Amanieu d'Antras

commit sha d51b7b229a09561311de67ef7bb5137204e227dd

Update hashbrown to 0.8.1

view details

Amanieu d'Antras

commit sha e3283e0331f6301b1dd8fc24d886c29359c49bbd

Handle new HashMap layout in GDB and LLDB

view details

MaulingMonkey

commit sha 122c03745ed18452fc3559862ff47f551bc44181

Handle new HashMap layout in CDB, MSVC, WinDbg, etc.

view details

Manish Goregaokar

commit sha 5f331c05853983001a1319d4d2116c44a087e5a4

Rollup merge of #74774 - oliver-giersch:set_data_ptr, r=dtolnay adds [*mut|*const] ptr::set_ptr_value I propose the addition of these two functions to `*mut T` and `*const T`, respectively. The motivation for this is primarily byte-wise pointer arithmetic on (potentially) fat pointers, i.e. for types with a `T: ?Sized` bound. A concrete use-case has been discussed in [this](https://internals.rust-lang.org/t/byte-wise-fat-pointer-arithmetic/12739) thread. TL;DR: Currently, byte-wise pointer arithmetic with potentially fat pointers in not possible in either stable or nightly Rust without making assumptions about the layout of fat pointers, which is currently still an implementation detail and not formally stabilized. This PR adds one function to `*mut T` and `*const T` each, allowing to circumvent this restriction without exposing any internal implementation details. One possible alternative would be to add specific byte-wise pointer arithmetic functions to the two pointer types in addition to the already existing count-wise functions. However, I feel this fairly niche use case does not warrant adding a whole set of new functions like `add_bytes`, `offset_bytes`, `wrapping_offset_bytes`, etc. (times two, one for each pointer type) to `libcore`.

view details

Manish Goregaokar

commit sha 5b1ed09df0528ec47e9007bfbf53ab3e584b97eb

Rollup merge of #75079 - jyn514:disambiguator, r=Manishearth Disallow linking to items with a mismatched disambiguator Closes https://github.com/rust-lang/rust/issues/74851 r? @Manishearth

view details

Manish Goregaokar

commit sha 25c8e9ac172cca11fc23b21f3bba4b2653a9bad2

Rollup merge of #75203 - canova:btreemap-into-iter, r=dtolnay Make `IntoIterator` lifetime bounds of `&BTreeMap` match with `&HashMap` This is a pretty small change on the lifetime bounds of `IntoIterator` implementations of both `&BTreeMap` and `&mut BTreeMap`. This is loosening the lifetime bounds, so more code should be accepted with this PR. This is lifetime bounds will still be implicit since we have `type Item = (&'a K, &'a V);` in the implementation. This change will make the HashMap and BTreeMap share the same signature, so we can share the same function/trait with both HashMap and BTreeMap in the code. Fixes #74034. r? @dtolnay hey, I was touching this file on my previous PR and wanted to fix this on the way. Would you mind taking a look at this, or redirecting it if you are busy?

view details

Manish Goregaokar

commit sha 9ab750d05dfc112b132ea4774ae105ca00474e46

Rollup merge of #75227 - Amanieu:fix_asm_arch, r=Mark-Simulacrum Fix ICE when using asm! on an unsupported architecture Fixes #75220

view details

Ivan Tham

commit sha 3d1388f514ab18ad798251f511c54097ba5c60ca

Add more examples to Path ends_with We faced a footgun when using ends_with to check extension, showing an example could prevent that.

view details

Amanieu d'Antras

commit sha e46bb17936abd262df4190fcac851cb9d48d10b4

Fix natvis tests

view details

bors

commit sha d4c940f0821754a98491b2d23fbb5323c14a2bf5

Auto merge of #75244 - Manishearth:rollup-dzfyjva, r=Manishearth Rollup of 4 pull requests Successful merges: - #74774 (adds [*mut|*const] ptr::set_ptr_value) - #75079 (Disallow linking to items with a mismatched disambiguator) - #75203 (Make `IntoIterator` lifetime bounds of `&BTreeMap` match with `&HashMap` ) - #75227 (Fix ICE when using asm! on an unsupported architecture) Failed merges: r? @ghost

view details

bors

commit sha 8b26609481c956a666f9189738f1ba611078e1ab

Auto merge of #70052 - Amanieu:hashbrown7, r=Mark-Simulacrum Update hashbrown to 0.8.1 This update includes: - https://github.com/rust-lang/hashbrown/pull/146, which improves the performance of `Clone` and implements `clone_from`. - https://github.com/rust-lang/hashbrown/pull/159, which reduces the size of `HashMap` by 8 bytes. - https://github.com/rust-lang/hashbrown/pull/162, which avoids creating small 1-element tables. Fixes #28481

view details

Guillaume Gomez

commit sha 48a6c2125b5313f5d0f6d713d72033dbe559588e

Only add a border for the rust logo

view details

Ralf Jung

commit sha 0aee186723a3bb3290fd4348b92b3c1aad862fc9

make MaybeUninit::as_(mut_)ptr const

view details

Ralf Jung

commit sha ec5d78d35004846f1d0c344e968eaf0068a68357

fix feature gate and tracking issue

view details

Nazım Can Altınova

commit sha e31116af50f35ff81f83561ba607c610f42bbf4a

Add `into_{keys,values}` methods for HashMap

view details

Nazım Can Altınova

commit sha 13529f22ba574e723bea2514ba153bd0dc53bfbb

Add `into_{keys,values}` methods for BTreeMap

view details

Nazım Can Altınova

commit sha 41dd4ee7ffea3e2bed0422675143426b322fc23b

Add unit tests for new `HashMap::into_{keys,values}` methods

view details

Nazım Can Altınova

commit sha 29d9233cf6cc874a03f8a8040115ade40feedf23

Add unit tests for new `BTreeMap::into_{keys,values}` methods

view details

bors

commit sha 1e0e618cfbcb9240e6beac8cd16778b369ebe1b7

Auto merge of #73842 - euclio:doctest-expn, r=GuillaumeGomez Use outermost invocation span for doctest names Fixes #70090. This PR also allows using aux-build files in rustdoc-ui tests.

view details

push time in a month

pull request commentavr-rust/avr-mcu

Update to latest mega pack to add ATmega4808/4809

Released 0.3.4

imle

comment created time in 2 months

created tagavr-rust/avr-mcu

tag0.3.4

Pragmatic access to AVR chip specifications

created time in 2 months

push eventavr-rust/avr-mcu

Dylan McKay

commit sha 474d9b978217536991eb129b7e415f842de1afdf

Bump the patch version to 0.3.4

view details

push time in 2 months

push eventavr-rust/avr-mcu

imle

commit sha a697763b9e663c4c1c4adfa4dd9bc4b5540eb518

Addition of ATmega4808/4809

view details

imle

commit sha 41596e327c1aeb4b38f1a7b0052cde8a3e281819

Addition of ATmega4808/4809 to info

view details

imle

commit sha caf99d932f5484c3b62213855c6ae70ec40f9da1

Add latest mega pack

view details

imle

commit sha 3d8b3f01eb9ca3941159998aa323e25d768216ef

Latest pack updated info with new devices

view details

Dylan McKay

commit sha bfb07d4166cf1db2636bc5ebde5a3da8979f20de

Merge pull request #11 from imle/master Update to latest mega pack to add ATmega4808/4809

view details

push time in 2 months

PR merged avr-rust/avr-mcu

Update to latest mega pack to add ATmega4808/4809
+32826 -23438

1 comment

134 changed files

imle

pr closed time in 2 months

pull request commentavr-rust/avr-mcu

Update to latest mega pack to add ATmega4808/4809

Nice work, thanks for the PR!

imle

comment created time in 2 months

created tagavr-rust/ruduino

tag0.2.5

Reusable components for the Arduino Uno.

created time in 2 months

push eventavr-rust/ruduino

Dylan McKay

commit sha 302095dca22f63a160d44c1fdcdc0fdf1db4072d

Bump the patch version to 0.2.5

view details

push time in 2 months

delete branch avr-rust/ruduino

delete branch : use-volatile-mem-ops

delete time in 2 months

push eventavr-rust/ruduino

Dylan McKay

commit sha 3868326bca8188df46da3efef040941667f1ffd9

Replace regular memory read/writes with volatile memory read/writes Fixes #21.

view details

push time in 2 months

issue closedavr-rust/ruduino

Shouldn't all IO registers use volatile operations?

    fn toggle_raw(mask: Self::T) {
        unsafe {
            *Self::ADDRESS ^= mask;
        }
    }

As I understand it, without using volatile operations, the compiler can see something like port = on; port = off; port = on and optimize that to just port = on.

closed time in 2 months

shepmaster

create barnchavr-rust/ruduino

branch : use-volatile-mem-ops

created branch time in 2 months

delete branch avr-rust/book.avr-rust.com

delete branch : document-io-libraries

delete time in 2 months

push eventavr-rust/book.avr-rust.com

Dylan McKay

commit sha 4cff3e2b3ed3f482985428eb2258c13899086d2a

Add documentation around IO, including existing libraries and a bare-metal example

view details

push time in 2 months

push eventavr-rust/book.avr-rust.com

Jonah Dahlquist

commit sha d59df86823583246de3d8a1f0c7041fa867ef417

Added instructions for manually installing avr-gcc and avrdude

view details

Dylan McKay

commit sha 0cf97cf71e37d2e43f5ee7e2c9b5d7135dd6185f

Typo fix

view details

push time in 2 months

Pull request review commentavr-rust/book.avr-rust.com

Added instructions for manually installing avr-gcc and avrdude

 To install all required dependencies under Ubuntu Linux, run sudo apt-get install binutils gcc-avr avr-libc avrdude ``` +## Linux++If your distrobution's package manager doesn't provide these tools, you can install them manually.

Just realized I can do this myself in GitHub now

jonahbron

comment created time in 2 months

push eventjonahbron/book.avr-rust.com

Dylan McKay

commit sha 20c7bbb1129e6169f7c935f8ba200a98f6941b67

Typo fix

view details

push time in 2 months

create barnchavr-rust/book.avr-rust.com

branch : document-io-libraries

created branch time in 2 months

delete branch avr-rust/book.avr-rust.com

delete branch : document-no-main-attr

delete time in 2 months

push eventavr-rust/book.avr-rust.com

Dylan McKay

commit sha 2034aff64e6e8748dd2131eac87ffb33ac4d86fc

Add documentation for adding the #[no_main] attribute to executables

view details

Dylan McKay

commit sha f1997280655faf6ec35bd1393133d1e92370252b

Increment duplicated number in numbered list

view details

push time in 2 months

push eventavr-rust/book.avr-rust.com

Dylan McKay

commit sha dfc8ab4792fe1f657a071676de5b4768149ba1f9

Increment duplicated number in numbered list

view details

push time in 2 months

create barnchavr-rust/book.avr-rust.com

branch : document-no-main-attr

created branch time in 2 months

delete branch avr-rust/blink

delete branch : remove-redundant-nightly-feature

delete time in 2 months

push eventavr-rust/blink

Dylan McKay

commit sha 7c58f52a3c1f829215235d9b1c91e42346dd2cf6

Remove the unused nightly #[feature(lang_items)] attribute from the crate

view details

push time in 2 months

create barnchavr-rust/blink

branch : remove-redundant-nightly-feature

created branch time in 2 months

push eventavr-rust/book.avr-rust.com

Dylan McKay

commit sha f201fe04843eb5716c261dedbde4e430a7431d02

Add a link to the Rust guide on #[no_std]

view details

push time in 2 months

push eventdylanmckay/rust

flip1995

commit sha f7acea2683c6124854bfe20e7127e4dfba344d3e

Register redundant_field_names and non_expressive_names as early passes

view details

flip1995

commit sha 485229c4a3d6a2fbe40f5a6976a33144a27497c6

Fix fallout in redundant_field_names

view details

flip1995

commit sha efd3dcff97f67f376e354c047133ce9044c52991

Fix fallout in similar_names

view details

Eduardo Broto

commit sha bb37a0f948b02e6434dbe3ea615960052d37f784

Avoid triggering similar names on code from expansion

view details

Alexis Bourget

commit sha 2853448426ce76926baa7e6e6173c15228e4951a

Document the ref keyword

view details

Stefan Lankes

commit sha 6813c1c69baf870a479c70e23ad0550d1d9aa9be

revise RwLock, which is derived from the wasm implementation - increasing the readability of `Condvar` - simplify the interface to the libos HermitCore

view details

Stefan Lankes

commit sha 3acc3ef10d2099a4b3118e8c705b36f4bbaf6f64

minor changes to pass the format check

view details

Stefan Lankes

commit sha beb1b1fa5b1047c7caf8a1d499725df3c1ad8cad

reorder crates to pass the format check

view details

Stefan Lankes

commit sha f9c609164251abc136eb9bda55c92cb99adb5c86

remove some compiler warnings

view details

Trevor Spiteri

commit sha 6dfe144bdd4413ac55cbb2ad2edfb1daa0c4bf15

stabilize const_nonzero_int_methods

view details

Trevor Spiteri

commit sha 9739b512a892628534e730ffcd9756b3218c8de8

stabilize some const_checked_int_methods

view details

Trevor Spiteri

commit sha c1c674c2dbfe3f6dc47d11368c1b5ee4ab008799

stabilize const_saturating_int_methods

view details

Trevor Spiteri

commit sha 056d925167318636fcf975c8ffb81efebdc9bca3

stabilize const_int_sign

view details

Trevor Spiteri

commit sha 2a84e313df095fd0e81b9348b68bd9b1d1caa551

stabilize const_ascii_ctype_on_intrinsics

view details

Adam Perry

commit sha d275739c09f266479d6db388cbf55ba6ca791b9d

Derive common traits for panic::Location. Add documentation about the host/target behavior of Location::file.

view details

Alexis Bourget

commit sha 837a761b398a6ff6a97f7f61e390dae9efbeab79

Document the where keyword

view details

Andrey Zgarbul

commit sha 7d4a92d4f8dc03409984695d78893fffdd3ff1f9

remove LengthAtMost32 on AsRef/Borrow impl for array

view details

Roman Proskuryakov

commit sha eff62069ad602090e8d27b83cffd9e77479ed4be

Remove the usage of the LengthAtMost32 trait

view details

Roman Proskuryakov

commit sha 4ad40a8737ab4ffaf6352ec4560fd86cb0b4ade8

Remove LengthAtMost32

view details

Roman Proskuryakov

commit sha 44dd95e4d008e9edc112dc1a599eac028889e015

Fix copypaste in test into-iter-impls-length-33 (const generic 32 -> 33)

view details

push time in 2 months

delete branch avr-rust/blink

delete branch : cleanup-target-spec

delete time in 2 months

push eventavr-rust/blink

Dylan McKay

commit sha 76a28c425df6bd60669fdaa4164267fdabfe2153

[target spec] Remove unnecessary linking parameters Libc is not required. Also, '-Os' is a NOP when passed to the linker.

view details

push time in 2 months

PR merged avr-rust/blink

[target spec] Remove unnecessary linking parameters

Libc is not required. Also, '-Os' is a NOP when passed to the linker.

+2 -8

1 comment

1 changed file

dylanmckay

pr closed time in 2 months

push eventdylanmckay/rust

Dylan McKay

commit sha 4749465913bb710a52be52e1db40c0877c9c5192

[AVR] Rename the last few remaining references from 'avr-unknown-unknown' to 'avr-unknown-gnu-atmega328'

view details

push time in 2 months

push eventavr-rust/book.avr-rust.com

Dylan McKay

commit sha 8822e84f73751b99b6eea48676932d58a2202666

Add a link to the embedonomicon docs on #[no_std]

view details

push time in 2 months

issue commentavr-rust/book.avr-rust.com

Demonstrate how to get the target JSON file

Regarding the replacement of avr-unknown-unknown with avr-unknown-gnu-atmega328 in rust-lang/rust#74941

I want to make a clearer distinction that this target is for the "GNU pathway". I can imagine that some downstream users might not AVR GCC for linking at all - for example, when the build target is a static library for use via FFI in C code which does not need to be linked for distribution.

There has been some work on AVR support in the LLD linker and compiler-rt, at some point in the future it should be possible to use the compiler without the GNU tools.

shepmaster

comment created time in 2 months

issue commentavr-rust/book.avr-rust.com

Demonstrate how to get the target JSON file

Once https://github.com/rust-lang/rust/pull/74941 lands the preferred way to do this will be rustc -Z unstable-options --print target-spec-json --target avr-unknown-gnu-atmega328 > my-target.json which will be added to the doc. From there, the only things needed to update the file to a new MCU will be cpu and the -mmcu option passed to the linker so that it uses the same CPU.

Added link to Embedonomicon in 66db0fb4bc5c8cfdafa193779faf760ca5b18705, thanks @couchand

shepmaster

comment created time in 2 months

push eventavr-rust/book.avr-rust.com

Dylan McKay

commit sha 66db0fb4bc5c8cfdafa193779faf760ca5b18705

Add a link to the embedonomicon section on target specification files Thanks to @couchand for the link in https://github.com/avr-rust/book.avr-rust.com/issues/10#issuecomment-666885573

view details

push time in 2 months

startedRahix/avr-hal

started time in 2 months

push eventavr-rust/book.avr-rust.com

Dylan McKay

commit sha ebeb7ff0e0e6a566c58b1dd02f80a2ec2ddaf1ec

Update a typo in the target spec JSON documentation

view details

push time in 2 months

push eventavr-rust/book.avr-rust.com

Dylan McKay

commit sha a4ea8b435fa0f44c9b8b2bd117cc7bd9f29315a5

Add a bulleted list of invariants relating to target spec JSON files This should make it clear what they do up front.

view details

push time in 2 months

delete branch avr-rust/book.avr-rust.com

delete branch : document-more-stuff

delete time in 2 months

push eventavr-rust/book.avr-rust.com

Dylan McKay

commit sha 92955a4df46a6b4dc288cb783ca750c1c4fb0368

Add documentation about the target specification JSON file

view details

Dylan McKay

commit sha 1aaf811750058eabff37e9a0aef51d30a2f8dcec

Add documentation for the `#[no_std]` attribute

view details

push time in 2 months

PR merged avr-rust/book.avr-rust.com

Document more stuff

Document #[no_std] attribute and the target specification JSON format

+152 -0

0 comment

5 changed files

dylanmckay

pr closed time in 2 months

PR opened avr-rust/book.avr-rust.com

Document more stuff

Document #[no_std] attribute and the target specification JSON format

+152 -0

0 comment

5 changed files

pr created time in 2 months

create barnchavr-rust/book.avr-rust.com

branch : document-more-stuff

created branch time in 2 months

Pull request review commentrust-lang/rust

[AVR] Replace broken 'avr-unknown-unknown' target with 'avr-unknown-gnu-atmega328' target

+use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};++/// A base target for AVR devices using the GNU toolchain.+///+/// Requires GNU avr-gcc and avr-binutils on the host system.+pub fn target(target_cpu: String) -> TargetResult {+    Ok(Target {+        arch: "avr".to_string(),+        data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".to_string(),+        llvm_target: "avr-unknown-unknown".to_string(),+        target_endian: "little".to_string(),+        target_pointer_width: "16".to_string(),+        linker_flavor: LinkerFlavor::Gcc,+        target_os: "unknown".to_string(),+        target_env: "".to_string(),+        target_vendor: "unknown".to_string(),+        target_c_int_width: 16.to_string(),+        options: TargetOptions {+            cpu: target_cpu.clone(),+            exe_suffix: ".elf".to_string(),+            linker: Some("avr-gcc".to_owned()),+            pre_link_args: vec![(+                LinkerFlavor::Gcc,+                vec!["-Os".to_owned(), format!("-mmcu={}", target_cpu)],

I ended up removing it in c4d3e03eb82719f86d20ae105a19c81ce80f5587. Most AVR projects will still need to use a custom JSON target specification file, in which case, it is trivial to add custom link arguments that can be tailored to the project.

dylanmckay

comment created time in 2 months

Pull request review commentrust-lang/rust

[AVR] Replace broken 'avr-unknown-unknown' target with 'avr-unknown-gnu-atmega328' target

+use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};++/// A base target for AVR devices using the GNU toolchain.+///+/// Requires GNU avr-gcc and avr-binutils on the host system.+pub fn target(target_cpu: String) -> TargetResult {+    Ok(Target {+        arch: "avr".to_string(),+        data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".to_string(),+        llvm_target: "avr-unknown-unknown".to_string(),+        target_endian: "little".to_string(),+        target_pointer_width: "16".to_string(),+        linker_flavor: LinkerFlavor::Gcc,+        target_os: "unknown".to_string(),+        target_env: "".to_string(),+        target_vendor: "unknown".to_string(),+        target_c_int_width: 16.to_string(),+        options: TargetOptions {+            cpu: target_cpu.clone(),+            exe_suffix: ".elf".to_string(),+            linker: Some("avr-gcc".to_owned()),+            pre_link_args: vec![(+                LinkerFlavor::Gcc,+                vec!["-Os".to_owned(), format!("-mmcu={}", target_cpu)],+            )]+            .into_iter()+            .collect(),+            late_link_args: vec![(LinkerFlavor::Gcc, vec!["-lc".to_owned(), "-lgcc".to_owned()])]+                .into_iter()+                .collect(),+            ..super::freestanding_base::opts()

Agree, fixed in ffe98aa186312f9e8a74765f75e0f32757cc425a

dylanmckay

comment created time in 2 months

Pull request review commentrust-lang/rust

[AVR] Replace broken 'avr-unknown-unknown' target with 'avr-unknown-gnu-atmega328' target

+use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};++/// A base target for AVR devices using the GNU toolchain.+///+/// Requires GNU avr-gcc and avr-binutils on the host system.+pub fn target(target_cpu: String) -> TargetResult {+    Ok(Target {+        arch: "avr".to_string(),+        data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".to_string(),+        llvm_target: "avr-unknown-unknown".to_string(),+        target_endian: "little".to_string(),+        target_pointer_width: "16".to_string(),+        linker_flavor: LinkerFlavor::Gcc,+        target_os: "unknown".to_string(),+        target_env: "".to_string(),+        target_vendor: "unknown".to_string(),+        target_c_int_width: 16.to_string(),+        options: TargetOptions {+            cpu: target_cpu.clone(),+            exe_suffix: ".elf".to_string(),+            linker: Some("avr-gcc".to_owned()),+            pre_link_args: vec![(+                LinkerFlavor::Gcc,+                vec!["-Os".to_owned(), format!("-mmcu={}", target_cpu)],+            )]+            .into_iter()+            .collect(),+            late_link_args: vec![(LinkerFlavor::Gcc, vec!["-lc".to_owned(), "-lgcc".to_owned()])]

Upon further inspection, I don't believe libc is actually required. I copied the options over from the blink example, but it is totally stripped out when linking as there are no references to it in emitted Rust or LLVM code.

I've dropped the dependency in c4d3e03eb82719f86d20ae105a19c81ce80f5587

dylanmckay

comment created time in 2 months

push eventdylanmckay/rust

Dylan McKay

commit sha c4d3e03eb82719f86d20ae105a19c81ce80f5587

[AVR] Remove unnecessary arguments passed to the linker for GNU target In general, linking with libc is not required, only libgcc is needed. As suggested in the code review, a better option for libc support is by building it into rust-lang/libc directly. This also removes the '-Os' argument to the linker, which is a NOP.

view details

Dylan McKay

commit sha ffe98aa186312f9e8a74765f75e0f32757cc425a

[AVR] Merge the 'freestanding' base target spec into AVR base target spec The 'freestanding' module was only ever used for AVR. It was an unnecessary layer of abstraction. This commit merges the 'freestanding_base' module into 'avr_gnu_base'.

view details

push time in 2 months

pull request commentavr-rust/blink

[target spec] Remove unnecessary linking parameters

The CI is affected by

https://stackoverflow.com/questions/63151602/rust-process-failed-with-exit-code-101-using-github-actions/63153228#63153228

dylanmckay

comment created time in 2 months

PR opened avr-rust/blink

[target spec] Remove unnecessary linking parameters

Libc is not required. Also, '-Os' is a NOP when passed to the linker.

+2 -8

0 comment

1 changed file

pr created time in 2 months

create barnchavr-rust/blink

branch : cleanup-target-spec

created branch time in 2 months

Pull request review commentrust-lang/rust

[AVR] Replace broken 'avr-unknown-unknown' target with 'avr-unknown-gnu-atmega328' target

+use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};++/// A base target for AVR devices using the GNU toolchain.+///+/// Requires GNU avr-gcc and avr-binutils on the host system.+pub fn target(target_cpu: String) -> TargetResult {+    Ok(Target {+        arch: "avr".to_string(),+        data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".to_string(),+        llvm_target: "avr-unknown-unknown".to_string(),+        target_endian: "little".to_string(),+        target_pointer_width: "16".to_string(),+        linker_flavor: LinkerFlavor::Gcc,+        target_os: "unknown".to_string(),+        target_env: "".to_string(),+        target_vendor: "unknown".to_string(),+        target_c_int_width: 16.to_string(),+        options: TargetOptions {+            cpu: target_cpu.clone(),+            exe_suffix: ".elf".to_string(),+            linker: Some("avr-gcc".to_owned()),+            pre_link_args: vec![(+                LinkerFlavor::Gcc,+                vec!["-Os".to_owned(), format!("-mmcu={}", target_cpu)],

Using strace on the avr-gcc frontend, it looks like -Os has no effect when GCC is invoked as a linker, as it is here. The flags passed to avr-ld do not change under the presence of -Os or not. I will remove the option from the array, good catch.

dylanmckay

comment created time in 2 months

push eventdylanmckay/rust

Dylan McKay

commit sha 2ec4b70696a5ca2430ee0f4108678a1143fd942f

[AVR] Replace broken 'avr-unknown-unknown' target with 'avr-unknown-gnu-atmega328' target The `avr-unknown-unknown` target has never worked correctly, always trying to invoke the host linker and failing. It aimed to be a mirror of AVR-GCC's default handling of the `avr-unknown-unknown' triple (assume bare minimum chip features, silently skip linking runtime libraries, etc). This behaviour is broken-by-default as it will cause a miscompiled executable when flashed. This patch improves the AVR builtin target specifications to instead expose only a 'avr-unknown-gnu-atmega328' target. This target system is `gnu`, as it uses the AVR-GCC frontend along with avr-binutils. The target triple ABI is 'atmega328'. In the future, it should be possible to replace the dependency on AVR-GCC and binutils by using the in-progress AVR LLD and compiler-rt support. Perhaps at that point it would make sense to add an 'avr-unknown-unknown-atmega328' target as a better default when implemented. There is no current intention to add in-tree AVR target specifications for other AVR microcontrollers - this one can serve as a reference implementation for other devices via `rustc --print target-spec-json avr-unknown-gnu-atmega328p`. There should be no users of the existing 'avr-unknown-unknown' Rust target as a custom target specification JSON has always been recommended, and the avr-unknown-unknown target could never pass the linking step anyway.

view details

push time in 2 months

startedNiedzwiedzw/blink

started time in 2 months

PR opened rust-lang/rust

[AVR] Replace broken 'avr-unknown-unknown' target with 'avr-unknown-gnu-atmega328' target

The avr-unknown-unknown target has never worked correctly, always trying to invoke the host linker and failing. It aimed to be a mirror of AVR-GCC's default handling of the `avr-unknown-unknown' triple (assume bare minimum chip features, silently skip linking runtime libraries, etc). This behaviour is broken-by-default as it will cause a miscompiled executable when flashed.

This patch improves the AVR builtin target specifications to instead expose only a 'avr-unknown-gnu-atmega328' target. This target system is gnu, as it uses the AVR-GCC frontend along with avr-binutils. The target triple ABI is 'atmega328'.

In the future, it should be possible to replace the dependency on AVR-GCC and binutils by using the in-progress AVR LLD and compiler-rt support. Perhaps at that point it would make sense to add an 'avr-unknown-unknown-atmega328' target as a better default when implemented.

There is no current intention to add in-tree AVR target specifications for other AVR microcontrollers - this one can serve as a reference implementation for other devices via rustc --print target-spec-json avr-unknown-gnu-atmega328p.

There should be no users of the existing 'avr-unknown-unknown' Rust target as a custom target specification JSON has always been recommended, and the avr-unknown-unknown target could never pass the linking step anyway.

+40 -18

0 comment

4 changed files

pr created time in 2 months

create barnchdylanmckay/rust

branch : replace-broken-avr-unknown-unknown-target

created branch time in 2 months

Pull request review commentavr-rust/book.avr-rust.com

Added instructions for manually installing avr-gcc and avrdude

 To install all required dependencies under Ubuntu Linux, run sudo apt-get install binutils gcc-avr avr-libc avrdude ``` +## Linux++If your distrobution's package manager doesn't provide these tools, you can install them manually.

s/distrobution/distribution

jonahbron

comment created time in 2 months

push eventavr-rust/blink

vringar

commit sha e05ad9d70aec5a233993c5d24020808b8496be5a

Switch to 2018 edition

view details

Dylan McKay

commit sha ec26148c8a850fa8052dc0ba43e2de0da2d7f3a9

Merge pull request #19 from vringar/changing_edition Switch to 2018 edition

view details

push time in 2 months

PR merged avr-rust/blink

Switch to 2018 edition
+1 -2

1 comment

2 changed files

vringar

pr closed time in 2 months

pull request commentavr-rust/blink

Switch to 2018 edition

Nice, thanks!

vringar

comment created time in 2 months

push eventdylanmckay/rust

Dylan McKay

commit sha 0cfbe07cf3d4db8af6072a1265d1d6053fcc107c

[AVR] Replace broken 'avr-unknown-unknown' target with 'avr-unknown-gnu-atmega328' target The `avr-unknown-unknown` target has never worked correctly, always trying to invoke the host linker and failing. It aimed to be a mirror of AVR-GCC's default handling of the `avr-unknown-unknown' triple (assume bare minimum chip features, silently skip linking runtime libraries, etc). This behaviour is never desired as it will cause a broken executable when flashed. This patch improves the AVR builtin target specifications to instead expose only a 'avr-unknown-gnu-atmega328' target. This target system is `gnu`, as it uses the AVR-GCC frontend along with avr-binutils. The target triple ABI is 'atmega328'. In the future, it should be possible to replace the dependency on AVR-GCC and binutils by using the in-progress AVR LLD and compiler-rt support. Perhaps at that point it would make sense to add an 'avr-unknown-unknown-atmega328' target as a better default when implemented. There is no intention to add in-tree AVR target specifications for other AVR microcontrollers - this one can serve as a reference implementation for other devices via `rustc --print target-spec-json avr-unknown-gnu-atmega328p`. There should be no users of the existing 'avr-unknown-unknown' Rust target as a custom target specification JSON has always been recommended, and the avr-unknown-unknown target could never pass the linking step anyway.

view details

push time in 2 months

create barnchdylanmckay/rust

branch : fix-avr-unknown-unknown

created branch time in 2 months

issue commentavr-rust/book.avr-rust.com

Installing required third party tools from source

In https://github.com/rust-lang/rust/pull/74631/files Rust got support for disabling --eh-frame-hdr flag via the "eh-frame-header": false target specification JSON option.

The blink example has this so that --eh-frame-hdr is not passed to the linker. My avr-gcc linker (Arch Linux) doesn't support the --eh-frame-hdr flag either (even though it is a very recent version of binutils). Here is the example in blink.

Good suggestion on adding distro-independent avr-gcc installation instructions. Raised #18.

This should be fixed by #10 when instructions for getting/creating a target specification JSON file are written.

jonahbron

comment created time in 2 months

more