串口2接收数据,comm处理信息
This commit is contained in:
1 parent
7c463c07c6
commit
9f9c96d650
14 files changed
+507
-58
No files matched your search
@@ -160,7 +160,7 @@ CONFIG_RT_USING_DEVICE_IPC=y
|
|||||||
CONFIG_RT_USING_SERIAL=y
|
CONFIG_RT_USING_SERIAL=y
|
||||||
CONFIG_RT_USING_SERIAL_V1=y
|
CONFIG_RT_USING_SERIAL_V1=y
|
||||||
# CONFIG_RT_USING_SERIAL_V2 is not set
|
# CONFIG_RT_USING_SERIAL_V2 is not set
|
||||||
# CONFIG_RT_SERIAL_USING_DMA is not set
|
CONFIG_RT_SERIAL_USING_DMA=y
|
||||||
CONFIG_RT_SERIAL_RB_BUFSZ=64
|
CONFIG_RT_SERIAL_RB_BUFSZ=64
|
||||||
# CONFIG_RT_USING_CAN is not set
|
# CONFIG_RT_USING_CAN is not set
|
||||||
# CONFIG_RT_USING_HWTIMER is not set
|
# CONFIG_RT_USING_HWTIMER is not set
|
||||||
|
|||||||
@@ -68,6 +68,9 @@
|
|||||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1570350559" name="GNU ARM Cross C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1570350559" name="GNU ARM Cross C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.634882052" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.634882052" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/applications}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/applications/DBSQL}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/applications/DB}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers//include}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers//include}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers//include//config}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers//include//config}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/libraries//CMSIS//Device//ST//STM32F4xx//Include}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/libraries//CMSIS//Device//ST//STM32F4xx//Include}""/>
|
||||||
@@ -265,6 +268,8 @@
|
|||||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1026498694" name="GNU ARM Cross C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1570350559">
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1026498694" name="GNU ARM Cross C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1570350559">
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.1599109014" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.1599109014" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/applications/DATA}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/applications/DBSQL}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/applications/RUN_LED}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/applications/RUN_LED}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers//include}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers//include}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers//include//config}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers//include//config}""/>
|
||||||
@@ -307,6 +312,97 @@
|
|||||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.1578710235" name="GNU ARM Cross Print Size" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.1073550295"/>
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.1578710235" name="GNU ARM Cross Print Size" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.1073550295"/>
|
||||||
</toolChain>
|
</toolChain>
|
||||||
</folderInfo>
|
</folderInfo>
|
||||||
|
<folderInfo id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.553091094.1496577543" name="/" resourcePath="applications/DBSQL">
|
||||||
|
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.elf.debug.307220578" name="ARM Cross GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.elf.debug" unusedChildren="">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.251260409.182158254.605770396" name="Create flash image" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.251260409.182158254"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.1365878149.619479147.80091130" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.1365878149.619479147"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.709136944.1346513839.478633071" name="Print size" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.709136944.1346513839"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.1986446770.452529508.719370483" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.1986446770.452529508"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.1312975261.2049716802.174552327" name="Message length (-fmessage-length=0)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.1312975261.2049716802"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.1538128212.444048439.1155153540" name="'char' is signed (-fsigned-char)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.1538128212.444048439"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.2136804218.127758899.895711654" name="Function sections (-ffunction-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.2136804218.127758899"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.244767666.1700439127.463116467" name="Data sections (-fdata-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.244767666.1700439127"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.1055848773.12492232.568911829" name="Debug level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.1055848773.12492232"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.501941135.1210690277.1077147407" name="Debug format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.501941135.1210690277"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.1696308067.916638732.4727098" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.1696308067.916638732"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1558403188.559460621.908558554" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1558403188.559460621"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.749415257.1902466141.1384755270" name="ARM family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.749415257.1902466141"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.2114153533.502713859.276734749" name="Instruction set" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.2114153533.502713859"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.1600865811.873915621.418272640" name="Prefix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.1600865811.873915621"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.1109963929.1225572227.1902558059" name="C compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.1109963929.1225572227"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp.1040883831.643388648.1569691656" name="C++ compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp.1040883831.643388648"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.1678200391.668953054.2091378131" name="Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.1678200391.668953054"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy.1171840296.1098989580.1332517300" name="Hex/Bin converter" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy.1171840296.1098989580"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump.342604837.499020117.1210894445" name="Listing generator" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump.342604837.499020117"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.size.898269225.984765130.2049393465" name="Size command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.size.898269225.984765130"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.make.2016398076.508188161.1720189824" name="Build command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.make.2016398076.508188161"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm.1606171496.1914561574.436957100" name="Remove command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm.1606171496.1914561574"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.id.540792084.1986591874.470247155" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.id.540792084.1986591874"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture.430121817.1989957222.1459720989" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture.430121817.1989957222"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.966735324.1734948804.2095233479" name="Float ABI" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.966735324.1734948804"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn.1381561249.62315102.1879102606" name="Enable all common warnings (-Wall)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn.1381561249.62315102"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.target.other.2041717463.1413802919.824529584" name="Other target flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.target.other.2041717463.1413802919"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.1463655269.1841695866.1255544434" name="FPU Type" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.1463655269.1841695866"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.208045305.1867334011" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.208045305"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.243028108.954454796" name="Message length (-fmessage-length=0)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.243028108"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.832062875.698192715" name="'char' is signed (-fsigned-char)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.832062875"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.1276842886.576955018" name="Function sections (-ffunction-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.1276842886"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.1667317482.1502562732" name="Data sections (-fdata-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.1667317482"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.1566045926.2122079446" name="Debug level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.1566045926"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.1854589250.131374215" name="Debug format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.1854589250"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.1817097645.1317027649" name="Create flash image" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.1817097645"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.271108098.1420884262" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.271108098"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.1970971720.324973894" name="Print size" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.1970971720"/>
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.116113962" name="GNU ARM Cross Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.222740011">
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.694680476" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1670964970" name="GNU ARM Cross C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1026498694">
|
||||||
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.1601286606" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/applications/DBSQL}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/applications/RUN_LED}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers//include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/drivers//include//config}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/libraries//CMSIS//Device//ST//STM32F4xx//Include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/libraries//CMSIS//Include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/libraries//CMSIS//RTOS//Template}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/libraries//STM32F4xx_HAL_Driver//Inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/libraries//STM32F4xx_HAL_Driver//Inc//Legacy}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/.}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}/applications}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//.}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//cubemx/Inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//cubemx}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//packages/cJSON-v1.7.17}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//packages/sqlite-v3.19.3}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/dfs/filesystems/devfs}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/dfs/filesystems/elmfat}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/dfs/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/drivers/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/finsh}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/legacy/dfs}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/legacy}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/libc/compilers/common}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/libc/compilers/newlib}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/libc/posix/io/poll}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/libc/posix/io/stdio}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/components/libc/posix/ipc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/libcpu/arm/common}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc://${ProjName}//rt-thread/libcpu/arm/cortex-m4}""/>
|
||||||
|
</option>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1548380191" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.406608043" name="GNU ARM Cross C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1236763088"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.29721557" name="Cross ARM C Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.1881909634"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.882917621" name="GNU ARM Cross C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.1116428017"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.1226705196" name="GNU ARM Cross Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.645248814"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash.769389433" name="GNU ARM Cross Create Flash Image" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash.1330026241"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting.1611811787" name="GNU ARM Cross Create Listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting.525987628"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.1793937333" name="GNU ARM Cross Print Size" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.1578710235"/>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
<sourceEntries>
|
<sourceEntries>
|
||||||
<entry excluding="//cubemx/Drivers|//cubemx/EWARM|//cubemx/Src/stm32f4xx_it.c|//cubemx/Src/system_stm32f4xx.c|//packages/sqlite-v3.19.3/rtthread_io_methods.c|//packages/sqlite-v3.19.3/rtthread_mutex.c|//packages/sqlite-v3.19.3/rtthread_vfs.c|//packages/sqlite-v3.19.3/shell.c|//packages/sqlite-v3.19.3/student_dao.c|//rt-thread/components/dfs/filesystems/nfs|//rt-thread/components/dfs/filesystems/ramfs|//rt-thread/components/dfs/filesystems/romfs|//rt-thread/components/dfs/filesystems/skeleton|//rt-thread/components/drivers/audio|//rt-thread/components/drivers/can|//rt-thread/components/drivers/cputime|//rt-thread/components/drivers/hwcrypto|//rt-thread/components/drivers/hwtimer|//rt-thread/components/drivers/i2c|//rt-thread/components/drivers/misc/adc.c|//rt-thread/components/drivers/misc/dac.c|//rt-thread/components/drivers/misc/pulse_encoder.c|//rt-thread/components/drivers/misc/rt_drv_pwm.c|//rt-thread/components/drivers/misc/rt_inputcapture.c|//rt-thread/components/drivers/mtd|//rt-thread/components/drivers/phy|//rt-thread/components/drivers/pm|//rt-thread/components/drivers/rtc|//rt-thread/components/drivers/sensors|//rt-thread/components/drivers/serial/serial_v2.c|//rt-thread/components/drivers/spi|//rt-thread/components/drivers/touch|//rt-thread/components/drivers/usb|//rt-thread/components/drivers/watchdog|//rt-thread/components/drivers/wlan|//rt-thread/components/fal|//rt-thread/components/libc/compilers/armlibc|//rt-thread/components/libc/compilers/dlib|//rt-thread/components/libc/cplusplus|//rt-thread/components/libc/posix|//rt-thread/components/lwp|//rt-thread/components/net|//rt-thread/components/utilities|//rt-thread/components/vbus|//rt-thread/components/vmm|//rt-thread/libcpu/aarch64|//rt-thread/libcpu/arc|//rt-thread/libcpu/arm/AT91SAM7S|//rt-thread/libcpu/arm/AT91SAM7X|//rt-thread/libcpu/arm/am335x|//rt-thread/libcpu/arm/arm926|//rt-thread/libcpu/arm/armv6|//rt-thread/libcpu/arm/common/divsi3.S|//rt-thread/libcpu/arm/cortex-a|//rt-thread/libcpu/arm/cortex-m0|//rt-thread/libcpu/arm/cortex-m23|//rt-thread/libcpu/arm/cortex-m3|//rt-thread/libcpu/arm/cortex-m33|//rt-thread/libcpu/arm/cortex-m4/context_iar.S|//rt-thread/libcpu/arm/cortex-m4/context_rvds.S|//rt-thread/libcpu/arm/cortex-m7|//rt-thread/libcpu/arm/cortex-r4|//rt-thread/libcpu/arm/dm36x|//rt-thread/libcpu/arm/lpc214x|//rt-thread/libcpu/arm/lpc24xx|//rt-thread/libcpu/arm/realview-a8-vmm|//rt-thread/libcpu/arm/s3c24x0|//rt-thread/libcpu/arm/s3c44b0|//rt-thread/libcpu/arm/sep4020|//rt-thread/libcpu/arm/zynqmp-r5|//rt-thread/libcpu/avr32|//rt-thread/libcpu/blackfin|//rt-thread/libcpu/c-sky|//rt-thread/libcpu/ia32|//rt-thread/libcpu/m16c|//rt-thread/libcpu/mips|//rt-thread/libcpu/nios|//rt-thread/libcpu/ppc|//rt-thread/libcpu/risc-v|//rt-thread/libcpu/rx|//rt-thread/libcpu/sim|//rt-thread/libcpu/sparc-v8|//rt-thread/libcpu/ti-dsp|//rt-thread/libcpu/unicore32|//rt-thread/libcpu/v850|//rt-thread/libcpu/xilinx|//rt-thread/src/cpu.c|//rt-thread/src/memheap.c|//rt-thread/src/signal.c|//rt-thread/src/slab.c|//rt-thread/tools" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
<entry excluding="//cubemx/Drivers|//cubemx/EWARM|//cubemx/Src/stm32f4xx_it.c|//cubemx/Src/system_stm32f4xx.c|//packages/sqlite-v3.19.3/rtthread_io_methods.c|//packages/sqlite-v3.19.3/rtthread_mutex.c|//packages/sqlite-v3.19.3/rtthread_vfs.c|//packages/sqlite-v3.19.3/shell.c|//packages/sqlite-v3.19.3/student_dao.c|//rt-thread/components/dfs/filesystems/nfs|//rt-thread/components/dfs/filesystems/ramfs|//rt-thread/components/dfs/filesystems/romfs|//rt-thread/components/dfs/filesystems/skeleton|//rt-thread/components/drivers/audio|//rt-thread/components/drivers/can|//rt-thread/components/drivers/cputime|//rt-thread/components/drivers/hwcrypto|//rt-thread/components/drivers/hwtimer|//rt-thread/components/drivers/i2c|//rt-thread/components/drivers/misc/adc.c|//rt-thread/components/drivers/misc/dac.c|//rt-thread/components/drivers/misc/pulse_encoder.c|//rt-thread/components/drivers/misc/rt_drv_pwm.c|//rt-thread/components/drivers/misc/rt_inputcapture.c|//rt-thread/components/drivers/mtd|//rt-thread/components/drivers/phy|//rt-thread/components/drivers/pm|//rt-thread/components/drivers/rtc|//rt-thread/components/drivers/sensors|//rt-thread/components/drivers/serial/serial_v2.c|//rt-thread/components/drivers/spi|//rt-thread/components/drivers/touch|//rt-thread/components/drivers/usb|//rt-thread/components/drivers/watchdog|//rt-thread/components/drivers/wlan|//rt-thread/components/fal|//rt-thread/components/libc/compilers/armlibc|//rt-thread/components/libc/compilers/dlib|//rt-thread/components/libc/cplusplus|//rt-thread/components/libc/posix|//rt-thread/components/lwp|//rt-thread/components/net|//rt-thread/components/utilities|//rt-thread/components/vbus|//rt-thread/components/vmm|//rt-thread/libcpu/aarch64|//rt-thread/libcpu/arc|//rt-thread/libcpu/arm/AT91SAM7S|//rt-thread/libcpu/arm/AT91SAM7X|//rt-thread/libcpu/arm/am335x|//rt-thread/libcpu/arm/arm926|//rt-thread/libcpu/arm/armv6|//rt-thread/libcpu/arm/common/divsi3.S|//rt-thread/libcpu/arm/cortex-a|//rt-thread/libcpu/arm/cortex-m0|//rt-thread/libcpu/arm/cortex-m23|//rt-thread/libcpu/arm/cortex-m3|//rt-thread/libcpu/arm/cortex-m33|//rt-thread/libcpu/arm/cortex-m4/context_iar.S|//rt-thread/libcpu/arm/cortex-m4/context_rvds.S|//rt-thread/libcpu/arm/cortex-m7|//rt-thread/libcpu/arm/cortex-r4|//rt-thread/libcpu/arm/dm36x|//rt-thread/libcpu/arm/lpc214x|//rt-thread/libcpu/arm/lpc24xx|//rt-thread/libcpu/arm/realview-a8-vmm|//rt-thread/libcpu/arm/s3c24x0|//rt-thread/libcpu/arm/s3c44b0|//rt-thread/libcpu/arm/sep4020|//rt-thread/libcpu/arm/zynqmp-r5|//rt-thread/libcpu/avr32|//rt-thread/libcpu/blackfin|//rt-thread/libcpu/c-sky|//rt-thread/libcpu/ia32|//rt-thread/libcpu/m16c|//rt-thread/libcpu/mips|//rt-thread/libcpu/nios|//rt-thread/libcpu/ppc|//rt-thread/libcpu/risc-v|//rt-thread/libcpu/rx|//rt-thread/libcpu/sim|//rt-thread/libcpu/sparc-v8|//rt-thread/libcpu/ti-dsp|//rt-thread/libcpu/unicore32|//rt-thread/libcpu/v850|//rt-thread/libcpu/xilinx|//rt-thread/src/cpu.c|//rt-thread/src/memheap.c|//rt-thread/src/signal.c|//rt-thread/src/slab.c|//rt-thread/tools" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||||
</sourceEntries>
|
</sourceEntries>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1329242017815709534" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1258495279358323302" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2025-10-20 Administrator the first version
|
||||||
|
*/
|
||||||
|
/* DATA_comm.c */
|
||||||
|
#include <rtthread.h>
|
||||||
|
#include "data_comm.h"
|
||||||
|
|
||||||
|
rt_mq_t proc_mq;
|
||||||
|
|
||||||
|
void proc_thread_entry(void *parameter)
|
||||||
|
{
|
||||||
|
struct proc_request *req;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
// 接收请求指针
|
||||||
|
if (rt_mq_recv(proc_mq, &req, sizeof(req), RT_WAITING_FOREVER) == RT_EOK)
|
||||||
|
{
|
||||||
|
if (!req) continue;
|
||||||
|
|
||||||
|
rt_kprintf("Processing: %.*s\n", req->input_len, req->input);
|
||||||
|
|
||||||
|
// 示例处理:回显
|
||||||
|
req->output_len = rt_snprintf(req->output, sizeof(req->output),
|
||||||
|
"Echo: %.*s", req->input_len, req->input);
|
||||||
|
|
||||||
|
// 通知 UART 线程可以发送了
|
||||||
|
if (req->sem)
|
||||||
|
{
|
||||||
|
rt_sem_release(req->sem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int data_comm_init(void)
|
||||||
|
{
|
||||||
|
proc_mq = rt_mq_create("proc_mq", sizeof(struct proc_request*), 5, RT_IPC_FLAG_FIFO);
|
||||||
|
if (proc_mq == RT_NULL)
|
||||||
|
{
|
||||||
|
rt_kprintf("Failed to create message queue!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
rt_thread_t tid = rt_thread_create("proc", proc_thread_entry, RT_NULL,
|
||||||
|
2048, 20, 10);
|
||||||
|
if (tid != RT_NULL)
|
||||||
|
{
|
||||||
|
rt_thread_startup(tid);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//INIT_COMPONENT_EXPORT(data_comm_init);
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2025-10-20 Administrator the first version
|
||||||
|
*/
|
||||||
|
#ifndef APPLICATIONS_DATA_COMM_H_
|
||||||
|
#define APPLICATIONS_DATA_COMM_H_
|
||||||
|
|
||||||
|
// 最大输入/输出长度
|
||||||
|
#define MAX_INPUT_LEN 512
|
||||||
|
#define MAX_OUTPUT_LEN 1024
|
||||||
|
|
||||||
|
// 请求结构体
|
||||||
|
struct proc_request {
|
||||||
|
char input[MAX_INPUT_LEN];
|
||||||
|
int input_len;
|
||||||
|
char output[MAX_OUTPUT_LEN];
|
||||||
|
int output_len;
|
||||||
|
struct rt_semaphore *sem; // 指向动态分配的信号量
|
||||||
|
};
|
||||||
|
|
||||||
|
// 消息队列(供外部使用)
|
||||||
|
extern rt_mq_t proc_mq;
|
||||||
|
|
||||||
|
int data_comm_init(void);
|
||||||
|
|
||||||
|
#endif /* APPLICATIONS_DATA_COMM_H_ */
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2025-10-20 Administrator the first version
|
||||||
|
*/
|
||||||
|
/* DATA_uart.c */
|
||||||
|
#include <rtthread.h>
|
||||||
|
#include <rtdevice.h>
|
||||||
|
#include "data_comm.h"
|
||||||
|
|
||||||
|
#define SAMPLE_UART_NAME "uart2"
|
||||||
|
#define DMA_RX_BUF_SIZE 512
|
||||||
|
#define RINGBUF_SIZE 4096
|
||||||
|
|
||||||
|
static rt_device_t serial;
|
||||||
|
|
||||||
|
// DMA 接收缓冲区
|
||||||
|
static rt_uint8_t dma_rx_buffer[DMA_RX_BUF_SIZE];
|
||||||
|
|
||||||
|
// 环形缓冲区(暂存未完整报文)
|
||||||
|
static struct rt_ringbuffer rx_rb;
|
||||||
|
static rt_uint8_t rb_pool[RINGBUF_SIZE];
|
||||||
|
|
||||||
|
// 接收回调信号量
|
||||||
|
static struct rt_semaphore rx_sem;
|
||||||
|
|
||||||
|
// 函数声明
|
||||||
|
static rt_err_t uart_rx_ind(rt_device_t dev, rt_size_t size);
|
||||||
|
static int get_line(char *buf, int maxlen);
|
||||||
|
|
||||||
|
void uart_thread_entry(void *parameter)
|
||||||
|
{
|
||||||
|
char input[MAX_INPUT_LEN];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
// 初始化环形缓冲区和信号量
|
||||||
|
rt_ringbuffer_init(&rx_rb, rb_pool, sizeof(rb_pool));
|
||||||
|
rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO);
|
||||||
|
|
||||||
|
// 查找串口设备
|
||||||
|
serial = rt_device_find(SAMPLE_UART_NAME);
|
||||||
|
if (!serial) {
|
||||||
|
rt_kprintf("Cannot find %s\n", SAMPLE_UART_NAME);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 配置串口参数(只设置 bufsz,去掉 dma_rx)
|
||||||
|
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||||
|
config.bufsz = DMA_RX_BUF_SIZE; // 设置接收缓冲区大小
|
||||||
|
|
||||||
|
rt_device_control(serial, RT_DEVICE_CTRL_CONFIG, &config);
|
||||||
|
|
||||||
|
// 打开设备:关键!使用 RT_DEVICE_FLAG_DMA_RX 启用 DMA 接收
|
||||||
|
rt_err_t result = rt_device_open(serial, RT_DEVICE_FLAG_DMA_RX | RT_DEVICE_FLAG_DMA_TX);
|
||||||
|
if (result != RT_EOK)
|
||||||
|
{
|
||||||
|
rt_kprintf("Failed to open %s with DMA, error=%d\n", SAMPLE_UART_NAME, result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置接收指示回调(DMA 完成或中断后调用)
|
||||||
|
rt_device_set_rx_indicate(serial, uart_rx_ind);
|
||||||
|
|
||||||
|
rt_kprintf("UART DMA thread running...\n");
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
// 等待数据就绪
|
||||||
|
if (rt_sem_take(&rx_sem, RT_WAITING_FOREVER) == RT_EOK)
|
||||||
|
{
|
||||||
|
// 处理接收到的数据(提取完整行)
|
||||||
|
while ((len = get_line(input, sizeof(input))) > 0)
|
||||||
|
{
|
||||||
|
rt_kprintf("Received: %.*s\n", len, input);
|
||||||
|
|
||||||
|
// 动态分配请求结构体(见之前完整代码)
|
||||||
|
struct proc_request *req = rt_malloc(sizeof(struct proc_request));
|
||||||
|
if (!req) continue;
|
||||||
|
|
||||||
|
rt_strncpy(req->input, input, sizeof(req->input));
|
||||||
|
req->input_len = len;
|
||||||
|
|
||||||
|
req->sem = rt_malloc(sizeof(struct rt_semaphore));
|
||||||
|
if (!req->sem) {
|
||||||
|
rt_free(req);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rt_sem_init(req->sem, "uart_resp", 0, RT_IPC_FLAG_FIFO);
|
||||||
|
|
||||||
|
// 发送到处理线程
|
||||||
|
if (rt_mq_send(proc_mq, &req, sizeof(req)) == RT_EOK)
|
||||||
|
{
|
||||||
|
// 等待处理完成
|
||||||
|
if (rt_sem_take(req->sem, RT_WAITING_FOREVER) == RT_EOK)
|
||||||
|
{
|
||||||
|
rt_device_write(serial, 0, req->output, req->output_len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理
|
||||||
|
rt_sem_detach(req->sem); // 或 rt_sem_delete
|
||||||
|
rt_free(req->sem);
|
||||||
|
rt_free(req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// DMA 接收回调
|
||||||
|
static rt_err_t uart_rx_ind(rt_device_t dev, rt_size_t size)
|
||||||
|
{
|
||||||
|
rt_ringbuffer_put(&rx_rb, (const rt_uint8_t*)dma_rx_buffer, size);
|
||||||
|
rt_sem_release(&rx_sem); // 通知线程处理
|
||||||
|
return RT_EOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从环形缓冲区提取一行
|
||||||
|
static int get_line(char *buf, int maxlen)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
char ch;
|
||||||
|
|
||||||
|
while (rt_ringbuffer_getchar(&rx_rb, &ch) == 1)
|
||||||
|
{
|
||||||
|
if (ch == '\n' || ch == '\r') {
|
||||||
|
if (i > 0) break;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i < maxlen - 1) buf[i++] = ch;
|
||||||
|
}
|
||||||
|
buf[i] = '\0';
|
||||||
|
return i > 0 ? i : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 启动 UART 线程
|
||||||
|
int start_uart_thread(void)
|
||||||
|
{
|
||||||
|
rt_thread_t tid = rt_thread_create("uart_rx", uart_thread_entry, RT_NULL,
|
||||||
|
4096, // 栈大小:4KB
|
||||||
|
25, // 优先级
|
||||||
|
10); // 时间片
|
||||||
|
if (tid != RT_NULL)
|
||||||
|
{
|
||||||
|
rt_thread_startup(tid);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//INIT_COMPONENT_EXPORT(start_uart_thread);
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2025-10-20 Administrator the first version
|
||||||
|
*/
|
||||||
|
#ifndef APPLICATIONS_DATA_UART_H_
|
||||||
|
#define APPLICATIONS_DATA_UART_H_
|
||||||
|
|
||||||
|
int start_uart_thread(void);
|
||||||
|
|
||||||
|
#endif /* APPLICATIONS_DATA_UART_H_ */
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2025-10-20 Administrator the first version
|
||||||
|
*/
|
||||||
|
#include <rtthread.h>
|
||||||
|
#include <rtdevice.h>
|
||||||
|
#include <board.h>
|
||||||
|
#include "DB_SQLite.h"
|
||||||
|
|
||||||
|
#include <dbhelper.h>
|
||||||
|
#define DB_NAME "/rt.db"
|
||||||
|
|
||||||
|
void db_sqlite(void *parameter)
|
||||||
|
{
|
||||||
|
int db_HelperInit;
|
||||||
|
int db_;
|
||||||
|
|
||||||
|
db_HelperInit = db_helper_init();
|
||||||
|
|
||||||
|
if(db_HelperInit =RT_EOK){
|
||||||
|
rt_kprintf("HelperInit database\n");
|
||||||
|
}else {
|
||||||
|
// db_ = db_create_database("CREATE TABLE student(id INTEGER PRIMARY KEY AUTOINCREMENT,name varchar(32) NOT NULL,score INT NOT NULL);");
|
||||||
|
// if(db_=0){rt_kprintf("database ok\n");}else{rt_kprintf("database no\n");}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* int fd = 0;
|
||||||
|
const char *dbname = db_get_name();
|
||||||
|
fd = open(dbname, O_RDONLY);
|
||||||
|
if (fd > 0)
|
||||||
|
rt_kprintf("%s exist\r\n", dbname);
|
||||||
|
else
|
||||||
|
rt_kprintf("%s not exist\r\n");
|
||||||
|
|
||||||
|
|
||||||
|
const char *sql = "CREATE TABLE IF NOT EXISTS student(id INTEGER PRIMARY KEY AUTOINCREMENT,name varchar(32) NOT NULL,score INT NOT NULL);";
|
||||||
|
rt_kprintf("sql cmd: %s\r\n\r\n", sql);
|
||||||
|
int ret = db_create_database(sql);
|
||||||
|
rt_kprintf("sql ret: %d\r\n", ret);*/
|
||||||
|
|
||||||
|
// sqlite3_os_init();
|
||||||
|
|
||||||
|
/* int rc = db_connect("/rt.db");
|
||||||
|
if (rc <0) {
|
||||||
|
const char *sql = "CREATE TABLE student(id INTEGER PRIMARY KEY AUTOINCREMENT,name varchar(32) NOT NULL,score INT NOT NULL);";
|
||||||
|
int db_create_database(sql);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 线程 */
|
||||||
|
void thread_DB_SQLite(void)
|
||||||
|
{
|
||||||
|
/* 初始化线程 1,名称是 thread1,入口是 thread1_entry*/
|
||||||
|
rt_thread_t tid;
|
||||||
|
tid = rt_thread_create("db_sqlite", db_sqlite, RT_NULL, 1024*32, 3, 10);
|
||||||
|
|
||||||
|
if (tid != RT_NULL)
|
||||||
|
{
|
||||||
|
rt_thread_startup(tid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rt_kprintf("Failed to create sqlite_sys thread!\n");
|
||||||
|
}
|
||||||
|
// return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2025-10-20 Administrator the first version
|
||||||
|
*/
|
||||||
|
#ifndef APPLICATIONS_DB_DB_SQLITE_H_
|
||||||
|
#define APPLICATIONS_DB_SQLITE_SYS_H_
|
||||||
|
|
||||||
|
void thread_DB_SQLite(void);
|
||||||
|
|
||||||
|
#endif /* APPLICATIONS_DB_DB_SQLITE_H_ */
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
#include"drv_common.h"
|
#include"drv_common.h"
|
||||||
|
#include "RUN_LED.h"
|
||||||
|
|
||||||
#define LED_PIN GET_PIN(C,13)
|
#define LED_PIN GET_PIN(C,13)
|
||||||
|
|
||||||
@@ -18,12 +19,12 @@ void RUN_LED(void *parameter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 线程示例 */
|
/* 线程 */
|
||||||
void thread_RUN_LED(void)
|
void thread_RUN_LED(void)
|
||||||
{
|
{
|
||||||
/* 初始化线程 1,名称是 thread1,入口是 thread1_entry*/
|
/* 初始化线程 1,名称是 thread1,入口是 thread1_entry*/
|
||||||
rt_thread_t tid;
|
rt_thread_t tid;
|
||||||
tid = rt_thread_create("run_led", RUN_LED, RT_NULL, 512, 3, 10);
|
tid = rt_thread_create("run_led", RUN_LED, RT_NULL, 256, 3, 10);
|
||||||
|
|
||||||
if (tid != RT_NULL)
|
if (tid != RT_NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
+9
-45
@@ -1,4 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
#include <DBSQL/DB_SQLite.h>
|
||||||
|
#include <DB_SQLite.h>
|
||||||
* Copyright (c) 2006-2025, RT-Thread Development Team
|
* Copyright (c) 2006-2025, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
@@ -12,61 +14,23 @@
|
|||||||
#include "dfs_fs.h"
|
#include "dfs_fs.h"
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
#include "RUN_LED.h"
|
#include "RUN_LED.h"
|
||||||
|
#include "DB_SQLite.h"
|
||||||
#include <dbhelper.h>
|
|
||||||
#define DB_NAME "/rt.db"
|
|
||||||
|
|
||||||
#define DBG_TAG "main"
|
#define DBG_TAG "main"
|
||||||
#define DBG_LVL DBG_LOG
|
#define DBG_LVL DBG_LOG
|
||||||
#include <rtdbg.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
extern rt_sem_t mount_sem; // 引用上面SD挂载线程定义的信号量
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
rt_thread_mdelay(100); //等待sd_mount线程挂载文件系统,可使用IPC信号量完成同步,提高实时性
|
rt_sem_take(mount_sem, rt_tick_from_millisecond(5000)); // 等待挂载完成,最多等待 5 秒
|
||||||
|
thread_RUN_LED();//运行指示灯线程
|
||||||
|
thread_DB_SQLite();
|
||||||
|
|
||||||
thread_RUN_LED();
|
start_uart_thread();
|
||||||
|
data_comm_init();
|
||||||
//int db_HelperInit;
|
|
||||||
// db_HelperInit = db_helper_init();
|
|
||||||
|
|
||||||
// if(db_HelperInit =RT_EOK){
|
|
||||||
// rt_kprintf("HelperInit database\n");
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// int db_helper_init();
|
|
||||||
|
|
||||||
// sqlite3 *db;
|
|
||||||
// int8_t rc;
|
|
||||||
|
|
||||||
// rc = sqlite3_open("rt.db", &db);
|
|
||||||
// if (rc != SQLITE_OK)
|
|
||||||
// {
|
|
||||||
//rt_kprintf("Cannot open database: %s\n", sqlite3_errmsg(db));
|
|
||||||
//return -1;
|
|
||||||
// }else{
|
|
||||||
// rt_kprintf("Database opened successfully\n");
|
|
||||||
// sqlite3_close(db);
|
|
||||||
// }
|
|
||||||
// sqlite3_os_init();
|
|
||||||
//if(int sqlite3_os_init()==RT_EOK){LOG_D("Sqlite int RT_EOK!");}
|
|
||||||
|
|
||||||
|
|
||||||
// sqlite3_os_init();
|
|
||||||
|
|
||||||
/* int rc = db_connect("/rt.db");
|
|
||||||
if (rc <0) {
|
|
||||||
const char *sql = "CREATE TABLE student(id INTEGER PRIMARY KEY AUTOINCREMENT,name varchar(32) NOT NULL,score INT NOT NULL);";
|
|
||||||
int db_create_database(sql);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
@@ -15,25 +15,39 @@
|
|||||||
#define DBG_LVL DBG_LOG
|
#define DBG_LVL DBG_LOG
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
|
|
||||||
|
rt_sem_t mount_sem = RT_NULL;
|
||||||
|
|
||||||
void sd_mount(void *parameter)
|
void sd_mount(void *parameter)
|
||||||
{
|
{
|
||||||
while (1)
|
LOG_I("SD mount thread started, waiting for SD card...");
|
||||||
|
int retry = 0;
|
||||||
|
while (retry<10)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (rt_device_find("sd0") != RT_NULL)
|
if (rt_device_find("sd0") != RT_NULL)
|
||||||
{
|
{
|
||||||
if (dfs_mount("sd0", "/", "elm", 0, 0) == RT_EOK)
|
if (dfs_mount("sd0", "/", "elm", 0, 0) == RT_EOK)
|
||||||
{
|
{
|
||||||
LOG_I("sd card mount to '/fatfs'");
|
LOG_I("SD card mounted to '/' successfully");
|
||||||
break;
|
// 挂载成功,释放信号量
|
||||||
|
if (mount_sem != RT_NULL)
|
||||||
|
{
|
||||||
|
rt_sem_release(mount_sem);
|
||||||
|
}
|
||||||
|
break; // 退出线程循环
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_W("sd card mount to '/fatfs' failed!");
|
LOG_W("SD card mount failed, retrying...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_D("SD device 'sd0' not found, retrying...");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 避免空转,延时 100ms 再试
|
||||||
|
rt_thread_mdelay(500);
|
||||||
|
retry++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,16 +55,41 @@ int stm32_sdcard_mount(void)
|
|||||||
{
|
{
|
||||||
rt_thread_t tid;
|
rt_thread_t tid;
|
||||||
|
|
||||||
tid = rt_thread_create("sd_mount", sd_mount, RT_NULL,
|
// 删除旧的信号量(如果存在)
|
||||||
1024*4, RT_THREAD_PRIORITY_MAX - 2, 20);
|
if (mount_sem != RT_NULL)
|
||||||
|
{
|
||||||
|
rt_sem_delete(mount_sem);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建计数信号量,初始值为 0
|
||||||
|
mount_sem = rt_sem_create("sd_mount", 0, RT_IPC_FLAG_FIFO);
|
||||||
|
if (mount_sem == RT_NULL)
|
||||||
|
{
|
||||||
|
LOG_E("Failed to create semaphore for SD mount!");
|
||||||
|
return -RT_ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
tid = rt_thread_create("sd_mount",
|
||||||
|
sd_mount,
|
||||||
|
RT_NULL,
|
||||||
|
4096, // 建议增大栈,避免溢出
|
||||||
|
RT_THREAD_PRIORITY_MAX - 2,
|
||||||
|
20);
|
||||||
if (tid != RT_NULL)
|
if (tid != RT_NULL)
|
||||||
{
|
{
|
||||||
rt_thread_startup(tid);
|
rt_thread_startup(tid);
|
||||||
|
LOG_I("SD mount thread created and started");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_E("create sd_mount thread err!");
|
LOG_E("Failed to create SD mount thread!");
|
||||||
|
rt_sem_delete(mount_sem);
|
||||||
|
mount_sem = RT_NULL;
|
||||||
|
return -RT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
|
// 使用 INIT_COMPONENTS_INIT 或 INIT_APP_EXPORT 自动启动
|
||||||
|
//INIT_COMPONENTS_INIT(stm32_sdcard_mount); // 在组件初始化阶段运行
|
||||||
INIT_APP_EXPORT(stm32_sdcard_mount);
|
INIT_APP_EXPORT(stm32_sdcard_mount);
|
||||||
@@ -71,6 +71,11 @@ extern "C"
|
|||||||
#define BSP_UART1_TX_PIN "PA9"
|
#define BSP_UART1_TX_PIN "PA9"
|
||||||
#define BSP_UART1_RX_PIN "PA10"
|
#define BSP_UART1_RX_PIN "PA10"
|
||||||
|
|
||||||
|
#define BSP_USING_UART2
|
||||||
|
#define BSP_UART2_TX_PIN "PA2"
|
||||||
|
#define BSP_UART2_RX_PIN "PA3"
|
||||||
|
#define BSP_UART2_TX_USING_DMA
|
||||||
|
#define BSP_UART2_RX_USING_DMA
|
||||||
/*-------------------------- UART CONFIG END --------------------------*/
|
/*-------------------------- UART CONFIG END --------------------------*/
|
||||||
|
|
||||||
/*-------------------------- I2C CONFIG BEGIN --------------------------*/
|
/*-------------------------- I2C CONFIG BEGIN --------------------------*/
|
||||||
|
|||||||
@@ -106,6 +106,7 @@
|
|||||||
#define RT_USING_DEVICE_IPC
|
#define RT_USING_DEVICE_IPC
|
||||||
#define RT_USING_SERIAL
|
#define RT_USING_SERIAL
|
||||||
#define RT_USING_SERIAL_V1
|
#define RT_USING_SERIAL_V1
|
||||||
|
#define RT_SERIAL_USING_DMA
|
||||||
#define RT_SERIAL_RB_BUFSZ 64
|
#define RT_SERIAL_RB_BUFSZ 64
|
||||||
#define RT_USING_PIN
|
#define RT_USING_PIN
|
||||||
#define RT_USING_SDIO
|
#define RT_USING_SDIO
|
||||||
|
|||||||
Reference in new issue
Block a user