am,mycpu: refactor directory structure

This commit is contained in:
Zihao Yu 2021-07-13 16:20:49 +08:00
parent 1a4ad39176
commit 17037fabb0
8 changed files with 20 additions and 51 deletions

View file

@ -1,5 +0,0 @@
#include <klib-macros.h>
#define PMEM_SIZE (128 * 1024 * 1024)
#define PMEM_END ((uintptr_t)&_pmem_start + PMEM_SIZE)
extern char _pmem_start;

View file

@ -1,6 +1,6 @@
#include <am.h>
void __am_input_keybrd(AM_INPUT_KEYBRD_T *kbd) {
kbd->keydown = 0;
kbd->keycode = AM_KEY_NONE;
}

View file

@ -1,33 +0,0 @@
_pmem_start = 0x80000000;
ENTRY(_start)
SECTIONS {
. = _pmem_start + 0x100000;
.text : {
*(entry)
*(.text*)
}
etext = .;
_etext = .;
.rodata : {
*(.rodata*)
}
.data : {
*(.data)
}
edata = .;
_data = .;
.bss : {
_bss_start = .;
*(.bss*)
*(.sbss*)
*(.scommon)
}
_stack_top = ALIGN(0x1000);
. = _stack_top + 0x8000;
_stack_pointer = .;
end = .;
_end = .;
_heap_start = ALIGN(0x1000);
}

View file

@ -1,13 +1,17 @@
#include <am.h>
void __am_timer_init() {
}
void __am_timer_uptime(AM_TIMER_UPTIME_T *uptime) {
uptime->us = 0;
}
void __am_timer_rtc(AM_TIMER_RTC_T *rtc) {
rtc->second = 0;
rtc->minute = 0;
rtc->hour = 0;
rtc->day = 0;
rtc->month = 0;
rtc->year = 1900;
}

View file

@ -1,9 +1,13 @@
#include <am.h>
#include <mycpu.h>
#include <klib-macros.h>
extern char _heap_start;
int main(const char *args);
extern char _pmem_start;
#define PMEM_SIZE (128 * 1024 * 1024)
#define PMEM_END ((uintptr_t)&_pmem_start + PMEM_SIZE)
Area heap = RANGE(&_heap_start, PMEM_END);
#ifndef MAINARGS
#define MAINARGS ""
@ -11,7 +15,6 @@ Area heap = RANGE(&_heap_start, PMEM_END);
static const char mainargs[] = MAINARGS;
void putch(char ch) {
}
void halt(int code) {

View file

@ -4,17 +4,17 @@ CFLAGS += $(COMMON_FLAGS) -static
ASFLAGS += $(COMMON_FLAGS) -O0
LDFLAGS += -melf64lriscv
AM_SRCS := mycpu/boot/start.S \
AM_SRCS := mycpu/start.S \
mycpu/trm.c \
mycpu/ioe/timer.c \
mycpu/ioe/ioe.c \
mycpu/ioe/input.c
mycpu/ioe.c \
mycpu/timer.c \
mycpu/input.c
CFLAGS += -fdata-sections -ffunction-sections
LDFLAGS += -T $(AM_HOME)/am/src/mycpu/scripts/section.ld
LDFLAGS += -T $(AM_HOME)/scripts/platform/nemu.ld --defsym=_pmem_start=0x80000000 --defsym=_entry_offset=0x0
LDFLAGS += --gc-sections -e _start
CFLAGS += -DMAINARGS=\"$(mainargs)\"
CFLAGS += -I$(AM_HOME)/am/src/mycpu/include
.PHONY: $(AM_HOME)/am/src/mycpu/trm.c
image: $(IMAGE).elf
@$(OBJDUMP) -d $(IMAGE).elf > $(IMAGE).txt