barafael / rust-sipeed-longan-DAC

A minimal example of using the DAC on the RISC-V Sipeed Longan Nano via Rust.
MIT License
5 stars 0 forks source link

rust-pac: section `.text.dummy' will not fit in region `FLASH' #1

Open advancedwebdeveloper opened 3 years ago

advancedwebdeveloper commented 3 years ago

oceanfish81@gollvm:~/Desktop$ git clone --single-branch --branch rust-pac https://github.com/barafael/rust-sipeed-longan-DAC longan_dac_rust-pac Cloning into 'longan_dac_rust-pac'... remote: Enumerating objects: 38, done. remote: Counting objects: 100% (38/38), done. remote: Compressing objects: 100% (28/28), done. remote: Total 38 (delta 10), reused 29 (delta 6), pack-reused 0 Unpacking objects: 100% (38/38), done. Checking connectivity... done.

~/Desktop/longan_dac_rust-pac$ cargo build Updating crates.io index Downloaded riscv-rt v0.6.2 Downloaded 1 crate (14.4 KB) in 1.70s Compiling semver-parser v0.7.0 Compiling proc-macro2 v0.4.30 Compiling riscv v0.5.4 Compiling unicode-xid v0.1.0 Compiling bit_field v0.9.0 Compiling rand_core v0.4.2 Compiling syn v0.15.44 Compiling nb v1.0.0 Compiling vcell v0.1.2 Compiling void v1.0.2 Compiling gd32vf103xx-hal v0.2.3 Compiling longan-nano v0.1.1 Compiling riscv-rt v0.6.2 Compiling rust-longan-dac v0.1.0 (/home/oceanfish81/Desktop/longan_dac_rust-pac) Compiling r0 v0.2.2 Compiling panic-abort v0.3.2 Compiling panic-halt v0.2.0 Compiling embedded-graphics v0.5.2 Compiling semver v0.9.0 Compiling rand_core v0.3.1 Compiling nb v0.1.3 Compiling rustc_version v0.2.3 Compiling rand v0.5.6 Compiling embedded-hal v0.2.4 Compiling bare-metal v0.2.5 Compiling cast v0.2.3 Compiling quote v0.6.13 Compiling riscv-rt-macros v0.1.6 Compiling gd32vf103-pac v0.2.0 error: linking with riscv32-unknown-elf-ld failed: exit code: 1 | = note: "riscv32-unknown-elf-ld" "-L" "/home/oceanfish81/.rustup/toolchains/nightly-i686-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f.1dq6wl4x9vqslasz.rcgu.o" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f.1pm3z79c7nk7ytyn.rcgu.o" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f.26197xidw0qzow84.rcgu.o" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f.2cyoechrpxkewp2m.rcgu.o" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f.38vex13t3gzjd6w4.rcgu.o" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f.3p7krsu2mb346mm9.rcgu.o" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f.4n629f1e7eym4lg2.rcgu.o" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f.5ggnhkzvv7kor6t0.rcgu.o" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f.ktutb6yupqvq3uw.rcgu.o" "-o" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f" "--gc-sections" "-L" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps" "-L" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/debug/deps" "-L" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/build/rust-longan-dac-ad87f2b63f3399bd/out" "-L" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/build/gd32vf103xx-hal-072470ce25380e32/out" "-L" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/build/riscv-50ecf700bc5ead16/out" "-L" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/build/longan-nano-430876beb173c6a1/out" "-L" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/build/riscv-rt-02bf3cd650071c2e/out" "-L" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/build/riscv-rt-02bf3cd650071c2e/out" "-L" "/home/oceanfish81/.rustup/toolchains/nightly-i686-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib" "-Bstatic" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libriscv_rt-93eb275a7743fd36.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libr0-c85b5ab54aceb5f9.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libgd32vf103xx_hal-1680e7885a8a1190.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libcast-9812cda0f99b47a2.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libembedded_hal-7eefa69faff2c8b3.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libvoid-a6a4a838ac2f6eef.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libnb-2346178da369cec7.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libnb-ff11b26417734117.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libgd32vf103_pac-eadc9eb92b7886cf.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libvcell-1002245d1d075441.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libriscv-8e577a7ab5e5e97b.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libbit_field-b0ec6a30cad97e7c.rlib" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libbare_metal-34e19f23cded4312.rlib" "--start-group" "/home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/libpanic_halt-c9bd1c6fdfabcb3d.rlib" "/home/oceanfish81/.rustup/toolchains/nightly-i686-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib/librustc_std_workspace_core-1bd0d3673780d693.rlib" "/home/oceanfish81/.rustup/toolchains/nightly-i686-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib/libcore-5aec724f1f867fb1.rlib" "--end-group" "/home/oceanfish81/.rustup/toolchains/nightly-i686-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib/libcompiler_builtins-deaf2d068ddf18c0.rlib" "-Tmemory.x" "-Tlink.x" "-Bdynamic" = note: riscv32-unknown-elf-ld: /home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f section .text.dummy' will not fit in regionFLASH' riscv32-unknown-elf-ld: /home/oceanfish81/Desktop/longan_dac_rust-pac/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-851c73491d78216f section .stack' will not fit in regionRAM' riscv32-unknown-elf-ld: region FLASH' overflowed by 134152192 bytes riscv32-unknown-elf-ld: regionRAM' overflowed by 536870912 bytes

error: aborting due to previous error

error: could not compile rust-longan-dac

In case if that would be of help: the file ~/.cargo/config contained the following:

[target.riscv32imac-unknown-none-elf] linker = "riscv32-unknown-elf-ld" . But once I removed it:

$ cargo build Finished dev [unoptimized + debuginfo] target(s) in 0.14s

.

On a contrary - I can't compile your example, on the "master" branch:

~/Desktop/rust-sipeed-longan-DAC$ cargo build warning: unused import: panic_abort --> src/main.rs:5:5 5 use panic_abort; ^^^^^^^^^^^

= note: #[warn(unused_imports)] on by default

warning: unnecessary parentheses around assigned value --> src/dma.rs:107:12 107 ctl = (init_struct.periph_width init_struct.memory_width init_struct.priority); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
= note: `#[warn(unused_parens)]` on by default

warning: unnecessary parentheses around function argument --> src/dma.rs:152:55 | 152 | set_bits(dma_intc(dma_periph), dma_flag_add(flag, (*channelx as u32))); | ^^^^^^^^^^^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around assigned value --> src/rcu.rs:4:32 | 4 | const RCU_AHB1_BUS_BASE: u32 = (0x4001_8000); | ^^^^^^^^^^^^^ help: remove these parentheses

warning: unused import: crate::dma::DmaChannel::DmaCh2 --> src/main.rs:14:5 | 14 | use crate::dma::DmaChannel::DmaCh2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: crate::DmaChannel::DmaCh4 --> src/main.rs:15:5 | 15 | use crate::DmaChannel::DmaCh4; | ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_SWT --> src/dac.rs:17:1 17 const DAC_SWT: *mut u32 = reg32(DAC + 0x4); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

= note: #[warn(dead_code)] on by default

warning: constant is never used: DAC0_R12DH --> src/dac.rs:19:1 | 19 | const DAC0_R12DH: *mut u32 = reg32(DAC + 0x8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC1_R12DH --> src/dac.rs:20:1 | 20 | const DAC1_R12DH: *mut u32 = reg32(DAC + 0x14); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_ALIGN_12B_R --> src/dac.rs:22:1 | 22 | pub(crate) const DAC_ALIGN_12B_R: u32 = data_align(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC0_DO --> src/dac.rs:24:1 | 24 | const DAC0_DO: *mut u32 = reg32(DAC + 0x2c); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC1_DO --> src/dac.rs:25:1 | 25 | const DAC1_DO: *mut u32 = reg32(DAC + 0x30); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_SWT_SWTR0 --> src/dac.rs:47:1 | 47 | const DAC_SWT_SWTR0: u32 = bit(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_SWT_SWTR1 --> src/dac.rs:48:1 | 48 | const DAC_SWT_SWTR1: u32 = bit(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T2_TRGO --> src/dac.rs:51:1 | 51 | pub(crate) const DAC_TRIGGER_T2_TRGO: u32 = ctl_dtsel(1); / TIMER2 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T6_TRGO --> src/dac.rs:52:1 | 52 | pub(crate) const DAC_TRIGGER_T6_TRGO: u32 = ctl_dtsel(2); / TIMER6 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T4_TRGO --> src/dac.rs:53:1 | 53 | pub(crate) const DAC_TRIGGER_T4_TRGO: u32 = ctl_dtsel(3); / TIMER4 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T1_TRGO --> src/dac.rs:54:1 | 54 | pub(crate) const DAC_TRIGGER_T1_TRGO: u32 = ctl_dtsel(4); / TIMER1 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T3_TRGO --> src/dac.rs:55:1 | 55 | pub(crate) const DAC_TRIGGER_T3_TRGO: u32 = ctl_dtsel(5); / TIMER3 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_EXTI_9 --> src/dac.rs:56:1 | 56 | pub(crate) const DAC_TRIGGER_EXTI_9: u32 = ctl_dtsel(6); / EXTI interrupt line9 event / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_SOFTWARE --> src/dac.rs:57:1 | 57 | pub(crate) const DAC_TRIGGER_SOFTWARE: u32 = ctl_dtsel(7); / software trigger / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_disable --> src/dac.rs:77:8 | 77 | pub fn dac_disable(dac_periph: u32) { | ^^^^^^^^^^^

warning: function is never used: dac_dma_disable --> src/dac.rs:93:8 | 93 | pub fn dac_dma_disable(dac_periph: u32) { | ^^^^^^^^^^^^^^^

warning: function is never used: dac_output_buffer_disable --> src/dac.rs:109:8 | 109 | pub fn dac_output_buffer_disable(dac_periph: u32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_output_value_get --> src/dac.rs:117:8 | 117 | pub fn dac_output_value_get(dac_periph: u32) -> u32 { | ^^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_data_set --> src/dac.rs:125:8 | 125 | pub fn dac_data_set(dac_periph: u32, dac_align: u32, data: u16) { | ^^^^^^^^^^^^

warning: function is never used: dac_trigger_disable --> src/dac.rs:147:8 | 147 | pub fn dac_trigger_disable(dac_periph: u32) { | ^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_software_trigger_enable --> src/dac.rs:175:8 | 175 | pub fn dac_software_trigger_enable(dac_periph: u32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DMA_MEMORY_INCREASE_DISABLE --> src/dma.rs:29:1 | 29 | pub const DMA_MEMORY_INCREASE_DISABLE: u8 = 0x0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: variant is never constructed: DmaCh0 --> src/dma.rs:84:5 | 84 | DmaCh0 = 0, | ^^^^^^^^^^

warning: variant is never constructed: DmaCh5 --> src/dma.rs:89:5 | 89 | DmaCh5, | ^^^^^^

warning: variant is never constructed: DmaCh6 --> src/dma.rs:90:5 | 90 | DmaCh6, | ^^^^^^

warning: function is never used: gpio_bit_set --> src/gpio.rs:34:4 | 34 | fn gpio_bit_set(gpio_periph: u32, pin: u32) { | ^^^^^^^^^^^^

warning: constant is never used: TIMER0 --> src/timer.rs:7:1 | 7 | pub(crate) const TIMER0: u32 = TIMER_BASE + 0x0001_2C00; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER1 --> src/timer.rs:8:1 | 8 | pub(crate) const TIMER1: u32 = TIMER_BASE + 0x0000_0000; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER2 --> src/timer.rs:9:1 | 9 | pub(crate) const TIMER2: u32 = TIMER_BASE + 0x0000_0400; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER3 --> src/timer.rs:10:1 | 10 | pub(crate) const TIMER3: u32 = TIMER_BASE + 0x0000_0800; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER4 --> src/timer.rs:11:1 | 11 | pub(crate) const TIMER4: u32 = TIMER_BASE + 0x0000_0C00; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER6 --> src/timer.rs:13:1 | 13 | pub(crate) const TIMER6: u32 = TIMER_BASE + 0x0000_1400; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_RESET --> src/timer.rs:17:1 | 17 | pub const TIMER_TRI_OUT_SRC_RESET: u32 = ctl1_mmc(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_ENABLE --> src/timer.rs:18:1 | 18 | pub const TIMER_TRI_OUT_SRC_ENABLE: u32 = ctl1_mmc(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_CH0 --> src/timer.rs:20:1 | 20 | pub const TIMER_TRI_OUT_SRC_CH0: u32 = ctl1_mmc(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O0CPRE --> src/timer.rs:21:1 | 21 | pub const TIMER_TRI_OUT_SRC_O0CPRE: u32 = ctl1_mmc(4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O1CPRE --> src/timer.rs:22:1 | 22 | pub const TIMER_TRI_OUT_SRC_O1CPRE: u32 = ctl1_mmc(5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O2CPRE --> src/timer.rs:23:1 | 23 | pub const TIMER_TRI_OUT_SRC_O2CPRE: u32 = ctl1_mmc(6); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O3CPRE --> src/timer.rs:24:1 | 24 | pub const TIMER_TRI_OUT_SRC_O3CPRE: u32 = ctl1_mmc(7); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_UPDIS --> src/timer.rs:29:1 | 29 | const TIMER_CTL0_UPDIS: u32 = bit(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_UPS --> src/timer.rs:30:1 | 30 | const TIMER_CTL0_UPS: u32 = bit(2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_SPM --> src/timer.rs:31:1 | 31 | const TIMER_CTL0_SPM: u32 = bit(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_DIR --> src/timer.rs:32:1 | 32 | const TIMER_CTL0_DIR: u32 = bit(4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_CAM --> src/timer.rs:33:1 | 33 | const TIMER_CTL0_CAM: u32 = bits(5,6); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_ARSE --> src/timer.rs:34:1 | 34 | const TIMER_CTL0_ARSE: u32 = bit(7); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_CKDIV --> src/timer.rs:35:1 | 35 | const TIMER_CTL0_CKDIV: u32 = bits(8,9); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: RCU_GPIOC --> src/rcu.rs:13:1 | 13 | pub(crate) const RCU_GPIOC: u32 = rcu_regidx_bit(APB2EN_REG_OFFSET, 4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: delay --> src/main.rs:90:4 | 90 | fn delay(mut n: u32) { | ^^^^^

warning: 55 warnings emitted

Finished dev [unoptimized + debuginfo] target(s) in 0.20s

oceanfish81@gollvm:~/Desktop/rust-sipeed-longan-DAC$ cargo clean

oceanfish81@gollvm:~/Desktop/rust-sipeed-longan-DAC$ cargo build Compiling panic-abort v0.3.2 Compiling r0 v0.2.2 Compiling rust-longan-dac v0.1.0 (/home/oceanfish81/Desktop/rust-sipeed-longan-DAC) warning: unused import: panic_abort --> src/main.rs:5:5 5 use panic_abort; ^^^^^^^^^^^

= note: #[warn(unused_imports)] on by default

warning: unnecessary parentheses around assigned value --> src/dma.rs:107:12 107 ctl = (init_struct.periph_width init_struct.memory_width init_struct.priority); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
= note: `#[warn(unused_parens)]` on by default

warning: unnecessary parentheses around function argument --> src/dma.rs:152:55 | 152 | set_bits(dma_intc(dma_periph), dma_flag_add(flag, (*channelx as u32))); | ^^^^^^^^^^^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around assigned value --> src/rcu.rs:4:32 | 4 | const RCU_AHB1_BUS_BASE: u32 = (0x4001_8000); | ^^^^^^^^^^^^^ help: remove these parentheses

warning: unused import: crate::dma::DmaChannel::DmaCh2 --> src/main.rs:14:5 | 14 | use crate::dma::DmaChannel::DmaCh2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: crate::DmaChannel::DmaCh4 --> src/main.rs:15:5 | 15 | use crate::DmaChannel::DmaCh4; | ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_SWT --> src/dac.rs:17:1 17 const DAC_SWT: *mut u32 = reg32(DAC + 0x4); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

= note: #[warn(dead_code)] on by default

warning: constant is never used: DAC0_R12DH --> src/dac.rs:19:1 | 19 | const DAC0_R12DH: *mut u32 = reg32(DAC + 0x8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC1_R12DH --> src/dac.rs:20:1 | 20 | const DAC1_R12DH: *mut u32 = reg32(DAC + 0x14); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_ALIGN_12B_R --> src/dac.rs:22:1 | 22 | pub(crate) const DAC_ALIGN_12B_R: u32 = data_align(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC0_DO --> src/dac.rs:24:1 | 24 | const DAC0_DO: *mut u32 = reg32(DAC + 0x2c); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC1_DO --> src/dac.rs:25:1 | 25 | const DAC1_DO: *mut u32 = reg32(DAC + 0x30); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_SWT_SWTR0 --> src/dac.rs:47:1 | 47 | const DAC_SWT_SWTR0: u32 = bit(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_SWT_SWTR1 --> src/dac.rs:48:1 | 48 | const DAC_SWT_SWTR1: u32 = bit(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T2_TRGO --> src/dac.rs:51:1 | 51 | pub(crate) const DAC_TRIGGER_T2_TRGO: u32 = ctl_dtsel(1); / TIMER2 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T6_TRGO --> src/dac.rs:52:1 | 52 | pub(crate) const DAC_TRIGGER_T6_TRGO: u32 = ctl_dtsel(2); / TIMER6 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T4_TRGO --> src/dac.rs:53:1 | 53 | pub(crate) const DAC_TRIGGER_T4_TRGO: u32 = ctl_dtsel(3); / TIMER4 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T1_TRGO --> src/dac.rs:54:1 | 54 | pub(crate) const DAC_TRIGGER_T1_TRGO: u32 = ctl_dtsel(4); / TIMER1 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T3_TRGO --> src/dac.rs:55:1 | 55 | pub(crate) const DAC_TRIGGER_T3_TRGO: u32 = ctl_dtsel(5); / TIMER3 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_EXTI_9 --> src/dac.rs:56:1 | 56 | pub(crate) const DAC_TRIGGER_EXTI_9: u32 = ctl_dtsel(6); / EXTI interrupt line9 event / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_SOFTWARE --> src/dac.rs:57:1 | 57 | pub(crate) const DAC_TRIGGER_SOFTWARE: u32 = ctl_dtsel(7); / software trigger / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_disable --> src/dac.rs:77:8 | 77 | pub fn dac_disable(dac_periph: u32) { | ^^^^^^^^^^^

warning: function is never used: dac_dma_disable --> src/dac.rs:93:8 | 93 | pub fn dac_dma_disable(dac_periph: u32) { | ^^^^^^^^^^^^^^^

warning: function is never used: dac_output_buffer_disable --> src/dac.rs:109:8 | 109 | pub fn dac_output_buffer_disable(dac_periph: u32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_output_value_get --> src/dac.rs:117:8 | 117 | pub fn dac_output_value_get(dac_periph: u32) -> u32 { | ^^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_data_set --> src/dac.rs:125:8 | 125 | pub fn dac_data_set(dac_periph: u32, dac_align: u32, data: u16) { | ^^^^^^^^^^^^

warning: function is never used: dac_trigger_disable --> src/dac.rs:147:8 | 147 | pub fn dac_trigger_disable(dac_periph: u32) { | ^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_software_trigger_enable --> src/dac.rs:175:8 | 175 | pub fn dac_software_trigger_enable(dac_periph: u32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DMA_MEMORY_INCREASE_DISABLE --> src/dma.rs:29:1 | 29 | pub const DMA_MEMORY_INCREASE_DISABLE: u8 = 0x0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: variant is never constructed: DmaCh0 --> src/dma.rs:84:5 | 84 | DmaCh0 = 0, | ^^^^^^^^^^

warning: variant is never constructed: DmaCh5 --> src/dma.rs:89:5 | 89 | DmaCh5, | ^^^^^^

warning: variant is never constructed: DmaCh6 --> src/dma.rs:90:5 | 90 | DmaCh6, | ^^^^^^

warning: function is never used: gpio_bit_set --> src/gpio.rs:34:4 | 34 | fn gpio_bit_set(gpio_periph: u32, pin: u32) { | ^^^^^^^^^^^^

warning: constant is never used: TIMER0 --> src/timer.rs:7:1 | 7 | pub(crate) const TIMER0: u32 = TIMER_BASE + 0x0001_2C00; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER1 --> src/timer.rs:8:1 | 8 | pub(crate) const TIMER1: u32 = TIMER_BASE + 0x0000_0000; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER2 --> src/timer.rs:9:1 | 9 | pub(crate) const TIMER2: u32 = TIMER_BASE + 0x0000_0400; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER3 --> src/timer.rs:10:1 | 10 | pub(crate) const TIMER3: u32 = TIMER_BASE + 0x0000_0800; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER4 --> src/timer.rs:11:1 | 11 | pub(crate) const TIMER4: u32 = TIMER_BASE + 0x0000_0C00; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER6 --> src/timer.rs:13:1 | 13 | pub(crate) const TIMER6: u32 = TIMER_BASE + 0x0000_1400; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_RESET --> src/timer.rs:17:1 | 17 | pub const TIMER_TRI_OUT_SRC_RESET: u32 = ctl1_mmc(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_ENABLE --> src/timer.rs:18:1 | 18 | pub const TIMER_TRI_OUT_SRC_ENABLE: u32 = ctl1_mmc(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_CH0 --> src/timer.rs:20:1 | 20 | pub const TIMER_TRI_OUT_SRC_CH0: u32 = ctl1_mmc(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O0CPRE --> src/timer.rs:21:1 | 21 | pub const TIMER_TRI_OUT_SRC_O0CPRE: u32 = ctl1_mmc(4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O1CPRE --> src/timer.rs:22:1 | 22 | pub const TIMER_TRI_OUT_SRC_O1CPRE: u32 = ctl1_mmc(5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O2CPRE --> src/timer.rs:23:1 | 23 | pub const TIMER_TRI_OUT_SRC_O2CPRE: u32 = ctl1_mmc(6); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O3CPRE --> src/timer.rs:24:1 | 24 | pub const TIMER_TRI_OUT_SRC_O3CPRE: u32 = ctl1_mmc(7); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_UPDIS --> src/timer.rs:29:1 | 29 | const TIMER_CTL0_UPDIS: u32 = bit(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_UPS --> src/timer.rs:30:1 | 30 | const TIMER_CTL0_UPS: u32 = bit(2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_SPM --> src/timer.rs:31:1 | 31 | const TIMER_CTL0_SPM: u32 = bit(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_DIR --> src/timer.rs:32:1 | 32 | const TIMER_CTL0_DIR: u32 = bit(4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_CAM --> src/timer.rs:33:1 | 33 | const TIMER_CTL0_CAM: u32 = bits(5,6); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_ARSE --> src/timer.rs:34:1 | 34 | const TIMER_CTL0_ARSE: u32 = bit(7); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_CKDIV --> src/timer.rs:35:1 | 35 | const TIMER_CTL0_CKDIV: u32 = bits(8,9); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: RCU_GPIOC --> src/rcu.rs:13:1 | 13 | pub(crate) const RCU_GPIOC: u32 = rcu_regidx_bit(APB2EN_REG_OFFSET, 4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: delay --> src/main.rs:90:4 | 90 | fn delay(mut n: u32) { | ^^^^^

error: linking with rust-lld failed: exit code: 1 | = note: "rust-lld" "-flavor" "gnu" "-L" "/home/oceanfish81/.rustup/toolchains/nightly-i686-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.16crx9abw28zf2vj.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.1acslztmmwmc6n0n.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.1o66glvt98dczbuq.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.1qghf6mf9q4mdiy5.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.1vtumlxpsx5dzvaw.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.21coziy96jp31bl0.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.25oborwgroc6fcg.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.29x13nfx1yfi902k.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.2qgd98ocn5js9h1j.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.2xj6146ahsucic09.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.3h6jrbydsdna932b.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.44opj2lz8rse1vjf.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.5b2yxlj3hllnidp1.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.5bfv8l39h427q4o3.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.5djj7cuk2tuoifn8.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.7752l6t6pbx6byd.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.b7xd69iye6pr0n9.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.gy85rgun42pguyi.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.pw3czl2u2z2rgap.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.t70c2v3ww66xdrb.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.vpruumf9vfyq3ff.rcgu.o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd.xbxd5qwzii7wbd3.rcgu.o" "-o" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/rust_longan_dac-4a5d6c52894e24dd" "--gc-sections" "-L" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps" "-L" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/debug/deps" "-L" "/home/oceanfish81/.rustup/toolchains/nightly-i686-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib" "-Bstatic" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/libr0-c85b5ab54aceb5f9.rlib" "--start-group" "/home/oceanfish81/Desktop/rust-sipeed-longan-DAC/target/riscv32imac-unknown-none-elf/debug/deps/libpanic_abort-204e2a56821a9d16.rlib" "/home/oceanfish81/.rustup/toolchains/nightly-i686-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib/librustc_std_workspace_core-1bd0d3673780d693.rlib" "/home/oceanfish81/.rustup/toolchains/nightly-i686-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib/libcore-5aec724f1f867fb1.rlib" "--end-group" "/home/oceanfish81/.rustup/toolchains/nightly-i686-unknown-linux-gnu/lib/rustlib/riscv32imac-unknown-none-elf/lib/libcompiler_builtins-deaf2d068ddf18c0.rlib" "-Tlink.x" "-Bdynamic" = note: rust-lld: error: no memory region specified for section '.eh_frame'

error: aborting due to previous error; 55 warnings emitted

error: could not compile rust-longan-dac

But once I re-create my ~/.cargo/config, with the very same content - Cargo builds the project successfully:

$ cargo build Compiling rust-longan-dac v0.1.0 (/home/oceanfish81/Desktop/rust-sipeed-longan-DAC) warning: unused import: panic_abort --> src/main.rs:5:5 5 use panic_abort; ^^^^^^^^^^^

= note: #[warn(unused_imports)] on by default

warning: unnecessary parentheses around assigned value --> src/dma.rs:107:12 107 ctl = (init_struct.periph_width init_struct.memory_width init_struct.priority); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
= note: `#[warn(unused_parens)]` on by default

warning: unnecessary parentheses around function argument --> src/dma.rs:152:55 | 152 | set_bits(dma_intc(dma_periph), dma_flag_add(flag, (*channelx as u32))); | ^^^^^^^^^^^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around assigned value --> src/rcu.rs:4:32 | 4 | const RCU_AHB1_BUS_BASE: u32 = (0x4001_8000); | ^^^^^^^^^^^^^ help: remove these parentheses

warning: unused import: crate::dma::DmaChannel::DmaCh2 --> src/main.rs:14:5 | 14 | use crate::dma::DmaChannel::DmaCh2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: crate::DmaChannel::DmaCh4 --> src/main.rs:15:5 | 15 | use crate::DmaChannel::DmaCh4; | ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_SWT --> src/dac.rs:17:1 17 const DAC_SWT: *mut u32 = reg32(DAC + 0x4); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

= note: #[warn(dead_code)] on by default

warning: constant is never used: DAC0_R12DH --> src/dac.rs:19:1 | 19 | const DAC0_R12DH: *mut u32 = reg32(DAC + 0x8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC1_R12DH --> src/dac.rs:20:1 | 20 | const DAC1_R12DH: *mut u32 = reg32(DAC + 0x14); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_ALIGN_12B_R --> src/dac.rs:22:1 | 22 | pub(crate) const DAC_ALIGN_12B_R: u32 = data_align(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC0_DO --> src/dac.rs:24:1 | 24 | const DAC0_DO: *mut u32 = reg32(DAC + 0x2c); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC1_DO --> src/dac.rs:25:1 | 25 | const DAC1_DO: *mut u32 = reg32(DAC + 0x30); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_SWT_SWTR0 --> src/dac.rs:47:1 | 47 | const DAC_SWT_SWTR0: u32 = bit(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_SWT_SWTR1 --> src/dac.rs:48:1 | 48 | const DAC_SWT_SWTR1: u32 = bit(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T2_TRGO --> src/dac.rs:51:1 | 51 | pub(crate) const DAC_TRIGGER_T2_TRGO: u32 = ctl_dtsel(1); / TIMER2 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T6_TRGO --> src/dac.rs:52:1 | 52 | pub(crate) const DAC_TRIGGER_T6_TRGO: u32 = ctl_dtsel(2); / TIMER6 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T4_TRGO --> src/dac.rs:53:1 | 53 | pub(crate) const DAC_TRIGGER_T4_TRGO: u32 = ctl_dtsel(3); / TIMER4 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T1_TRGO --> src/dac.rs:54:1 | 54 | pub(crate) const DAC_TRIGGER_T1_TRGO: u32 = ctl_dtsel(4); / TIMER1 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_T3_TRGO --> src/dac.rs:55:1 | 55 | pub(crate) const DAC_TRIGGER_T3_TRGO: u32 = ctl_dtsel(5); / TIMER3 TRGO / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_EXTI_9 --> src/dac.rs:56:1 | 56 | pub(crate) const DAC_TRIGGER_EXTI_9: u32 = ctl_dtsel(6); / EXTI interrupt line9 event / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DAC_TRIGGER_SOFTWARE --> src/dac.rs:57:1 | 57 | pub(crate) const DAC_TRIGGER_SOFTWARE: u32 = ctl_dtsel(7); / software trigger / | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_disable --> src/dac.rs:77:8 | 77 | pub fn dac_disable(dac_periph: u32) { | ^^^^^^^^^^^

warning: function is never used: dac_dma_disable --> src/dac.rs:93:8 | 93 | pub fn dac_dma_disable(dac_periph: u32) { | ^^^^^^^^^^^^^^^

warning: function is never used: dac_output_buffer_disable --> src/dac.rs:109:8 | 109 | pub fn dac_output_buffer_disable(dac_periph: u32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_output_value_get --> src/dac.rs:117:8 | 117 | pub fn dac_output_value_get(dac_periph: u32) -> u32 { | ^^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_data_set --> src/dac.rs:125:8 | 125 | pub fn dac_data_set(dac_periph: u32, dac_align: u32, data: u16) { | ^^^^^^^^^^^^

warning: function is never used: dac_trigger_disable --> src/dac.rs:147:8 | 147 | pub fn dac_trigger_disable(dac_periph: u32) { | ^^^^^^^^^^^^^^^^^^^

warning: function is never used: dac_software_trigger_enable --> src/dac.rs:175:8 | 175 | pub fn dac_software_trigger_enable(dac_periph: u32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: DMA_MEMORY_INCREASE_DISABLE --> src/dma.rs:29:1 | 29 | pub const DMA_MEMORY_INCREASE_DISABLE: u8 = 0x0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: variant is never constructed: DmaCh0 --> src/dma.rs:84:5 | 84 | DmaCh0 = 0, | ^^^^^^^^^^

warning: variant is never constructed: DmaCh5 --> src/dma.rs:89:5 | 89 | DmaCh5, | ^^^^^^

warning: variant is never constructed: DmaCh6 --> src/dma.rs:90:5 | 90 | DmaCh6, | ^^^^^^

warning: function is never used: gpio_bit_set --> src/gpio.rs:34:4 | 34 | fn gpio_bit_set(gpio_periph: u32, pin: u32) { | ^^^^^^^^^^^^

warning: constant is never used: TIMER0 --> src/timer.rs:7:1 | 7 | pub(crate) const TIMER0: u32 = TIMER_BASE + 0x0001_2C00; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER1 --> src/timer.rs:8:1 | 8 | pub(crate) const TIMER1: u32 = TIMER_BASE + 0x0000_0000; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER2 --> src/timer.rs:9:1 | 9 | pub(crate) const TIMER2: u32 = TIMER_BASE + 0x0000_0400; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER3 --> src/timer.rs:10:1 | 10 | pub(crate) const TIMER3: u32 = TIMER_BASE + 0x0000_0800; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER4 --> src/timer.rs:11:1 | 11 | pub(crate) const TIMER4: u32 = TIMER_BASE + 0x0000_0C00; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER6 --> src/timer.rs:13:1 | 13 | pub(crate) const TIMER6: u32 = TIMER_BASE + 0x0000_1400; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_RESET --> src/timer.rs:17:1 | 17 | pub const TIMER_TRI_OUT_SRC_RESET: u32 = ctl1_mmc(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_ENABLE --> src/timer.rs:18:1 | 18 | pub const TIMER_TRI_OUT_SRC_ENABLE: u32 = ctl1_mmc(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_CH0 --> src/timer.rs:20:1 | 20 | pub const TIMER_TRI_OUT_SRC_CH0: u32 = ctl1_mmc(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O0CPRE --> src/timer.rs:21:1 | 21 | pub const TIMER_TRI_OUT_SRC_O0CPRE: u32 = ctl1_mmc(4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O1CPRE --> src/timer.rs:22:1 | 22 | pub const TIMER_TRI_OUT_SRC_O1CPRE: u32 = ctl1_mmc(5); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O2CPRE --> src/timer.rs:23:1 | 23 | pub const TIMER_TRI_OUT_SRC_O2CPRE: u32 = ctl1_mmc(6); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_TRI_OUT_SRC_O3CPRE --> src/timer.rs:24:1 | 24 | pub const TIMER_TRI_OUT_SRC_O3CPRE: u32 = ctl1_mmc(7); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_UPDIS --> src/timer.rs:29:1 | 29 | const TIMER_CTL0_UPDIS: u32 = bit(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_UPS --> src/timer.rs:30:1 | 30 | const TIMER_CTL0_UPS: u32 = bit(2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_SPM --> src/timer.rs:31:1 | 31 | const TIMER_CTL0_SPM: u32 = bit(3); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_DIR --> src/timer.rs:32:1 | 32 | const TIMER_CTL0_DIR: u32 = bit(4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_CAM --> src/timer.rs:33:1 | 33 | const TIMER_CTL0_CAM: u32 = bits(5,6); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_ARSE --> src/timer.rs:34:1 | 34 | const TIMER_CTL0_ARSE: u32 = bit(7); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: TIMER_CTL0_CKDIV --> src/timer.rs:35:1 | 35 | const TIMER_CTL0_CKDIV: u32 = bits(8,9); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant is never used: RCU_GPIOC --> src/rcu.rs:13:1 | 13 | pub(crate) const RCU_GPIOC: u32 = rcu_regidx_bit(APB2EN_REG_OFFSET, 4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: delay --> src/main.rs:90:4 | 90 | fn delay(mut n: u32) { | ^^^^^

warning: 55 warnings emitted

Finished dev [unoptimized + debuginfo] target(s) in 0.51s
advancedwebdeveloper commented 3 years ago

@barafael , did you plan to add an explanation of the purpose of the demos? Are you experimenting with the generation of various forms of output signals?

Maybe hard-coding the bits for "jingle bells" song, closer to the New Year, would be vibrant?

barafael commented 3 years ago

Try checking out the branch rust-pac as mentioned in the readme :) I don't think I will fix the master branch, don't even remember how I got there. I should probably just merge rust-pac branch.

barafael commented 3 years ago

Re: "jingle bells": I extended this project to take frequencies over i2c, so that would be simple to do :) good idea.

barafael commented 3 years ago

I merged into master, should work now