.section .text .align 2 .global setup_GPIO .include "memory_map.inc" .include "gpio.inc" setup_GPIO: addi sp, sp, -16 # Allocate stack frame sw ra, 12(sp) # save return address to the stack li t0, GPIO_CTRL_ADDR # load base GPIO address li t1, GPIO_RGB_PINS # get RGB offsets sw t1, GPIO_OUTPUT_EN(t0) # enable output on the RGB pins sw t1, GPIO_OUTPUT_XOR(t0) # set the RGB pins to active high sw x0, GPIO_OUTPUT_VAL(t0) # set all pins to 0 lw ra, 12(sp) # load return address addi sp, sp, 16 # deallocate stack frame ret