support GCC compiler for LM3S platform

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@233 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
qiuyiuestc 2009-12-26 10:10:50 +00:00
parent d65e9dd610
commit 6d9100da2e
18 changed files with 466 additions and 1455 deletions

View File

@ -0,0 +1,37 @@
Import('env')
Import('RTT_ROOT')
# The set of source files associated with this SConscript file.
src_local = Split("""
driverlib/adc.c
driverlib/can.c
driverlib/comp.c
driverlib/cpu.c
driverlib/epi.c
driverlib/ethernet.c
driverlib/flash.c
driverlib/gpio.c
driverlib/hibernate.c
driverlib/i2c.c
driverlib/i2s.c
driverlib/interrupt.c
driverlib/mpu.c
driverlib/pwm.c
driverlib/qei.c
driverlib/ssi.c
driverlib/sysctl.c
driverlib/systick.c
driverlib/timer.c
driverlib/uart.c
driverlib/udma.c
driverlib/usb.c
driverlib/watchdog.c
""")
path = [RTT_ROOT + '/bsp/lm3s/Libraries/inc', RTT_ROOT + '/bsp/lm3s/Libraries', RTT_ROOT + '/bsp/lm3s/Libraries/driverlib']
env.Append(CPPPATH = path)
obj = env.Object(src_local)
Return('obj')

View File

@ -1,80 +0,0 @@
### uVision2 Project, (C) Keil Software
### Do not modify !
cExt (*.c)
aExt (*.s*; *.src; *.a*)
oExt (*.obj)
lExt (*.lib)
tExt (*.txt; *.h; *.inc)
pExt (*.plm)
CppX (*.cpp)
DaveTm { 0,0,0,0,0,0,0,0 }
Target (RT-Thread/LM3S), 0x0004 // Tools: 'ARM-ADS'
GRPOPT 1,(Startup),1,0,0
GRPOPT 2,(Kernel),0,0,0
GRPOPT 3,(finsh),1,0,0
GRPOPT 4,(LM3S),1,0,0
GRPOPT 5,(driverlib),0,0,0
OPTFFF 1,1,1,0,0,0,0,0,<.\application.c><application.c>
OPTFFF 1,2,1,16777216,0,0,0,0,<.\board.c><board.c>
OPTFFF 1,3,1,0,0,0,0,0,<.\startup.c><startup.c>
OPTFFF 1,4,5,335544320,0,0,0,0,<.\rtconfig.h><rtconfig.h>
OPTFFF 2,5,1,0,0,0,0,0,<..\..\src\clock.c><clock.c>
OPTFFF 2,6,1,0,0,0,0,0,<..\..\src\device.c><device.c>
OPTFFF 2,7,1,234881024,0,0,0,0,<..\..\src\idle.c><idle.c>
OPTFFF 2,8,1,0,0,0,0,0,<..\..\src\ipc.c><ipc.c>
OPTFFF 2,9,1,0,0,0,0,0,<..\..\src\irq.c><irq.c>
OPTFFF 2,10,1,0,0,0,0,0,<..\..\src\mem.c><mem.c>
OPTFFF 2,11,1,0,0,0,0,0,<..\..\src\mempool.c><mempool.c>
OPTFFF 2,12,1,0,0,0,0,0,<..\..\src\object.c><object.c>
OPTFFF 2,13,1,0,0,0,0,0,<..\..\src\scheduler.c><scheduler.c>
OPTFFF 2,14,1,0,0,0,0,0,<..\..\src\slab.c><slab.c>
OPTFFF 2,15,1,0,0,0,0,0,<..\..\src\thread.c><thread.c>
OPTFFF 2,16,1,0,0,0,0,0,<..\..\src\timer.c><timer.c>
OPTFFF 2,17,1,0,0,0,0,0,<..\..\src\kservice.c><kservice.c>
OPTFFF 3,18,1,0,0,0,0,0,<..\..\finsh\symbol.c><symbol.c>
OPTFFF 3,19,1,0,0,0,0,0,<..\..\finsh\cmd.c><cmd.c>
OPTFFF 3,20,1,0,0,0,0,0,<..\..\finsh\finsh_compiler.c><finsh_compiler.c>
OPTFFF 3,21,1,0,0,0,0,0,<..\..\finsh\finsh_error.c><finsh_error.c>
OPTFFF 3,22,1,0,0,0,0,0,<..\..\finsh\finsh_heap.c><finsh_heap.c>
OPTFFF 3,23,1,0,0,0,0,0,<..\..\finsh\finsh_init.c><finsh_init.c>
OPTFFF 3,24,1,0,0,0,0,0,<..\..\finsh\finsh_node.c><finsh_node.c>
OPTFFF 3,25,1,0,0,0,0,0,<..\..\finsh\finsh_ops.c><finsh_ops.c>
OPTFFF 3,26,1,0,0,0,0,0,<..\..\finsh\finsh_parser.c><finsh_parser.c>
OPTFFF 3,27,1,0,0,0,0,0,<..\..\finsh\finsh_token.c><finsh_token.c>
OPTFFF 3,28,1,0,0,0,0,0,<..\..\finsh\finsh_var.c><finsh_var.c>
OPTFFF 3,29,1,0,0,0,0,0,<..\..\finsh\finsh_vm.c><finsh_vm.c>
OPTFFF 3,30,1,0,0,0,0,0,<..\..\finsh\shell.c><shell.c>
OPTFFF 4,31,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\cpu.c><cpu.c>
OPTFFF 4,32,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\interrupt.c><interrupt.c>
OPTFFF 4,33,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\stack.c><stack.c>
OPTFFF 4,34,2,0,0,157,157,0,<..\..\libcpu\arm\lm3s\context_rvds.S><context_rvds.S> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,88,0,0,0,116,0,0,0,222,2,0,0,106,1,0,0 }
OPTFFF 4,35,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\start_rvds.S><start_rvds.S>
OPTFFF 4,36,1,620756994,0,52,65,0,<..\..\libcpu\arm\lm3s\serial.c><serial.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,196,2,0,0,75,1,0,0 }
OPTFFF 5,37,4,0,0,0,0,0,<.\driverlib\rvmdk\driverlib.lib><driverlib.lib>
TARGOPT 1, (RT-Thread/LM3S)
ADSCLK=6000000
OPTTT 1,1,1,0
OPTHX 1,65535,0,0,0
OPTLX 79,66,8,<.\>
OPTOX 16
OPTLT 1,1,1,0,1,1,0,1,0,0,0,0
OPTXL 1,1,1,1,1,1,1,0,0
OPTFL 1,0,1
OPTAX 0
OPTDL (SARMCM3.DLL)()(DLM.DLL)(-pLM3S6918)(SARMCM3.DLL)()(TLM.DLL)(-pLM3S6918)
OPTDBG 48125,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()()
OPTKEY 0,(DLGDARM)((1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(101=-1,-1,-1,-1,0)(102=-1,-1,-1,-1,0)(103=-1,-1,-1,-1,0)(104=-1,-1,-1,-1,0)(105=-1,-1,-1,-1,0)(106=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(163=-1,-1,-1,-1,0)(164=-1,-1,-1,-1,0)(150=165,205,660,637,0)(151=-1,-1,-1,-1,0)(152=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)(1014=-1,-1,-1,-1,0)(1016=-1,-1,-1,-1,0)(136=-1,-1,-1,-1,0))
OPTKEY 0,(DLGTARM)((1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(101=-1,-1,-1,-1,0)(102=-1,-1,-1,-1,0)(103=-1,-1,-1,-1,0)(104=-1,-1,-1,-1,0)(105=-1,-1,-1,-1,0)(106=-1,-1,-1,-1,0)(161=-1,-1,-1,-1,0)(162=-1,-1,-1,-1,0)(163=-1,-1,-1,-1,0)(164=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0)(152=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)(1014=-1,-1,-1,-1,0)(1016=-1,-1,-1,-1,0)(136=-1,-1,-1,-1,0))
OPTKEY 0,(ARMDBGFLAGS)(-T0)
OPTKEY 0,(DLGUARM)((105=-1,-1,-1,-1,0)(106=-1,-1,-1,-1,0)(107=-1,-1,-1,-1,0))
OPTKEY 0,(JL2CM3)(-U20090110 -O206 -S0 -C0 -JU1 -JI127.0.0.1 -JP0 -N00("ARM CoreSight SW-DP") -D00(3BA00477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0LM3S_256 -FS00 -FL040000)
OPTDF 0x94
OPTLE <>
OPTLC <>
EndOpt

View File

@ -1,140 +0,0 @@
### uVision2 Project, (C) Keil Software
### Do not modify !
Target (RT-Thread/LM3S), 0x0004 // Tools: 'ARM-ADS'
Group (Startup)
Group (Kernel)
Group (finsh)
Group (LM3S)
Group (driverlib)
File 1,1,<.\application.c><application.c>
File 1,1,<.\board.c><board.c>
File 1,1,<.\startup.c><startup.c>
File 1,5,<.\rtconfig.h><rtconfig.h>
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\mem.c><mem.c>
File 2,1,<..\..\src\mempool.c><mempool.c>
File 2,1,<..\..\src\object.c><object.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 2,1,<..\..\src\kservice.c><kservice.c>
File 3,1,<..\..\finsh\symbol.c><symbol.c>
File 3,1,<..\..\finsh\cmd.c><cmd.c>
File 3,1,<..\..\finsh\finsh_compiler.c><finsh_compiler.c>
File 3,1,<..\..\finsh\finsh_error.c><finsh_error.c>
File 3,1,<..\..\finsh\finsh_heap.c><finsh_heap.c>
File 3,1,<..\..\finsh\finsh_init.c><finsh_init.c>
File 3,1,<..\..\finsh\finsh_node.c><finsh_node.c>
File 3,1,<..\..\finsh\finsh_ops.c><finsh_ops.c>
File 3,1,<..\..\finsh\finsh_parser.c><finsh_parser.c>
File 3,1,<..\..\finsh\finsh_token.c><finsh_token.c>
File 3,1,<..\..\finsh\finsh_var.c><finsh_var.c>
File 3,1,<..\..\finsh\finsh_vm.c><finsh_vm.c>
File 3,1,<..\..\finsh\shell.c><shell.c>
File 4,1,<..\..\libcpu\arm\lm3s\cpu.c><cpu.c>
File 4,1,<..\..\libcpu\arm\lm3s\interrupt.c><interrupt.c>
File 4,1,<..\..\libcpu\arm\lm3s\stack.c><stack.c>
File 4,2,<..\..\libcpu\arm\lm3s\context_rvds.S><context_rvds.S>
File 4,2,<..\..\libcpu\arm\lm3s\start_rvds.S><start_rvds.S>
File 4,1,<..\..\libcpu\arm\lm3s\serial.c><serial.c>
File 5,4,<.\driverlib\rvmdk\driverlib.lib><driverlib.lib>
Options 1,0,0 // Target 'RT-Thread/LM3S'
Device (LM3S6918)
Vendor (Luminary Micro)
Cpu (IRAM(0x20000000-0x2000FFFF) IROM(0-0x3FFFF) CLOCK(6000000) CPUTYPE("Cortex-M3"))
FlashUt ()
StupF ("STARTUP\Luminary\Startup.s" ("Luminary Startup Code"))
FlashDR (UL2CM3(-UU0101L5E -O14 -S0 -C0 -N00("ARM Cortex-M3") -D00(1BA00477) -L00(4) -FO7 -FD20000000 -FC800 -FN1 -FF0LM3S_256 -FS00 -FL040000))
DevID (4722)
Rgf (LM3Sxxxx.H)
Mem ()
C ()
A ()
RL ()
OH ()
DBC_IFX ()
DBC_CMS ()
DBC_AMS ()
DBC_LMS ()
UseEnv=0
EnvBin ()
EnvInc ()
EnvLib ()
EnvReg (ÿLuminary\)
OrgReg (ÿLuminary\)
TgStat=16
OutDir (.\obj\)
OutName (rtthread-lm3s)
GenApp=1
GenLib=0
GenHex=0
Debug=1
Browse=1
LstDir (.\)
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,0,2,99,0,1,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,32,0,0,1,0 }
OCMADSIROM { 1,0,0,0,0,0,0,4,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,4,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,32,0,0,1,0,0,0,0,0,0,0,0,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 (.;.\inc;..\..\include;..\..\libcpu\arm\lm3s;..\..\finsh)
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 (0x20000000)
ADSLDSC ()
ADSLDIB ()
ADSLDIC ()
ADSLDMC (--keep __fsym_* --keep __vsym_*)
ADSLDIF ()
ADSLDDW ()
OPTDL (SARMCM3.DLL)()(DLM.DLL)(-pLM3S6918)(SARMCM3.DLL)()(TLM.DLL)(-pLM3S6918)
OPTDBG 48125,7,()()()()()()()()()() (Segger\JL2CM3.dll)()()()
FLASH1 { 9,0,0,0,1,0,0,0,5,16,0,0,0,0,0,0,0,0,0,0 }
FLASH2 (Segger\JL2CM3.dll)
FLASH3 ("" ())
FLASH4 ()
EndOpt

View File

@ -14,21 +14,21 @@ Target (RT-Thread/LM3S), 0x0004 // Tools: 'ARM-ADS'
GRPOPT 1,(Startup),1,0,0
GRPOPT 2,(Kernel),0,0,0
GRPOPT 3,(finsh),0,0,0
GRPOPT 4,(LM3S),1,0,0
GRPOPT 5,(driverlib),0,0,0
GRPOPT 6,(Filesystem),0,0,0
GRPOPT 7,(LwIP),1,0,0
GRPOPT 4,(LM3S),0,0,0
GRPOPT 5,(driverlib),1,0,0
GRPOPT 6,(Filesystem),1,0,0
GRPOPT 7,(LwIP),0,0,0
GRPOPT 8,(Utils),1,0,0
OPTFFF 1,1,1,201326592,0,0,0,0,<.\application.c><application.c>
OPTFFF 1,2,1,520093698,0,46,58,0,<.\board.c><board.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,205,2,0,0,129,1,0,0 }
OPTFFF 1,3,1,0,0,133,135,0,<.\startup.c><startup.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,214,2,0,0,38,1,0,0 }
OPTFFF 1,4,5,0,0,1,1,0,<.\rtconfig.h><rtconfig.h> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,22,0,0,0,29,0,0,0,192,2,0,0,9,1,0,0 }
OPTFFF 1,5,1,922746880,0,783,783,0,<.\sdcard.c><sdcard.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,236,2,0,0,67,1,0,0 }
OPTFFF 1,6,1,0,0,38,46,0,<.\luminaryif.c><luminaryif.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,205,2,0,0,129,1,0,0 }
OPTFFF 1,2,1,2,0,10,18,0,<.\board.c><board.c> { 44,0,0,0,2,0,0,0,3,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,22,0,0,0,29,0,0,0,161,2,0,0,71,1,0,0 }
OPTFFF 1,3,1,0,0,0,0,0,<.\startup.c><startup.c>
OPTFFF 1,4,5,0,0,0,0,0,<.\rtconfig.h><rtconfig.h>
OPTFFF 1,5,1,922746880,0,0,0,0,<.\sdcard.c><sdcard.c>
OPTFFF 1,6,1,0,0,0,0,0,<.\luminaryif.c><luminaryif.c>
OPTFFF 2,7,1,0,0,0,0,0,<..\..\src\clock.c><clock.c>
OPTFFF 2,8,1,0,0,0,0,0,<..\..\src\device.c><device.c>
OPTFFF 2,9,1,0,0,57,60,0,<..\..\src\idle.c><idle.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,236,2,0,0,67,1,0,0 }
OPTFFF 2,9,1,0,0,0,0,0,<..\..\src\idle.c><idle.c>
OPTFFF 2,10,1,0,0,0,0,0,<..\..\src\ipc.c><ipc.c>
OPTFFF 2,11,1,0,0,0,0,0,<..\..\src\irq.c><irq.c>
OPTFFF 2,12,1,0,0,0,0,0,<..\..\src\mem.c><mem.c>
@ -56,18 +56,18 @@ OPTFFF 4,33,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\cpu.c><cpu.c>
OPTFFF 4,34,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\interrupt.c><interrupt.c>
OPTFFF 4,35,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\stack.c><stack.c>
OPTFFF 4,36,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\context_rvds.S><context_rvds.S>
OPTFFF 4,37,2,0,0,28,32,0,<..\..\libcpu\arm\lm3s\start_rvds.S><start_rvds.S> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,205,2,0,0,129,1,0,0 }
OPTFFF 4,37,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\start_rvds.S><start_rvds.S>
OPTFFF 4,38,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\serial.c><serial.c>
OPTFFF 4,39,1,0,0,0,0,0,<..\..\libcpu\arm\lm3s\fault.c><fault.c>
OPTFFF 4,40,2,0,0,12,12,0,<..\..\libcpu\arm\lm3s\fault_rvds.S><fault_rvds.S> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,88,0,0,0,116,0,0,0,227,2,0,0,158,1,0,0 }
OPTFFF 5,41,4,0,0,0,0,0,<.\driverlib\rvmdk\driverlib.lib><driverlib.lib>
OPTFFF 4,40,2,0,0,0,0,0,<..\..\libcpu\arm\lm3s\fault_rvds.S><fault_rvds.S>
OPTFFF 5,41,4,0,0,0,0,0,<E:\SVN-Google-Source\bsp\lm3s\Libraries\driverlib\rvmdk\driverlib.lib><driverlib.lib>
OPTFFF 6,42,1,1,0,0,0,0,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
OPTFFF 6,43,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
OPTFFF 6,44,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
OPTFFF 6,45,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
OPTFFF 6,46,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c>
OPTFFF 6,46,1,0,0,1,1,0,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,135,2,0,0,41,1,0,0 }
OPTFFF 6,47,1,0,0,0,0,0,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
OPTFFF 6,48,1,0,0,160,168,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,183,2,0,0,100,1,0,0 }
OPTFFF 6,48,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c>
OPTFFF 6,49,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c>
OPTFFF 6,50,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c>
OPTFFF 6,51,1,0,0,0,0,0,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c>
@ -115,16 +115,12 @@ OPTFFF 7,92,1,0,0,0,0,0,<..\..\net\lwip\src\arch\sys_arch.c><sys_arch.c>
OPTFFF 7,93,1,0,0,0,0,0,<..\..\net\lwip\src\api\sockets.c><sockets.c>
OPTFFF 7,94,1,0,0,0,0,0,<..\..\net\lwip\src\core\memp_tiny.c><memp_tiny.c>
OPTFFF 8,95,1,0,0,0,0,0,<..\..\net\apps\chargen.c><chargen.c>
OPTFFF 8,96,1,0,0,548,558,0,<..\..\net\apps\ftpd.c><ftpd.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,44,0,0,0,58,0,0,0,214,2,0,0,38,1,0,0 }
OPTFFF 8,96,1,0,0,0,0,0,<..\..\net\apps\ftpd.c><ftpd.c>
OPTFFF 8,97,1,0,0,0,0,0,<..\..\net\apps\sntp.c><sntp.c>
OPTFFF 8,98,1,0,0,0,0,0,<..\..\net\apps\tcpecho.c><tcpecho.c>
OPTFFF 8,99,1,486539264,0,56,56,0,<..\..\net\apps\tftp.c><tftp.c> { 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,22,0,0,0,29,0,0,0,161,2,0,0,71,1,0,0 }
OPTFFF 8,99,1,486539264,0,0,0,0,<..\..\net\apps\tftp.c><tftp.c>
OPTFFF 8,100,1,0,0,0,0,0,<..\..\net\apps\udpecho.c><udpecho.c>
ExtF <E:\SVN-Google-Source\filesystem\dfs\include\dfs_def.h> 141,141,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,66,0,0,0,87,0,0,0,236,2,0,0,67,1,0,0 }
ExtF <E:\SVN-Google-Source\filesystem\dfs\dfs_config.h> 83,91,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,170,2,0,0,236,0,0,0 }
ExtF <E:\SVN-Google-Source\net\lwip\src\lwipopts.h> 144,148,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,170,2,0,0,236,0,0,0 }
ExtF <E:\SVN-Google-Source\src\kservice.h> 81,87,0,{ 44,0,0,0,0,0,0,0,1,0,0,0,255,255,255,255,255,255,255,255,252,255,255,255,226,255,255,255,0,0,0,0,0,0,0,0,170,2,0,0,236,0,0,0 }
TARGOPT 1, (RT-Thread/LM3S)
ADSCLK=6000000

View File

@ -52,7 +52,7 @@ File 4,2,<..\..\libcpu\arm\lm3s\start_rvds.S><start_rvds.S>
File 4,1,<..\..\libcpu\arm\lm3s\serial.c><serial.c>
File 4,1,<..\..\libcpu\arm\lm3s\fault.c><fault.c>
File 4,2,<..\..\libcpu\arm\lm3s\fault_rvds.S><fault_rvds.S>
File 5,4,<.\driverlib\rvmdk\driverlib.lib><driverlib.lib>
File 5,4,<E:\SVN-Google-Source\bsp\lm3s\Libraries\driverlib\rvmdk\driverlib.lib><driverlib.lib>
File 6,1,<..\..\filesystem\dfs\src\dfs_init.c><dfs_init.c>
File 6,1,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
File 6,1,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
@ -172,7 +172,7 @@ Options 1,0,0 // Target 'RT-Thread/LM3S'
ADSCMISC ()
ADSCDEFN ()
ADSCUDEF ()
ADSCINCD (.;.\inc;..\..\include;..\..\libcpu\arm\lm3s;..\..\finsh;..\..\filesystem\dfs;..\..\filesystem\dfs\include;..\..\net\lwip\src;..\..\net\lwip\src\include;..\..\net\lwip\src\arch\include;..\..\net\lwip\src\include\ipv4;..\..\filesystem\dfs\include;..\..\filesystem\dfs\filesystems\efsl\src\include;..\..\filesystem\dfs\filesystems\efsl\src\base\include;..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include)
ADSCINCD (.;.\Libraries;..\..\include;..\..\libcpu\arm\lm3s;..\..\finsh;..\..\filesystem\dfs;..\..\filesystem\dfs\include;..\..\net\lwip\src;..\..\net\lwip\src\include;..\..\net\lwip\src\arch\include;..\..\net\lwip\src\include\ipv4;..\..\filesystem\dfs\include;..\..\filesystem\dfs\filesystems\efsl\src\include;..\..\filesystem\dfs\filesystems\efsl\src\base\include;..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\include)
ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
ADSAMISC ()
ADSADEFN ()

View File

@ -1,182 +0,0 @@
/*****************************************************************************\
* EFSL - Embedded Filesystems Library *
* ----------------------------------- *
* *
* Filename : debug.c *
* Release : 0.3 - devel *
* Description : These functions are used for debugging output on different *
* environments *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2006 Lennart Yseboodt *
* (c)2006 Michael De Nil *
\*****************************************************************************/
/* COMMENT REGARDING FUNCTION COMMENTS IN THIS FILE
* Only the linuxfile debug functions are commented since all functions
* perform the same logical task.
*/
/*****************************************************************************/
#include "debug.h"
/*****************************************************************************/
/*****************************************************************************/
#ifdef DEBUG
#ifdef HW_ENDPOINT_LINUX_ALL
/*****************************************************************************/
/* ****************************************************************************
* void debug(const eint8 *format, ...)
* Description: This function prints debug output to the screen (target dependant)
* and if DO_FUNC_DEBUG is defined also to a localfile.
* Return value: void
*/
void debug(const eint8 *format, ...)
{
va_list ap;
#ifdef DO_FUNC_DEBUG
euint8 c;
extern FILE* debugfile;
extern volatile euint8 tw;
#endif
va_start(ap, format);
vprintf(format,ap);
#ifdef DO_FUNC_DEBUG
for(c=0;c<tw+1;c++)
{
fprintf(debugfile," ");
}
vfprintf(debugfile,format,ap);
#endif
va_end(ap);
}
/*****************************************************************************/
/* ****************************************************************************
* void debug_funcin(const eint8 *format, ...)
* Description: This function marks the entrance of a function, which
* increments a tabfieldcounter. A tree like structure can the be found in the
* debugging file.
* Return value: void
*/
void debug_funcin(const eint8 *format, ...)
{
#ifdef DO_FUNC_DEBUG
eint8 c;
va_list ap;
extern FILE* debugfile;
extern volatile unsigned char tw;
if(debugfile==RT_NULL)return;
for(c=0;c<tw;c++){
fprintf(debugfile," ");
}
va_start(ap, format);
vfprintf(debugfile,format,ap);
va_end(ap);
fprintf(debugfile,"\n");
tw++;
#endif
}
/*****************************************************************************/
/* ****************************************************************************
* void debug_funcout(const eint8 *format, ...)
* Description: Decrements the tabfieldcounter. This function is called everywhere
* a function is left.
* Return value: void
*/
void debug_funcout(const eint8 *format, ...)
{
#ifdef DO_FUNC_DEBUG
eint8 c;
va_list ap;
extern FILE* debugfile;
extern volatile euint8 tw;
if(debugfile==RT_NULL)return;
if(tw>0)tw--;
for(c=0;c<tw;c++){
fprintf(debugfile," ");
}
va_start(ap, format);
vfprintf(debugfile,format,ap);
va_end(ap);
fprintf(debugfile,"\n");
#endif
}
/*****************************************************************************/
/* ****************************************************************************
* void debug_init()
* Description: This function optionally opens the debugfile, or does any other
* initialisation to enable debugoutput.
* Return value: void
*/
void debug_init()
{
#ifdef DO_FUNC_DEBUG
extern FILE* debugfile;
extern volatile unsigned char tw;
debugfile=RT_NULL;
tw=0;
debugfile=fopen("DBG.OUT","w");
#endif
}
/*****************************************************************************/
/* ****************************************************************************
* void debug_end()
* Description: This function closes the debugfile.
* Return value: void
*/
void debug_end()
{
#ifdef DO_FUNC_DEBUG
extern FILE* debugfile;
fflush(debugfile);
fclose(debugfile);
#endif
}
/*****************************************************************************/
/*****************************************************************************/
#endif
#endif
/*****************************************************************************/

View File

@ -1,68 +0,0 @@
/*****************************************************************************\
* EFSL - Embedded Filesystems Library *
* ----------------------------------- *
* *
* Filename : debug.h *
* Release : 0.3 - devel *
* Description : These functions are used for debugging output on different *
* environments *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2006 Lennart Yseboodt *
* (c)2006 Michael De Nil *
\*****************************************************************************/
#ifndef __DEBUG_H__
#define __DEBUG_H__
/*****************************************************************************/
#include "types.h"
#include "config.h"
/*****************************************************************************/
#ifndef DEBUG
#define TXT(x) ;
#define DBG(x) ;
#define FUNC_IN(x) ;
#define FUNC_OUT(x) ;
#endif
#ifdef DEBUG
#ifdef HW_ENDPOINT_LINUX
#include <stdio.h>
#include <stdarg.h>
#define TXT(x) x
#define DBG(x) debug x
#define FUNC_IN(x) debug_funcin(x)
#define FUNC_OUT(x) debug_funcout(x)
#endif
void debug(const eint8 *format, ...);
void debug_init();
void debug_end();
#endif
#endif

View File

@ -1,140 +0,0 @@
/*****************************************************************************\
* EFSL - Embedded Filesystems Library *
* ----------------------------------- *
* *
* Filename : ioman.c *
* Release : 0.3 - devel *
* Description : The IO Manager receives all requests for sectors in a central *
* allowing it to make smart decision regarding caching. *
* The IOMAN_NUMBUFFER parameter determines how many sectors *
* ioman can cache. ioman also supports overallocating and *
* backtracking sectors. *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2006 Lennart Yseboodt *
* (c)2006 Michael De Nil *
\*****************************************************************************/
#ifndef __IOMAN_H__
#define __IOMAN_H__
/*****************************************************************************/
#include <rtthread.h>
#include "error.h"
#include "plibc.h"
#include "debug.h"
#include "types.h"
#include "config.h"
/*****************************************************************************/
#define IOMAN_STATUS_ATTR_VALIDDATA 0
#define IOMAN_STATUS_ATTR_USERBUFFER 1
#define IOMAN_STATUS_ATTR_WRITE 2
#define IOM_MODE_READONLY 1
#define IOM_MODE_READWRITE 2
#define IOM_MODE_EXP_REQ 4
struct _IOManStack{
euint32 sector;
euint8 status;
euint8 usage;
};
typedef struct _IOManStack IOManStack;
struct _IOManager{
rt_device_t device;
euint8 *bufptr;
euint16 numbuf;
euint16 numit;
IOMAN_ERR_EUINT8
IOManStack stack[IOMAN_NUMBUFFER][IOMAN_NUMITERATIONS];
euint32 sector[IOMAN_NUMBUFFER];
euint8 status[IOMAN_NUMBUFFER];
euint8 usage[IOMAN_NUMBUFFER];
euint8 reference[IOMAN_NUMBUFFER];
euint8 itptr[IOMAN_NUMBUFFER];
#ifdef IOMAN_DO_MEMALLOC
euint8 cache_mem[IOMAN_NUMBUFFER * 512];
#endif
};
typedef struct _IOManager IOManager;
#define IOBJ ioman
#define ioman_isValid(bp) ioman_getAttr(IOBJ,bp,IOMAN_STATUS_ATTR_VALIDDATA)
#define ioman_isUserBuf(bp) ioman_getAttr(IOBJ,bp,IOMAN_STATUS_ATTR_USERBUFFER)
#define ioman_isWritable(bp) ioman_getAttr(IOBJ,bp,IOMAN_STATUS_ATTR_WRITE)
#define ioman_setValid(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_VALIDDATA,1)
#define ioman_setUserBuf(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_USERBUFFER,1)
#define ioman_setWritable(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_WRITE,1)
#define ioman_setNotValid(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_VALIDDATA,0)
#define ioman_setNotUserBuf(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_USERBUFFER,0)
#define ioman_setNotWritable(bp) ioman_setAttr(IOBJ,bp,IOMAN_STATUS_ATTR_WRITE,0)
#define ioman_isReqRo(mode) ((mode)&(IOM_MODE_READONLY))
#define ioman_isReqRw(mode) ((mode)&(IOM_MODE_READWRITE))
#define ioman_isReqExp(mode) ((mode)&(IOM_MODE_EXP_REQ))
esint8 ioman_init(IOManager *ioman, euint8* bufferarea);
void ioman_reset(IOManager *ioman);
euint8* ioman_getBuffer(IOManager *ioman,euint8* bufferarea);
void ioman_setAttr(IOManager *ioman,euint16 bufplace,euint8 attribute,euint8 val);
euint8 ioman_getAttr(IOManager *ioman,euint16 bufplace,euint8 attribute);
euint8 ioman_getUseCnt(IOManager *ioman,euint16 bufplace);
void ioman_incUseCnt(IOManager *ioman,euint16 bufplace);
void ioman_decUseCnt(IOManager *ioman,euint16 bufplace);
void ioman_resetUseCnt(IOManager *ioman,euint16 bufplace);
euint8 ioman_getRefCnt(IOManager *ioman,euint16 bufplace);
void ioman_incRefCnt(IOManager *ioman,euint16 bufplace);
void ioman_decRefCnt(IOManager *ioman,euint16 bufplace);
void ioman_resetRefCnt(IOManager *ioman,euint16 bufplace);
esint8 ioman_pop(IOManager *ioman,euint16 bufplace);
esint8 ioman_push(IOManager *ioman,euint16 bufplace);
euint8* ioman_getPtr(IOManager *ioman,euint16 bufplace);
esint16 ioman_getBp(IOManager *ioman,euint8* buf);
esint8 ioman_readSector(IOManager *ioman,euint32 address,euint8* buf);
esint8 ioman_writeSector(IOManager *ioman, euint32 address, euint8* buf);
void ioman_resetCacheItem(IOManager *ioman,euint16 bufplace);
esint32 ioman_findSectorInCache(IOManager *ioman, euint32 address);
esint32 ioman_findFreeSpot(IOManager *ioman);
esint32 ioman_findUnusedSpot(IOManager *ioman);
esint32 ioman_findOverallocableSpot(IOManager *ioman);
esint8 ioman_putSectorInCache(IOManager *ioman,euint32 address, euint16 bufplace);
esint8 ioman_flushSector(IOManager *ioman, euint16 bufplace);
euint8* ioman_getSector(IOManager *ioman,euint32 address, euint8 mode);
esint8 ioman_releaseSector(IOManager *ioman,euint8* buf);
esint8 ioman_directSectorRead(IOManager *ioman,euint32 address, euint8* buf);
esint8 ioman_directSectorWrite(IOManager *ioman,euint32 address, euint8* buf);
esint8 ioman_flushRange(IOManager *ioman,euint32 address_low, euint32 address_high);
esint8 ioman_flushAll(IOManager *ioman);
void ioman_printStatus(IOManager *ioman);
#endif

View File

@ -1,93 +0,0 @@
/*****************************************************************************\
* EFSL - Embedded Filesystems Library *
* ----------------------------------- *
* *
* Filename : ioman_small.c *
* Release : 0.3 - devel *
* Description : The IO Manager receives all requests for sectors in a central *
* allowing it to make smart decision regarding caching. *
* The IOMAN_NUMBUFFER parameter determines how many sectors *
* ioman can cache. ioman also supports overallocating and *
* backtracking sectors. *
* This is the small version of IOMan, for systems with limited *
* resources. It features only one fixed buffer, and has *
* simplified operation *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2006 Lennart Yseboodt *
* (c)2006 Michael De Nil *
\*****************************************************************************/
#include "error.h"
#include "plibc.h"
#include "debug.h"
#include "types.h"
#include "config.h"
#define IOMAN_STATUS_ATTR_VALIDDATA 0
#define IOMAN_STATUS_ATTR_USERBUFFER 1
#define IOMAN_STATUS_ATTR_WRITE 2
#define IOM_MODE_READONLY 1
#define IOM_MODE_READWRITE 2
#define IOM_MODE_EXP_REQ 4
struct _IOManStack{
euint32 sector;
euint8 status;
};
typedef struct _IOManStack IOManStack;
struct _IOManager{
rt_device_t device; /* device handler */
euint8 bufptr[512];
IOMAN_ERR_EUINT8
euint32 sector;
euint8 status;
euint8 itptr;
IOManStack stack;
};
typedef struct _IOManager IOManager;
#define IOBJ ioman
#define ioman_isValid() ioman_getAttr(IOBJ,IOMAN_STATUS_ATTR_VALIDDATA)
#define ioman_isUserBuf() ioman_getAttr(IOBJ,IOMAN_STATUS_ATTR_USERBUFFER)
#define ioman_isWritable() ioman_getAttr(IOBJ,IOMAN_STATUS_ATTR_WRITE)
#define ioman_setValid() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_VALIDDATA,1)
#define ioman_setUserBuf() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_USERBUFFER,1)
#define ioman_setWritable() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_WRITE,1)
#define ioman_setNotValid() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_VALIDDATA,0)
#define ioman_setNotUserBuf() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_USERBUFFER,0)
#define ioman_setNotWritable() ioman_setAttr(IOBJ,IOMAN_STATUS_ATTR_WRITE,0)
#define ioman_isReqRo(mode) ((mode)&(IOM_MODE_READONLY))
#define ioman_isReqRw(mode) ((mode)&(IOM_MODE_READWRITE))
#define ioman_isReqExp(mode) ((mode)&(IOM_MODE_EXP_REQ))
esint8 ioman_init(IOManager *ioman, euint8* bufferarea);
void ioman_reset(IOManager *ioman);
void ioman_setAttr(IOManager *ioman,euint8 attribute,euint8 val);
euint8 ioman_getAttr(IOManager *ioman,euint8 attribute);

View File

@ -35,7 +35,6 @@
#define __PLIBC_H__
/*****************************************************************************/
#include "debug.h"
#include "types.h"
#include "config.h"
/*****************************************************************************/

View File

@ -1,600 +0,0 @@
/*****************************************************************************\
* EFSL - Embedded Filesystems Library *
* ----------------------------------- *
* *
* Filename : ioman.c *
* Release : 0.3 - devel *
* Description : The IO Manager receives all requests for sectors in a central *
* allowing it to make smart decision regarding caching. *
* The IOMAN_NUMBUFFER parameter determines how many sectors *
* ioman can cache. ioman also supports overallocating and *
* backtracking sectors. *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2006 Lennart Yseboodt *
* (c)2006 Michael De Nil *
\*****************************************************************************/
/*****************************************************************************/
#include "ioman.h"
#include "efs.h"
/*****************************************************************************/
esint8 ioman_init(IOManager *ioman, euint8* bufferarea)
{
ioman->bufptr = ioman_getBuffer(ioman,bufferarea);
ioman->numbuf = IOMAN_NUMBUFFER;
ioman->numit = IOMAN_NUMITERATIONS;
ioman_reset(ioman);
return(0);
}
/*****************************************************************************/
void ioman_reset(IOManager *ioman)
{
euint16 nb,ni;
memClr(ioman->sector,sizeof(euint32)*ioman->numbuf);
memClr(ioman->status,sizeof(euint8) *ioman->numbuf);
memClr(ioman->usage ,sizeof(euint8) *ioman->numbuf);
memClr(ioman->itptr ,sizeof(euint8) *ioman->numbuf);
ioman_setError(ioman,IOMAN_NOERROR);
for(nb=0;nb<ioman->numbuf;nb++){
for(ni=0;ni<ioman->numit;ni++){
ioman->stack[nb][ni].sector=0;
ioman->stack[nb][ni].status=0;
ioman->stack[nb][ni].usage =0;
}
}
}
/*****************************************************************************/
euint8* ioman_getBuffer(IOManager *ioman,euint8* bufferarea)
{
#ifdef IOMAN_DO_MEMALLOC
return(ioman->cache_mem);
#else
return(bufferarea);
#endif
}
/*****************************************************************************/
void ioman_setAttr(IOManager *ioman,euint16 bufplace,euint8 attribute,euint8 val)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_SETATTROUTOFBOUNDS);
return; /* Out of bounds */
}
if(val){
ioman->status[bufplace]|=1<<attribute;
}else{
ioman->status[bufplace]&=~(1<<attribute);
}
}
/*****************************************************************************/
euint8 ioman_getAttr(IOManager *ioman,euint16 bufplace,euint8 attribute)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_GETATTROUTOFBOUNDS);
return(0xFF); /* Out of bounds */
}
return(ioman->status[bufplace]&(1<<attribute));
}
/*****************************************************************************/
euint8 ioman_getUseCnt(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_OPOUTOFBOUNDS);
return(0x00);
}
return(ioman->usage[bufplace]);
}
/*****************************************************************************/
void ioman_incUseCnt(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_OPOUTOFBOUNDS);
return;
}
if(ioman->usage[bufplace]==0xFF)return;
else ioman->usage[bufplace]++;
}
/*****************************************************************************/
void ioman_decUseCnt(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_OPOUTOFBOUNDS);
return;
}
if(ioman->usage[bufplace]==0x0)return;
else ioman->usage[bufplace]--;
}
/*****************************************************************************/
void ioman_resetUseCnt(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_OPOUTOFBOUNDS);
return;
}
ioman->usage[bufplace]=0x00;
}
/*****************************************************************************/
euint8 ioman_getRefCnt(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_OPOUTOFBOUNDS);
return(0x00);
}
return(ioman->reference[bufplace]);
}
/*****************************************************************************/
void ioman_incRefCnt(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_OPOUTOFBOUNDS);
return;
}
if(ioman->reference[bufplace]==0xFF)return;
else ioman->reference[bufplace]++;
}
/*****************************************************************************/
void ioman_decRefCnt(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_OPOUTOFBOUNDS);
return;
}
if(ioman->reference[bufplace]==0x00)return;
else ioman->reference[bufplace]--;
}
/*****************************************************************************/
void ioman_resetRefCnt(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_OPOUTOFBOUNDS);
return;
}
ioman->reference[bufplace]=0x00;
}
/*****************************************************************************/
esint8 ioman_pop(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_POPEMPTYSTACK);
return(-1);
}
if(ioman->itptr[bufplace]==0 || ioman->itptr[bufplace]>IOMAN_NUMITERATIONS)return(-1);
ioman->itptr[bufplace]--;
ioman->sector[bufplace] = ioman->stack[bufplace][ioman->itptr[bufplace]].sector;
ioman->status[bufplace] = ioman->stack[bufplace][ioman->itptr[bufplace]].status;
ioman->usage[bufplace] = ioman->stack[bufplace][ioman->itptr[bufplace]].usage;
return(0);
}
/*****************************************************************************/
esint8 ioman_push(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_OPOUTOFBOUNDS);
return(-1);
}
if(ioman->itptr[bufplace]>=IOMAN_NUMITERATIONS){
ioman_setError(ioman,IOMAN_ERR_PUSHBEYONDSTACK);
return(-1);
}
ioman->stack[bufplace][ioman->itptr[bufplace]].sector = ioman->sector[bufplace];
ioman->stack[bufplace][ioman->itptr[bufplace]].status = ioman->status[bufplace];
ioman->stack[bufplace][ioman->itptr[bufplace]].usage = ioman->usage[bufplace];
ioman->itptr[bufplace]++;
return(0);
}
/*****************************************************************************/
euint8* ioman_getPtr(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_OPOUTOFBOUNDS);
return(0);
}
return(ioman->bufptr+bufplace*512);
}
/*****************************************************************************/
esint16 ioman_getBp(IOManager *ioman,euint8* buf)
{
if(buf<(ioman->bufptr) || buf>=( ioman->bufptr+(ioman->numbuf*512) )){
ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE);
return(-1);
}
return((buf-(ioman->bufptr))/512);
}
/*****************************************************************************/
esint8 ioman_readSector(IOManager *ioman,euint32 address,euint8* buf)
{
esint8 r;
if(buf==0){
return(-1);
}
r = efs_read_sectors(ioman->device, address, 1, buf);
if(r!=1){
ioman_setError(ioman,IOMAN_ERR_READFAIL);
return(-1);
}
return(0);
}
/*****************************************************************************/
esint8 ioman_writeSector(IOManager *ioman, euint32 address, euint8* buf)
{
esint8 r;
if(buf==0)return(-1);
r = efs_write_sectors(ioman->device, address, 1, buf);
if(r!=1){
ioman_setError(ioman,IOMAN_ERR_WRITEFAIL);
return(-1);
}
return(0);
}
/*****************************************************************************/
void ioman_resetCacheItem(IOManager *ioman,euint16 bufplace)
{
if(bufplace>=ioman->numbuf){
ioman_setError(ioman,IOMAN_ERR_OPOUTOFBOUNDS);
return;
}
ioman->sector[bufplace] = 0;
ioman->status[bufplace] = 0;
ioman->usage[bufplace] = 0;
ioman->reference[bufplace] = 0;
}
/*****************************************************************************/
esint32 ioman_findSectorInCache(IOManager *ioman, euint32 address)
{
euint16 c;
for(c=0;c<ioman->numbuf;c++){
if(ioman_isValid(c) && ioman->sector[c] == address)return(c);
}
return(-1);
}
/*****************************************************************************/
esint32 ioman_findFreeSpot(IOManager *ioman)
{
euint16 c;
for(c=0;c<ioman->numbuf;c++){
if(!ioman_isValid(c))return(c);
}
return(-1);
}
/*****************************************************************************/
esint32 ioman_findUnusedSpot(IOManager *ioman)
{
esint32 r=-1;
euint16 c;
euint8 fr=0,lr=0xFF;
for(c=0;c<ioman->numbuf;c++){
if(ioman_getUseCnt(ioman,c)==0){
if(!ioman_isWritable(c) && !fr){
fr=1;
lr=0xFF;
r=-1;
}
if(ioman_isWritable(c) && !fr){
if(ioman_getRefCnt(ioman,c)<=lr){
r=c;
lr=ioman_getRefCnt(ioman,c);
}
}
if(fr && !ioman_isWritable(c)){
if(ioman_getRefCnt(ioman,c)<=lr){
r=c;
lr=ioman_getRefCnt(ioman,c);
}
}
}
}
return(r);
}
/*****************************************************************************/
esint32 ioman_findOverallocableSpot(IOManager *ioman)
{
euint8 points,lp=0xFF;
euint16 c;
esint32 r=-1;
for(c=0;c<ioman->numbuf;c++){
if(ioman->itptr[c]<ioman->numit){
points = 0;
if(ioman_isWritable(c))points+=0x7F;
points += ((euint16)(ioman->itptr[c]*0x4D))/(ioman->numit);
points += ((euint16)(ioman_getRefCnt(ioman,c)*0x33))/0xFF;
if(points<lp){
lp=points;
r=c;
}
}
}
return(r);
}
/*****************************************************************************/
esint8 ioman_putSectorInCache(IOManager *ioman, euint32 address, euint16 bufplace)
{
euint8* buf;
if((buf = ioman_getPtr(ioman,bufplace))==0){
ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE);
return(-1);
}
if((ioman_readSector(ioman,address,buf))){
ioman_setError(ioman,IOMAN_ERR_READFAIL);
return(-1);
}
ioman_setValid(bufplace);
ioman->sector[bufplace]=address;
return(0);
}
/***************** if(bufplace>=ioman->numbuf)return;
************************************************************/
esint8 ioman_flushSector(IOManager *ioman, euint16 bufplace)
{
euint8* buf;
if((buf = ioman_getPtr(ioman,bufplace))==0){
ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE);
return(-1);
}
if(!ioman_isWritable(bufplace)){
ioman_setError(ioman,IOMAN_ERR_WRITEREADONLYSECTOR);
return(-1);
}
if(ioman_writeSector(ioman,ioman->sector[bufplace],buf)){ /* ERROR HERE STILL TO BE FIXED -> ! must be removed! */
ioman_setError(ioman,IOMAN_ERR_WRITEFAIL);
return(-1);
}
if(ioman->usage[bufplace]==0)ioman_setNotWritable(bufplace);
return(0);
}
/*****************************************************************************/
esint8 ioman_flushRange(IOManager *ioman,euint32 address_low, euint32 address_high)
{
euint32 c;
if(address_low>address_high){
c=address_low; address_low=address_high;address_high=c;
}
for(c=0;c<ioman->numbuf;c++){
if((ioman->sector[c]>=address_low) && (ioman->sector[c]<=address_high) && (ioman_isWritable(c))){
if(ioman_flushSector(ioman,c)){
return(-1);
}
if(ioman->usage[c]==0)ioman_setNotWritable(c);
}
}
return(0);
}
/*****************************************************************************/
esint8 ioman_flushAll(IOManager *ioman)
{
euint16 c;
for(c=0;c<ioman->numbuf;c++){
if(ioman_isWritable(c)){
if(ioman_flushSector(ioman,c)){
return(-1);
}
if(ioman->usage[c]==0)ioman_setNotWritable(c);
}
}
return(0);
}
/*****************************************************************************/
euint8* ioman_getSector(IOManager *ioman,euint32 address, euint8 mode)
{
esint32 bp;
if((bp=ioman_findSectorInCache(ioman,address))!=-1){
if(ioman_isReqRw(mode)){
ioman_setWritable(bp);
}
ioman_incUseCnt(ioman,bp);
if(!ioman_isReqExp(mode))ioman_incRefCnt(ioman,bp);
return(ioman_getPtr(ioman,bp));
}
if((bp=ioman_findFreeSpot(ioman))==-1){
if(((bp=ioman_findUnusedSpot(ioman))!=-1)&&(ioman_isWritable(bp))){
ioman_flushSector(ioman,bp);
}
}
if(bp!=-1){
ioman_resetCacheItem(ioman,bp);
if((ioman_putSectorInCache(ioman,address,bp))){
return(0);
}
if(ioman_isReqRw(mode)){
ioman_setWritable(bp);
}
ioman_incUseCnt(ioman,bp);
if(!ioman_isReqExp(mode))ioman_incRefCnt(ioman,bp);
return(ioman_getPtr(ioman,bp));
}
if((bp=ioman_findOverallocableSpot(ioman))!=-1){
if(ioman_isWritable(bp)){
ioman_flushSector(ioman,bp);
}
if(ioman_push(ioman,bp)){
return(0);
}
ioman_resetCacheItem(ioman,bp);
if((ioman_putSectorInCache(ioman,address,bp))){
return(0);
}
if(ioman_isReqRw(mode)){
ioman_setWritable(bp);
}
ioman_incUseCnt(ioman,bp);
if(!ioman_isReqExp(mode))ioman_incRefCnt(ioman,bp);
return(ioman_getPtr(ioman,bp));
}
ioman_setError(ioman,IOMAN_ERR_NOMEMORY);
return(0);
}
/*****************************************************************************/
esint8 ioman_releaseSector(IOManager *ioman,euint8* buf)
{
euint16 bp;
bp=ioman_getBp(ioman,buf);
ioman_decUseCnt(ioman,bp);
if(ioman_getUseCnt(ioman,bp)==0)
{
if(ioman_isWritable(bp))
{
ioman_flushSector(ioman,bp);
}
if(ioman->itptr[bp]!=0)
{
ioman_pop(ioman,bp);
ioman_putSectorInCache(ioman,ioman->sector[bp],bp);
}
}
return(0);
}
/*****************************************************************************/
esint8 ioman_directSectorRead(IOManager *ioman,euint32 address, euint8* buf)
{
euint8* ibuf;
esint16 bp;
if((bp=ioman_findSectorInCache(ioman,address))!=-1){
ibuf=ioman_getPtr(ioman,bp);
memCpy(ibuf,buf,512);
return(0);
}
if((bp=ioman_findFreeSpot(ioman))!=-1){
if((ioman_putSectorInCache(ioman,address,bp))){
return(-1);
}
ibuf=ioman_getPtr(ioman,bp);
memCpy(ibuf,buf,512);
return(0);
}
if(ioman_readSector(ioman,address,buf)){
return(-1);
}
return(0);
}
/*****************************************************************************/
esint8 ioman_directSectorWrite(IOManager *ioman,euint32 address, euint8* buf)
{
euint8* ibuf;
esint16 bp;
if((bp=ioman_findSectorInCache(ioman,address))!=-1){
ibuf=ioman_getPtr(ioman,bp);
memCpy(buf,ibuf,512);
ioman_setWritable(bp);
return(0);
}
if((bp=ioman_findFreeSpot(ioman))!=-1){
ibuf=ioman_getPtr(ioman,bp);
memCpy(buf,ibuf,512);
ioman_resetCacheItem(ioman,bp);
ioman->sector[bp]=address;
ioman_setWritable(bp);
ioman_setValid(bp);
return(0);
}
if(ioman_writeSector(ioman,address,buf)){
return(-1);
}
return(0);
}
/*****************************************************************************/
void ioman_printStatus(IOManager *ioman)
{
euint16 c;
DBG((TXT("IO-Manager -- Report\n====================\n")));
DBG((TXT("Buffer is %i sectors, from %p to %p\n"),
ioman->numbuf,ioman->bufptr,ioman->bufptr+(ioman->numbuf*512)));
for(c=0;c<ioman->numbuf;c++){
if(ioman_isValid(c)){
DBG((TXT("BP %3i\t SC %8li\t\t US %i\t RF %i\t %s %s\n"),
c,ioman->sector[c],ioman_getUseCnt(ioman,c),ioman_getRefCnt(ioman,c),
ioman_isUserBuf(c) ? "USRBUF" : " ",
ioman_isWritable(c) ? "WRITABLE" : "READONLY"));
}
}
}
/*****************************************************************************/

View File

@ -1,120 +0,0 @@
/*****************************************************************************\
* EFSL - Embedded Filesystems Library *
* ----------------------------------- *
* *
* Filename : ioman_small.c *
* Release : 0.3 - devel *
* Description : The IO Manager receives all requests for sectors in a central *
* allowing it to make smart decision regarding caching. *
* The IOMAN_NUMBUFFER parameter determines how many sectors *
* ioman can cache. ioman also supports overallocating and *
* backtracking sectors. *
* This is the small version of IOMan, for systems with limited *
* resources. It features only one fixed buffer, and has *
* simplified operation *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; version 2 *
* of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* As a special exception, if other files instantiate templates or *
* use macros or inline functions from this file, or you compile this *
* file and link it with other works to produce a work based on this file, *
* this file does not by itself cause the resulting work to be covered *
* by the GNU General Public License. However the source code for this *
* file must still be made available in accordance with section (3) of *
* the GNU General Public License. *
* *
* This exception does not invalidate any other reasons why a work based *
* on this file might be covered by the GNU General Public License. *
* *
* (c)2006 Lennart Yseboodt *
* (c)2006 Michael De Nil *
\*****************************************************************************/
#include "ioman_small.h"
esint8 ioman_init(IOManager *ioman, euint8* bufferarea)
{
ioman_reset(ioman);
return(0);
}
/*****************************************************************************/
void ioman_reset(IOManager *ioman)
{
ioman->sector=ioman->status=ioman->itptr=0;
ioman->stack.sector=ioman->stack.status=0;
ioman_setError(ioman,IOMAN_NOERROR);
}
/*****************************************************************************/
void ioman_setAttr(IOManager *ioman,euint8 attribute,euint8 val)
{
if(val){
ioman->status|=1<<attribute;
}else{
ioman->status&=~(1<<attribute);
}
}
/*****************************************************************************/
euint8 ioman_getAttr(IOManager *ioman,euint8 attribute)
{
return(ioman->status&(1<<attribute));
}
/*****************************************************************************/
euint8* ioman_getSector(IOManager *ioman,euint32 address, euint8 mode)
{
if(address==ioman->sector){
if(mode==IOM_MODE_READWRITE)ioman_setWritable();
return(ioman->bufptr);
}
}
esint8 ioman_readSector(IOManager *ioman,euint32 address,euint8* buf)
{
esint8 r;
if(buf==0){
return(-1);
}
//r=if_readBuf(ioman->iface,address,buf);
r = efs_read_sectors(ioman->device, address, 1, buf);
if(r!=0){
ioman_setError(ioman,IOMAN_ERR_READFAIL);
return(-1);
}
return(0);
}
/*****************************************************************************/
esint8 ioman_writeSector(IOManager *ioman, euint32 address, euint8* buf)
{
esint8 r;
if(buf==0)return(-1);
//r=if_writeBuf(ioman->iface,address,buf);
r = efs_write_sectors(ioman->device, address, 1, buf);
if(r<=0){
ioman_setError(ioman,IOMAN_ERR_WRITEFAIL);
return(-1);
}
return(0);
}
/*****************************************************************************/

View File

@ -51,9 +51,9 @@ euint32 fat_getSectorAddressFatEntry(FileSystem *fs,euint32 cluster_addr)
res=(cluster_addr*3/1024);
if(res>=fs->FatSectorCount){
return(0);
}
}
return(base+res);
case FAT16:
res=cluster_addr/256;
if(res>=fs->FatSectorCount){
@ -64,7 +64,7 @@ euint32 fat_getSectorAddressFatEntry(FileSystem *fs,euint32 cluster_addr)
res=cluster_addr/128;
if(res>=fs->FatSectorCount){
return(0);
}
}
return(base+res);
}
return(0);
@ -142,8 +142,7 @@ void fat_setNextClusterAddress(FileSystem *fs,euint32 cluster_addr,euint32 next_
euint32 sector;
sector=fat_getSectorAddressFatEntry(fs,cluster_addr);
if(fs->FatSectorCount<sector){
DBG((TXT("HARDERROR:::fat_getNextClusterAddress READ PAST FAT BOUNDARY\n")));
if(fs->FatSectorCount<sector){
return;
}

View File

@ -39,7 +39,6 @@
#include "config.h"
#include "error.h"
#include "file.h"
#include "debug.h"
#include "types.h"
/*****************************************************************************/

View File

@ -42,7 +42,6 @@
#include "fs.h"
#include "dir.h"
#include "plibc.h"
#include "debug.h"
#include "types.h"
#include "fat.h"
/*****************************************************************************/

View File

@ -41,7 +41,6 @@
#include "types.h"
#include "error.h"
#include "partition.h"
#include "debug.h"
#include "tm.h"
#include "extract.h"
/*****************************************************************************/

View File

@ -0,0 +1,164 @@
/*
* File : context_gcc.S
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009, 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://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2009-10-11 Bernard first version
*/
/**
* @addtogroup STM32
*/
/*@{*/
.cpu cortex-m3
.fpu softvfp
.syntax unified
.thumb
.text
.equ NVIC_INT_CTRL, 0xE000ED04 /* interrupt control state register */
.equ NVIC_SYSPRI2, 0xE000ED20 /* system priority register (2) */
.equ NVIC_PENDSV_PRI, 0x00FF0000 /* PendSV priority value (lowest) */
.equ NVIC_PENDSVSET, 0x10000000 /* value to trigger PendSV exception */
/*
* rt_base_t rt_hw_interrupt_disable();
*/
.global rt_hw_interrupt_disable
.type rt_hw_interrupt_disable, %function
rt_hw_interrupt_disable:
MRS r0, PRIMASK
CPSID I
BX LR
/*
* void rt_hw_interrupt_enable(rt_base_t level);
*/
.global rt_hw_interrupt_enable
.type rt_hw_interrupt_enable, %function
rt_hw_interrupt_enable:
MSR PRIMASK, r0
BX LR
/*
* void rt_hw_context_switch(rt_uint32 from, rt_uint32 to);
* r0 --> from
* r1 --> to
*/
.global rt_hw_context_switch_interrupt
.type rt_hw_context_switch_interrupt, %function
.global rt_hw_context_switch
.type rt_hw_context_switch, %function
rt_hw_context_switch_interrupt:
rt_hw_context_switch:
/* set rt_thread_switch_interrput_flag to 1 */
LDR r2, =rt_thread_switch_interrput_flag
LDR r3, [r2]
CMP r3, #1
BEQ _reswitch
MOV r3, #1
STR r3, [r2]
LDR r2, =rt_interrupt_from_thread /* set rt_interrupt_from_thread */
STR r0, [r2]
_reswitch:
LDR r2, =rt_interrupt_to_thread /* set rt_interrupt_to_thread */
STR r1, [r2]
LDR r0, =NVIC_INT_CTRL /* trigger the PendSV exception (causes context switch) */
LDR r1, =NVIC_PENDSVSET
STR r1, [r0]
BX LR
/* r0 --> swith from thread stack
* r1 --> swith to thread stack
* psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack
*/
.global rt_hw_pend_sv
.type rt_hw_pend_sv, %function
rt_hw_pend_sv:
/* disable interrupt to protect context switch */
MRS r2, PRIMASK
CPSID I
/* get rt_thread_switch_interrupt_flag */
LDR r0, =rt_thread_switch_interrput_flag
LDR r1, [r0]
CBZ r1, pendsv_exit /* pendsv already handled */
/* clear rt_thread_switch_interrput_flag to 0 */
MOV r1, #0x00
STR r1, [r0]
LDR r0, =rt_interrupt_from_thread
LDR r1, [r0]
CBZ r1, swtich_to_thread /* skip register save at the first time */
MRS r1, psp /* get from thread stack pointer */
STMFD r1!, {r4 - r11} /* push r4 - r11 register */
LDR r0, [r0]
STR r1, [r0] /* update from thread stack pointer */
swtich_to_thread:
LDR r1, =rt_interrupt_to_thread
LDR r1, [r1]
LDR r1, [r1] /* load thread stack pointer */
LDMFD r1!, {r4 - r11} /* pop r4 - r11 register */
MSR psp, r1 /* update stack pointer */
pendsv_exit:
/* restore interrupt */
MSR PRIMASK, r2
ORR lr, lr, #0x04
BX lr
/*
* void rt_hw_context_switch_to(rt_uint32 to);
* r0 --> to
*/
.global rt_hw_context_switch_to
.type rt_hw_context_switch_to, %function
rt_hw_context_switch_to:
LDR r1, =rt_interrupt_to_thread
STR r0, [r1]
/* set from thread to 0 */
LDR r1, =rt_interrupt_from_thread
MOV r0, #0x0
STR r0, [r1]
/* set interrupt flag to 1 */
LDR r1, =rt_thread_switch_interrput_flag
MOV r0, #1
STR r0, [r1]
/* set the PendSV exception priority */
LDR r0, =NVIC_SYSPRI2
LDR r1, =NVIC_PENDSV_PRI
STR r1, [r0]
LDR r0, =NVIC_INT_CTRL /* trigger the PendSV exception (causes context switch) */
LDR r1, =NVIC_PENDSVSET
STR r1, [r0]
CPSIE I /* enable interrupts at processor level */
/* never reach here! */
/* compatible with old version */
.global rt_hw_interrupt_thread_switch
.type rt_hw_interrupt_thread_switch, %function
rt_hw_interrupt_thread_switch:
BX lr
NOP

242
libcpu/arm/lm3s/start_gcc.c Normal file
View File

@ -0,0 +1,242 @@
//*****************************************************************************
//
// startup.c - Boot code for Stellaris.
//
// Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved.
//
// Software License Agreement
//
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's microcontroller products.
//
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws. All rights are reserved. You may not combine
// this software with "viral" open-source software in order to form a larger
// program. Any use in violation of the foregoing restrictions may subject
// the user to criminal sanctions under applicable laws, as well as to civil
// liability for the breach of the terms and conditions of this license.
//
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 2752 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************
//*****************************************************************************
//
// Forward declaration of the default fault handlers.
//
//*****************************************************************************
void ResetISR(void);
static void NmiSR(void);
static void FaultISR(void);
static void IntDefaultHandler(void);
//*****************************************************************************
//
// The entry point for the application.
//
//*****************************************************************************
extern int main(void);
//*****************************************************************************
//
// Reserve space for the system stack.
//
//*****************************************************************************
#ifndef STACK_SIZE
#define STACK_SIZE 64
#endif
static unsigned long pulStack[STACK_SIZE];
//*****************************************************************************
//
// The minimal vector table for a Cortex M3. Note that the proper constructs
// must be placed on this to ensure that it ends up at physical address
// 0x0000.0000.
//
//*****************************************************************************
__attribute__ ((section(".isr_vector")))
void (* const g_pfnVectors[])(void) =
{
(void (*)(void))((unsigned long)pulStack + sizeof(pulStack)),
// The initial stack pointer
ResetISR, // The reset handler
NmiSR, // The NMI handler
FaultISR, // The hard fault handler
IntDefaultHandler, // The MPU fault handler
IntDefaultHandler, // The bus fault handler
IntDefaultHandler, // The usage fault handler
0, // Reserved
0, // Reserved
0, // Reserved
0, // Reserved
IntDefaultHandler, // SVCall handler
IntDefaultHandler, // Debug monitor handler
0, // Reserved
IntDefaultHandler, // The PendSV handler
IntDefaultHandler, // The SysTick handler
IntDefaultHandler, // GPIO Port A
IntDefaultHandler, // GPIO Port B
IntDefaultHandler, // GPIO Port C
IntDefaultHandler, // GPIO Port D
IntDefaultHandler, // GPIO Port E
IntDefaultHandler, // UART0 Rx and Tx
IntDefaultHandler, // UART1 Rx and Tx
IntDefaultHandler, // SSI Rx and Tx
IntDefaultHandler, // I2C Master and Slave
IntDefaultHandler, // PWM Fault
IntDefaultHandler, // PWM Generator 0
IntDefaultHandler, // PWM Generator 1
IntDefaultHandler, // PWM Generator 2
IntDefaultHandler, // Quadrature Encoder
IntDefaultHandler, // ADC Sequence 0
IntDefaultHandler, // ADC Sequence 1
IntDefaultHandler, // ADC Sequence 2
IntDefaultHandler, // ADC Sequence 3
IntDefaultHandler, // Watchdog timer
IntDefaultHandler, // Timer 0 subtimer A
IntDefaultHandler, // Timer 0 subtimer B
IntDefaultHandler, // Timer 1 subtimer A
IntDefaultHandler, // Timer 1 subtimer B
IntDefaultHandler, // Timer 2 subtimer A
IntDefaultHandler, // Timer 2 subtimer B
IntDefaultHandler, // Analog Comparator 0
IntDefaultHandler, // Analog Comparator 1
IntDefaultHandler, // Analog Comparator 2
IntDefaultHandler, // System Control (PLL, OSC, BO)
IntDefaultHandler, // FLASH Control
IntDefaultHandler, // GPIO Port F
IntDefaultHandler, // GPIO Port G
IntDefaultHandler, // GPIO Port H
IntDefaultHandler, // UART2 Rx and Tx
IntDefaultHandler, // SSI1 Rx and Tx
IntDefaultHandler, // Timer 3 subtimer A
IntDefaultHandler, // Timer 3 subtimer B
IntDefaultHandler, // I2C1 Master and Slave
IntDefaultHandler, // Quadrature Encoder 1
IntDefaultHandler, // CAN0
IntDefaultHandler, // CAN1
IntDefaultHandler, // CAN2
IntDefaultHandler, // Ethernet
IntDefaultHandler, // Hibernate
IntDefaultHandler, // USB0
IntDefaultHandler, // PWM Generator 3
IntDefaultHandler, // uDMA Software Transfer
IntDefaultHandler // uDMA Error
};
//*****************************************************************************
//
// The following are constructs created by the linker, indicating where the
// the "data" and "bss" segments reside in memory. The initializers for the
// for the "data" segment resides immediately following the "text" segment.
//
//*****************************************************************************
extern unsigned long _etext;
extern unsigned long _sdata;
extern unsigned long _edata;
extern unsigned long _sbss;
extern unsigned long _ebss;
//*****************************************************************************
//
// This is the code that gets called when the processor first starts execution
// following a reset event. Only the absolutely necessary set is performed,
// after which the application supplied main() routine is called. Any fancy
// actions (such as making decisions based on the reset cause register, and
// resetting the bits in that register) are left solely in the hands of the
// application.
//
//*****************************************************************************
void
ResetISR(void)
{
unsigned long *pulSrc, *pulDest;
//
// Copy the data segment initializers from flash to SRAM.
//
pulSrc = &_etext;
for(pulDest = &_sdata; pulDest < &_edata; )
{
*pulDest++ = *pulSrc++;
}
//
// Zero fill the bss segment. This is done with inline assembly since this
// will clear the value of pulDest if it is not kept in a register.
//
__asm(" ldr r0, =_sbss\n"
" ldr r1, =_ebss\n"
" mov r2, #0\n"
" .thumb_func\n"
"zero_loop:\n"
" cmp r0, r1\n"
" it lt\n"
" strlt r2, [r0], #4\n"
" blt zero_loop");
//
// Call the application's entry point.
//
main();
}
//*****************************************************************************
//
// This is the code that gets called when the processor receives a NMI. This
// simply enters an infinite loop, preserving the system state for examination
// by a debugger.
//
//*****************************************************************************
static void
NmiSR(void)
{
//
// Enter an infinite loop.
//
while(1)
{
}
}
//*****************************************************************************
//
// This is the code that gets called when the processor receives a fault
// interrupt. This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
FaultISR(void)
{
//
// Enter an infinite loop.
//
while(1)
{
}
}
//*****************************************************************************
//
// This is the code that gets called when the processor receives an unexpected
// interrupt. This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void
IntDefaultHandler(void)
{
//
// Go into an infinite loop.
//
while(1)
{
}
}