Assembly examples for Red-V Thing Plus (SiFive FE310-G002)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.3 KiB

#
# main.s
#
# 2021 flabbergast <flabbergast@drak.xyz>
# Unlicense: https://unlicense.org/
#
.option norelax
.equ compressed_isa, 1
# -----------------------------------------------------------------------------
# Code begins here
# -----------------------------------------------------------------------------
.text
j Reset # Instead of a true vector table
# -----------------------------------------------------------------------------
# Include any supporting code
# -----------------------------------------------------------------------------
.include "platform_regs.inc"
.include "p_delay.s"
# -----------------------------------------------------------------------------
Reset: # Execution begins here
# -----------------------------------------------------------------------------
li s1, GPIO_BASE
li s2, 0b111111<<18 # pins 18-23
sw s2, GPIO_OUTPUT_EN(s1) # set as outputs
li a0, 200 # delay in ms
li s2, 0b1<<18 # start with pin 18
li s3, 0b1<<23 # end with pin 23
1:
sw s2, GPIO_OUTPUT_VAL(s1) # make the pin high
jal delay
slli s2, s2, 1 # move one to the left
bleu s2, s3, 1b # did we move past last pin?
li s2, 0b1<<18 # back to the first pin
j 1b
end:
j end