-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A beginning of bare metal SDK? #3
Comments
Thanks for your advice,If you are interested in contributing code, You can refer to the link below:
I want to do some separate routines for peripheral experiments on the development board. If you need SDK, you can add the successfully tested peripherals to the SDK, and finally you can make some demos Using meson for project construction can be compiled on both Linux and window, which is convenient for development. Looking forward to your suggestion for bare metal SDK! |
The file typedef unsigned long uint64_t;
typedef unsigned int uint32_t;
typedef uint64_t virtual_addr_t;
static inline void write32(virtual_addr_t addr, uint32_t value) {
*((volatile uint32_t *)(addr)) = value;
}
static inline uint32_t read32(virtual_addr_t addr) {
return *((volatile uint32_t *)(addr));
}
static inline uint64_t counter(void)
{
uint64_t cnt;
__asm__ __volatile__("csrr %0, time\n" : "=r"(cnt) :: "memory");
return cnt;
}
static inline void sdelay(unsigned long us)
{
uint64_t t = counter() + us * 24;
while(counter() <= t);
}
static void sys_uart_putc(char c)
{
virtual_addr_t addr = 0x02500000;
while((read32(addr + 0x7c) & (0x1 << 1)) == 0);
write32(addr, c);
}
void _start(void)
{
while(1){
sys_uart_putc('h');
sys_uart_putc('e');
sys_uart_putc('l');
sys_uart_putc('l');
sys_uart_putc('o');
sys_uart_putc('\r');
sys_uart_putc('\n');
sdelay(1000*1000);
}
}
I think these clocks and peripherals configured by Is there a way for us to reset the board without losing the code data in the |
About the source codes, I have tried to compile them and finally found that actually we do NOT need to include some header files like
<stdio.h>
<stdlib.h>
on bare board.Also we can spend a little time to get the code easier to organize and reuse.I would like contribute if you could point me a direction.
The text was updated successfully, but these errors were encountered: