From 2b88bcf6f57b586cd7bb6ed3956a44cb8c1b7d33 Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Sat, 25 Jan 2020 19:14:40 -0500 Subject: [PATCH] working flash --- Makefile | 6 ++++++ flash | 3 --- memory.x | 4 ++-- src/main.rs | 8 +++----- 4 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 Makefile delete mode 100755 flash diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0b0c59c --- /dev/null +++ b/Makefile @@ -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 \ No newline at end of file diff --git a/flash b/flash deleted file mode 100755 index 31cb46a..0000000 --- a/flash +++ /dev/null @@ -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 \ No newline at end of file diff --git a/memory.x b/memory.x index 65cd5a2..28559d6 100644 --- a/memory.x +++ b/memory.x @@ -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. */ diff --git a/src/main.rs b/src/main.rs index e2bb178..27b8625 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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(); } }