[platform][sifive] add switch to scripts/do-riscvqemu to run sifive unleashed

Also fix up some broken bits on the previously unused qemu-sifive-u target.
This commit is contained in:
Travis Geiselbrecht
2020-12-30 01:32:33 -08:00
parent 1e50428091
commit 6ea6256d89
4 changed files with 43 additions and 22 deletions

View File

@@ -10,6 +10,9 @@
#include <arch/arch_ops.h>
#include <platform/sifive.h>
// NOTE: set to 0 if trying to boot on qemu
#define ENABLE_DEBUG_LED 1
static volatile struct {
volatile uint32_t pwmcfg;
volatile uint32_t res0;
@@ -21,18 +24,22 @@ static volatile struct {
} *const pwm0_base = (void*)PWM0_BASE;
void target_early_init(void) {
pwm0_base->pwmcfg = 0x100f; // enable always and max scaling
target_set_debug_led(0, false);
target_set_debug_led(1, false);
target_set_debug_led(2, false);
target_set_debug_led(3, false);
if (ENABLE_DEBUG_LED) {
pwm0_base->pwmcfg = 0x100f; // enable always and max scaling
target_set_debug_led(0, false);
target_set_debug_led(1, false);
target_set_debug_led(2, false);
target_set_debug_led(3, false);
}
}
void target_init(void) {
}
void target_set_debug_led(unsigned int led, bool on) {
if(led > 3)
return;
pwm0_base->pwmcmp[led] = (0xffff + on) & 0xffff;
if (ENABLE_DEBUG_LED) {
if(led > 3)
return;
pwm0_base->pwmcmp[led] = (0xffff + on) & 0xffff;
}
}