Skip to content

Commit

Permalink
Basic build setup for at2560
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigovalle committed Sep 15, 2020
0 parents commit ed154b8
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build]
target = "avr-unknown-gnu-atmega2560.json"

[unstable]
build-std = ["core"]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "rust-test"
version = "0.1.0"
authors = ["Rodrigo Valle <[email protected]>"]
edition = "2018"

[dependencies]
# this is broken
#ruduino = "0.2"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
basically atmega2560.json is required to be the name because of a bug with
relative paths in dylanmckay/target-cpu-utils
34 changes: 34 additions & 0 deletions avr-unknown-gnu-atmega2560.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"arch": "avr",
"atomic-cas": false,
"cpu": "atmega2560",
"data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8",
"eh-frame-header": false,
"env": "",
"exe-suffix": ".elf",
"executables": true,
"is-builtin": true,
"late-link-args": {
"gcc": [
"-lgcc",
"-lc"
]
},
"linker": "avr-gcc",
"linker-flavor": "gcc",
"linker-is-gnu": true,
"llvm-target": "avr-unknown-unknown",
"max-atomic-width": 0,
"os": "unknown",
"panic-strategy": "abort",
"pre-link-args": {
"gcc": [
"-mmcu=atmega2560",
"-Wl,--as-needed"
]
},
"target-c-int-width": "16",
"target-endian": "little",
"target-pointer-width": "16",
"vendor": "unknown"
}
1 change: 1 addition & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nightly
24 changes: 24 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#![feature(llvm_asm)]

#![no_std]
#![no_main]

use core::panic::PanicInfo;


#[no_mangle]
pub extern fn main() {
delay();
}

fn delay() {
for _ in 0..400000 {
unsafe { llvm_asm!("" :::: "volatile") }
}
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
//println!("{}", info);
loop {}
}

0 comments on commit ed154b8

Please sign in to comment.