diff --git a/bsp/lpc176x/CMSIS/SConscript b/bsp/lpc176x/CMSIS/SConscript index ca249a88d..c6faa680a 100644 --- a/bsp/lpc176x/CMSIS/SConscript +++ b/bsp/lpc176x/CMSIS/SConscript @@ -1,17 +1,16 @@ -Import('RTT_ROOT') Import('rtconfig') from building import * -cwd = GetCurrentDir() -src = Glob('*.c') +cwd = GetCurrentDir() +src = Glob('*.c') src = ['CM3/CoreSupport/core_cm3.c', 'CM3/DeviceSupport/NXP/LPC17xx/system_LPC17xx.c'] # add for startup script if rtconfig.CROSS_TOOL == 'gcc': - src += ['CM3/DeviceSupport/NXP/LPC17xx/startup/gcc/startup_LPC17xx.s'] + src += ['CM3/DeviceSupport/NXP/LPC17xx/startup/gcc/startup_LPC17xx.s'] elif rtconfig.CROSS_TOOL == 'keil': - src += ['CM3/DeviceSupport/NXP/LPC17xx/startup/arm/startup_LPC17xx.s'] + src += ['CM3/DeviceSupport/NXP/LPC17xx/startup/arm/startup_LPC17xx.s'] elif rtconfig.CROSS_TOOL == 'iar': - src += ['CM3/DeviceSupport/NXP/LPC17xx/startup/iar/startup_LPC17xx.s'] + src += ['CM3/DeviceSupport/NXP/LPC17xx/startup/iar/startup_LPC17xx.s'] CPPPATH = [cwd + '/CM3/CoreSupport', cwd + '/CM3/DeviceSupport/NXP/LPC17xx/'] diff --git a/bsp/lpc176x/SConscript b/bsp/lpc176x/SConscript index 3bf2ce4f9..d9c64eb9f 100644 --- a/bsp/lpc176x/SConscript +++ b/bsp/lpc176x/SConscript @@ -1,18 +1,12 @@ -import rtconfig -Import('RTT_ROOT') from building import * -src_bsp = ['application.c', 'startup.c', 'board.c'] -src_drv = ['uart.c', 'led.c'] +cwd = GetCurrentDir() +objs = [] +list = os.listdir(cwd) -if GetDepend('RT_USING_DFS'): - src_drv += ['sd.c', 'spi.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 += ['emac.c'] - -src = File(src_bsp + src_drv ) -CPPPATH = [ GetCurrentDir() ] -group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH) - -Return('group') +Return('objs') diff --git a/bsp/lpc176x/SConstruct b/bsp/lpc176x/SConstruct index f66c829c9..273bcbb8b 100644 --- a/bsp/lpc176x/SConstruct +++ b/bsp/lpc176x/SConstruct @@ -9,7 +9,7 @@ else: sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')] from building import * -TARGET = 'rtthread-lpc176x.' + rtconfig.TARGET_EXT +TARGET = 'rtthread-lpc17xx.' + rtconfig.TARGET_EXT env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, @@ -28,22 +28,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) - -cwd = str(Dir('#')) -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')) - -# libc testsuite -# objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0) - # build program env.Program(TARGET, objs) diff --git a/bsp/lpc176x/applications/SConscript b/bsp/lpc176x/applications/SConscript new file mode 100644 index 000000000..4fe38ed0c --- /dev/null +++ b/bsp/lpc176x/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/lpc176x/application.c b/bsp/lpc176x/applications/application.c similarity index 100% rename from bsp/lpc176x/application.c rename to bsp/lpc176x/applications/application.c diff --git a/bsp/lpc176x/startup.c b/bsp/lpc176x/applications/startup.c similarity index 100% rename from bsp/lpc176x/startup.c rename to bsp/lpc176x/applications/startup.c diff --git a/bsp/lpc176x/drivers/SConscript b/bsp/lpc176x/drivers/SConscript new file mode 100644 index 000000000..6a3cfe2b4 --- /dev/null +++ b/bsp/lpc176x/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, 'emac.c') +if GetDepend('RT_USING_DFS') == False: + SrcRemove(src, 'sd.c') + +CPPPATH = [cwd] + +group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH) + +Return('group') diff --git a/bsp/lpc176x/board.c b/bsp/lpc176x/drivers/board.c similarity index 100% rename from bsp/lpc176x/board.c rename to bsp/lpc176x/drivers/board.c diff --git a/bsp/lpc176x/board.h b/bsp/lpc176x/drivers/board.h similarity index 100% rename from bsp/lpc176x/board.h rename to bsp/lpc176x/drivers/board.h diff --git a/bsp/lpc176x/emac.c b/bsp/lpc176x/drivers/emac.c similarity index 100% rename from bsp/lpc176x/emac.c rename to bsp/lpc176x/drivers/emac.c diff --git a/bsp/lpc176x/emac.h b/bsp/lpc176x/drivers/emac.h similarity index 100% rename from bsp/lpc176x/emac.h rename to bsp/lpc176x/drivers/emac.h diff --git a/bsp/lpc176x/led.c b/bsp/lpc176x/drivers/led.c similarity index 100% rename from bsp/lpc176x/led.c rename to bsp/lpc176x/drivers/led.c diff --git a/bsp/lpc176x/led.h b/bsp/lpc176x/drivers/led.h similarity index 100% rename from bsp/lpc176x/led.h rename to bsp/lpc176x/drivers/led.h diff --git a/bsp/lpc176x/sd.c b/bsp/lpc176x/drivers/sd.c similarity index 100% rename from bsp/lpc176x/sd.c rename to bsp/lpc176x/drivers/sd.c diff --git a/bsp/lpc176x/sd.h b/bsp/lpc176x/drivers/sd.h similarity index 100% rename from bsp/lpc176x/sd.h rename to bsp/lpc176x/drivers/sd.h diff --git a/bsp/lpc176x/spi.c b/bsp/lpc176x/drivers/spi.c similarity index 100% rename from bsp/lpc176x/spi.c rename to bsp/lpc176x/drivers/spi.c diff --git a/bsp/lpc176x/spi.h b/bsp/lpc176x/drivers/spi.h similarity index 100% rename from bsp/lpc176x/spi.h rename to bsp/lpc176x/drivers/spi.h diff --git a/bsp/lpc176x/uart.c b/bsp/lpc176x/drivers/uart.c similarity index 100% rename from bsp/lpc176x/uart.c rename to bsp/lpc176x/drivers/uart.c diff --git a/bsp/lpc176x/uart.h b/bsp/lpc176x/drivers/uart.h similarity index 100% rename from bsp/lpc176x/uart.h rename to bsp/lpc176x/drivers/uart.h diff --git a/bsp/lpc176x/rtconfig.py b/bsp/lpc176x/rtconfig.py index 0a7b0b107..629f1d399 100644 --- a/bsp/lpc176x/rtconfig.py +++ b/bsp/lpc176x/rtconfig.py @@ -10,7 +10,7 @@ if os.getenv('RTT_CC'): if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' - EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin' + EXEC_PATH = 'C:/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin' elif CROSS_TOOL == 'keil': PLATFORM = 'armcc' EXEC_PATH = 'E:/Keil' @@ -38,7 +38,7 @@ if PLATFORM == 'gcc': DEVICE = ' -mcpu=cortex-m3 -mthumb' CFLAGS = DEVICE AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' - LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-lpc17xx.map,-cref,-u,Reset_Handler -T lpc17xx_rom.ld' + LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-lpc17xx.map,-cref,-u,Reset_Handler -T rtthread-lpc17xx.ld' CPATH = '' LPATH = '' @@ -62,7 +62,7 @@ elif PLATFORM == 'armcc': DEVICE = ' --device DARMP1' CFLAGS = DEVICE + ' --apcs=interwork' AFLAGS = DEVICE - LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread-lpc17xx.map --scatter lpc17xx_rom.sct' + LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread-lpc17xx.map --scatter rtthread-lpc17xx.sct' CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC' LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB' @@ -112,7 +112,7 @@ elif PLATFORM == 'iar': AFLAGS += ' --cpu Cortex-M3' AFLAGS += ' --fpu None' - LFLAGS = ' --config lpc17xx_flash.icf' + LFLAGS = ' --config rtthread-lpc17xx.icf' LFLAGS += ' --semihosting' LFLAGS += ' --entry __iar_program_start' diff --git a/bsp/lpc176x/lpc17xx_flash.icf b/bsp/lpc176x/rtthread-lpc17xx.icf similarity index 100% rename from bsp/lpc176x/lpc17xx_flash.icf rename to bsp/lpc176x/rtthread-lpc17xx.icf diff --git a/bsp/lpc176x/lpc17xx_rom.ld b/bsp/lpc176x/rtthread-lpc17xx.ld similarity index 100% rename from bsp/lpc176x/lpc17xx_rom.ld rename to bsp/lpc176x/rtthread-lpc17xx.ld diff --git a/bsp/lpc176x/lpc17xx_rom.sct b/bsp/lpc176x/rtthread-lpc17xx.sct similarity index 100% rename from bsp/lpc176x/lpc17xx_rom.sct rename to bsp/lpc176x/rtthread-lpc17xx.sct diff --git a/bsp/lpc176x/template.Uv2 b/bsp/lpc176x/template.Uv2 deleted file mode 100644 index aef58974a..000000000 --- a/bsp/lpc176x/template.Uv2 +++ /dev/null @@ -1,98 +0,0 @@ -### uVision2 Project, (C) Keil Software -### Do not modify ! - -Target (RT-Thread LPC17xx), 0x0004 // Tools: 'ARM-ADS' - - - - -Options 1,0,0 // Target 'RT-Thread LPC17xx' - Device (LPC1768) - Vendor (NXP (founded by Philips)) - Cpu (IRAM(0x10000000-0x10007FFF) IRAM2(0x20000000-0x20007FFF) IROM(0-0x7FFFF) CLOCK(12000000) CPUTYPE("Cortex-M3")) - FlashUt () - StupF ("STARTUP\NXP\startup_LPC17xx.s" ("NXP LPC17xx Startup Code")) - FlashDR (UL2CM3(-O463 -S0 -C0 -FO7 -FD10000000 -FC800 -FN1 -FF0LPC_IAP_256 -FS00 -FL040000)) - DevID (4868) - Rgf (LPC17xx.H) - Mem () - C () - A () - RL () - OH () - DBC_IFX () - DBC_CMS () - DBC_AMS () - DBC_LMS () - UseEnv=0 - EnvBin () - EnvInc () - EnvLib () - EnvReg (ÿNXP\) - OrgReg (ÿNXP\) - 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 ("Cortex-M3") - 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,16,0,128,0,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,16,0,128,0,0,0,0,0,0,32,0,128,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 () - 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 () - ADSLDIF () - ADSLDDW () - OPTDL (SARMCM3.DLL)(-MPU)(DARMP1.DLL)(-pLPC1768)(SARMCM3.DLL)(-MPU)(TARMP1.DLL)(-pLPC1768) - OPTDBG 48126,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()() - FLASH1 { 9,0,0,0,1,0,0,0,6,16,0,0,0,0,0,0,0,0,0,0 } - FLASH2 (Segger\JL2CM3.dll) - FLASH3 ("" ()) - FLASH4 () -EndOpt - diff --git a/bsp/lpc176x/template.uvproj b/bsp/lpc176x/template.uvproj new file mode 100644 index 000000000..60aa3221c --- /dev/null +++ b/bsp/lpc176x/template.uvproj @@ -0,0 +1,388 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + RT-Thread LPC17xx + 0x4 + ARM-ADS + + + LPC1768 + NXP (founded by Philips) + IRAM(0x10000000-0x10007FFF) IRAM2(0x20000000-0x20007FFF) IROM(0-0x7FFFF) CLOCK(12000000) CPUTYPE("Cortex-M3") + + "STARTUP\NXP\startup_LPC17xx.s" ("NXP LPC17xx Startup Code") + UL2CM3(-O463 -S0 -C0 -FO7 -FD10000000 -FC800 -FN1 -FF0LPC_IAP_256 -FS00 -FL040000) + 4868 + LPC17xx.H + + + + + + + + + + + 0 + + + + NXP\ + NXP\ + + 0 + 0 + 0 + 0 + 1 + + .\obj\ + rtthread-lpc + 1 + 0 + 0 + 1 + 1 + .\obj\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DARMP1.DLL + -pLPC1768 + SARMCM3.DLL + -MPU + TARMP1.DLL + -pLPC1768 + + + + 1 + 0 + 0 + 0 + 16 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 5 + + + + + + + + + + + + + + Segger\JL2CM3.dll + + + + + 1 + 0 + 0 + 1 + 1 + 4099 + + Segger\JL2CM3.dll + "" () + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M3" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 1 + 0 + 8 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x10000000 + 0x8000 + + + 1 + 0x0 + 0x80000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x80000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x10000000 + 0x8000 + + + 0 + 0x20000000 + 0x8000 + + + + + + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x10000000 + + + + + + + + + + + + +