Go to file
Zihao Yu 90a1a94f51 Makefile.compile: use gnu11 to compile native
* with c11, gcc will report the following error:
  /usr/include/sys/ucontext.h:238:5: error: unknown type name ‘stack_t’
2018-08-14 13:40:01 +08:00
am x86-qemu,ioe: fix range 2018-08-14 12:18:48 +08:00
apps change _RegSet to _Context 2018-08-08 14:38:35 +00:00
docs updates 2018-08-11 20:28:38 +08:00
libs Modified the implementation of memcpy to avoid unaligned rw 2018-07-02 16:04:27 +08:00
tests tests: move some tests under reasonable directories 2018-08-14 12:40:17 +08:00
.gitignore add binary output trace to COM2 2018-08-11 02:15:58 +00:00
Makefile Makefile: add -s 2017-08-12 15:53:11 +08:00
Makefile.app Add interrupt, add t0 ~ t9 in irq_handle 2018-07-16 17:56:28 +08:00
Makefile.check Makefile: really set the default value of ARCH to native 2017-06-06 00:02:49 +08:00
Makefile.compile Makefile.compile: use gnu11 to compile native 2018-08-14 13:40:01 +08:00
Makefile.lib Makefile: output short message while compiling/linking 2017-08-12 15:58:53 +08:00
README.md add a docbook 2018-08-11 16:48:14 +08:00

README.md

The Abstract Machine (AM)

抽象计算机:必要的抽象,帮你编写一个完整的计算机系统!

目录组织:

  • am/AM头文件、每个体系结构分别实现的AM代码。
  • docs/: AM文档、开发指南。
  • libs/建立在AM上、体系结构无关的运行库如软件模拟浮点数、基础libc功能等。
  • apps/一些运行在AM上应用程序示例。
  • tests/: 用来测试AM实现的简单测试程序。

创建一个AM应用

在任何目录都可以创建运行在AM上的应用程序。程序用C/C++语言编写除AM之外无法调用其他库函数但可以引用stdarg.h, limits.h等包含体系结构相关数据定义的头文件)。

为此你需要在应用程序项目的根目录添加一个Makefile

NAME = app-name
SRCS = src/main.c src/help.c src/lib.cpp
include $(AM_HOME)/Makefile.app

一些注意事项:

  • NAME定义了应用的名字。编译后会在build/目录里出现以此命名的应用程序。

  • SRCS指定了编译应用所需的源文件。可以放在应用目录中的任意位置。

  • 应用目录下的include/目录会被添加到编译的-I选项中。

  • 环境变量AM_HOME需要包含nexus-am项目的根目录的绝对路径

编译时,首先确保AM_HOME正确设置,然后执行make ARCH=体系结构名编译。例如make ARCH=native将会编译成本地可运行的项目,make ARCH=mips32-minimal生成用于仿真的MIPS32程序。ARCH缺省时默认编译到本地。