risc-v-tlm/tests/C/func1/func1.c

28 lines
345 B
C
Raw Normal View History

2018-10-07 04:19:29 +08:00
#define TRACE (*(unsigned char *)0x40000000)
int func1(int a, int* b) {
return a + (*b);
}
2019-01-10 06:03:08 +08:00
int main(void) {
2018-10-07 04:19:29 +08:00
int x1, x2, x3;
x1 = 6;
x2 = 7;
x3 = func1(x1, &x2);
if (x3 == 13) {
TRACE = 'O';
TRACE = 'K';
TRACE = '\n';
} else {
TRACE = 'E';
TRACE = 'R';
TRACE = '\n';
}
2019-01-10 06:03:08 +08:00
asm volatile ("ecall");
2018-10-07 04:19:29 +08:00
}