support GD32VF103C START board

This commit is contained in:
acevest
2019-09-23 22:01:10 +08:00
parent 2d9580cf78
commit 1747cedc61
17 changed files with 698 additions and 262 deletions

View File

@@ -116,7 +116,7 @@ void cpu_trap_entry(cpu_data_t cause, cpu_context_t *regs)
}
void SysTick_IRQHandler() {
port_systick_config(k_cpu_cycle_per_tick);
port_systick_config((uint32_t)k_cpu_cycle_per_tick);
if (tos_knl_is_running()) {
tos_knl_irq_enter();
tos_tick_handler();

View File

@@ -1,10 +1,18 @@
#include "riscv_encoding.h"
#include <tos.h>
#if 0
#define CLINT_CTRL_ADDR 0x2000000
#define CLINT_MSIP 0x0000
#define CLINT_MTIMECMP 0x4000
#define CLINT_MTIME 0xBFF8
#else
#include "gd32vf103.h"
#define CLINT_CTRL_ADDR 0xD1000000
#define CLINT_MSIP 0x0FFC
#define CLINT_MTIMECMP 0x0008
#define CLINT_MTIME 0x0000
#endif
__PORT__ void port_systick_config(uint32_t cycle_per_tick)
{
@@ -35,6 +43,8 @@ __PORT__ void port_systick_config(uint32_t cycle_per_tick)
*(volatile uint32_t *)(CLINT_CTRL_ADDR + CLINT_MTIMECMP + 0) = 0xFFFFFFFF;
*(volatile uint32_t *)(CLINT_CTRL_ADDR + CLINT_MTIMECMP + 4) = 0xFFFFFFFF & (mtimecmp >> 32);
*(volatile uint32_t *)(CLINT_CTRL_ADDR + CLINT_MTIMECMP + 0) = 0xFFFFFFFF & (mtimecmp >> 0);
}
__PORT__ void port_systick_priority_set(uint32_t prio)

View File

@@ -250,8 +250,8 @@ irq_entry:
call cpu_trap_entry
j restore
irq:
slli a0, a0, 1
srli a0, a0, 1
slli a0, a0, 16
srli a0, a0, 16
call cpu_irq_entry
restore:
RESTORE_CONTEXT