cores/cpu/gowin: fix isr table optimization and uart init

This commit is contained in:
Ilia Sergachev 2022-01-23 15:37:00 +01:00
parent d4c12a5231
commit 0f44723957
1 changed files with 12 additions and 9 deletions

View File

@ -1,4 +1,6 @@
#include <stdint.h>
#include "system.h"
#include "generated/soc.h"
extern uint32_t _fdata_rom, _fdata, _edata, _fbss, _ebss, _fstack;
@ -6,17 +8,18 @@ void _start(void);
void default_handler(void);
void _start(void) {
uint32_t *y = &_fdata_rom;
for (uint32_t *x = &_fdata; x < &_edata; x ++)
*x = *y ++;
uint32_t *y = &_fdata_rom;
for (uint32_t *x = &_fdata; x < &_edata; x ++)
*x = *y ++;
for (uint32_t *x = &_fbss; x < &_ebss; x ++)
*x = 0;
for (uint32_t *x = &_fbss; x < &_ebss; x ++)
*x = 0;
// TODO: init uart
UART0->ctrl = 0b11; // set rx and tx enable bits
UART0->baud_div = CONFIG_CLOCK_FREQUENCY / 115200; // FIXME
__asm__("bl main");
while(1);
__asm__("bl main");
while(1);
}
void default_handler(void) {
@ -24,7 +27,7 @@ void default_handler(void) {
}
const void* isr_vector[] __attribute__ ((section(".isr_vector"))) = {
const void* isr_vector[] __attribute__((__used__)) __attribute__((section(".isr_vector"))) = {
&_fstack,
_start,
default_handler,