create project for qemu
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@95 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
cdf794cc3a
commit
7794b165ae
|
@ -0,0 +1,59 @@
|
|||
KERNEL_ROOT=.
|
||||
|
||||
include $(KERNEL_ROOT)/config.mk
|
||||
|
||||
SRC_DIR = src libcpu
|
||||
MAKE_CMD=
|
||||
|
||||
ifeq ($(RT_USING_FINSH), 1)
|
||||
SRC_DIR += finsh
|
||||
MAKE_CMD+= RT_USING_FINSH=1
|
||||
endif
|
||||
|
||||
ifeq ($(RT_USING_LWIP), 1)
|
||||
SRC_DIR += net
|
||||
MAKE_CMD+= RT_USING_LWIP=1
|
||||
endif
|
||||
|
||||
ifeq ($(RT_USING_EFSL), 1)
|
||||
SRC_DIR += filesystem
|
||||
MAKE_CMD+= RT_USING_EFSL=1
|
||||
endif
|
||||
|
||||
ifeq ($(RT_USING_RTGUI), 1)
|
||||
SRC_DIR += rtgui
|
||||
MAKE_CMD+= RT_USING_RTGUI=1
|
||||
endif
|
||||
|
||||
ifeq ($(RT_USING_CPLUSPLUS), 1)
|
||||
SRC_DIR += cplusplus
|
||||
endif
|
||||
|
||||
ifeq ($(RT_USING_NEWLIB), 1)
|
||||
SRC_DIR += libc
|
||||
else
|
||||
ifeq ($(RT_USING_MINILIBC), 1)
|
||||
SRC_DIR += libc
|
||||
endif
|
||||
endif
|
||||
|
||||
SRC_DIR += bsp
|
||||
|
||||
all:
|
||||
for dir in $(SRC_DIR); do \
|
||||
make -C $$dir $(MAKE_CMD); \
|
||||
done
|
||||
|
||||
clean :
|
||||
for dir in $(SRC_DIR); do \
|
||||
make -C $$dir clean $(MAKE_CMD); \
|
||||
done
|
||||
|
||||
test:
|
||||
make -C testsuite
|
||||
|
||||
docs:
|
||||
$(DOXYGEN) Doxyfile
|
||||
|
||||
dist-clean: clean
|
||||
make -C testsuite clean
|
|
@ -0,0 +1,9 @@
|
|||
KERNEL_ROOT=..
|
||||
|
||||
include $(KERNEL_ROOT)/config.mk
|
||||
|
||||
all:
|
||||
make -C $(BOARD)
|
||||
|
||||
clean:
|
||||
make -C $(BOARD) clean
|
|
@ -0,0 +1,39 @@
|
|||
KERNEL_ROOT=../..
|
||||
|
||||
include $(KERNEL_ROOT)/config.mk
|
||||
|
||||
SRC = board.c startup.c keyboard.c console.c serial.c
|
||||
APP = application.o
|
||||
OBJ = $(SRC:.c=.o)
|
||||
BIN = rtthread-$(BOARD)
|
||||
IMG = $(KERNEL_ROOT)/lib/$(BIN).img
|
||||
|
||||
#LFALGS = -nostdlib -Bstatic -T $(LDSCRIPT) -Ttext $(TEXTBASE)
|
||||
LFALGS = -nostdlib -Bstatic -T $(LDSCRIPT)
|
||||
CFLAGS += -I$(KERNEL_ROOT)/libcpu/$(ARCH)/include
|
||||
|
||||
all: $(BIN) $(LIBBSP)
|
||||
|
||||
$(IMG): $(BIN) $(KERNEL_ROOT)/lib/boot
|
||||
dd if=/dev/zero of=$(IMG)~ count=1000 2>/dev/null
|
||||
dd if=$(KERNEL_ROOT)/lib/boot of=$(IMG)~ conv=notrunc 2>/dev/null
|
||||
dd if=$(BIN) of=$(IMG)~ seek=1 conv=notrunc 2>/dev/null
|
||||
|
||||
$(LIBBSP): $(OBJ)
|
||||
$(AR) r $@ $?
|
||||
$(RANLIB) $@
|
||||
|
||||
$(BIN): $(OBJ) $(APP) $(LIBFINSH) $(LIBCPU) $(KERNEL)
|
||||
$(LD) $(LFALGS) $(STARTOBJ) $(OBJ) $(APP) $(LIBFINSH) $(KERNEL) $(LIBCPU) -o $(BIN).elf
|
||||
$(SIZE) $(BIN).elf
|
||||
|
||||
clean :
|
||||
$(RM) $(BIN).elf *.o *~ *.bak *.bin $(LIBBSP)
|
||||
$(RM) .depend
|
||||
|
||||
dep : .depend
|
||||
|
||||
include .depend
|
||||
|
||||
.depend: $(SRC)
|
||||
$(CC) $(CFLAGS) -M $^ > $@
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
rm lib -rf
|
||||
rm include -f
|
||||
rm src/*.c -f
|
||||
rm src/*.h -f
|
||||
rm src/*.o -f
|
||||
rm bsp/qemu/*.c -f
|
||||
rm bsp/qemu/*.h -f
|
||||
rm bsp/qemu/*.S -f
|
||||
rm bsp/qemu/*.o -f
|
||||
rm bsp/qemu/*.lds -f
|
||||
rm libcpu/ia32/*.c -f
|
||||
rm libcpu/ia32/*.S -f
|
||||
rm libcpu/ia32/*.o -f
|
||||
rm libcpu/ia32/include -f
|
||||
rm finsh/*.c -f
|
||||
rm finsh/*.h -f
|
||||
rm finsh/*.o -f
|
|
@ -0,0 +1,38 @@
|
|||
# RT-Thread build config file
|
||||
# Platform
|
||||
PLATFORM=qemu
|
||||
|
||||
# Platform Prefix
|
||||
PREFIX=
|
||||
|
||||
# C flags
|
||||
CFLAGS=-Wall
|
||||
|
||||
# Linker flags
|
||||
LDFLAGS=-nostdlib
|
||||
|
||||
# ASM Flags
|
||||
ASFLAGS=
|
||||
|
||||
# Build Type
|
||||
BUILDTYPE=RAM
|
||||
|
||||
# Release Type
|
||||
RELEASETYPE=Release
|
||||
|
||||
# Text Base
|
||||
TEXTBASE=0x108000
|
||||
|
||||
# SECTION: RT-Thread Component
|
||||
# finsh, shell of RT-Thread
|
||||
RT_USING_FINSH=1
|
||||
|
||||
# a mini libc
|
||||
#RT_USING_MINILIBC=1
|
||||
|
||||
# Using C++ support
|
||||
# RT_USING_CPLUSPLUS=1
|
||||
|
||||
# LwIP, light weight TCP/IP stack for RT-Thread
|
||||
# RT_USING_LWIP=1
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
#
|
||||
# RT-Thread Makefile
|
||||
# CFLAGS for C compiler flags
|
||||
# CPPFLAGS for C++ compiler flags
|
||||
# LDFLAGS for ld link flags
|
||||
# LDLIBS for libraries should be linked
|
||||
# AFLAGS for assemble flags
|
||||
#
|
||||
|
||||
include $(KERNEL_ROOT)/config.local
|
||||
include $(KERNEL_ROOT)/config.target
|
||||
|
||||
#
|
||||
# toolchain variables
|
||||
#
|
||||
CC = $(PREFIX)gcc
|
||||
CXX = $(PREFIX)g++
|
||||
LD = $(PREFIX)ld
|
||||
AR = $(PREFIX)ar
|
||||
AS = $(PREFIX)as
|
||||
RANLIB = $(PREFIX)ranlib
|
||||
NM = $(PREFIX)nm
|
||||
OBJCOPY = $(PREFIX)objcopy
|
||||
OBJDUMP = $(PREFIX)objdump
|
||||
STRIP = $(PREFIX)strip
|
||||
SIZE = $(PREFIX)size
|
||||
RM = rm -rf
|
||||
MKDIR = mkdir -p
|
||||
|
||||
#
|
||||
# start object and library
|
||||
#
|
||||
STARTOBJ = $(KERNEL_ROOT)/lib/start_$(CPU).o
|
||||
LIBCPU = $(KERNEL_ROOT)/lib/libcpu_$(CPU).a
|
||||
KERNEL = $(KERNEL_ROOT)/lib/libkernel_$(ARCH).a
|
||||
LIBBSP = $(KERNEL_ROOT)/lib/libbsp_$(BOARD).a
|
||||
LIBFINSH = $(KERNEL_ROOT)/lib/libfinsh_$(ARCH).a
|
||||
LIBEFSL = $(KERNEL_ROOT)/lib/libefsl-fs-vfat.a \
|
||||
$(KERNEL_ROOT)/lib/libefsl-base.a
|
||||
LIBRTGUI = $(KERNEL_ROOT)/lib/librtgui_widgets.a \
|
||||
$(KERNEL_ROOT)/lib/librtgui_server.a \
|
||||
$(KERNEL_ROOT)/lib/librtgui_common.a \
|
||||
$(KERNEL_ROOT)/lib/librtgui_app.a
|
||||
LIBLWIP = $(KERNEL_ROOT)/lib/liblwip_$(ARCH).a
|
||||
LIBCPP = $(KERNEL_ROOT)/lib/librtt++_$(ARCH).a
|
||||
LIBMINIC = $(KERNEL_ROOT)/lib/libminilibc_$(ARCH).a
|
||||
|
||||
LDLIBS = -lcpu_$(CPU) -lkernel_$(ARCH) -lbsp_$(BOARD)
|
||||
|
||||
#
|
||||
# ld script, according to build type, RAM or ROM
|
||||
#
|
||||
ifeq ($(BUILDTYPE), RAM)
|
||||
LDSCRIPT= $(KERNEL_ROOT)/bsp/$(BOARD)/$(BOARD)_ram.lds
|
||||
else
|
||||
LDSCRIPT= $(KERNEL_ROOT)/bsp/$(BOARD)/$(BOARD)_rom.lds
|
||||
endif
|
||||
|
||||
#
|
||||
# RT-Thread component
|
||||
#
|
||||
ifeq ($(RT_USING_FINSH), 1)
|
||||
CFLAGS += -I$(KERNEL_ROOT)/finsh
|
||||
LDLIBS += -lfinsh_$(ARCH)
|
||||
endif
|
||||
|
||||
ifeq ($(RT_USING_RTGUI), 1)
|
||||
CFLAGS += -I$(KERNEL_ROOT)/rtgui/include
|
||||
LDLIBS += -lrtgui_server -lrtgui_common -lrtgui_widgets -lrtgui_app
|
||||
endif
|
||||
|
||||
ifeq ($(RT_USING_LWIP), 1)
|
||||
CFLAGS += -I$(KERNEL_ROOT)/net/lwip/src \
|
||||
-I$(KERNEL_ROOT)/net/lwip/src/include \
|
||||
-I$(KERNEL_ROOT)/net/lwip/src/include/ipv4 \
|
||||
-I$(KERNEL_ROOT)/net/lwip/src/arch/include
|
||||
LDLIBS += -llwip_$(ARCH)
|
||||
endif
|
||||
|
||||
ifeq ($(RT_USING_EFSL), 1)
|
||||
CFLAGS += -I$(KERNEL_ROOT)/filesystem/efsl/src/fs/vfat/include \
|
||||
-I$(KERNEL_ROOT)/filesystem/efsl/src/base/include \
|
||||
-I$(KERNEL_ROOT)/filesystem/efsl/src/include \
|
||||
-I$(KERNEL_ROOT)/filesystem/efsl/conf
|
||||
LDLIBS += -lefsl-base -lefsl-fs-vfat
|
||||
endif
|
||||
|
||||
ifeq ($(RT_USING_CPLUSPLUS), 1)
|
||||
CFLAGS +=
|
||||
LDLIBS += -lrtt++_$(ARCH)
|
||||
endif
|
||||
|
||||
ifeq ($(RT_USING_NEWLIB), 1)
|
||||
CFLAGS += -I$(KERNEL_ROOT)/newlib/libc/include
|
||||
LDLIBS += -lnewlib_$(ARCH)
|
||||
else
|
||||
ifeq ($(RT_USING_MINILIBC), 1)
|
||||
CFLAGS += -I$(KERNEL_ROOT)/libc/minilibc
|
||||
LDLIBS += -lminilibc_$(ARCH)
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# compiler, assemble and ld link flag
|
||||
#
|
||||
CFLAGS += -I$(KERNEL_ROOT)/include -I$(KERNEL_ROOT)/bsp/$(BOARD) -Wall -nostdinc -fno-builtin
|
||||
|
||||
ifeq ($(RELEASETYPE), DEBUG)
|
||||
CFLAGS += -ggdb
|
||||
AFLAGS += -ggdb
|
||||
else
|
||||
CFLAGS += -O2
|
||||
CFLAGS +=
|
||||
AFLAGS +=
|
||||
endif
|
||||
|
||||
ifeq ($(BUILDTYPE), RAM)
|
||||
#AFLAGS +=
|
||||
#AFLAGS += -x assembler-with-cpp -DTEXT_BASE=$(TEXTBASE)
|
||||
#AFLAGS += -x assembler-with-cpp
|
||||
else
|
||||
#AFLAGS +=
|
||||
#AFLAGS += -x assembler-with-cpp -DTEXT_BASE=$(TEXTBASE) -D__FLASH_BUILD__
|
||||
endif
|
||||
|
||||
LDFLAGS += -L$(KERNEL_ROOT)/lib --start-group $(LDLIBS) --end-group
|
||||
|
||||
CPPFLAGS = $(CFLAGS) -fno-rtti
|
||||
|
||||
#
|
||||
# Common rules
|
||||
#
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) -c $(CPPFLAGS) -o $@ $<
|
||||
|
||||
.S.o:
|
||||
$(CC) -c $(AFLAGS) -o $@ $<
|
|
@ -0,0 +1,59 @@
|
|||
ifeq ($(PLATFORM), lumit4510)
|
||||
ARCH = arm
|
||||
CPU = s3c4510
|
||||
BOARD = lumit4510
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), wh44b0)
|
||||
ARCH = arm
|
||||
CPU = s3c44b0
|
||||
BOARD = wh44b0
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), s3ceb2410)
|
||||
ARCH = arm
|
||||
CPU = s3c2410
|
||||
BOARD = s3ceb2410
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), sam7s)
|
||||
ARCH = arm
|
||||
CPU = AT91SAM7S
|
||||
BOARD = sam7s
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), sam7x)
|
||||
ARCH = arm
|
||||
CPU = AT91SAM7X
|
||||
BOARD = sam7x
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), zaurusc1k)
|
||||
ARCH = arm
|
||||
CPU = pxa270
|
||||
BOARD = zaurusc1k
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), qemu_akita)
|
||||
ARCH = arm
|
||||
CPU = pxa270
|
||||
BOARD = qemu_akita
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), nds)
|
||||
ARCH = arm
|
||||
CPU = nds
|
||||
BOARD = nds
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), qemu)
|
||||
ARCH = ia32
|
||||
CPU = ia32
|
||||
BOARD = qemu
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), at9200)
|
||||
ARCH = arm
|
||||
CPU = AT9200
|
||||
BOARD = AT9200
|
||||
endif
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
mkdir lib
|
||||
ln -s ../../../include include
|
||||
|
||||
for m_file in `ls ../../../src`
|
||||
do
|
||||
ln -s ../../../../src/$m_file src/$m_file
|
||||
done
|
||||
|
||||
for m_file in `ls ../`
|
||||
do
|
||||
ln -s ../../../$m_file bsp/qemu/$m_file
|
||||
done
|
||||
rm bsp/qemu/build -f
|
||||
|
||||
for m_file in `ls ../../../libcpu/ia32`
|
||||
do
|
||||
ln -s ../../../../../libcpu/ia32/$m_file libcpu/ia32/$m_file
|
||||
done
|
||||
|
||||
for m_file in `ls ../../../finsh`
|
||||
do
|
||||
ln -s ../../../../finsh/$m_file finsh/$m_file
|
||||
done
|
|
@ -0,0 +1,29 @@
|
|||
KERNEL_ROOT=..
|
||||
|
||||
include $(KERNEL_ROOT)/config.mk
|
||||
|
||||
SRC = cmd.c shell.c symbol.c finsh_error.c finsh_node.c finsh_token.c \
|
||||
finsh_heap.c finsh_ops.c finsh_var.c finsh_compiler.c finsh_init.c\
|
||||
finsh_parser.c finsh_vm.c
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
CFLAGS += -I.
|
||||
|
||||
|
||||
all: $(LIBFINSH)
|
||||
|
||||
$(LIBFINSH): $(OBJ)
|
||||
$(AR) -r $@ $?
|
||||
$(RANLIB) $@
|
||||
|
||||
clean :
|
||||
$(RM) *.o *~ *.bak
|
||||
$(RM) $(LIBFINSH)
|
||||
$(RM) .depend
|
||||
|
||||
dep : .depend
|
||||
|
||||
include .depend
|
||||
|
||||
.depend: $(SRC)
|
||||
$(CC) $(CFLAGS) -M $^ > $@
|
|
@ -0,0 +1,9 @@
|
|||
KERNEL_ROOT=..
|
||||
|
||||
include $(KERNEL_ROOT)/config.mk
|
||||
|
||||
all:
|
||||
make -C $(ARCH)
|
||||
|
||||
clean:
|
||||
make -C $(ARCH) clean
|
|
@ -0,0 +1,33 @@
|
|||
KERNEL_ROOT=../..
|
||||
|
||||
include $(KERNEL_ROOT)/config.mk
|
||||
|
||||
SRC = interrupt.c trap.c stack.c backtrace.c showmem.c __udivsi3.c __umodsi3.c
|
||||
CPU_OBJ = $(SRC:.c=.o) context.o trapisr.o hdisr.o
|
||||
|
||||
#AFLAGS += -DTEXT_BASE=$(TEXTBASE) -I$(KERNEL_ROOT)/libcpu/$(ARCH)/include
|
||||
AFLAGS += -I$(KERNEL_ROOT)/libcpu/$(ARCH)/include
|
||||
CFLAGS += -I$(KERNEL_ROOT)/libcpu/$(ARCH)/include
|
||||
|
||||
all: $(LIBCPU) $(STARTOBJ)
|
||||
|
||||
$(STARTOBJ): start.S
|
||||
# $(CC) $(AFLAGS) -c start.S -ggdb -o $(STARTOBJ)
|
||||
$(CC) $(AFLAGS) -c start.S -o $(STARTOBJ)
|
||||
|
||||
$(LIBCPU): $(CPU_OBJ)
|
||||
$(AR) r $(LIBCPU) $?
|
||||
$(RANLIB) $(LIBCPU)
|
||||
|
||||
clean :
|
||||
$(RM) *.o *~ *.bak
|
||||
$(RM) $(LIBCPU)
|
||||
$(RM) $(STARTOBJ)
|
||||
$(RM) .depend
|
||||
|
||||
dep : .depend
|
||||
|
||||
include .depend
|
||||
|
||||
.depend: $(SRC)
|
||||
$(CC) $(CFLAGS) -M $^ > $@
|
|
@ -0,0 +1,25 @@
|
|||
KERNEL_ROOT=..
|
||||
|
||||
include $(KERNEL_ROOT)/config.mk
|
||||
|
||||
SRC = kservice.c clock.c object.c ipc.c timer.c irq.c scheduler.c \
|
||||
thread.c idle.c mempool.c mem.c slab.c device.c
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
all: $(KERNEL)
|
||||
|
||||
$(KERNEL): $(OBJ)
|
||||
$(AR) r $@ $?
|
||||
$(RANLIB) $@
|
||||
|
||||
clean :
|
||||
$(RM) *.o *~ *.bak
|
||||
$(RM) $(KERNEL)
|
||||
$(RM) .depend
|
||||
|
||||
dep : .depend
|
||||
|
||||
include .depend
|
||||
|
||||
.depend: $(SRC)
|
||||
$(CC) $(CFLAGS) -M $^ > $@
|
Loading…
Reference in New Issue