We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e6242d commit 45d77eaCopy full SHA for 45d77ea
riscv-asm.md
@@ -465,19 +465,25 @@ The following example shows loading a constant using the `%hi` and
465
`%lo` assembler functions.
466
467
```assembly
468
- .equ UART_BASE, 0x40003080
+ .equ UART0_BASE, 0x40003080 # positive offset
469
+ .equ UART1_BASE, 0x40003880 # negative offset
470
- lui a0, %hi(UART_BASE)
471
- addi a0, a0, %lo(UART_BASE)
+ lui a0, %hi(UART0_BASE)
472
+ addi a0, a0, %lo(UART0_BASE)
473
+
474
+ lui a0, %hi(UART1_BASE)
475
+ addi a0, a0, %lo(UART1_BASE)
476
```
477
478
Which generates the following assembler output
479
as seen by `objdump`:
480
481
482
0000000000000000 <.text>:
- 0: 40003537 lui a0,0x40003
- 4: 08050513 addi a0,a0,128 # 40003080 <UART_BASE>
483
+ 0: 40003537 lui a0,0x40003
484
+ 4: 08050513 addi a0,a0,128 # 40003080 <UART0_BASE>
485
+ 8: 40004537 lui a0,0x40004
486
+ c: 88050513 addi a0,a0,-1920 # 40003880 <UART1_BASE>
487
488
489
Function Calls
0 commit comments