mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-05 22:43:39 +00:00
uvm32 initial version
This commit is contained in:
commit
c9d30b6d28
34 changed files with 2088 additions and 0 deletions
39
common/uvm32_target.h
Normal file
39
common/uvm32_target.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// Common to all target code
|
||||
|
||||
#include "uvm32_sys.h"
|
||||
|
||||
// Basic types
|
||||
typedef long uint32_t;
|
||||
typedef char uint8_t;
|
||||
typedef int bool;
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
// Convenience macro for defining CSR helper functions
|
||||
#define xstr(a) str(a)
|
||||
#define str(a) #a
|
||||
#define DEFINE_CSR_WRITE_FUNCTION(function_name, csr, typ) \
|
||||
static void function_name(typ val) { \
|
||||
asm volatile( ".option norvc\ncsrrw x0," xstr(csr) ", %0\n" : : "r" (val)); \
|
||||
}
|
||||
#define DEFINE_CSR_WRITE_FUNCTION_VOID(function_name, csr) \
|
||||
static void function_name(void) { \
|
||||
asm volatile( ".option norvc\ncsrwi " xstr(csr) ", 0"); \
|
||||
}
|
||||
|
||||
#include "uvm32_common_custom.h"
|
||||
#include "uvm32_target_custom.h"
|
||||
|
||||
// provide main, with setup()/loop() flow
|
||||
void setup(void);
|
||||
bool loop(void);
|
||||
|
||||
#ifndef USE_MAIN
|
||||
void main(void) {
|
||||
setup();
|
||||
while(loop()) {
|
||||
yield();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue