Fixed build issues.
Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
parent
c788231108
commit
01355f9873
|
@ -1,7 +1,8 @@
|
|||
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||
rustflags = [
|
||||
# LLD (shipped with the Rust toolchain) is used as the default linker
|
||||
"-C", "link-arg=-Tlink.x",
|
||||
]
|
||||
|
||||
[build]
|
||||
target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
|
||||
target = "thumbv6m-none-eabi"
|
||||
|
|
|
@ -46,6 +46,7 @@ checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9"
|
|||
dependencies = [
|
||||
"bare-metal",
|
||||
"bitfield",
|
||||
"critical-section",
|
||||
"embedded-hal",
|
||||
"volatile-register",
|
||||
]
|
||||
|
|
|
@ -7,7 +7,7 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
ch57x-pac = {git = "https://git.minori.work/Embedded_SDK/WCH_CH57x_PAC.git", features = ["critical-section"]}
|
||||
cortex-m = "0.7.6"
|
||||
cortex-m = {version = "0.7.6", features = ["critical-section-single-core"]}
|
||||
cortex-m-rt = "0.6.13"
|
||||
cortex-m-semihosting = "0.3.3"
|
||||
panic-halt = "0.2.0"
|
||||
|
|
27
src/main.rs
27
src/main.rs
|
@ -3,7 +3,6 @@
|
|||
|
||||
use panic_halt as _;
|
||||
|
||||
use cortex_m::asm;
|
||||
use cortex_m::peripheral::syst;
|
||||
use cortex_m_rt::entry;
|
||||
|
||||
|
@ -17,14 +16,30 @@ fn main() -> ! {
|
|||
let mut systick = core_peripherals.SYST;
|
||||
|
||||
systick.set_clock_source(syst::SystClkSource::Core);
|
||||
systick.set_reload(16_000);
|
||||
systick.set_reload(8_000_000);
|
||||
systick.clear_current();
|
||||
|
||||
systick.enable_counter();
|
||||
|
||||
while !systick.has_wrapped() {
|
||||
asm::nop();
|
||||
}
|
||||
let ch57x_sys = peripherals.SYS;
|
||||
|
||||
loop {}
|
||||
/* PB0: LED, data set to 1 */
|
||||
ch57x_sys.r32_pb_out__r8_slv_rd_data.modify(|r, w| unsafe {
|
||||
w.bits(r.bits() | 0x01)
|
||||
});
|
||||
|
||||
/* PB0: LED, direction set to output */
|
||||
ch57x_sys.r32_pb_dir.modify(|r, w| unsafe {
|
||||
w.bits(r.bits() | 0x01)
|
||||
});
|
||||
|
||||
loop {
|
||||
while !systick.has_wrapped() {
|
||||
}
|
||||
|
||||
/* Toggle LED */
|
||||
ch57x_sys.r32_pb_out__r8_slv_rd_data.modify(|r, w| unsafe {
|
||||
w.bits(r.bits() ^ 0x01)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue