From a97ed29249f3e13e55f6ae203be52980ed9f6211 Mon Sep 17 00:00:00 2001 From: "dzzxzz@gmail.com" Date: Wed, 27 Jun 2012 00:59:28 +0000 Subject: [PATCH] update the sam7x project git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2189 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- bsp/sam7x/SConscript | 23 +++++---------- bsp/sam7x/applications/SConscript | 9 ++++++ bsp/sam7x/{ => applications}/application.c | 4 ++- bsp/sam7x/{ => applications}/startup.c | 0 bsp/sam7x/{ => drivers}/AT91SAM7X.h | 0 bsp/sam7x/{ => drivers}/AT91SAM7X256.h | 0 bsp/sam7x/drivers/SConscript | 16 ++++++++++ bsp/sam7x/{ => drivers}/board.c | 0 bsp/sam7x/{ => drivers}/board.h | 0 bsp/sam7x/{ => drivers}/mii.h | 0 bsp/sam7x/{ => drivers}/sam7x_emac.c | 0 bsp/sam7x/{ => drivers}/sam7x_emac.h | 4 --- bsp/sam7x/{ => drivers}/sd.c | 0 bsp/sam7x/{ => drivers}/sd.h | 0 bsp/sam7x/{ => drivers}/serial.c | 0 bsp/sam7x/{ => drivers}/serial.h | 0 bsp/sam7x/project.uvproj | 34 ++++++++++++---------- bsp/sam7x/rtconfig.py | 14 ++++----- 18 files changed, 59 insertions(+), 45 deletions(-) create mode 100644 bsp/sam7x/applications/SConscript rename bsp/sam7x/{ => applications}/application.c (96%) rename bsp/sam7x/{ => applications}/startup.c (100%) rename bsp/sam7x/{ => drivers}/AT91SAM7X.h (100%) rename bsp/sam7x/{ => drivers}/AT91SAM7X256.h (100%) create mode 100644 bsp/sam7x/drivers/SConscript rename bsp/sam7x/{ => drivers}/board.c (100%) rename bsp/sam7x/{ => drivers}/board.h (100%) rename bsp/sam7x/{ => drivers}/mii.h (100%) rename bsp/sam7x/{ => drivers}/sam7x_emac.c (100%) rename bsp/sam7x/{ => drivers}/sam7x_emac.h (98%) rename bsp/sam7x/{ => drivers}/sd.c (100%) rename bsp/sam7x/{ => drivers}/sd.h (100%) rename bsp/sam7x/{ => drivers}/serial.c (100%) rename bsp/sam7x/{ => drivers}/serial.h (100%) diff --git a/bsp/sam7x/SConscript b/bsp/sam7x/SConscript index 2804c7dedf..0992612410 100644 --- a/bsp/sam7x/SConscript +++ b/bsp/sam7x/SConscript @@ -1,19 +1,12 @@ -import rtconfig -Import('RTT_ROOT') from building import * -src_bsp = ['application.c', 'startup.c', 'board.c'] -src_drv = ['serial.c'] +cwd = GetCurrentDir() +objs = [] +list = os.listdir(cwd) -if GetDepend('RT_USING_DFS'): - src_drv += ['sd.c'] +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')) -if GetDepend('RT_USING_LWIP'): - src_drv += ['sam7x_emac.c'] - - -src = File(src_bsp + src_drv) -CPPPATH = [RTT_ROOT + '/bsp/sam7x'] -group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH) - -Return('group') +Return('objs') diff --git a/bsp/sam7x/applications/SConscript b/bsp/sam7x/applications/SConscript new file mode 100644 index 0000000000..4fe38ed0cf --- /dev/null +++ b/bsp/sam7x/applications/SConscript @@ -0,0 +1,9 @@ +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd, str(Dir('#'))] + +group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) + +Return('group') diff --git a/bsp/sam7x/application.c b/bsp/sam7x/applications/application.c similarity index 96% rename from bsp/sam7x/application.c rename to bsp/sam7x/applications/application.c index 1cb09b0bf9..5cd12348de 100644 --- a/bsp/sam7x/application.c +++ b/bsp/sam7x/applications/application.c @@ -30,7 +30,9 @@ #endif #ifdef RT_USING_LWIP -#include +#include +#include +#include "sam7x_emac.h" #endif #ifdef RT_USING_RTGUI diff --git a/bsp/sam7x/startup.c b/bsp/sam7x/applications/startup.c similarity index 100% rename from bsp/sam7x/startup.c rename to bsp/sam7x/applications/startup.c diff --git a/bsp/sam7x/AT91SAM7X.h b/bsp/sam7x/drivers/AT91SAM7X.h similarity index 100% rename from bsp/sam7x/AT91SAM7X.h rename to bsp/sam7x/drivers/AT91SAM7X.h diff --git a/bsp/sam7x/AT91SAM7X256.h b/bsp/sam7x/drivers/AT91SAM7X256.h similarity index 100% rename from bsp/sam7x/AT91SAM7X256.h rename to bsp/sam7x/drivers/AT91SAM7X256.h diff --git a/bsp/sam7x/drivers/SConscript b/bsp/sam7x/drivers/SConscript new file mode 100644 index 0000000000..5b10d6f2f5 --- /dev/null +++ b/bsp/sam7x/drivers/SConscript @@ -0,0 +1,16 @@ +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') + +# remove no need file. +if GetDepend('RT_USING_LWIP') == False: + SrcRemove(src, 'sam7x_emac.c') +if GetDepend('RT_USING_DFS') == False: + SrcRemove(src, 'ssd.c') + +CPPPATH = [cwd] + +group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH) + +Return('group') diff --git a/bsp/sam7x/board.c b/bsp/sam7x/drivers/board.c similarity index 100% rename from bsp/sam7x/board.c rename to bsp/sam7x/drivers/board.c diff --git a/bsp/sam7x/board.h b/bsp/sam7x/drivers/board.h similarity index 100% rename from bsp/sam7x/board.h rename to bsp/sam7x/drivers/board.h diff --git a/bsp/sam7x/mii.h b/bsp/sam7x/drivers/mii.h similarity index 100% rename from bsp/sam7x/mii.h rename to bsp/sam7x/drivers/mii.h diff --git a/bsp/sam7x/sam7x_emac.c b/bsp/sam7x/drivers/sam7x_emac.c similarity index 100% rename from bsp/sam7x/sam7x_emac.c rename to bsp/sam7x/drivers/sam7x_emac.c diff --git a/bsp/sam7x/sam7x_emac.h b/bsp/sam7x/drivers/sam7x_emac.h similarity index 98% rename from bsp/sam7x/sam7x_emac.h rename to bsp/sam7x/drivers/sam7x_emac.h index 4a351fe9b3..ff9102ae4e 100644 --- a/bsp/sam7x/sam7x_emac.h +++ b/bsp/sam7x/drivers/sam7x_emac.h @@ -4,9 +4,6 @@ //#define DM9161 #define RTL8201 - - - #ifdef DM9161 #define AT91C_PHY_ADDR 31 #else @@ -94,7 +91,6 @@ #define DM9161_DUPLEX_MODE (1 << 8) // 1 = Full duplex operation 0 = Normal operation #define DM9161_COLLISION_TEST (1 << 7) // 1 = Collision test enabled 0 = Normal operation - #define DM9161_NP (1 << 15) // Next page Indication #define DM9161_ACK (1 << 14) // Acknowledge #define DM9161_RF (1 << 13) // Remote Fault diff --git a/bsp/sam7x/sd.c b/bsp/sam7x/drivers/sd.c similarity index 100% rename from bsp/sam7x/sd.c rename to bsp/sam7x/drivers/sd.c diff --git a/bsp/sam7x/sd.h b/bsp/sam7x/drivers/sd.h similarity index 100% rename from bsp/sam7x/sd.h rename to bsp/sam7x/drivers/sd.h diff --git a/bsp/sam7x/serial.c b/bsp/sam7x/drivers/serial.c similarity index 100% rename from bsp/sam7x/serial.c rename to bsp/sam7x/drivers/serial.c diff --git a/bsp/sam7x/serial.h b/bsp/sam7x/drivers/serial.h similarity index 100% rename from bsp/sam7x/serial.h rename to bsp/sam7x/drivers/serial.h diff --git a/bsp/sam7x/project.uvproj b/bsp/sam7x/project.uvproj index 44e303f7c2..c30f48ab07 100644 --- a/bsp/sam7x/project.uvproj +++ b/bsp/sam7x/project.uvproj @@ -61,6 +61,8 @@ 0 0 + 0 + 0 0 @@ -346,7 +348,7 @@ - .;..\..\components\finsh;..\..\components\net\lwip\src;..\..\components\net\lwip\src\arch\include;..\..\components\net\lwip\src\include;..\..\components\net\lwip\src\include\ipv4;..\..\components\net\lwip\src\include\netif;..\..\include;..\..\libcpu\arm\AT91SAM7X;..\..\libcpu\arm\common + .;..\..\components\finsh;..\..\components\net\lwip\src;..\..\components\net\lwip\src\arch\include;..\..\components\net\lwip\src\include;..\..\components\net\lwip\src\include\ipv4;..\..\components\net\lwip\src\include\netif;..\..\include;..\..\libcpu\arm\AT91SAM7X;..\..\libcpu\arm\common;applications;drivers @@ -384,32 +386,37 @@ - Startup + Applications application.c 1 - .\application.c + applications\application.c startup.c 1 - .\startup.c + applications\startup.c + + + + Drivers + board.c 1 - .\board.c - - - serial.c - 1 - .\serial.c + drivers\board.c sam7x_emac.c 1 - .\sam7x_emac.c + drivers\sam7x_emac.c + + + serial.c + 1 + drivers\serial.c @@ -451,11 +458,6 @@ 1 ..\..\src\mem.c - - memheap.c - 1 - ..\..\src\memheap.c - mempool.c 1 diff --git a/bsp/sam7x/rtconfig.py b/bsp/sam7x/rtconfig.py index 18b19fc1b3..57a131a43d 100644 --- a/bsp/sam7x/rtconfig.py +++ b/bsp/sam7x/rtconfig.py @@ -1,21 +1,17 @@ import os -# panel options -# 'PNL_A70','PNL_N35', 'PNL_T35' -RT_USING_LCD_TYPE = 'PNL_T35' - # toolchains options -ARCH = 'arm' -CPU = 'AT91SAM7X' +ARCH = 'arm' +CPU = 'AT91SAM7X' -CROSS_TOOL = 'gcc' +CROSS_TOOL = 'gcc' if os.getenv('RTT_CC'): CROSS_TOOL = os.getenv('RTT_CC') -if CROSS_TOOL == 'gcc': +if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' - EXEC_PATH = 'C:/Program Files/CodeSourcery/Sourcery G++ Lite/bin' + EXEC_PATH = 'C:/Program Files/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin' elif CROSS_TOOL == 'keil': PLATFORM = 'armcc' EXEC_PATH = 'C:/Keil'