Skip to content

Commit 1c68e4d

Browse files
bors[bot]dkhayes117Disasm
authored
Merge #90
90: add asm::nop, asm::delay, and delay.rs. r=Disasm a=dkhayes117 update assembly binaries. update CHANGELOG.md Co-authored-by: dkhayes117 <[email protected]> Co-authored-by: Daniel Hayes <[email protected]> Co-authored-by: Vadim Kaushan <[email protected]>
2 parents 3d0a439 + daf019c commit 1c68e4d

18 files changed

+145
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111
- Add enums `Range`, `Permission` for PMP configuration
1212
- Add `set_pmp()` and `clear_pmp()` functions to pmpcfg(x) modules
1313
- Add struct `Pmpcsr` and is returned from `pmpcfgx::read()`
14+
- Add delay structure and methods using embedded-hal traits and `mcycle` register
15+
- Add `asm::delay()` function for assembly-based busy-loops
16+
- Add `asm::nop()`, a wrapper for implementing a `nop` instruction
1417

1518
### Changed
1619

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ targets = [
1818
[dependencies]
1919
bare-metal = "1.0.0"
2020
bit_field = "0.10.0"
21+
embedded-hal = "0.2.6"
2122

2223
[build-dependencies]
2324
riscv-target = "0.1.2"

asm.S

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#include "asm.h"
22

3+
.section .text.__nop
4+
.global __nop
5+
__nop:
6+
nop
7+
ret
8+
39
.section .text.__ebreak
410
.global __ebreak
511
__ebreak:
@@ -24,6 +30,14 @@ __sfence_vma:
2430
sfence.vma a0, a1
2531
ret
2632

33+
.section .text.__delay
34+
.global __delay
35+
__delay:
36+
1:
37+
addi a0, a0, -1
38+
bne a0, zero, 1b
39+
ret
40+
2741
// User Trap Setup
2842
RW(0x000, ustatus) // User status register
2943
RW(0x004, uie) // User interrupt-enable register

bin/riscv32i-unknown-none-elf.a

302 Bytes
Binary file not shown.

bin/riscv32ic-unknown-none-elf.a

290 Bytes
Binary file not shown.

bin/riscv32if-unknown-none-elf.a

302 Bytes
Binary file not shown.

bin/riscv32ifc-unknown-none-elf.a

290 Bytes
Binary file not shown.

bin/riscv32ifd-unknown-none-elf.a

302 Bytes
Binary file not shown.

bin/riscv32ifdc-unknown-none-elf.a

294 Bytes
Binary file not shown.

bin/riscv64i-unknown-none-elf.a

422 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)