working flash

master
Edward Shen 2020-01-25 19:14:40 -05:00
parent 37a3ffb1bf
commit 2b88bcf6f5
Signed by: edward
GPG Key ID: 19182661E818369F
4 changed files with 11 additions and 10 deletions

6
Makefile Normal file
View File

@ -0,0 +1,6 @@
.PHONY: build
build:
cargo build --release
arm-none-eabi-objcopy -O binary target/thumbv6m-none-eabi/release/onyx.elf target/onyx.bin
bossac -ewvRo 0x2000 target/onyx.bin

3
flash
View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
cargo build --release && sudo bossac -p /dev/ttyACM0 -e -w -v -R --offset 0x2000 target/thumbv6m-none-eabi/release/onyx

View File

@ -1,7 +1,7 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000 + 8K, LENGTH = 256K - 8K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
FLASH : ORIGIN = 0x00000000 + 8K, LENGTH = 256K - 8K
RAM : ORIGIN = 0x20000000, LENGTH = 32K
}
/* This is where the call stack will be allocated. */

View File

@ -26,13 +26,11 @@ fn main() -> ! {
&mut peripherals.NVMCTRL,
);
let mut pins = hal::Pins::new(peripherals.PORT);
let mut red_led = pins.d13.into_open_drain_output(&mut pins.port);
let mut red_led = pins.d13.into_push_pull_output(&mut pins.port);
let mut delay = Delay::new(core.SYST, &mut clocks);
loop {
delay.delay_ms(200u8);
red_led.set_high().unwrap();
delay.delay_ms(200u8);
red_led.set_low().unwrap();
delay.delay_ms(1000u16);
red_led.toggle();
}
}