Add boilerplate stuff

This commit is contained in:
Luca 2020-10-30 21:05:41 +01:00
parent f27ef7b505
commit 02f4cd0de1
6 changed files with 55 additions and 1 deletions

2
.cargo/config Normal file
View File

@ -0,0 +1,2 @@
[build]
target = "thumbv6m-none-eabi"

3
.gitignore vendored
View File

@ -1 +1,2 @@
/target
target/
Cargo.lock

View File

@ -6,3 +6,5 @@ edition = "2018"
readme = "README.md"
[dependencies]
cortex-m-rt = "0.6.13"
panic-halt = "0.2.0"

15
build.rs Normal file
View File

@ -0,0 +1,15 @@
use std::env;
use std::fs;
use std::io::Write;
use std::path::PathBuf;
fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
fs::File::create(out_dir.join("memory.x"))
.unwrap()
.write_all(include_bytes!("memory.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out_dir.display());
println!("cargo:rerun-if-changed=memory.x");
}

6
memory.x Normal file
View File

@ -0,0 +1,6 @@
/* STM32F072CxT6 */
MEMORY
{
FLASH : ORIGIN = 0x08000000, LENGTH = 64K /* change length to 128K for STM32F072CBT6 */
RAM : ORIGIN = 0x20000000, LENGTH = 16K
}

28
src/main.rs Normal file
View File

@ -0,0 +1,28 @@
/*
* any key firmware
* Copyright (C) 2020 Luca Schmid
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#![no_std]
#![no_main]
use cortex_m_rt::entry;
use panic_halt as _;
#[entry]
fn main() -> ! {
loop {}
}