mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-07 00:59:00 +08:00
add GNU GCC support in LPC2478.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1333 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -3,15 +3,8 @@ Import('RTT_ROOT')
|
||||
from building import *
|
||||
|
||||
src_bsp = ['application.c', 'startup.c', 'board.c']
|
||||
src_drv = []
|
||||
|
||||
if GetDepend('RT_USING_DFS'):
|
||||
src_drv += ['sd.c', 'spi.c']
|
||||
|
||||
if GetDepend('RT_USING_LWIP'):
|
||||
src_drv += ['emac.c']
|
||||
|
||||
src = File(src_bsp + src_drv)
|
||||
src = File(src_bsp)
|
||||
CPPPATH = [RTT_ROOT + '/bsp/lpc2478']
|
||||
group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
|
||||
+1
-10
@@ -6,7 +6,7 @@ RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
|
||||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||
from building import *
|
||||
|
||||
TARGET = 'rtthread-lpc2478.' + rtconfig.TARGET_EXT
|
||||
TARGET = 'rtthread-lpc.' + rtconfig.TARGET_EXT
|
||||
|
||||
env = Environment(tools = ['mingw'],
|
||||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
||||
@@ -21,15 +21,6 @@ Export('rtconfig')
|
||||
# prepare building environment
|
||||
objs = PrepareBuilding(env, RTT_ROOT)
|
||||
|
||||
if GetDepend('RT_USING_WEBSERVER'):
|
||||
objs = objs + SConscript(RTT_ROOT + '/components/net/webserver/SConscript', variant_dir='build/net/webserver', duplicate=0)
|
||||
|
||||
if GetDepend('RT_USING_RTGUI'):
|
||||
objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
|
||||
|
||||
# libc testsuite
|
||||
# objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0)
|
||||
|
||||
# build program
|
||||
env.Program(TARGET, objs)
|
||||
|
||||
|
||||
@@ -18,54 +18,8 @@
|
||||
* @addtogroup LPC2478
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
char thread1_stack[512];
|
||||
char thread2_stack[512];
|
||||
|
||||
struct rt_thread thread1;
|
||||
struct rt_thread thread2;
|
||||
|
||||
void thread1_entry(void* parameter)
|
||||
{
|
||||
int i;
|
||||
|
||||
while (1)
|
||||
{
|
||||
for (i = 0; i < 10; i ++)
|
||||
{
|
||||
rt_kprintf("%d\n", i);
|
||||
rt_thread_delay(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void thread2_entry(void* parameter)
|
||||
{
|
||||
int count = 0;
|
||||
while (1)
|
||||
{
|
||||
rt_kprintf("Thread2 count:%d\n", count++);
|
||||
rt_thread_delay(50);
|
||||
}
|
||||
}
|
||||
|
||||
int rt_application_init()
|
||||
{
|
||||
rt_thread_init(&thread1,
|
||||
"thread1",
|
||||
thread1_entry, RT_NULL,
|
||||
&thread1_stack[0], sizeof(thread1_stack),
|
||||
20, 10);
|
||||
|
||||
rt_thread_init(&thread2,
|
||||
"thread2",
|
||||
thread2_entry, RT_NULL,
|
||||
&thread2_stack[0], sizeof(thread2_stack),
|
||||
25, 8);
|
||||
|
||||
rt_thread_startup(&thread1);
|
||||
rt_thread_startup(&thread2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+7
-56
@@ -18,9 +18,9 @@
|
||||
#include <LPC24xx.h>
|
||||
#include "board.h"
|
||||
|
||||
/* #define RT_BOARD_DEBUG */
|
||||
#define DATA_COUNT 14400000/RT_TICK_PER_SECOND /* T0MR0 = delayInMs * (Fpclk / 1000); */
|
||||
|
||||
#define DATA_COUNT 14400000/RT_TICK_PER_SECOND /* T0MR0 = delayInMs * (Fpclk / 1000); */
|
||||
extern void rt_hw_serial_init(void);
|
||||
|
||||
/**
|
||||
* @addtogroup LPC2478
|
||||
@@ -29,70 +29,21 @@
|
||||
|
||||
void rt_timer_handler(int vector)
|
||||
{
|
||||
#ifdef BOARD_DEBUG
|
||||
rt_kprintf("timer handler, increase a tick\n");
|
||||
#endif
|
||||
|
||||
T0IR |= 0x01; /* clear interrupt flag */
|
||||
rt_tick_increase();
|
||||
VICVectAddr = 0; /* Acknowledge Interrupt */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function is used to display a string on console, normally, it's
|
||||
* invoked by rt_kprintf
|
||||
*
|
||||
* @param str the displayed string
|
||||
*/
|
||||
void rt_hw_console_output(const char* str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
if (*str=='\n')
|
||||
{
|
||||
while (!(U0LSR & 0x20));
|
||||
U0THR = '\r';
|
||||
}
|
||||
|
||||
while (!(U0LSR & 0x20));
|
||||
U0THR = *str;
|
||||
|
||||
str ++;
|
||||
}
|
||||
}
|
||||
|
||||
#define BAUD_RATE 115200
|
||||
#define U0PINS 0x50
|
||||
void rt_hw_console_init()
|
||||
{
|
||||
rt_uint32_t fdiv;
|
||||
|
||||
/* Enable RxD and TxD pins */
|
||||
PINSEL0 = U0PINS;
|
||||
|
||||
/* 8 bits, no Parity, 1 Stop bit */
|
||||
U0LCR = 0x83;
|
||||
|
||||
/* Setup Baudrate */
|
||||
fdiv = ( PCLK / 16 ) / BAUD_RATE ; /*baud rate */
|
||||
U0DLM = fdiv / 256;
|
||||
U0DLL = fdiv % 256;
|
||||
U0FCR = 0x00; /* Enable and reset TX and RX FIFO. */
|
||||
U0LCR = 0x03; /* DLAB = 0 */
|
||||
|
||||
/* DLAB = 0 */
|
||||
U0LCR = 0x03;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will init LPC2478 board
|
||||
*/
|
||||
void rt_hw_board_init()
|
||||
{
|
||||
/* init console for rt_kprintf function */
|
||||
rt_hw_console_init();
|
||||
|
||||
#if defined(RT_USING_DEVICE) && defined(RT_USING_UART1)
|
||||
rt_hw_serial_init();
|
||||
rt_console_set_device("uart1");
|
||||
#endif
|
||||
|
||||
T0IR = 0xff;
|
||||
T0TC = 0;
|
||||
T0MCR = 0x03;
|
||||
|
||||
+133
-94
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,143 @@
|
||||
### uVision2 Project, (C) Keil Software
|
||||
### Do not modify !
|
||||
|
||||
Target (RT-Thread LPC2478), 0x0004 // Tools: 'ARM-ADS'
|
||||
|
||||
Group (Startup)
|
||||
Group (Kernel)
|
||||
Group (LPC24XX)
|
||||
Group (finsh)
|
||||
|
||||
File 1,1,<.\application.c><application.c>
|
||||
File 1,1,<.\startup.c><startup.c>
|
||||
File 1,1,<.\board.c><board.c>
|
||||
File 2,1,<..\..\src\clock.c><clock.c>
|
||||
File 2,1,<..\..\src\device.c><device.c>
|
||||
File 2,1,<..\..\src\idle.c><idle.c>
|
||||
File 2,1,<..\..\src\ipc.c><ipc.c>
|
||||
File 2,1,<..\..\src\irq.c><irq.c>
|
||||
File 2,1,<..\..\src\kservice.c><kservice.c>
|
||||
File 2,1,<..\..\src\mem.c><mem.c>
|
||||
File 2,1,<..\..\src\mempool.c><mempool.c>
|
||||
File 2,1,<..\..\src\module.c><module.c>
|
||||
File 2,1,<..\..\src\object.c><object.c>
|
||||
File 2,1,<..\..\src\rtm.c><rtm.c>
|
||||
File 2,1,<..\..\src\scheduler.c><scheduler.c>
|
||||
File 2,1,<..\..\src\slab.c><slab.c>
|
||||
File 2,1,<..\..\src\thread.c><thread.c>
|
||||
File 2,1,<..\..\src\timer.c><timer.c>
|
||||
File 3,1,<..\..\libcpu\arm\lpc24xx\cpu.c><cpu.c>
|
||||
File 3,1,<..\..\libcpu\arm\lpc24xx\interrupt.c><interrupt.c>
|
||||
File 3,1,<..\..\libcpu\arm\lpc24xx\serial.c><serial.c>
|
||||
File 3,1,<..\..\libcpu\arm\lpc24xx\stack.c><stack.c>
|
||||
File 3,1,<..\..\libcpu\arm\lpc24xx\trap.c><trap.c>
|
||||
File 3,2,<..\..\libcpu\arm\lpc24xx\context_rvds.S><context_rvds.S>
|
||||
File 3,2,<..\..\libcpu\arm\lpc24xx\start_rvds.S><start_rvds.S>
|
||||
File 3,1,<..\..\libcpu\arm\common\backtrace.c><backtrace.c>
|
||||
File 3,1,<..\..\libcpu\arm\common\div0.c><div0.c>
|
||||
File 3,1,<..\..\libcpu\arm\common\showmem.c><showmem.c>
|
||||
File 4,1,<..\..\components\finsh\cmd.c><cmd.c>
|
||||
File 4,1,<..\..\components\finsh\finsh_compiler.c><finsh_compiler.c>
|
||||
File 4,1,<..\..\components\finsh\finsh_error.c><finsh_error.c>
|
||||
File 4,1,<..\..\components\finsh\finsh_heap.c><finsh_heap.c>
|
||||
File 4,1,<..\..\components\finsh\finsh_init.c><finsh_init.c>
|
||||
File 4,1,<..\..\components\finsh\finsh_node.c><finsh_node.c>
|
||||
File 4,1,<..\..\components\finsh\finsh_ops.c><finsh_ops.c>
|
||||
File 4,1,<..\..\components\finsh\finsh_parser.c><finsh_parser.c>
|
||||
File 4,1,<..\..\components\finsh\finsh_token.c><finsh_token.c>
|
||||
File 4,1,<..\..\components\finsh\finsh_var.c><finsh_var.c>
|
||||
File 4,1,<..\..\components\finsh\finsh_vm.c><finsh_vm.c>
|
||||
File 4,1,<..\..\components\finsh\shell.c><shell.c>
|
||||
File 4,1,<..\..\components\finsh\symbol.c><symbol.c>
|
||||
|
||||
|
||||
Options 1,0,0 // Target 'RT-Thread LPC2478'
|
||||
Device (LPC2478)
|
||||
Vendor (NXP (founded by Philips))
|
||||
Cpu (IRAM(0x40000000-0x4000FFFF) IRAM2(0x7FE00000-0x7FE03FFF) IROM(0-0x7FFFF) CLOCK(12000000) CPUTYPE(ARM7TDMI))
|
||||
FlashUt (LPC210x_ISP.EXE ("#H" ^X $D COM1: 38400 1))
|
||||
StupF ("STARTUP\Philips\LPC2400.s" ("Philips LPC2400 Startup Code"))
|
||||
FlashDR (UL2ARM(-U268761108 -O7 -S0 -C0 -FO15 -FD40000000 -FC800 -FN1 -FF0LPC_IAP2_512 -FS00 -FL07E000))
|
||||
DevID (4307)
|
||||
Rgf (LPC23xx.H)
|
||||
Mem ()
|
||||
C ()
|
||||
A ()
|
||||
RL ()
|
||||
OH ()
|
||||
DBC_IFX ()
|
||||
DBC_CMS ()
|
||||
DBC_AMS ()
|
||||
DBC_LMS ()
|
||||
UseEnv=0
|
||||
EnvBin ()
|
||||
EnvInc ()
|
||||
EnvLib ()
|
||||
EnvReg (Philips\)
|
||||
OrgReg (Philips\)
|
||||
TgStat=16
|
||||
OutDir (.\obj\)
|
||||
OutName (rtthread-lpc)
|
||||
GenApp=1
|
||||
GenLib=0
|
||||
GenHex=0
|
||||
Debug=1
|
||||
Browse=1
|
||||
LstDir (.\obj\)
|
||||
HexSel=1
|
||||
MG32K=0
|
||||
TGMORE=0
|
||||
RunUsr 0 0 <>
|
||||
RunUsr 1 0 <>
|
||||
BrunUsr 0 0 <>
|
||||
BrunUsr 1 0 <>
|
||||
CrunUsr 0 0 <>
|
||||
CrunUsr 1 0 <>
|
||||
SVCSID <>
|
||||
GLFLAGS=1790
|
||||
ADSFLGA { 243,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
ACPUTYP (ARM7TDMI)
|
||||
RVDEV ()
|
||||
ADSTFLGA { 0,12,16,2,99,0,0,66,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
OCMADSOCM { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
OCMADSIRAM { 0,0,0,0,64,0,0,1,0 }
|
||||
OCMADSIROM { 1,0,0,0,0,0,0,8,0 }
|
||||
OCMADSXRAM { 0,0,0,0,0,0,0,0,0 }
|
||||
OCR_RVCT { 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,8,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,1,0,0,0,0,224,127,0,64,0,0 }
|
||||
RV_STAVEC ()
|
||||
ADSCCFLG { 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
ADSCMISC ()
|
||||
ADSCDEFN ()
|
||||
ADSCUDEF ()
|
||||
ADSCINCD (..\..\include;..\..\libcpu\arm\common;..\..\components\finsh;..\..\libcpu\arm\lpc24xx;.)
|
||||
ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
ADSAMISC ()
|
||||
ADSADEFN ()
|
||||
ADSAUDEF ()
|
||||
ADSAINCD ()
|
||||
PropFld { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
IncBld=1
|
||||
AlwaysBuild=0
|
||||
GenAsm=0
|
||||
AsmAsm=0
|
||||
PublicsOnly=0
|
||||
StopCode=3
|
||||
CustArgs ()
|
||||
LibMods ()
|
||||
ADSLDFG { 17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
ADSLDTA (0x00000000)
|
||||
ADSLDDA (0x10000000)
|
||||
ADSLDSC ()
|
||||
ADSLDIB ()
|
||||
ADSLDIC ()
|
||||
ADSLDMC ( --keep __fsym_* --keep __vsym_*)
|
||||
ADSLDIF ()
|
||||
ADSLDDW ()
|
||||
OPTDL (SARM.DLL)(-cLPC24xx)(DARMP.DLL)(-pLPC2478)(SARM.DLL)()(TARMP.DLL)(-pLPC2478)
|
||||
OPTDBG 48125,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()()
|
||||
FLASH1 { 9,0,0,0,1,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0 }
|
||||
FLASH2 (BIN\UL2ARM.DLL)
|
||||
FLASH3 ("LPC210x_ISP.EXE" ("#H" ^X $D COM1: 38400 1))
|
||||
FLASH4 ()
|
||||
EndOpt
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
#define RT_UART_RX_BUFFER_SIZE 64
|
||||
|
||||
/* SECTION: Console options */
|
||||
#define RT_USING_CONSOLE
|
||||
/* the buffer size of console*/
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
|
||||
@@ -77,14 +78,6 @@
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
|
||||
/* SECTION: a mini libc */
|
||||
/* Using mini libc library*/
|
||||
/* #define RT_USING_MINILIBC */
|
||||
|
||||
/* SECTION: C++ support */
|
||||
/* Using C++ support*/
|
||||
/* #define RT_USING_CPLUSPLUS */
|
||||
|
||||
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
|
||||
/* Using lighweight TCP/IP protocol stack*/
|
||||
/* #define RT_USING_LWIP */
|
||||
|
||||
@@ -12,11 +12,6 @@ elif CROSS_TOOL == 'keil':
|
||||
BUILD = 'debug'
|
||||
|
||||
if PLATFORM == 'gcc':
|
||||
print "========================="
|
||||
print "Can not support GNU GCC!!"
|
||||
print "========================="
|
||||
exit (0)
|
||||
|
||||
# toolchains
|
||||
PREFIX = 'arm-none-eabi-'
|
||||
CC = PREFIX + 'gcc'
|
||||
|
||||
@@ -73,14 +73,7 @@ void rtthread_startup(void)
|
||||
|
||||
/* init scheduler system */
|
||||
rt_system_scheduler_init();
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
/* init hardware serial device */
|
||||
rt_hw_serial_init();
|
||||
|
||||
/*init all registed devices*/
|
||||
rt_device_init_all();
|
||||
#endif
|
||||
/* init application */
|
||||
rt_application_init();
|
||||
|
||||
@@ -106,6 +99,11 @@ void rtthread_startup(void)
|
||||
#ifdef __CC_ARM
|
||||
int main(void)
|
||||
{
|
||||
rt_uint32_t UNUSED level;
|
||||
|
||||
/* disable interrupt first */
|
||||
level = rt_hw_interrupt_disable();
|
||||
|
||||
/* invoke rtthread_startup */
|
||||
rtthread_startup();
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ void rt_hw_interrupt_init()
|
||||
*vect_addr = 0x0;
|
||||
*vect_cntl = 0xF;
|
||||
}
|
||||
|
||||
|
||||
/* init interrupt nest, and context in thread sp */
|
||||
rt_interrupt_nest = 0;
|
||||
@@ -79,6 +78,7 @@ void rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, rt_isr_ha
|
||||
{
|
||||
/* find first un-assigned VIC address for the handler */
|
||||
vect_addr = (rt_uint32_t *)(VIC_BASE_ADDR + 0x100 + vector*4);
|
||||
if (old_handler != RT_NULL) *old_handler = *vect_addr; /* get old handler */
|
||||
*vect_addr = (rt_uint32_t)new_handler; /* set interrupt vector */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ void rt_hw_serial_init(void)
|
||||
lpc_serial->read_index = lpc_serial->save_index = 0;
|
||||
|
||||
/* Enable UART0 RxD and TxD pins */
|
||||
PINSEL0 |= 0x05;
|
||||
PINSEL0 |= 0x50;
|
||||
|
||||
/* 8 bits, no Parity, 1 Stop bit */
|
||||
UART_LCR(lpc_serial->hw_base) = 0x83;
|
||||
@@ -334,6 +334,7 @@ void rt_hw_serial_init(void)
|
||||
/* DLAB = 0 */
|
||||
UART_LCR(lpc_serial->hw_base) = 0x03;
|
||||
|
||||
lpc_serial->parent.type = RT_Device_Class_Char;
|
||||
lpc_serial->parent.init = rt_serial_init;
|
||||
lpc_serial->parent.open = rt_serial_open;
|
||||
lpc_serial->parent.close = rt_serial_close;
|
||||
@@ -343,7 +344,7 @@ void rt_hw_serial_init(void)
|
||||
lpc_serial->parent.user_data = RT_NULL;
|
||||
|
||||
rt_device_register(&lpc_serial->parent,
|
||||
"uart1", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX);
|
||||
"uart1", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_UART2
|
||||
@@ -371,6 +372,7 @@ void rt_hw_serial_init(void)
|
||||
/* DLAB = 0 */
|
||||
UART_LCR(lpc_serial->hw_base) = 0x03;
|
||||
|
||||
lpc_serial->parent.type = RT_Device_Class_Char;
|
||||
lpc_serial->parent.init = rt_serial_init;
|
||||
lpc_serial->parent.open = rt_serial_open;
|
||||
lpc_serial->parent.close = rt_serial_close;
|
||||
|
||||
+218
-145
File diff suppressed because it is too large
Load Diff
@@ -121,6 +121,8 @@ void rt_hw_trap_irq()
|
||||
rt_isr_handler_t isr_func;
|
||||
|
||||
isr_func = (rt_isr_handler_t) VICVectAddr;
|
||||
|
||||
/* fixme, how to get interrupt number */
|
||||
isr_func(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user