forked from springcute/rt-thread
update x86.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1950 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
4f6f15601d
commit
be7bd6b5d7
|
@ -0,0 +1,14 @@
|
|||
# for module compiling
|
||||
import os
|
||||
Import('RTT_ROOT')
|
||||
|
||||
cwd = str(Dir('#'))
|
||||
objs = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
Return('objs')
|
|
@ -0,0 +1,28 @@
|
|||
import os
|
||||
import sys
|
||||
import rtconfig
|
||||
|
||||
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
|
||||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||
from building import *
|
||||
|
||||
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
|
||||
|
||||
env = Environment(tools = ['mingw'],
|
||||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
||||
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
|
||||
AR = rtconfig.AR, ARFLAGS = '-rc',
|
||||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
||||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
||||
|
||||
Export('RTT_ROOT')
|
||||
Export('rtconfig')
|
||||
|
||||
# prepare building environment
|
||||
objs = PrepareBuilding(env, RTT_ROOT)
|
||||
|
||||
# build program
|
||||
env.Program(TARGET, objs)
|
||||
|
||||
# end building
|
||||
EndBuilding(TARGET)
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* File : application.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-09-15 QiuYi the first version
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup QEMU
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* This function will be invoked to initalize user application when system startup.
|
||||
*/
|
||||
int rt_application_init()
|
||||
{
|
||||
return 0; /* empty */
|
||||
}
|
||||
|
||||
/*@}*/
|
|
@ -0,0 +1,11 @@
|
|||
Import('RTT_ROOT')
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = os.path.join(str(Dir('#')), 'applications')
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd, str(Dir('#'))]
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* File : application.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-09-15 QiuYi the first version
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup QEMU
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
ALIGN(RT_ALIGN_SIZE)
|
||||
static char thread_led1_stack[1024];
|
||||
struct rt_thread thread_led1;
|
||||
static void rt_thread_entry_led1(void* parameter)
|
||||
{
|
||||
unsigned int count=0;
|
||||
while (1)
|
||||
{
|
||||
/* led1 on */
|
||||
#ifndef RT_USING_FINSH
|
||||
rt_kprintf("led1 on,count : %d\r\n",count);
|
||||
#endif
|
||||
count++;
|
||||
/* sleep 0.5 second and switch to other thread */
|
||||
rt_thread_delay(RT_TICK_PER_SECOND/2);
|
||||
|
||||
/* led1 off */
|
||||
#ifndef RT_USING_FINSH
|
||||
rt_kprintf("led1 off\r\n");
|
||||
#endif
|
||||
rt_thread_delay(RT_TICK_PER_SECOND/2);
|
||||
}
|
||||
}
|
||||
|
||||
ALIGN(RT_ALIGN_SIZE)
|
||||
static char thread_led2_stack[1024];
|
||||
struct rt_thread thread_led2;
|
||||
void rt_thread_entry_led2(void* parameter)
|
||||
{
|
||||
unsigned int count=0;
|
||||
while (1)
|
||||
{
|
||||
/* led2 on */
|
||||
#ifndef RT_USING_FINSH
|
||||
rt_kprintf("led2 on,count : %d\r\n",count);
|
||||
#endif
|
||||
count++;
|
||||
rt_thread_delay(RT_TICK_PER_SECOND);
|
||||
|
||||
/* led2 off */
|
||||
#ifndef RT_USING_FINSH
|
||||
rt_kprintf("led2 off\r\n");
|
||||
#endif
|
||||
rt_thread_delay(RT_TICK_PER_SECOND);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will be invoked to initalize user application when system startup.
|
||||
*/
|
||||
int rt_application_init()
|
||||
{
|
||||
//------- init led1 thread
|
||||
rt_thread_init(&thread_led1,
|
||||
"led1",
|
||||
rt_thread_entry_led1,
|
||||
RT_NULL,
|
||||
&thread_led1_stack[0],
|
||||
sizeof(thread_led1_stack),11,5);
|
||||
rt_thread_startup(&thread_led1);
|
||||
|
||||
//------- init led2 thread
|
||||
rt_thread_init(&thread_led2,
|
||||
"led2",
|
||||
rt_thread_entry_led2,
|
||||
RT_NULL,
|
||||
&thread_led2_stack[0],
|
||||
sizeof(thread_led2_stack),12,5);
|
||||
rt_thread_startup(&thread_led2);
|
||||
|
||||
return 0; /* empty */
|
||||
}
|
||||
|
||||
/*@}*/
|
|
@ -18,12 +18,18 @@
|
|||
|
||||
#include "board.h"
|
||||
|
||||
extern void rt_console_init(void);
|
||||
extern void rt_hw_interrupt_init(void);
|
||||
extern void rt_hw_console_init(void);
|
||||
extern void rt_hw_board_init(void);
|
||||
extern void rt_system_timer_init(void);
|
||||
extern void rt_system_scheduler_init(void);
|
||||
extern void rt_thread_idle_init(void);
|
||||
extern int rt_application_init(void);
|
||||
//extern void rt_hw_interrupt_init(void);
|
||||
//extern void rt_system_timer_init(void);
|
||||
//extern void rt_system_scheduler_init(void);
|
||||
//extern void rt_thread_idle_init(void);
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
extern void finsh_system_init(void);
|
||||
extern void finsh_set_device(const char* device);
|
||||
#endif
|
||||
|
||||
extern unsigned char __bss_start[];
|
||||
extern unsigned char __bss_end[];
|
||||
|
@ -41,9 +47,6 @@ void rt_hw_clear_bss()
|
|||
while(dst < __bss_end) *dst++ = 0;
|
||||
}
|
||||
|
||||
extern void finsh_system_init(void);
|
||||
extern int rt_application_init(void);
|
||||
|
||||
/**
|
||||
* This function will startup RT-Thread RTOS
|
||||
*/
|
||||
|
@ -51,55 +54,56 @@ void rtthread_startup()
|
|||
{
|
||||
/* clear .bss */
|
||||
rt_hw_clear_bss();
|
||||
|
||||
|
||||
/* init hardware interrupt */
|
||||
rt_hw_interrupt_init();
|
||||
|
||||
|
||||
/* init the console */
|
||||
rt_console_init();
|
||||
|
||||
rt_hw_console_init();
|
||||
rt_console_set_device("console");
|
||||
|
||||
/* init board */
|
||||
rt_hw_board_init();
|
||||
|
||||
|
||||
rt_show_version();
|
||||
|
||||
|
||||
/* init tick */
|
||||
rt_system_tick_init();
|
||||
|
||||
rt_system_tick_init();
|
||||
|
||||
/* init kernel object */
|
||||
rt_system_object_init();
|
||||
|
||||
|
||||
/* init timer system */
|
||||
rt_system_timer_init();
|
||||
|
||||
|
||||
/* init memory system */
|
||||
#ifdef RT_USING_HEAP
|
||||
//rt_system_heap_init();
|
||||
#ifdef RT_USING_HEAP
|
||||
rt_system_heap_init((void*)&__bss_end, (void*)(1024UL*1024*8)); /* RAM 16M */
|
||||
#endif
|
||||
|
||||
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
/* init the finsh input */
|
||||
rt_hw_finsh_init();
|
||||
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
/* init finsh */
|
||||
finsh_system_init();
|
||||
|
||||
finsh_set_device("console");
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_HOOK
|
||||
/* set idle thread hook */
|
||||
rt_thread_idle_sethook(RT_NULL);
|
||||
#endif
|
||||
|
||||
|
||||
/* init idle thread */
|
||||
rt_thread_idle_init();
|
||||
|
||||
|
||||
/* start scheduler */
|
||||
rt_system_scheduler_start();
|
||||
|
||||
|
||||
/* never reach here */
|
||||
return ;
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
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
|
|
@ -1,9 +0,0 @@
|
|||
KERNEL_ROOT=..
|
||||
|
||||
include $(KERNEL_ROOT)/config.mk
|
||||
|
||||
all:
|
||||
make -C $(BOARD)
|
||||
|
||||
clean:
|
||||
make -C $(BOARD) clean
|
|
@ -1,39 +0,0 @@
|
|||
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 $^ > $@
|
|
@ -1,18 +0,0 @@
|
|||
#!/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
|
|
@ -1,38 +0,0 @@
|
|||
# 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
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
#
|
||||
# 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 $@ $<
|
|
@ -1,59 +0,0 @@
|
|||
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
|
|
@ -1,24 +0,0 @@
|
|||
#!/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
|
|
@ -1,29 +0,0 @@
|
|||
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 $^ > $@
|
|
@ -1,9 +0,0 @@
|
|||
KERNEL_ROOT=..
|
||||
|
||||
include $(KERNEL_ROOT)/config.mk
|
||||
|
||||
all:
|
||||
make -C $(ARCH)
|
||||
|
||||
clean:
|
||||
make -C $(ARCH) clean
|
|
@ -1,33 +0,0 @@
|
|||
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 $^ > $@
|
|
@ -1,9 +0,0 @@
|
|||
./create-link
|
||||
make
|
||||
cp bsp/qemu/rtthread-qemu.elf $dest
|
||||
|
||||
|
||||
|
||||
test OK ON:
|
||||
Fedora 10
|
||||
Fedora 11
|
|
@ -1,25 +0,0 @@
|
|||
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 $^ > $@
|
|
@ -1,210 +0,0 @@
|
|||
/*
|
||||
* File : console.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-09-15 QiuYi the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
|
||||
#include "serial.h"
|
||||
|
||||
static unsigned addr_6845;
|
||||
static rt_uint16_t *crt_buf;
|
||||
static rt_int16_t crt_pos;
|
||||
|
||||
extern void rt_serial_init(void);
|
||||
extern char rt_keyboard_getc(void);
|
||||
|
||||
static void rt_console_putc(int c);
|
||||
|
||||
/**
|
||||
* @addtogroup QEMU
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* This function initializes cga
|
||||
*
|
||||
*/
|
||||
void rt_cga_init(void)
|
||||
{
|
||||
rt_uint16_t volatile *cp;
|
||||
rt_uint16_t was;
|
||||
rt_uint32_t pos;
|
||||
|
||||
cp = (rt_uint16_t *) (CGA_BUF);
|
||||
was = *cp;
|
||||
*cp = (rt_uint16_t) 0xA55A;
|
||||
if (*cp != 0xA55A)
|
||||
{
|
||||
cp = (rt_uint16_t *) (MONO_BUF);
|
||||
addr_6845 = MONO_BASE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*cp = was;
|
||||
addr_6845 = CGA_BASE;
|
||||
}
|
||||
|
||||
/* Extract cursor location */
|
||||
outb(addr_6845, 14);
|
||||
pos = inb(addr_6845+1) << 8;
|
||||
outb(addr_6845, 15);
|
||||
pos |= inb(addr_6845+1);
|
||||
|
||||
crt_buf = (rt_uint16_t *)cp;
|
||||
crt_pos = pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will write a character to cga
|
||||
*
|
||||
* @param c the char to write
|
||||
*/
|
||||
static void rt_cga_putc(int c)
|
||||
{
|
||||
/* if no attribute given, then use black on white */
|
||||
if (!(c & ~0xff)) c |= 0x0700;
|
||||
|
||||
switch (c & 0xff)
|
||||
{
|
||||
case '\b':
|
||||
if (crt_pos > 0)
|
||||
{
|
||||
crt_pos--;
|
||||
crt_buf[crt_pos] = (c&~0xff) | ' ';
|
||||
}
|
||||
break;
|
||||
case '\n':
|
||||
crt_pos += CRT_COLS;
|
||||
/* cascade */
|
||||
case '\r':
|
||||
crt_pos -= (crt_pos % CRT_COLS);
|
||||
break;
|
||||
case '\t':
|
||||
rt_console_putc(' ');
|
||||
rt_console_putc(' ');
|
||||
rt_console_putc(' ');
|
||||
rt_console_putc(' ');
|
||||
rt_console_putc(' ');
|
||||
break;
|
||||
default:
|
||||
crt_buf[crt_pos++] = c; /* write the character */
|
||||
break;
|
||||
}
|
||||
|
||||
if (crt_pos >= CRT_SIZE)
|
||||
{
|
||||
rt_int32_t i;
|
||||
rt_memcpy(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) << 1);
|
||||
for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i++)
|
||||
crt_buf[i] = 0x0700 | ' ';
|
||||
crt_pos -= CRT_COLS;
|
||||
}
|
||||
|
||||
outb(addr_6845, 14);
|
||||
outb(addr_6845+1, crt_pos >> 8);
|
||||
outb(addr_6845, 15);
|
||||
outb(addr_6845+1, crt_pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will write a character to serial an cga
|
||||
*
|
||||
* @param c the char to write
|
||||
*/
|
||||
static void rt_console_putc(int c)
|
||||
{
|
||||
rt_cga_putc(c);
|
||||
rt_serial_putc(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function initializes console
|
||||
*
|
||||
*/
|
||||
void rt_console_init(void)
|
||||
{
|
||||
rt_cga_init();
|
||||
rt_serial_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to display a string on console, normally, it's
|
||||
* invoked by rt_kprintf
|
||||
*
|
||||
* @param str the displayed string
|
||||
*
|
||||
* Modified:
|
||||
* caoxl 2009-10-14
|
||||
* the name is change to rt_hw_console_output in the v0.3.0
|
||||
*
|
||||
*/
|
||||
|
||||
//void rt_console_puts(const char* str)
|
||||
void rt_hw_console_output(const char* str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
rt_console_putc (*str++);
|
||||
}
|
||||
}
|
||||
|
||||
#define BY2CONS 512
|
||||
|
||||
static struct
|
||||
{
|
||||
rt_uint8_t buf[BY2CONS];
|
||||
rt_uint32_t rpos;
|
||||
rt_uint32_t wpos;
|
||||
}cons;
|
||||
|
||||
static void rt_console_intr(char (*proc)(void))
|
||||
{
|
||||
int c;
|
||||
|
||||
while ((c = (*proc)()) != -1)
|
||||
{
|
||||
if (c == 0)
|
||||
continue;
|
||||
cons.buf[cons.wpos++] = c;
|
||||
if (cons.wpos == BY2CONS)
|
||||
cons.wpos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return the next input character from the console,either from serial,
|
||||
* or keyboard
|
||||
*
|
||||
*/
|
||||
int rt_console_getc(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
rt_console_intr(rt_serial_getc);
|
||||
rt_console_intr(rt_keyboard_getc);
|
||||
|
||||
if (cons.rpos != cons.wpos)
|
||||
{
|
||||
c = cons.buf[cons.rpos++];
|
||||
if (cons.rpos == BY2CONS)
|
||||
cons.rpos = 0;
|
||||
return c;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*@}*/
|
|
@ -0,0 +1,13 @@
|
|||
Import('RTT_ROOT')
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = os.path.join(str(Dir('#')), 'drivers')
|
||||
|
||||
src = Glob('*.c')
|
||||
|
||||
CPPPATH = [cwd, cwd + '/include']
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
|
@ -12,7 +12,7 @@
|
|||
* 2006-09-15 QiuYi the first version
|
||||
* 2006-10-10 Bernard add hardware related of finsh
|
||||
*/
|
||||
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
|
||||
|
@ -34,36 +34,31 @@ static void rt_timer_handler(int vector)
|
|||
*/
|
||||
void rt_hw_board_init(void)
|
||||
{
|
||||
/* initialize 8253 clock to interrupt 100 times/sec */
|
||||
/* initialize 8253 clock to interrupt 1000 times/sec */
|
||||
outb(TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT);
|
||||
outb(IO_TIMER1, TIMER_DIV(100) % 256);
|
||||
outb(IO_TIMER1, TIMER_DIV(100) / 256);
|
||||
outb(IO_TIMER1, TIMER_DIV(RT_TICK_PER_SECOND) % 256);
|
||||
outb(IO_TIMER1, TIMER_DIV(RT_TICK_PER_SECOND) / 256);
|
||||
|
||||
/* install interrupt handler */
|
||||
rt_hw_interrupt_install(INTTIMER0, rt_timer_handler, RT_NULL);
|
||||
rt_hw_interrupt_umask(INTTIMER0);
|
||||
}
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
extern void finsh_notify(void);
|
||||
static void rt_serial_isr(int vector)
|
||||
{
|
||||
finsh_notify();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will init hardware related in finsh shell
|
||||
*/
|
||||
void rt_hw_finsh_init()
|
||||
{
|
||||
/* install UART isr */
|
||||
rt_hw_interrupt_install(INTUART0_RX, rt_serial_isr, RT_NULL);
|
||||
rt_hw_interrupt_umask(INTUART0_RX);
|
||||
|
||||
/* install keyboard isr */
|
||||
rt_hw_interrupt_install(INTKEYBOARD, rt_serial_isr, RT_NULL);
|
||||
rt_hw_interrupt_umask(INTKEYBOARD);
|
||||
}
|
||||
#endif
|
||||
|
||||
void restart(void)
|
||||
{
|
||||
outb(KBSTATP, 0xFE); /* pulse reset low */
|
||||
while(1);
|
||||
}
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <finsh.h>
|
||||
FINSH_FUNCTION_EXPORT(restart, reboot PC)
|
||||
|
||||
void reboot(void)
|
||||
{
|
||||
restart();
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(reboot, reboot PC)
|
||||
#endif
|
||||
|
||||
/*@}*/
|
|
@ -17,8 +17,4 @@
|
|||
|
||||
void rt_hw_board_init(void);
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
void rt_hw_finsh_init(void);
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,378 @@
|
|||
/*
|
||||
* File : console.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-09-15 QiuYi the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
|
||||
//#include "serial.h"
|
||||
|
||||
static unsigned addr_6845;
|
||||
static rt_uint16_t *crt_buf;
|
||||
static rt_int16_t crt_pos;
|
||||
|
||||
//extern void rt_serial_init(void);
|
||||
extern char rt_keyboard_getc(void);
|
||||
//extern char rt_serial_getc(void);
|
||||
|
||||
static void rt_console_putc(int c);
|
||||
|
||||
/**
|
||||
* @addtogroup QEMU
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* This function initializes cga
|
||||
*
|
||||
*/
|
||||
void rt_cga_init(void)
|
||||
{
|
||||
rt_uint16_t volatile *cp;
|
||||
rt_uint16_t was;
|
||||
rt_uint32_t pos;
|
||||
|
||||
cp = (rt_uint16_t *) (CGA_BUF);
|
||||
was = *cp;
|
||||
*cp = (rt_uint16_t) 0xA55A;
|
||||
if (*cp != 0xA55A)
|
||||
{
|
||||
cp = (rt_uint16_t *) (MONO_BUF);
|
||||
addr_6845 = MONO_BASE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*cp = was;
|
||||
addr_6845 = CGA_BASE;
|
||||
}
|
||||
|
||||
/* Extract cursor location */
|
||||
outb(addr_6845, 14);
|
||||
pos = inb(addr_6845+1) << 8;
|
||||
outb(addr_6845, 15);
|
||||
pos |= inb(addr_6845+1);
|
||||
|
||||
crt_buf = (rt_uint16_t *)cp;
|
||||
crt_pos = pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will write a character to cga
|
||||
*
|
||||
* @param c the char to write
|
||||
*/
|
||||
static void rt_cga_putc(int c)
|
||||
{
|
||||
/* if no attribute given, then use black on white */
|
||||
if (!(c & ~0xff)) c |= 0x0700;
|
||||
|
||||
switch (c & 0xff)
|
||||
{
|
||||
case '\b':
|
||||
if (crt_pos > 0)
|
||||
{
|
||||
crt_pos--;
|
||||
crt_buf[crt_pos] = (c&~0xff) | ' ';
|
||||
}
|
||||
break;
|
||||
case '\n':
|
||||
crt_pos += CRT_COLS;
|
||||
/* cascade */
|
||||
case '\r':
|
||||
crt_pos -= (crt_pos % CRT_COLS);
|
||||
break;
|
||||
case '\t':
|
||||
rt_console_putc(' ');
|
||||
rt_console_putc(' ');
|
||||
rt_console_putc(' ');
|
||||
rt_console_putc(' ');
|
||||
rt_console_putc(' ');
|
||||
break;
|
||||
default:
|
||||
crt_buf[crt_pos++] = c; /* write the character */
|
||||
break;
|
||||
}
|
||||
|
||||
if (crt_pos >= CRT_SIZE)
|
||||
{
|
||||
rt_int32_t i;
|
||||
rt_memcpy(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) << 1);
|
||||
for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i++)
|
||||
crt_buf[i] = 0x0700 | ' ';
|
||||
crt_pos -= CRT_COLS;
|
||||
}
|
||||
|
||||
outb(addr_6845, 14);
|
||||
outb(addr_6845+1, crt_pos >> 8);
|
||||
outb(addr_6845, 15);
|
||||
outb(addr_6845+1, crt_pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will write a character to serial an cga
|
||||
*
|
||||
* @param c the char to write
|
||||
*/
|
||||
static void rt_console_putc(int c)
|
||||
{
|
||||
rt_cga_putc(c);
|
||||
// rt_serial_putc(c);
|
||||
}
|
||||
|
||||
/* RT-Thread Device Interface */
|
||||
#define CONSOLE_RX_BUFFER_SIZE 64
|
||||
static struct rt_device console_device;
|
||||
static rt_uint8_t rx_buffer[CONSOLE_RX_BUFFER_SIZE];
|
||||
static rt_uint32_t read_index, save_index;
|
||||
|
||||
static rt_err_t rt_console_init (rt_device_t dev)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt_console_open(rt_device_t dev, rt_uint16_t oflag)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt_console_close(rt_device_t dev)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t rt_console_control(rt_device_t dev, rt_uint8_t cmd, void *args)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_size_t rt_console_write(rt_device_t dev, rt_off_t pos, const void * buffer, rt_size_t size)
|
||||
{
|
||||
rt_size_t i = size;
|
||||
const char* str = buffer;
|
||||
|
||||
while(i--)
|
||||
{
|
||||
rt_console_putc(*str++);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static rt_size_t rt_console_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
|
||||
{
|
||||
rt_uint8_t* ptr = buffer;
|
||||
rt_err_t err_code = RT_EOK;
|
||||
|
||||
/* interrupt mode Rx */
|
||||
while (size)
|
||||
{
|
||||
rt_base_t level;
|
||||
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
if (read_index != save_index)
|
||||
{
|
||||
/* read a character */
|
||||
*ptr++ = rx_buffer[read_index];
|
||||
size--;
|
||||
|
||||
/* move to next position */
|
||||
read_index ++;
|
||||
if (read_index >= CONSOLE_RX_BUFFER_SIZE)
|
||||
read_index = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* set error code */
|
||||
err_code = -RT_EEMPTY;
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
break;
|
||||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
|
||||
/* set error code */
|
||||
rt_set_errno(err_code);
|
||||
return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
|
||||
}
|
||||
|
||||
static void rt_console_isr(int vector)
|
||||
{
|
||||
// rt_kprintf("rt_console_isr\r\n");
|
||||
// RT_ASSERT(INTKEYBOARD == vector);
|
||||
// finsh_notify();
|
||||
|
||||
char c;
|
||||
rt_base_t level;
|
||||
|
||||
while(1)
|
||||
{
|
||||
c = rt_keyboard_getc();
|
||||
// rt_kprintf(" %x", c);
|
||||
|
||||
if(c == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if(c > 0)
|
||||
{
|
||||
/* disable interrupt */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* save character */
|
||||
rx_buffer[save_index] = c;
|
||||
save_index ++;
|
||||
if (save_index >= CONSOLE_RX_BUFFER_SIZE)
|
||||
save_index = 0;
|
||||
|
||||
/* if the next position is read index, discard this 'read char' */
|
||||
if (save_index == read_index)
|
||||
{
|
||||
read_index ++;
|
||||
if (read_index >= CONSOLE_RX_BUFFER_SIZE)
|
||||
read_index = 0;
|
||||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
}
|
||||
|
||||
/* invoke callback */
|
||||
if (console_device.rx_indicate != RT_NULL)
|
||||
{
|
||||
rt_size_t rx_length;
|
||||
|
||||
/* get rx length */
|
||||
rx_length = read_index > save_index ?
|
||||
CONSOLE_RX_BUFFER_SIZE - read_index + save_index :
|
||||
save_index - read_index;
|
||||
|
||||
// rt_kprintf("\r\nrx_length %d\r\n", rx_length);
|
||||
if(rx_length > 0)
|
||||
{
|
||||
console_device.rx_indicate(&console_device, rx_length);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// rt_kprintf("\r\nconsole_device.rx_indicate == RT_NULL\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function initializes console
|
||||
*
|
||||
*/
|
||||
void rt_hw_console_init(void)
|
||||
{
|
||||
rt_cga_init();
|
||||
// rt_serial_init();
|
||||
|
||||
|
||||
/* install keyboard isr */
|
||||
rt_hw_interrupt_install(INTKEYBOARD, rt_console_isr, RT_NULL);
|
||||
rt_hw_interrupt_umask(INTKEYBOARD);
|
||||
|
||||
console_device.type = RT_Device_Class_Char;
|
||||
console_device.rx_indicate = RT_NULL;
|
||||
console_device.tx_complete = RT_NULL;
|
||||
console_device.init = rt_console_init;
|
||||
console_device.open = rt_console_open;
|
||||
console_device.close = rt_console_close;
|
||||
console_device.read = rt_console_read;
|
||||
console_device.write = rt_console_write;
|
||||
console_device.control = rt_console_control;
|
||||
console_device.user_data = RT_NULL;
|
||||
|
||||
/* register a character device */
|
||||
rt_device_register(&console_device,
|
||||
"console",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to display a string on console, normally, it's
|
||||
* invoked by rt_kprintf
|
||||
*
|
||||
* @param str the displayed string
|
||||
*
|
||||
* Modified:
|
||||
* caoxl 2009-10-14
|
||||
* the name is change to rt_hw_console_output in the v0.3.0
|
||||
*
|
||||
*/
|
||||
|
||||
//void rt_console_puts(const char* str)
|
||||
void rt_hw_console_output(const char* str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
rt_console_putc (*str++);
|
||||
}
|
||||
}
|
||||
|
||||
//#define BY2CONS 512
|
||||
//
|
||||
//static struct
|
||||
//{
|
||||
// rt_uint8_t buf[BY2CONS];
|
||||
// rt_uint32_t rpos;
|
||||
// rt_uint32_t wpos;
|
||||
//} cons;
|
||||
//
|
||||
//static void rt_console_intr(char (*proc)(void))
|
||||
//{
|
||||
// int c;
|
||||
//
|
||||
// while ((c = (*proc)()) != -1)
|
||||
// {
|
||||
// if (c == 0)
|
||||
// continue;
|
||||
// cons.buf[cons.wpos++] = c;
|
||||
// if (cons.wpos == BY2CONS)
|
||||
// cons.wpos = 0;
|
||||
// }
|
||||
//}
|
||||
|
||||
///**
|
||||
// * return the next input character from the console,either from serial,
|
||||
// * or keyboard
|
||||
// *
|
||||
// */
|
||||
//int rt_console_getc(void)
|
||||
//{
|
||||
// int c;
|
||||
//
|
||||
// rt_console_intr(rt_serial_getc);
|
||||
// rt_console_intr(rt_keyboard_getc);
|
||||
//
|
||||
// if (cons.rpos != cons.wpos)
|
||||
// {
|
||||
// c = cons.buf[cons.rpos++];
|
||||
// if (cons.rpos == BY2CONS)
|
||||
// cons.rpos = 0;
|
||||
// return c;
|
||||
// }
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
/*@}*/
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* File : bsp.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-09-15 QiuYi the first version */
|
||||
|
||||
#ifndef __BSP_H_
|
||||
#define __BSP_H_
|
||||
|
||||
#include <i386.h>
|
||||
|
||||
/*******************************************************************/
|
||||
/* Timer Register */
|
||||
/*******************************************************************/
|
||||
#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
|
||||
#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
|
||||
#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
|
||||
#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
|
||||
#define TIMER_SEL0 0x00 /* select counter 0 */
|
||||
#define TIMER_SEL1 0x40 /* select counter 1 */
|
||||
#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
|
||||
#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
|
||||
#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
|
||||
#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
|
||||
#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
|
||||
#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
|
||||
#define TIMER_LATCH 0x00 /* latch counter for reading */
|
||||
#define TIMER_LSB 0x10 /* r/w counter LSB */
|
||||
#define TIMER_MSB 0x20 /* r/w counter MSB */
|
||||
#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
|
||||
#define TIMER_BCD 0x01 /* count in BCD */
|
||||
|
||||
#define TIMER_FREQ 1193182
|
||||
#define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x))
|
||||
|
||||
#define IO_TIMER1 0x040 /* 8253 Timer #1 */
|
||||
|
||||
/*******************************************************************/
|
||||
/* Interrupt Controller */
|
||||
/*******************************************************************/
|
||||
/* these are processor defined */
|
||||
#define T_DIVIDE 0 /* divide error */
|
||||
#define T_DEBUG 1 /* debug exception */
|
||||
#define T_NMI 2 /* non-maskable interrupt */
|
||||
#define T_BRKPT 3 /* breakpoint */
|
||||
#define T_OFLOW 4 /* overflow */
|
||||
#define T_BOUND 5 /* bounds check */
|
||||
#define T_ILLOP 6 /* illegal opcode */
|
||||
#define T_DEVICE 7 /* device not available */
|
||||
#define T_DBLFLT 8 /* double fault */
|
||||
/* 9 is reserved */
|
||||
#define T_TSS 10 /* invalid task switch segment */
|
||||
#define T_SEGNP 11 /* segment not present */
|
||||
#define T_STACK 12 /* stack exception */
|
||||
#define T_GPFLT 13 /* genernal protection fault */
|
||||
#define T_PGFLT 14 /* page fault */
|
||||
/* 15 is reserved */
|
||||
#define T_FPERR 16 /* floating point error */
|
||||
#define T_ALIGN 17 /* aligment check */
|
||||
#define T_MCHK 18 /* machine check */
|
||||
#define T_DEFAULT 500 /* catchall */
|
||||
|
||||
#define INTTIMER0 0
|
||||
#define INTKEYBOARD 1
|
||||
#define INTUART0_RX 4
|
||||
|
||||
/* I/O Addresses of the two 8259A programmable interrupt controllers */
|
||||
#define IO_PIC1 0x20 /* Master(IRQs 0-7) */
|
||||
#define IO_PIC2 0xa0 /* Slave(IRQs 8-15) */
|
||||
#define IRQ_SLAVE 0x2 /* IRQ at which slave connects to master */
|
||||
#define IRQ_OFFSET 0x20 /* IRQ 0 corresponds to int IRQ_OFFSET */
|
||||
|
||||
#define MAX_HANDLERS 16 /*max number of isr handler*/
|
||||
|
||||
/*******************************************************************/
|
||||
/* CRT Register */
|
||||
/*******************************************************************/
|
||||
#define MONO_BASE 0x3b4
|
||||
#define MONO_BUF 0xb0000
|
||||
#define CGA_BASE 0x3d4
|
||||
#define CGA_BUF 0xb8000
|
||||
|
||||
#define CRT_ROWS 25
|
||||
#define CRT_COLS 80
|
||||
#define CRT_SIZE (CRT_ROWS * CRT_COLS)
|
||||
|
||||
/*******************************************************************/
|
||||
/* Keyboard Register */
|
||||
/*******************************************************************/
|
||||
#define KBSTATP 0x64 /* kbd controller status port(I) */
|
||||
#define KBS_DIB 0x01 /* kbd data in buffer */
|
||||
#define KBDATAP 0x60 /* kbd data port(I) */
|
||||
|
||||
/*******************************************************************/
|
||||
/* Serial Register */
|
||||
/*******************************************************************/
|
||||
/*Serial I/O code */
|
||||
#define COM1 0x3F8
|
||||
#define COMSTATUS 5
|
||||
#define COMDATA 0x01
|
||||
#define COMREAD 0
|
||||
#define COMWRITE 0
|
||||
|
||||
/* Bits definition of the Line Status Register (LSR)*/
|
||||
#define DR 0x01 /* Data Ready */
|
||||
#define OE 0x02 /* Overrun Error */
|
||||
#define PE 0x04 /* Parity Error */
|
||||
#define FE 0x08 /* Framing Error */
|
||||
#define BI 0x10 /* Break Interrupt */
|
||||
#define THRE 0x20 /* Transmitter Holding Register Empty */
|
||||
#define TEMT 0x40 /* Transmitter Empty */
|
||||
#define ERFIFO 0x80 /* Error receive Fifo */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __BSP_H_ */
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* File : grub.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006, RT-Thread Develop Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://openlab.rt-thread.com/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2006-10-09 Bernard the grub related definitions
|
||||
* (multiboot)
|
||||
*/
|
||||
|
||||
#ifndef __GRUB_H__
|
||||
#define __GRUB_H__
|
||||
|
||||
/* the magic number for the multiboot header. */
|
||||
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
|
||||
|
||||
/* the flags for the multiboot header. */
|
||||
#define MULTIBOOT_HEADER_FLAGS 0x00000003
|
||||
|
||||
/* the magic number passed by a multiboot-compliant boot loader. */
|
||||
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
|
||||
|
||||
#ifndef __ASM__
|
||||
/* the multiboot header. */
|
||||
typedef struct multiboot_header
|
||||
{
|
||||
unsigned long magic;
|
||||
unsigned long flags;
|
||||
unsigned long checksum;
|
||||
unsigned long header_addr;
|
||||
unsigned long load_addr;
|
||||
unsigned long load_end_addr;
|
||||
unsigned long bss_end_addr;
|
||||
unsigned long entry_addr;
|
||||
} multiboot_header_t;
|
||||
|
||||
/* the section header table for elf. */
|
||||
typedef struct elf_section_header_table
|
||||
{
|
||||
unsigned long num;
|
||||
unsigned long size;
|
||||
unsigned long addr;
|
||||
unsigned long shndx;
|
||||
} elf_section_header_table_t;
|
||||
|
||||
/* the multiboot information. */
|
||||
typedef struct multiboot_info
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long mem_lower;
|
||||
unsigned long mem_upper;
|
||||
unsigned long boot_device;
|
||||
unsigned long cmdline;
|
||||
unsigned long mods_count;
|
||||
unsigned long mods_addr;
|
||||
union
|
||||
{
|
||||
aout_symbol_table_t aout_sym;
|
||||
elf_section_header_table_t elf_sec;
|
||||
} u;
|
||||
unsigned long mmap_length;
|
||||
unsigned long mmap_addr;
|
||||
} multiboot_info_t;
|
||||
|
||||
/* the module structure. */
|
||||
typedef struct module
|
||||
{
|
||||
unsigned long mod_start;
|
||||
unsigned long mod_end;
|
||||
unsigned long string;
|
||||
unsigned long reserved;
|
||||
} module_t;
|
||||
|
||||
/* the memory map. be careful that the offset 0 is base_addr_low
|
||||
but no size. */
|
||||
typedef struct memory_map
|
||||
{
|
||||
unsigned long size;
|
||||
unsigned long base_addr_low;
|
||||
unsigned long base_addr_high;
|
||||
unsigned long length_low;
|
||||
unsigned long length_high;
|
||||
unsigned long type;
|
||||
} memory_map_t;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,108 @@
|
|||
#ifndef __I386_H_
|
||||
#define __I386_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static __inline unsigned char inb(int port)
|
||||
{
|
||||
unsigned char data;
|
||||
__asm __volatile("inb %w1,%0" : "=a" (data) : "d" (port));
|
||||
return data;
|
||||
}
|
||||
|
||||
static __inline unsigned short inw(int port)
|
||||
{
|
||||
unsigned short data;
|
||||
__asm __volatile("inw %w1,%0" : "=a" (data) : "d" (port));
|
||||
return data;
|
||||
}
|
||||
|
||||
static __inline unsigned int inl(int port)
|
||||
{
|
||||
unsigned int data;
|
||||
__asm __volatile("inl %w1,%0" : "=a" (data) : "d" (port));
|
||||
return data;
|
||||
}
|
||||
|
||||
static __inline void insl(int port, void *addr, int cnt)
|
||||
{
|
||||
__asm __volatile("cld\n\trepne\n\tinsl" :
|
||||
"=D" (addr), "=c" (cnt) :
|
||||
"d" (port), "0" (addr), "1" (cnt) :
|
||||
"memory", "cc");
|
||||
}
|
||||
|
||||
static __inline void outb(int port, unsigned char data)
|
||||
{
|
||||
__asm __volatile("outb %0,%w1" : : "a" (data), "d" (port));
|
||||
}
|
||||
|
||||
static __inline void outw(int port, unsigned short data)
|
||||
{
|
||||
__asm __volatile("outw %0,%w1" : : "a" (data), "d" (port));
|
||||
}
|
||||
|
||||
/* Gate descriptors are slightly different*/
|
||||
struct Gatedesc {
|
||||
unsigned gd_off_15_0 : 16; // low 16 bits of offset in segment
|
||||
unsigned gd_ss : 16; // segment selector
|
||||
unsigned gd_args : 5; // # args, 0 for interrupt/trap gates
|
||||
unsigned gd_rsv1 : 3; // reserved(should be zero I guess)
|
||||
unsigned gd_type :4; // type(STS_{TG,IG32,TG32})
|
||||
unsigned gd_s : 1; // must be 0 (system)
|
||||
unsigned gd_dpl : 2; // descriptor(meaning new) privilege level
|
||||
unsigned gd_p : 1; // Present
|
||||
unsigned gd_off_31_16 : 16; // high bits of offset in segment
|
||||
};
|
||||
|
||||
/* Pseudo-descriptors used for LGDT, LLDT and LIDT instructions*/
|
||||
struct Pseudodesc {
|
||||
rt_uint16_t pd__garbage; // LGDT supposed to be from address 4N+2
|
||||
rt_uint16_t pd_lim; // Limit
|
||||
rt_uint32_t pd_base __attribute__ ((packed)); // Base address
|
||||
};
|
||||
|
||||
#define SETGATE(gate, istrap, sel, off, dpl) \
|
||||
{ \
|
||||
(gate).gd_off_15_0 = (rt_uint32_t) (off) & 0xffff; \
|
||||
(gate).gd_ss = (sel); \
|
||||
(gate).gd_args = 0; \
|
||||
(gate).gd_rsv1 = 0; \
|
||||
(gate).gd_type = (istrap) ? STS_TG32 : STS_IG32; \
|
||||
(gate).gd_s = 0; \
|
||||
(gate).gd_dpl = dpl; \
|
||||
(gate).gd_p = 1; \
|
||||
(gate).gd_off_31_16 = (rt_uint32_t) (off) >> 16; \
|
||||
}
|
||||
|
||||
/* Global descriptor numbers*/
|
||||
#define GD_KT 0x08 // kernel text
|
||||
#define GD_KD 0x10 // kernel data
|
||||
#define GD_UT 0x18 // user text
|
||||
#define GD_UD 0x20 // user data
|
||||
|
||||
/* Application segment type bits*/
|
||||
#define STA_X 0x8 // Executable segment
|
||||
#define STA_E 0x4 // Expand down(non-executable segments)
|
||||
#define STA_C 0x4 // Conforming code segment(executable only)
|
||||
#define STA_W 0x2 // Writeable(non-executable segments)
|
||||
#define STA_R 0x2 // Readable(executable segments)
|
||||
#define STA_A 0x1 // Accessed
|
||||
|
||||
/* System segment type bits*/
|
||||
#define STS_T16A 0x1 // Available 16-bit TSS
|
||||
#define STS_LDT 0x2 // Local Descriptor Table
|
||||
#define STS_T16B 0x3 // Busy 16-bit TSS
|
||||
#define STS_CG16 0x4 // 16-bit Call Gate
|
||||
#define STS_TG 0x5 // Task Gate / Coum Transmitions
|
||||
#define STS_IG16 0x6 // 16-bit Interrupt Gate
|
||||
#define STS_TG16 0x7 // 16-bit Trap Gate
|
||||
#define STS_T32A 0x9 // Available 32-bit TSS
|
||||
#define STS_T32B 0xb // Busy 32-bit TSS
|
||||
#define STS_CG32 0xc // 32-bit Call Gate
|
||||
#define STS_IG32 0xe // 32-bit Interrupt Gate
|
||||
#define STS_TG32 0xf // 32-bit Trap Gate
|
||||
|
||||
#endif
|
|
@ -0,0 +1,177 @@
|
|||
/* RT-Thread config file */
|
||||
#ifndef __RTTHREAD_CFG_H__
|
||||
#define __RTTHREAD_CFG_H__
|
||||
|
||||
#define RT_USING_NEWLIB
|
||||
//#define RT_USING_PTHREADS
|
||||
#define RT_USING_DFS_DEVFS
|
||||
|
||||
/* RT_NAME_MAX*/
|
||||
#define RT_NAME_MAX 8
|
||||
|
||||
/* RT_ALIGN_SIZE*/
|
||||
#define RT_ALIGN_SIZE 8
|
||||
|
||||
/* PRIORITY_MAX */
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
|
||||
/* Tick per Second */
|
||||
#define RT_TICK_PER_SECOND 1000
|
||||
|
||||
/* SECTION: RT_DEBUG */
|
||||
/* Thread Debug */
|
||||
#define RT_DEBUG
|
||||
#define RT_THREAD_DEBUG
|
||||
|
||||
#define RT_USING_OVERFLOW_CHECK
|
||||
|
||||
/* Using Hook */
|
||||
#define RT_USING_HOOK
|
||||
|
||||
/* Using Software Timer */
|
||||
/* #define RT_USING_TIMER_SOFT */
|
||||
#define RT_TIMER_THREAD_PRIO 4
|
||||
#define RT_TIMER_THREAD_STACK_SIZE 512
|
||||
#define RT_TIMER_TICK_PER_SECOND 10
|
||||
|
||||
/* SECTION: IPC */
|
||||
/* Using Semaphore*/
|
||||
#define RT_USING_SEMAPHORE
|
||||
|
||||
/* Using Mutex */
|
||||
#define RT_USING_MUTEX
|
||||
|
||||
/* Using Event */
|
||||
#define RT_USING_EVENT
|
||||
|
||||
/* Using MailBox */
|
||||
#define RT_USING_MAILBOX
|
||||
|
||||
/* Using Message Queue */
|
||||
#define RT_USING_MESSAGEQUEUE
|
||||
|
||||
/* SECTION: Memory Management */
|
||||
/* Using Memory Pool Management*/
|
||||
#define RT_USING_MEMPOOL
|
||||
|
||||
/* Using Dynamic Heap Management */
|
||||
#define RT_USING_HEAP
|
||||
|
||||
/* Using Small MM */
|
||||
#define RT_USING_SMALL_MEM
|
||||
|
||||
/* SECTION: Device System */
|
||||
/* Using Device System */
|
||||
#define RT_USING_DEVICE
|
||||
|
||||
/* SECTION: Console options */
|
||||
#define RT_USING_CONSOLE
|
||||
/* the buffer size of console*/
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
|
||||
#define IDLE_THREAD_STACK_SIZE 1024 /* idle stack 1K */
|
||||
|
||||
/* SECTION: finsh, a C-Express shell */
|
||||
#define RT_USING_FINSH
|
||||
/* Using symbol table */
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
|
||||
/* SECTION: device filesystem */
|
||||
#define RT_USING_DFS
|
||||
|
||||
#define RT_USING_DFS_ELMFAT
|
||||
#define RT_DFS_ELM_WORD_ACCESS
|
||||
/* Reentrancy (thread safe) of the FatFs module. */
|
||||
#define RT_DFS_ELM_REENTRANT
|
||||
/* Number of volumes (logical drives) to be used. */
|
||||
#define RT_DFS_ELM_DRIVES 2
|
||||
/* #define RT_DFS_ELM_USE_LFN 1 */
|
||||
#define RT_DFS_ELM_MAX_LFN 255
|
||||
/* Maximum sector size to be handled. */
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
|
||||
|
||||
/* the max number of mounted filesystem */
|
||||
#define DFS_FILESYSTEMS_MAX 2
|
||||
/* the max number of opened files */
|
||||
#define DFS_FD_MAX 4
|
||||
|
||||
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
|
||||
//#define RT_USING_LWIP
|
||||
/* LwIP uses RT-Thread Memory Management */
|
||||
#define RT_LWIP_USING_RT_MEM
|
||||
/* Enable ICMP protocol*/
|
||||
#define RT_LWIP_ICMP
|
||||
/* Enable UDP protocol*/
|
||||
#define RT_LWIP_UDP
|
||||
/* Enable TCP protocol*/
|
||||
#define RT_LWIP_TCP
|
||||
/* Enable DNS */
|
||||
#define RT_LWIP_DNS
|
||||
|
||||
/* the number of simulatenously active TCP connections*/
|
||||
#define RT_LWIP_TCP_PCB_NUM 5
|
||||
|
||||
/* Using DHCP */
|
||||
/* #define RT_LWIP_DHCP */
|
||||
|
||||
/* ip address of target*/
|
||||
#define RT_LWIP_IPADDR0 192
|
||||
#define RT_LWIP_IPADDR1 168
|
||||
#define RT_LWIP_IPADDR2 1
|
||||
#define RT_LWIP_IPADDR3 30
|
||||
|
||||
/* gateway address of target*/
|
||||
#define RT_LWIP_GWADDR0 192
|
||||
#define RT_LWIP_GWADDR1 168
|
||||
#define RT_LWIP_GWADDR2 1
|
||||
#define RT_LWIP_GWADDR3 1
|
||||
|
||||
/* mask address of target*/
|
||||
#define RT_LWIP_MSKADDR0 255
|
||||
#define RT_LWIP_MSKADDR1 255
|
||||
#define RT_LWIP_MSKADDR2 255
|
||||
#define RT_LWIP_MSKADDR3 0
|
||||
|
||||
/* tcp thread options */
|
||||
#define RT_LWIP_TCPTHREAD_PRIORITY 12
|
||||
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 10
|
||||
#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
|
||||
|
||||
/* ethernet if thread options */
|
||||
#define RT_LWIP_ETHTHREAD_PRIORITY 15
|
||||
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 10
|
||||
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
|
||||
|
||||
/* TCP sender buffer space */
|
||||
#define RT_LWIP_TCP_SND_BUF 8192
|
||||
/* TCP receive window. */
|
||||
#define RT_LWIP_TCP_WND 8192
|
||||
|
||||
/* SECTION: RT-Thread/GUI */
|
||||
/* #define RT_USING_RTGUI */
|
||||
|
||||
/* name length of RTGUI object */
|
||||
#define RTGUI_NAME_MAX 12
|
||||
/* support 16 weight font */
|
||||
#define RTGUI_USING_FONT16
|
||||
/* support Chinese font */
|
||||
#define RTGUI_USING_FONTHZ
|
||||
/* use DFS as file interface */
|
||||
#define RTGUI_USING_DFS_FILERW
|
||||
/* use font file as Chinese font */
|
||||
#define RTGUI_USING_HZ_FILE
|
||||
/* use Chinese bitmap font */
|
||||
#define RTGUI_USING_HZ_BMP
|
||||
/* use small size in RTGUI */
|
||||
#define RTGUI_USING_SMALL_SIZE
|
||||
/* use mouse cursor */
|
||||
/* #define RTGUI_USING_MOUSE_CURSOR */
|
||||
/* default font size in RTGUI */
|
||||
#define RTGUI_DEFAULT_FONT_SIZE 16
|
||||
|
||||
/* image support */
|
||||
/* #define RTGUI_IMAGE_XPM */
|
||||
/* #define RTGUI_IMAGE_BMP */
|
||||
|
||||
#endif
|
|
@ -0,0 +1,41 @@
|
|||
# toolchains options
|
||||
ARCH='ia32'
|
||||
CPU=''
|
||||
CROSS_TOOL='gcc'
|
||||
|
||||
# cross_tool provides the cross compiler
|
||||
# EXEC_PATH is the compiler execute path, for example, CodeSourcery,
|
||||
|
||||
if CROSS_TOOL == 'gcc':
|
||||
PLATFORM = 'gcc'
|
||||
EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery_CodeBench_Lite_for_IA32_ELF/bin'
|
||||
|
||||
BUILD = 'debug'
|
||||
|
||||
if PLATFORM == 'gcc':
|
||||
# toolchains
|
||||
PREFIX = 'i686-elf-'
|
||||
CC = PREFIX + 'gcc'
|
||||
AS = PREFIX + 'gcc'
|
||||
AR = PREFIX + 'ar'
|
||||
LINK = PREFIX + 'gcc'
|
||||
TARGET_EXT = 'elf'
|
||||
SIZE = PREFIX + 'size'
|
||||
OBJDUMP = PREFIX + 'objdump'
|
||||
OBJCPY = PREFIX + 'objcopy'
|
||||
|
||||
DEVICE = ' -mtune=generic'
|
||||
CFLAGS = DEVICE + ' -Wall'
|
||||
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
|
||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-ia32.map,-cref,-u,_start -T x86_ram.lds'
|
||||
|
||||
CPATH = ''
|
||||
LPATH = ''
|
||||
|
||||
if BUILD == 'debug':
|
||||
CFLAGS += ' -O0 -gdwarf-2'
|
||||
AFLAGS += ' -gdwarf-2'
|
||||
else:
|
||||
CFLAGS += ' -O2'
|
||||
|
||||
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|
|
@ -8,9 +8,20 @@ SECTIONS
|
|||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
*(.init)
|
||||
*(.text)
|
||||
}
|
||||
*(.init)
|
||||
*(.text)
|
||||
|
||||
/* section information for finsh shell */
|
||||
. = ALIGN(4);
|
||||
__fsymtab_start = .;
|
||||
KEEP(*(FSymTab))
|
||||
__fsymtab_end = .;
|
||||
. = ALIGN(4);
|
||||
__vsymtab_start = .;
|
||||
KEEP(*(VSymTab))
|
||||
__vsymtab_end = .;
|
||||
. = ALIGN(4);
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
Loading…
Reference in New Issue