Add Posix Target
This commit is contained in:
2
Makefile
2
Makefile
@ -15,7 +15,7 @@ BOCHS_RUNNER ?= ${FAIL_BIN}/bochs-experiment-runner
|
|||||||
|
|
||||||
EXPERIMENTS := $(patsubst %.c,%,$(shell echo *.c))
|
EXPERIMENTS := $(patsubst %.c,%,$(shell echo *.c))
|
||||||
|
|
||||||
CFLAGS := -I. -include arch/${ARCH}/lib.c -O2 -std=c11
|
CFLAGS += -I. -include arch/${ARCH}/lib.c -O2 -std=c11
|
||||||
|
|
||||||
include arch/${ARCH}.mk
|
include arch/${ARCH}.mk
|
||||||
|
|
||||||
|
|||||||
28
arch/posix.mk
Normal file
28
arch/posix.mk
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
FAIL_DOWNLOAD_URL = NOTAVAILABLE
|
||||||
|
|
||||||
|
CFLAGS +=
|
||||||
|
LDFLAGS +=
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Build Targets
|
||||||
|
${BUILD_DIR}/%/system.o: %.c
|
||||||
|
mkdir -p $(shell dirname $@)
|
||||||
|
${CC} ${CFLAGS} -c $< -o $@
|
||||||
|
|
||||||
|
${BUILD_DIR}/%/system.elf: ${BUILD_DIR}/%/system.o
|
||||||
|
${CC} ${LDFLAGS} $< -o $@
|
||||||
|
|
||||||
|
${BUILD_DIR}/%/trace.pb: ${BUILD_DIR}/%/system.elf
|
||||||
|
$<
|
||||||
|
|
||||||
|
define arch-make-targets
|
||||||
|
|
||||||
|
build-$1: ${BUILD_DIR}/$1/system.elf
|
||||||
|
|
||||||
|
trace-$1: ${BUILD_DIR}/$1/trace.pb
|
||||||
|
|
||||||
|
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
7
arch/posix/lib.c
Normal file
7
arch/posix/lib.c
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define MARKER(str) printf(QUOTE(str) "\n")
|
||||||
|
|
||||||
|
#define POSIX_PRINTF(...) printf(__VA_ARGS__)
|
||||||
|
|
||||||
|
#define MAIN() int main(int argc, char** argv)
|
||||||
@ -1,4 +1,4 @@
|
|||||||
FAIL_DOWNLOAD_URL = ${FAIL_DOWNLOAD_BASE}?job=build-riscv-generic-tools%3A+%5Briscv32%5D
|
FAIL_DOWNLOAD_URL = ${FAIL_DOWNLOAD_BASE}?job=build-riscv-generic-tools%3A+%5Briscv32%2C+true%5D
|
||||||
|
|
||||||
include arch/riscv-common.mk
|
include arch/riscv-common.mk
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
FAIL_DOWNLOAD_URL = ${FAIL_DOWNLOAD_BASE}?job=build-riscv-generic-tools%3A+%5Briscv64%5D
|
FAIL_DOWNLOAD_URL = ${FAIL_DOWNLOAD_BASE}?job=build-riscv-generic-tools%3A+%5Briscv64%2C+true%5D
|
||||||
|
|
||||||
|
|
||||||
include arch/riscv-common.mk
|
include arch/riscv-common.mk
|
||||||
|
|
||||||
|
|||||||
28
lib.c
28
lib.c
@ -6,19 +6,27 @@
|
|||||||
#define __QUOTE(x) #x
|
#define __QUOTE(x) #x
|
||||||
#define QUOTE(x) __QUOTE(x)
|
#define QUOTE(x) __QUOTE(x)
|
||||||
|
|
||||||
|
#ifndef MARKER
|
||||||
#define MARKER(str) __asm__ volatile(QUOTE(str) ":" \
|
#define MARKER(str) __asm__ volatile(QUOTE(str) ":" \
|
||||||
: /* no inputs */ \
|
: /* no inputs */ \
|
||||||
: /* no outputs */ \
|
: /* no outputs */ \
|
||||||
: "memory", ARCH_ASM_CLOBBER_ALL \
|
: "memory", ARCH_ASM_CLOBBER_ALL \
|
||||||
)
|
)
|
||||||
|
|
||||||
#ifndef DEBUG
|
|
||||||
#define MAIN() void os_main(void)
|
|
||||||
#define PRINT_DEBUG(...)
|
|
||||||
#else
|
|
||||||
#include <stdio.h>
|
|
||||||
#define MARKER(str) printf(QUOTE(str) "\n")
|
|
||||||
#define DEBUG 1
|
|
||||||
#define PRINT_DEBUG(...) printf(__VA_ARGS__)
|
|
||||||
#define MAIN() void main(int argc, char** argv)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAIN
|
||||||
|
#define MAIN() void os_main(void)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef POSIX_PRINTF
|
||||||
|
#define POSIX_PRINTF(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
typedef __UINT8_TYPE__ uint8_t;
|
||||||
|
typedef __UINT16_TYPE__ uint16_t;
|
||||||
|
typedef __UINT32_TYPE__ uint32_t;
|
||||||
|
|
||||||
|
typedef __INT8_TYPE__ int8_t;
|
||||||
|
typedef __INT16_TYPE__ int16_t;
|
||||||
|
typedef __INT32_TYPE__ int32_t;
|
||||||
|
|||||||
Reference in New Issue
Block a user