Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2036c780c2 | |||
| 14a4870f5a |
@@ -0,0 +1,53 @@
|
||||
#Generated from Visual Studio settings
|
||||
---
|
||||
BasedOnStyle: webkit
|
||||
BraceWrapping:
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
AfterClass: true
|
||||
AfterFunction: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
ColumnLimit: 0
|
||||
BreakBeforeBraces: Custom
|
||||
NamespaceIndentation: All
|
||||
TabWidth: 2
|
||||
IndentWidth: 2
|
||||
IndentCaseLabels: true
|
||||
AlignAfterOpenBracket: Align
|
||||
PointerAlignment: Right
|
||||
AlignOperands: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
AlignTrailingComments: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
AlignConsecutiveMacros:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: true
|
||||
AcrossComments: true
|
||||
AlignArrayOfStructures: Right
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveBitFields:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: true
|
||||
PadOperators: true
|
||||
AlignEscapedNewlines: Right
|
||||
...
|
||||
@@ -0,0 +1,294 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.926872659">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.926872659" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.RV_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="${cross_rm} -rf" description="" id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.926872659" name="Debug" parent="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug" postbuildStep="${cross_prefix}${cross_objcopy}${cross_suffix} -O binary ${ProjName}.elf ${ProjName}.bin">
|
||||
<folderInfo id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.926872659." name="/" resourcePath="">
|
||||
<toolChain id="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.debug.1243233573" name="RISC-V Cross GCC" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.debug">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash.249191345" name="Create flash image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createlisting.243120876" name="Create extended listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createlisting" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize.1566043258" name="Print size" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.1801001334" name="Optimization Level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.optimize" valueType="enumerated"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength.651682061" name="Message length (-fmessage-length=0)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.signedchar.1219903449" name="'char' is signed (-fsigned-char)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.signedchar" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.functionsections.168524687" name="Function sections (-ffunction-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.functionsections" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.datasections.2098519515" name="Data sections (-fdata-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.datasections" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level.1093129020" name="Debug level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.format.449325272" name="Debug format" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.format"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id.758656032" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id" value="2262347901" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.name.932361954" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.name" value="RISC-V GCC/Newlib" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.prefix.1942787399" name="Prefix" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.prefix" value="riscv64-unknown-elf-" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.c.684525315" name="C compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.c" value="gcc" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.cpp.1638988330" name="C++ compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.cpp" value="g++" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.ar.1234563299" name="Archiver" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.ar" value="ar" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objcopy.1492404953" name="Hex/Bin converter" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objcopy" value="objcopy" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objdump.1394253527" name="Listing generator" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objdump" value="objdump" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.size.1332389637" name="Size command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.size" value="size" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.make.2031126337" name="Build command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.make" value="make" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.rm.1285759101" name="Remove command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.rm" value="rm" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.base.1410576671" name="Architecture" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.base" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.arch.rv32e" valueType="enumerated"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.compressed.353152664" name="Compressed extension (RVC)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.compressed" value="false" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.abi.integer.1735833830" name="Integer ABI" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.abi.integer" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.abi.integer.ilp32e" valueType="enumerated"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel.796386542" name="Code model" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel.low" valueType="enumerated"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.tune.90660292" name="Tuning" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.tune" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.tune.n200series" valueType="enumerated"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.preferxpacksbin.159763604" name="Prefer xpacks/.bin" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.preferxpacksbin" value="false" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.multiply.1863445619" name="Multiply extension (RVM)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.multiply" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic.1533438913" name="Atomic extension (RVA)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.extensions.447179843" name="Other extensions" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.extensions" value="_zba_zbb_zbs_zca_zcb_zcmp_zcmt_zicond" valueType="string"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.RV_ELF;org.eclipse.cdt.core.ELF" id="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform.624485565" isAbstract="false" osList="all" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform"/>
|
||||
<builder buildPath="${workspace_loc:/Project}/Debug" id="ilg.gnumcueclipse.managedbuild.cross.riscv.builder.1494546460" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.builder"/>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.1909166920" name="GNU RISC-V Cross Assembler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor.1982625252" name="Use preprocessor" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.defs.1756055012" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.defs" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__IDE_RV_CORE=N203E"/>
|
||||
<listOptionValue builtIn="false" value="CONFIG_USE_PEC930"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths.1624800055" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/NMSIS/Core/Include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/Device/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/HAL_Lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/BSP/StarterKit}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Common}""/>
|
||||
</option>
|
||||
<inputType id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.input.724532243" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.991594434" name="GNU RISC-V Cross C Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs.1630974101" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__IDE_RV_CORE=N203E"/>
|
||||
<listOptionValue builtIn="false" value="CONFIG_USE_PEC930"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths.1504538192" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/NMSIS/Core/Include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/Device/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/HAL_Lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/BSP/StarterKit}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Common}""/>
|
||||
</option>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.345216805" name="Language standard" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.c99" valueType="enumerated"/>
|
||||
<inputType id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.input.1843576227" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.compiler.958908384" name="GNU RISC-V Cross C++ Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.compiler">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.compiler.defs.665145577" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__IDE_RV_CORE=N203E"/>
|
||||
</option>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.1832379824" name="GNU RISC-V Cross C Linker" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.gcsections.1847575804" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.gcsections" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.other.962260539" name="Other linker flags" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.other" value="" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.nostart.1331613792" name="Do not use standard start files (-nostartfiles)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.nostart" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.nodeflibs.1405041078" name="Do not use default libraries (-nodefaultlibs)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.nodeflibs" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.printmap.663083040" name="Print link map (-Xlinker --print-map)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.printmap" value="false" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.cref.986670320" name="Cross reference (-Xlinker --cref)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.cref" value="true" valueType="boolean"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.scriptfile.1007616047" name="Script files (-T)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.scriptfile" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/gcc_flashxip.ld}""/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.libs.2005823803" name="Libraries (-l)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="c_nano"/>
|
||||
<listOptionValue builtIn="false" value="m"/>
|
||||
<listOptionValue builtIn="false" value="gcc"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.flags.1425978507" name="Linker flags (-Xlinker [option])" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.flags" valueType="stringList"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.grouplibs.1661588098" name="Group libraries (-Wl,--start-group, ... ,--end-group)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.grouplibs" value="true" valueType="boolean"/>
|
||||
<inputType id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.input.393723091" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.linker.1387419752" name="GNU RISC-V Cross C++ Linker" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.linker">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.gcsections.297993148" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.gcsections" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.other.720519285" name="Other linker flags" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.other" value="-u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek " valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.libs.2127007227" name="Libraries (-l)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.libs"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver.2145124977" name="GNU RISC-V Cross Archiver" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver"/>
|
||||
<tool command="${cross_prefix}${cross_objcopy}${cross_suffix}" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT}" id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash.586549949" name="GNU RISC-V Cross Create Flash Image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice.283218197" name="Output file format (-O)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice.ihex" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting.1070118556" name="GNU RISC-V Cross Create Listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source.1733954628" name="Display source (--source|-S)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders.1626209232" name="Display all headers (--all-headers|-x)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.demangle.280684598" name="Demangle names (--demangle|-C)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.demangle" value="false" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.linenumbers.1695987115" name="Display line numbers (--line-numbers|-l)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.linenumbers" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.wide.1148871387" name="Wide lines (--wide|-w)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.wide" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.disassemble.1301534980" name="Disassemble (--disassemble|-d)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.disassemble" value="true" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.printsize.315205585" name="GNU RISC-V Cross Print Size" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.printsize">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.printsize.format.1467048234" name="Size format" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.printsize.format"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="ilg.gnumcueclipse.managedbuild.packs"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.16434552">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.16434552" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.RV_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="${cross_rm} -rf" description="" id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.16434552" name="Release" parent="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release">
|
||||
<folderInfo id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.16434552." name="/" resourcePath="">
|
||||
<toolChain id="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release.837856819" name="RISC-V Cross GCC" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.release">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash.1208613512" name="Create flash image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createlisting.1016401583" name="Create extended listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createlisting" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize.1246797237" name="Print size" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.2012455781" name="Optimization Level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.size" valueType="enumerated"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength.1493955924" name="Message length (-fmessage-length=0)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.signedchar.651822097" name="'char' is signed (-fsigned-char)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.signedchar" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.functionsections.1717953891" name="Function sections (-ffunction-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.functionsections" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.datasections.541048735" name="Data sections (-fdata-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.datasections" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level.360621726" name="Debug level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.format.1281181250" name="Debug format" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.format"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id.723143813" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id" value="2262347901" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.name.399597377" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.name" value="RISC-V GCC/Newlib" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.prefix.568227293" name="Prefix" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.prefix" value="riscv64-unknown-elf-" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.c.639974320" name="C compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.c" value="gcc" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.cpp.1733841476" name="C++ compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.cpp" value="g++" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.ar.789308737" name="Archiver" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.ar" value="ar" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objcopy.1273467405" name="Hex/Bin converter" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objcopy" value="objcopy" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objdump.1863146323" name="Listing generator" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objdump" value="objdump" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.size.350346878" name="Size command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.size" value="size" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.make.1982710953" name="Build command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.make" value="make" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.rm.1369963916" name="Remove command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.rm" value="rm" valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.base.371627411" name="Architecture" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.base" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.arch.rv32e" valueType="enumerated"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.compressed.325570710" name="Compressed extension (RVC)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.compressed" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.abi.integer.268981471" name="Integer ABI" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.abi.integer" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.abi.integer.ilp32e" valueType="enumerated"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel.1135863126" name="Code model" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel.low" valueType="enumerated"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.tune.1264121613" name="Tuning" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.tune" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.tune.n200series" valueType="enumerated"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.multiply.2138851355" name="Multiply extension (RVM)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.multiply" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic.1576924112" name="Atomic extension (RVA)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic" value="true" valueType="boolean"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.RV_ELF;org.eclipse.cdt.core.ELF" id="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform.930977981" isAbstract="false" osList="all" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform"/>
|
||||
<builder buildPath="${workspace_loc:/Project}/Release" id="ilg.gnumcueclipse.managedbuild.cross.riscv.builder.1235026887" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.builder"/>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.1274001025" name="GNU RISC-V Cross Assembler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor.1238271906" name="Use preprocessor" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.defs.1967727594" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.defs" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__IDE_RV_CORE=N203E"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths.284910497" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/NMSIS/Core/Include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/Device/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/HAL_Lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/BSP/StarterKit}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Common}""/>
|
||||
</option>
|
||||
<inputType id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.input.1276065282" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.1901433257" name="GNU RISC-V Cross C Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs.687116111" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__IDE_RV_CORE=N203E"/>
|
||||
<listOptionValue builtIn="false" value="NDEBUG"/>
|
||||
<listOptionValue builtIn="false" value="CONFIG_USE_PEC930"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths.140100445" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/NMSIS/Core/Include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/Device/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/HAL_Lib/inc}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/BSP/StarterKit}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Common}""/>
|
||||
</option>
|
||||
<inputType id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.input.868354821" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.compiler.1780721496" name="GNU RISC-V Cross C++ Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.compiler">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.compiler.defs.1060583602" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__IDE_RV_CORE=N203E"/>
|
||||
</option>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.1023024678" name="GNU RISC-V Cross C Linker" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.gcsections.589554014" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.gcsections" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.other.170075676" name="Other linker flags" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.other" value="--specs=nosys.specs" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.scriptfile.123103120" name="Script files (-T)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.scriptfile" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/Drivers/PEC930/gcc_flashxip.ld}""/>
|
||||
</option>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.nodeflibs.122457886" name="Do not use default libraries (-nodefaultlibs)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.nodeflibs" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.nostart.507700170" name="Do not use standard start files (-nostartfiles)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.nostart" value="true" valueType="boolean"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.libs.1049690196" name="Libraries (-l)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.libs" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="c_nano"/>
|
||||
<listOptionValue builtIn="false" value="gcc"/>
|
||||
</option>
|
||||
<inputType id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.input.1639406854" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.linker.554290345" name="GNU RISC-V Cross C++ Linker" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.cpp.linker">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.gcsections.1904431755" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.gcsections" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.other.450429501" name="Other linker flags" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.other" value="-u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek " valueType="string"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.libs.1125125661" name="Libraries (-l)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.libs"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver.1507570544" name="GNU RISC-V Cross Archiver" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.archiver"/>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash.841899246" name="GNU RISC-V Cross Create Flash Image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createflash">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice.413941719" name="Output file format (-O)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createflash.choice.ihex" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting.39250443" name="GNU RISC-V Cross Create Listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source.778908801" name="Display source (--source|-S)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders.1081260692" name="Display all headers (--all-headers|-x)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.demangle.212671820" name="Demangle names (--demangle|-C)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.demangle" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.linenumbers.1206119075" name="Display line numbers (--line-numbers|-l)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.linenumbers" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.wide.625905344" name="Wide lines (--wide|-w)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.wide" value="true" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.printsize.1552514466" name="GNU RISC-V Cross Print Size" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.printsize">
|
||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.printsize.format.1158424346" name="Size format" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.printsize.format"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="Project.ilg.gnumcueclipse.managedbuild.cross.riscv.target.rvelf.1157615279" name="Executable" projectType="ilg.gnumcueclipse.managedbuild.cross.riscv.target.rvelf"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.926872659;ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.debug.926872659.;ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.991594434;ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.input.1843576227">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.16434552;ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.16434552.;ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.1901433257;ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.input.868354821">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/Project"/>
|
||||
</configuration>
|
||||
<configuration configurationName="Release">
|
||||
<resource resourceType="PROJECT" workspacePath="/Project"/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cproject>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Project</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>Common</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/Common</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>Drivers</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/Drivers</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>Profiles</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/Tools/scripts/Profiles</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name></name>
|
||||
<type>6</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-*.nuproject</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,25 @@
|
||||
SDK_CONFIG:
|
||||
Debug:
|
||||
core: N203E
|
||||
extra_asmflags:
|
||||
archext:
|
||||
extra_cxxflags:
|
||||
cmodel: medlow
|
||||
extra_commonflags:
|
||||
abi: ilp32e
|
||||
arch: rv32ema_zba_zbb_zbs_zca_zcb_zcmp_zcmt_zicond
|
||||
toolchain: gnu
|
||||
extra_cflags:
|
||||
extra_ldflags:
|
||||
Release:
|
||||
core: N203E
|
||||
extra_asmflags:
|
||||
archext:
|
||||
extra_cxxflags:
|
||||
cmodel: medlow
|
||||
extra_commonflags:
|
||||
abi: ilp32e
|
||||
arch: rv32emac_zba_zbb_zbs
|
||||
toolchain: gnu
|
||||
extra_cflags:
|
||||
extra_ldflags:
|
||||
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# component Makefile
|
||||
#
|
||||
|
||||
|
||||
C_SOURCES += \
|
||||
$(srctree)/$(PROJ)/src/isr.c \
|
||||
$(srctree)/$(PROJ)/src/main.c
|
||||
|
||||
C_INCLUDES += -I$(srctree)/$(PROJ)/inc
|
||||
|
||||
|
||||
LIBS +=
|
||||
CFLAGS +=
|
||||
LDFLAGS +=
|
||||
LIBDIR +=
|
||||
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Wisetop. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef __APP_H__
|
||||
#define __APP_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
|
||||
//=============================================================================
|
||||
// Constant Definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Macro Definition
|
||||
//=============================================================================
|
||||
#define UART_RX_BUF_SIZE 64
|
||||
#define UART_SERIAL_BAUD 115200
|
||||
#define UART_RX_TIMEOUT_MS 100
|
||||
|
||||
/* flash*/
|
||||
#define FLASH_PROG_ADDR_END sizeof(EFLASH_MEM_Type)
|
||||
#define FLASH_PROG_ADDR_USER_CALI (FLASH_PROG_ADDR_END - FLASH_1_PAGE_SIZE) // 0x8000-512
|
||||
#define FLASH_PARAM_MAGIC 0x50464C54U
|
||||
|
||||
//=============================================================================
|
||||
// Structure Definition
|
||||
//=============================================================================
|
||||
struct bode_plot_param_t
|
||||
{
|
||||
int32_t b0;
|
||||
int32_t b1;
|
||||
int32_t b2;
|
||||
int32_t a1;
|
||||
int32_t a2;
|
||||
};
|
||||
|
||||
struct flash_bode_plot_blob_t
|
||||
{
|
||||
uint32_t magic;
|
||||
struct bode_plot_param_t cloop;
|
||||
struct bode_plot_param_t vloop;
|
||||
uint32_t reserved;
|
||||
};
|
||||
//=============================================================================
|
||||
// Global Data Definition
|
||||
//=============================================================================
|
||||
static volatile char g_rx_buf[UART_RX_BUF_SIZE];
|
||||
static volatile uint32_t g_rx_idx = 0;
|
||||
static volatile uint32_t g_rx_len = 0;
|
||||
static volatile int g_rx_ready = 0;
|
||||
static volatile uint32_t g_rx_last_tick = 0; /* sys_tick when last byte arrived */
|
||||
//=============================================================================
|
||||
// Private Function Definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Public Function Definition
|
||||
//=============================================================================
|
||||
void app(void);
|
||||
|
||||
/* uart and cmd*/
|
||||
void uart_init(void);
|
||||
void uart_rx_handler(void);
|
||||
int is_rx_frame_ready(void);
|
||||
int uart_rx_getline(char *pBuf, uint32_t size);
|
||||
void uart_cmd_parse(char *cmd_buf, uint32_t size);
|
||||
|
||||
/* flash */
|
||||
int write_bodeplot_params_to_flash(const struct bode_plot_param_t *cloop, const struct bode_plot_param_t *vloop, uint32_t addr);
|
||||
void read_bodeplot_params_from_flash(struct bode_plot_param_t *cloop, struct bode_plot_param_t *vloop, uint32_t addr);
|
||||
void peek_bodeplot_params_in_flash(uint32_t addr);
|
||||
void print_bodeplot_params(struct bode_plot_param_t *cloop, struct bode_plot_param_t *vloop);
|
||||
extern struct bode_plot_param_t pfc_cloop_bode_plot_param;
|
||||
extern struct bode_plot_param_t pfc_vloop_bode_plot_param;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Wisetop. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef INC_INIT_H_
|
||||
#define INC_INIT_H_
|
||||
|
||||
#include "main.h"
|
||||
|
||||
void SYS_Config(void);
|
||||
void sysclk_init(void);
|
||||
void gpio_init(void);
|
||||
void opa_init(void);
|
||||
void adc_init(void);
|
||||
void tim0_init(void);
|
||||
void llc_pwm_init(void);
|
||||
void pfc_pwm_init(void);
|
||||
void pwm_brake();
|
||||
|
||||
#endif /* INC_INIT_H_ */
|
||||
@@ -0,0 +1,140 @@
|
||||
/**
|
||||
* Copyright (c) 2024 Wei-Lun Hsu. All Rights Reserved.
|
||||
*/
|
||||
/** @file main.h
|
||||
*
|
||||
* @author Wei-Lun Hsu
|
||||
* @version 0.1
|
||||
* @date 2024/08/29
|
||||
* @license
|
||||
* @description
|
||||
*/
|
||||
|
||||
#ifndef __main_H_wxBnwdPw_lq7D_H4I5_sHPp_uXof15pFLp4V__
|
||||
#define __main_H_wxBnwdPw_lq7D_H4I5_sHPp_uXof15pFLp4V__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "hal_device.h"
|
||||
#include "syslog.h"
|
||||
//=============================================================================
|
||||
// Constant Definition
|
||||
//=============================================================================
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// PFC DUTY 參數
|
||||
#define PFC_PERIOD 600 // 600 = 100khz
|
||||
#define PFC_DUTY_MAX 540 //(PFC_PERIOD * 0.9) // 600 * 0.85 = 510
|
||||
#define PFC_DUTY_MIN 12 //(PFC_PERIOD * 0.02) // 600 * 0.02 = 12
|
||||
#define YN_MAX (PFC_DUTY_MAX << 14)
|
||||
#define YN_MIN (PFC_DUTY_MIN << 14)
|
||||
// VBUS 參數
|
||||
#define VBUS_SET 350 // unit: volt (Transformer N = 14)
|
||||
#define VBUS_SET_H (VBUS_SET + 20) // burst mode in, 在過零區判斷
|
||||
#define VBUS_SET_L (VBUS_SET - 20) // burst mode out, 在過零區判斷
|
||||
// #define VBUS_SET_H2 370 // for skip mode
|
||||
#define VBUS_OVP 72
|
||||
#define VBUS_UVP 36
|
||||
#define VBUS_2ADC 24.81f // 100K + 4.2K
|
||||
#define VCOMP_2DUTY 0 // vbus_comp control duty
|
||||
#define V_COMP_MAX 16000 // (PFC_DUTY_MAX * 32) // 480 * 32 = 16360
|
||||
#define V_COMP_MIN 300 // (PFC_DUTY_MAX * 32) // 12 * 32 = 384
|
||||
#define V_INT_GAIN_BIT 9 // 7=/128, 9=/512 大約除 120 ~ 500 之間 (粗調用bit, 細調用整數)
|
||||
#define V_POR_GAIN_BIT 8 // 6=/64, 8=/256 大約除 60 ~ 250 之間
|
||||
#define VBUS_INT_MAX (V_COMP_MAX << V_INT_GAIN_BIT)
|
||||
#define VBUS_POR_MAX (V_COMP_MAX << (V_POR_GAIN_BIT - 1))
|
||||
//---------------------------------------------------------------
|
||||
#define DIGI_COMP_BIT 10
|
||||
// #define DIGI_COMP_MAX (VBUS_SET_H * 4096 / VBUS_2ADC / 3.3) << 4
|
||||
//------------------------------------------------------------------
|
||||
// 武士 12V 變壓器 + 47nF 諧振頻率 ~ 75KHZ
|
||||
// 實測值 106uH + 47nF = 73KHZ --> PERIOD = 820 ~ 830
|
||||
// 高正 40uH + 68nF ~ 95KHZ
|
||||
#define LLC_PERIOD_SS 400 // 600 = 100khz (EPWM initial use)
|
||||
#define DEAD_TIME 500 // ns
|
||||
#define DEAD_TIME_VALUE (DEAD_TIME * 0.06) // double
|
||||
// LLC free run, 改控 vbus_set
|
||||
#define LLC_PERIOD_MIN 400 // MIN, 400 = 150KHZ (>760不會振)
|
||||
#define LLC_PERIOD_MAX 820 // MAX, 800 = 75KHZ // 可調範圍太大會共振
|
||||
#define LLC_COMP_GAIN_BIT 10 // 要慢才不會振
|
||||
#define LLC_COMP_MAX ((LLC_PERIOD_MAX - LLC_PERIOD_MIN) << LLC_COMP_GAIN_BIT)
|
||||
// LLC Soft Start 掃頻 2倍 ~ 1倍 = 150KHZ ~ 73KHZ
|
||||
#define LLC_SS_MIN (LLC_PERIOD_MIN << 2) // 精度不夠,放大 4 倍, 1600
|
||||
#define LLC_SS_MAX (LLC_PERIOD_MAX << 2) // 精度不夠,放大 4 倍, 3280
|
||||
#define LLC_SS_COUNT (LLC_SS_MAX - LLC_SS_MIN) // 3280 - 1600 = 1680 * 10us = 16.8ms
|
||||
// TIM0 參數 = ADC 取樣頻率
|
||||
#define TIM0_PERIOD 600 // 60M / 600 = 100KHZ
|
||||
// IAC 參數
|
||||
#define I_COMP_MAX 16000 // = V_COMP_MAX * 1.414
|
||||
#define I_INT_GAIN_BIT 2
|
||||
// #define I_POR_GAIN_BIT 6
|
||||
#define I_INT_MAX (I_COMP_MAX << 3)
|
||||
#define I_POR_MAX (I_INT_MAX) // 減半,影響 50%
|
||||
|
||||
// #define VAC_BROWN_IN 1113 // 約 95V (你原本的邏輯)
|
||||
// #define VAC_BROWN_OUT 930 // 約 80V (根據你的比例計算)
|
||||
#define VAC_ZERO 400
|
||||
#define VAC_ZERO_RISE 600
|
||||
#define BROWNOUT_DELAY 500 // 延遲計數,避免瞬時雜訊觸發
|
||||
#define VOLT_BROWN_IN 900 // 78V = 912
|
||||
#define VOLT_BROWN_OUT 855 // 73V = 855
|
||||
// VAC 110V = 1260
|
||||
// VAC 220V = 2483
|
||||
// 定義控制參數
|
||||
#define STEP_FAST 16 // 遠離目標時的步長
|
||||
#define STEP_SLOW 1 // 接近目標時的步長
|
||||
#define STABLE_THRES 5 // 狀態翻轉幾次後判定為進入穩態
|
||||
|
||||
#define CURR_OFFSET 3840 // 零點電流 = 3820 ~ 3860
|
||||
|
||||
//=============================================================================
|
||||
// Macro Definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Structure Definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Global Data Definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Private Function Definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Public Function Definition
|
||||
//=============================================================================
|
||||
extern uint8_t capture_continuous_mode;
|
||||
extern int16_t capture_package_cnt;
|
||||
extern uint16_t capture_packet_gap_ms;
|
||||
|
||||
void Power_On();
|
||||
void Power_Off();
|
||||
void Key1_Scan();
|
||||
void Key_Action();
|
||||
void Vol_Loop_PFC();
|
||||
void llc_set_period(uint16_t val);
|
||||
void llc_pwm_enable();
|
||||
void llc_pwm_disable();
|
||||
void pfc_set_duty(uint16_t val);
|
||||
void pfc_pwm_enable();
|
||||
void pfc_pwm_disable();
|
||||
void A_Pata_Reset();
|
||||
void Vol_Loop_LLC(void);
|
||||
void Cur_Loop_PFC(void);
|
||||
|
||||
void isr_adc_handle(void);
|
||||
void isr_tim0_handle(void);
|
||||
|
||||
void capture_start(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
demo_project
|
||||
---
|
||||
|
||||
This example is a demo project to descript `how to log message`
|
||||
|
||||
## Log
|
||||
|
||||
Use serial port with baudrate 115200, 8bit, no parity check.
|
||||
@@ -0,0 +1,472 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Wisetop. All Rights Reserved.
|
||||
*/
|
||||
#include "app.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define TICK_1000_MS 1000
|
||||
|
||||
struct bode_plot_param_t pfc_cloop_bode_plot_param;
|
||||
struct bode_plot_param_t pfc_vloop_bode_plot_param;
|
||||
|
||||
/* sys clock*/
|
||||
static void sysclk_systick_init(SYSCFG_ClkSrcTypeDef clk_src, uint32_t sys_tick_ms)
|
||||
{
|
||||
SYSCFG_ClkInitTypeDef SysClkInit = { 0 };
|
||||
|
||||
SysClkInit.ClkSource = clk_src;
|
||||
SYSCFG_SysClkConfig(&SysClkInit);
|
||||
|
||||
sys_config_systick(sys_tick_ms);
|
||||
}
|
||||
|
||||
static void sys_disable_ice(void)
|
||||
{
|
||||
/* Disable ICE I/O for free run mode to use UART */
|
||||
sys_delay(5000);
|
||||
SYSCFG_SetICEPin2NormalIO(true);
|
||||
}
|
||||
|
||||
/* uart*/
|
||||
void uart_init(void)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init = { 0 };
|
||||
UART_InitTypeDef uart_init = { 0 };
|
||||
sys_irq_attr_t irq_attr = {
|
||||
.trig_mode = SYS_IRQ_TRIGGER_LEVEL,
|
||||
};
|
||||
|
||||
/* UART Tx: PB3 AF1 */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_03;
|
||||
gpio_init.GPIO_AF_Mode = GPIO_AF_1;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_AF;
|
||||
GPIO_Init(GPIOB, &gpio_init);
|
||||
|
||||
/* UART Rx: PB5 AF1 */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_05;
|
||||
gpio_init.GPIO_AF_Mode = GPIO_AF_1;
|
||||
GPIO_Init(GPIOB, &gpio_init);
|
||||
|
||||
uart_init.BaudRate = UART_SERIAL_BAUD;
|
||||
uart_init.WordLength = UART_WordLength_8b;
|
||||
uart_init.StopBits = UART_StopBits_1;
|
||||
uart_init.Parity = UART_Parity_No;
|
||||
uart_init.Mode = UART_Mode_TxRx;
|
||||
UART_Init(UART0, &uart_init);
|
||||
|
||||
// clear RX FIFO and state
|
||||
UART_ResetRxFIFO(UART0);
|
||||
g_rx_idx = 0;
|
||||
g_rx_len = 0;
|
||||
g_rx_ready = 0;
|
||||
|
||||
UART_ITConfig(UART0, UART_IE_RXNEE_Msk, ENABLE);
|
||||
sys_register_IRQ(UART0_IRQn, uart_rx_handler, &irq_attr);
|
||||
sys_enable_girq();
|
||||
|
||||
UART_Start(UART0);
|
||||
return;
|
||||
}
|
||||
|
||||
int uart_rx_getline(char *pBuf, uint32_t size)
|
||||
{
|
||||
if (!pBuf || size == 0 || !g_rx_ready)
|
||||
return 0;
|
||||
|
||||
uint32_t len = (g_rx_len < size - 1) ? g_rx_len : (size - 1);
|
||||
for (uint32_t i = 0; i < len; i++)
|
||||
pBuf[i] = g_rx_buf[i];
|
||||
pBuf[len] = '\0';
|
||||
|
||||
g_rx_len = 0;
|
||||
g_rx_ready = 0;
|
||||
g_rx_idx = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int is_rx_frame_ready(void)
|
||||
{
|
||||
return g_rx_ready;
|
||||
}
|
||||
|
||||
uint32_t __FASTCODE fastcode_proc(void)
|
||||
{
|
||||
log_color(SLOG_CYAN, "run at fast area: $pc= x%08X\n", (uint32_t)&fastcode_proc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
__INTERRUPT void uart_rx_handler(void)
|
||||
{
|
||||
SAVE_IRQ_CSR_CONTEXT();
|
||||
|
||||
while (UART_GetITStatus(UART0, UART_IE_RXNEE_Msk))
|
||||
{
|
||||
uint8_t ch = (uint8_t)UART_ReceiveData(UART0);
|
||||
g_rx_last_tick = sys_get_tick(); // record time of last received byte
|
||||
|
||||
if (g_rx_ready) continue; // not ready to receive new frame, discard incoming data
|
||||
|
||||
if (ch == '\r' || ch == '\n')
|
||||
{
|
||||
if (g_rx_idx > 0)
|
||||
{
|
||||
g_rx_buf[g_rx_idx] = '\0';
|
||||
g_rx_len = g_rx_idx;
|
||||
g_rx_idx = 0;
|
||||
g_rx_ready = 1;
|
||||
}
|
||||
}
|
||||
else if (g_rx_idx < (UART_RX_BUF_SIZE - 1))
|
||||
{
|
||||
g_rx_buf[g_rx_idx++] = (char)ch;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_rx_idx = 0; // overflow, reset buffer index and discard data
|
||||
}
|
||||
}
|
||||
|
||||
RESTORE_IRQ_CSR_CONTEXT();
|
||||
}
|
||||
|
||||
/* cmd*/
|
||||
static bool cmd_match_with_arg(const volatile char *buf, const char *prefix, const char **arg_out)
|
||||
{
|
||||
size_t len = strlen(prefix);
|
||||
|
||||
if (strncmp((const char *)buf, prefix, len) != 0)
|
||||
return false;
|
||||
|
||||
*arg_out = (const char *)&buf[len];
|
||||
return true;
|
||||
}
|
||||
|
||||
static void cmd_trim_eol(char *buf)
|
||||
{
|
||||
size_t len = strlen(buf);
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
char ch = buf[len - 1];
|
||||
if (ch == '\r' || ch == '\n' || ch == ' ' || ch == '\t')
|
||||
{
|
||||
buf[len - 1] = '\0';
|
||||
len--;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool parse_i32_csv5(const char *arg, struct bode_plot_param_t *out)
|
||||
{
|
||||
int32_t vals[5] = { 0 };
|
||||
char *end = NULL;
|
||||
|
||||
if (!arg || !out)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
long v = strtol(arg, &end, 10);
|
||||
if (end == arg || v < -2147483648L || v > 2147483647L)
|
||||
return false;
|
||||
|
||||
vals[i] = (int32_t)v;
|
||||
|
||||
if (i < 4)
|
||||
{
|
||||
if (*end != ',')
|
||||
return false;
|
||||
arg = end + 1;
|
||||
}
|
||||
else if (*end != '\0')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
out->b0 = vals[0];
|
||||
out->b1 = vals[1];
|
||||
out->b2 = vals[2];
|
||||
out->a1 = vals[3];
|
||||
out->a2 = vals[4];
|
||||
return true;
|
||||
}
|
||||
|
||||
void uart_cmd_parse(char *cmd_buf, uint32_t size)
|
||||
{
|
||||
if (!cmd_buf || size == 0)
|
||||
return;
|
||||
|
||||
const char *arg = NULL;
|
||||
cmd_trim_eol(cmd_buf);
|
||||
|
||||
/* Skip empty commands (e.g., from CR+LF line endings) */
|
||||
if (strlen(cmd_buf) == 0)
|
||||
return;
|
||||
|
||||
if (strcmp(cmd_buf, "help") == 0)
|
||||
{
|
||||
msg("Available commands:\r\n");
|
||||
msg(" help - show this help\r\n");
|
||||
msg(" version - show firmware version\r\n");
|
||||
msg(" cloop=B0,B1,B2,A1,A2\r\n");
|
||||
msg(" vloop=B0,B1,B2,A1,A2\r\n");
|
||||
msg(" bodeplot? - show runtime cloop & vloop bode plot parameters\r\n");
|
||||
msg(" flash_bodeplot? - show raw flash content for bode plot parameters\r\n");
|
||||
msg(" notify_en=0 or notify_en=1 or notify_en=255,n\r\n");
|
||||
msg(" notify_packet_gap=GAP_MS\r\n");
|
||||
}
|
||||
else if (strcmp(cmd_buf, "version") == 0)
|
||||
{
|
||||
msg("version: %s\r\n", "1.0.0");
|
||||
}
|
||||
else if (cmd_match_with_arg(cmd_buf, "cloop=", &arg))
|
||||
{
|
||||
struct bode_plot_param_t *cloop_p = &pfc_cloop_bode_plot_param;
|
||||
struct bode_plot_param_t *vloop_p = &pfc_vloop_bode_plot_param;
|
||||
if (parse_i32_csv5(arg, cloop_p))
|
||||
{
|
||||
write_bodeplot_params_to_flash(cloop_p, vloop_p, FLASH_PROG_ADDR_USER_CALI);
|
||||
peek_bodeplot_params_in_flash(FLASH_PROG_ADDR_USER_CALI);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("invalid cloop format, use: cloop=111,8,5,6,77\r\n");
|
||||
}
|
||||
}
|
||||
else if (cmd_match_with_arg(cmd_buf, "vloop=", &arg))
|
||||
{
|
||||
struct bode_plot_param_t *cloop_p = &pfc_cloop_bode_plot_param;
|
||||
struct bode_plot_param_t *vloop_p = &pfc_vloop_bode_plot_param;
|
||||
if (parse_i32_csv5(arg, vloop_p))
|
||||
{
|
||||
write_bodeplot_params_to_flash(cloop_p, vloop_p, FLASH_PROG_ADDR_USER_CALI);
|
||||
peek_bodeplot_params_in_flash(FLASH_PROG_ADDR_USER_CALI);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("invalid vloop format, use: vloop=111,8,5,6,77\r\n");
|
||||
}
|
||||
}
|
||||
else if (strcmp(cmd_buf, "bodeplot?") == 0)
|
||||
{
|
||||
struct bode_plot_param_t *cloop_p = &pfc_cloop_bode_plot_param;
|
||||
struct bode_plot_param_t *vloop_p = &pfc_vloop_bode_plot_param;
|
||||
print_bodeplot_params(cloop_p, vloop_p);
|
||||
}
|
||||
else if (strcmp(cmd_buf, "flash_bodeplot?") == 0)
|
||||
{
|
||||
peek_bodeplot_params_in_flash(FLASH_PROG_ADDR_USER_CALI);
|
||||
}
|
||||
else if (cmd_match_with_arg(cmd_buf, "notify_en=", &arg))
|
||||
{
|
||||
int notify_en = atoi(arg);
|
||||
|
||||
if (notify_en == 1)
|
||||
{
|
||||
capture_start();
|
||||
capture_continuous_mode = 0;
|
||||
}
|
||||
else if (notify_en == 0)
|
||||
{
|
||||
capture_continuous_mode = 0;
|
||||
capture_package_cnt = 0;
|
||||
}
|
||||
else if (notify_en == 255)
|
||||
{
|
||||
const char *comma = strchr(arg, ',');
|
||||
if (comma)
|
||||
{
|
||||
capture_package_cnt = atoi(comma + 1); // 連續模式下每次捕獲 n 包數據
|
||||
capture_continuous_mode = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("invalid notify_en format, use: notify_en=0 or notify_en=1 or notify_en=255,n\r\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("invalid notify_en format, use: notify_en=0 or notify_en=1 or notify_en=255,n\r\n");
|
||||
}
|
||||
}
|
||||
else if (cmd_match_with_arg(cmd_buf, "notify_packet_gap=", &arg))
|
||||
{
|
||||
capture_packet_gap_ms = atoi(arg) < 10 ? 10 : atoi(arg); // 設置最小間隔為10ms
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Unknown command: %s\r\n", cmd_buf);
|
||||
}
|
||||
}
|
||||
|
||||
/* flash*/
|
||||
#if 0
|
||||
static void dump_flash_bytes(uint32_t addr, uint32_t size)
|
||||
{
|
||||
const uint8_t *pData = (const uint8_t *)addr;
|
||||
|
||||
msg("flash dump source base address: 0x%08X, size=%u bytes\n", addr, (unsigned int)size);
|
||||
|
||||
for (uint32_t i = 0; i < size; i++)
|
||||
{
|
||||
msg("read [0x%08X] = 0x%02X\n", (unsigned int)(addr + i), pData[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_flash_bytes_8perline(uint32_t addr, uint32_t size)
|
||||
{
|
||||
const uint8_t *pData = (const uint8_t *)addr;
|
||||
|
||||
msg("flash dump source base address: 0x%08X, size=%u bytes\n", addr, (unsigned int)size);
|
||||
|
||||
for (uint32_t i = 0; i < size; i += 8)
|
||||
{
|
||||
msg("read [0x%08X]", (unsigned int)(addr + i));
|
||||
|
||||
for (uint32_t j = 0; j < 8 && (i + j) < size; j++)
|
||||
{
|
||||
msg(" %02X", pData[i + j]);
|
||||
}
|
||||
|
||||
msg("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int write_bodeplot_params_to_flash(const struct bode_plot_param_t *cloop, const struct bode_plot_param_t *vloop, uint32_t addr)
|
||||
{
|
||||
int rval = 0;
|
||||
|
||||
if (!cloop || !vloop)
|
||||
return -1;
|
||||
|
||||
struct flash_bode_plot_blob_t blob = {
|
||||
.magic = FLASH_PARAM_MAGIC,
|
||||
.cloop = *cloop,
|
||||
.vloop = *vloop,
|
||||
.reserved = 0,
|
||||
};
|
||||
|
||||
rval = FLASH_ErasePage(addr);
|
||||
if (rval)
|
||||
{
|
||||
err(" ! erase plot/vloop param fail (%d)\n", rval);
|
||||
return rval;
|
||||
}
|
||||
|
||||
rval = FLASH_ProgData(addr, (uint32_t *)&blob, sizeof(blob));
|
||||
if (rval)
|
||||
{
|
||||
err(" ! prog plot/vloop param fail (%d)\n", rval);
|
||||
return rval;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void peek_bodeplot_params_in_flash(uint32_t addr)
|
||||
{
|
||||
struct flash_bode_plot_blob_t blob = { 0 };
|
||||
|
||||
memcpy(&blob, (const void *)addr, sizeof(blob));
|
||||
|
||||
if (blob.magic != FLASH_PARAM_MAGIC)
|
||||
{
|
||||
err(" ! invalid flash blob magic: 0x%08X\n", blob.magic);
|
||||
return;
|
||||
}
|
||||
|
||||
msg("flash blob content:\r\n");
|
||||
msg(" magic: 0x%08X\r\n", blob.magic);
|
||||
print_bodeplot_params(&blob.cloop, &blob.vloop);
|
||||
}
|
||||
|
||||
void read_bodeplot_params_from_flash(struct bode_plot_param_t *cloop, struct bode_plot_param_t *vloop, uint32_t addr)
|
||||
{
|
||||
struct flash_bode_plot_blob_t blob = { 0 };
|
||||
|
||||
if (!cloop || !vloop)
|
||||
return;
|
||||
|
||||
memcpy(&blob, (const void *)addr, sizeof(blob));
|
||||
|
||||
if (blob.magic != FLASH_PARAM_MAGIC)
|
||||
{
|
||||
err(" ! invalid flash blob magic: 0x%08X\n", blob.magic);
|
||||
return;
|
||||
}
|
||||
|
||||
*cloop = blob.cloop;
|
||||
*vloop = blob.vloop;
|
||||
}
|
||||
|
||||
void print_bodeplot_params(struct bode_plot_param_t *cloop, struct bode_plot_param_t *vloop)
|
||||
{
|
||||
msg("cloop: b0=%d, b1=%d, b2=%d, a1=%d, a2=%d\r\n",
|
||||
cloop->b0,
|
||||
cloop->b1,
|
||||
cloop->b2,
|
||||
cloop->a1,
|
||||
cloop->a2);
|
||||
msg("vloop: b0=%d, b1=%d, b2=%d, a1=%d, a2=%d\r\n\n",
|
||||
vloop->b0,
|
||||
vloop->b1,
|
||||
vloop->b2,
|
||||
vloop->a1,
|
||||
vloop->a2);
|
||||
}
|
||||
|
||||
/* main code*/
|
||||
void app(void)
|
||||
{
|
||||
char cmd_buf[UART_RX_BUF_SIZE];
|
||||
|
||||
sysclk_systick_init(SYSCFG_ClkSrc_HSI, SYS_TICK_1_MS);
|
||||
|
||||
// sys_disable_ice();
|
||||
|
||||
uart_init();
|
||||
|
||||
info("This is a app demo project\n");
|
||||
info("uart cmd demo\n");
|
||||
|
||||
struct bode_plot_param_t *cloop_p = &pfc_cloop_bode_plot_param;
|
||||
struct bode_plot_param_t *vloop_p = &pfc_vloop_bode_plot_param;
|
||||
|
||||
// cloop_p->b0 = 1021;
|
||||
// cloop_p->b1 = -480;
|
||||
// cloop_p->b2 = -522;
|
||||
// cloop_p->a1 = -1951;
|
||||
// cloop_p->a2 = -14414;
|
||||
|
||||
// vloop_p->b0 = 598;
|
||||
// vloop_p->b1 = -64;
|
||||
// vloop_p->b2 = -408;
|
||||
// vloop_p->a1 = -12644;
|
||||
// vloop_p->a2 = -3615;
|
||||
|
||||
// write plot param to flash
|
||||
// msg("write plot param to flash\r\n");
|
||||
// write_bodeplot_params_to_flash(cloop_p, vloop_p, FLASH_PROG_ADDR_USER_CALI);
|
||||
// print_bodeplot_params(cloop_p, vloop_p);
|
||||
|
||||
// read plot param from flash
|
||||
msg("read plot param from flash\r\n");
|
||||
read_bodeplot_params_from_flash(cloop_p, vloop_p, FLASH_PROG_ADDR_USER_CALI);
|
||||
print_bodeplot_params(cloop_p, vloop_p);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (is_rx_frame_ready())
|
||||
{
|
||||
uart_rx_getline(cmd_buf, sizeof(cmd_buf));
|
||||
msg("RX: %s\r\n", cmd_buf);
|
||||
uart_cmd_parse(cmd_buf, sizeof(cmd_buf));
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,144 @@
|
||||
/**
|
||||
* Copyright (c) 2026 Wisetop. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "init.h"
|
||||
#include "app.h"
|
||||
#include "hal_device.h"
|
||||
|
||||
//=============================================================================
|
||||
// Constant Definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Public Function Definition
|
||||
//=============================================================================
|
||||
void gpio_init(void)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init = { 0 };
|
||||
|
||||
// PA12, PWOK
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_12;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_OUT;
|
||||
gpio_init.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_Init(GPIOA, &gpio_init);
|
||||
}
|
||||
//===================================================================================
|
||||
void adc_init(void)
|
||||
{
|
||||
// gpio
|
||||
GPIO_InitTypeDef gpio_init;
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_08; // PA8 AIN2 VBUS
|
||||
gpio_init.GPIO_Pin |= GPIO_Pin_09; // PA9 AIN3 IP_CS
|
||||
gpio_init.GPIO_Pin |= GPIO_Pin_10; // PA10 AIN4 VCOMP
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_ANAL;
|
||||
GPIO_Init(GPIOA, &gpio_init);
|
||||
|
||||
// adc
|
||||
ADC_InitTypeDef adc_init = { 0 };
|
||||
ADC_StructInit(&adc_init);
|
||||
adc_init.SelChannels = ADC_Channel_02;
|
||||
adc_init.SelChannels |= ADC_Channel_03;
|
||||
adc_init.SelChannels |= ADC_Channel_04;
|
||||
adc_init.ClkPrescaler = ADC_ClkDiv_4; // 60M/4 = 15MHz, ADC max working clock is 16MHz
|
||||
adc_init.DataAlign = ADC_DataAlign_Right;
|
||||
adc_init.Mode = ADC_Mode_Scan; // Scan mode
|
||||
ADC_Init(ADC0, &adc_init);
|
||||
ADC_ExtTrigConfig(ADC0, ADC_ExtTrigSource_EPWM_CH1R, ADC_ExtTrigMode_Enable);
|
||||
|
||||
// ADC interrupt config
|
||||
sys_irq_attr_t irq_attr = {
|
||||
.disable_vector = false,
|
||||
.trig_mode = SYS_IRQ_TRIGGER_LEVEL,
|
||||
.level = SYS_IRQ_LEVEL_H,
|
||||
.priority = SYS_IRQ_PRIORITY_MIDDEN,
|
||||
};
|
||||
sys_register_IRQ(ADC0_IRQn, isr_adc_handle, &irq_attr);
|
||||
|
||||
ADC0->CON0_b.INT_EN = 1; // ADC interrupt enable
|
||||
}
|
||||
//===================================================================================
|
||||
void llc_pwm_init(void)
|
||||
{
|
||||
// gpio
|
||||
// PA0(EPWM0P), PA1(EPWM0N)
|
||||
GPIO_InitTypeDef gpio_init = {
|
||||
.GPIO_Pin = GPIO_Pin_00 | GPIO_Pin_01,
|
||||
.GPIO_Mode = GPIO_Mode_AF,
|
||||
.GPIO_AF_Mode = GPIO_AF_6,
|
||||
};
|
||||
GPIO_Init(GPIOA, &gpio_init);
|
||||
|
||||
// tim
|
||||
TIM_TimeBaseInitTypeDef tim_init = {
|
||||
.TIM_Prescaler = 0,
|
||||
.TIM_CounterMode = TIM_CounterMode_Up,
|
||||
.TIM_Period = LLC_PERIOD_SS,
|
||||
.TIM_ClockDivision = TIM_CKD_Div1,
|
||||
.TIM_RepetitionCounter = 0,
|
||||
};
|
||||
TIM_DeInit(EPWM);
|
||||
TIM_TimeBaseInit(EPWM, &tim_init);
|
||||
|
||||
TIM_ARRPreloadConfig(EPWM, ENABLE);
|
||||
|
||||
// pwm
|
||||
TIM_OCInitTypeDef pwm_init = {
|
||||
.TIM_OCMode = TIM_OCMode_PWM1,
|
||||
.TIM_OutputState = TIM_OutputState_Disable,
|
||||
.TIM_OCPolarity = TIM_OCPolarity_High,
|
||||
.TIM_OCIdleState = TIM_OCIdleState_Reset,
|
||||
.TIM_OutputNState = TIM_OutputNState_Disable,
|
||||
.TIM_OCNPolarity = TIM_OCPolarity_High,
|
||||
.TIM_Pulse = 1,
|
||||
};
|
||||
TIM_OC1Init(EPWM, &pwm_init);
|
||||
TIM_OC2Init(EPWM, &pwm_init);
|
||||
|
||||
{ /* Automatic Output enable, Break, dead time and lock configuration */
|
||||
TIM_BDTRInitTypeDef bdtr_init = { 0 };
|
||||
bdtr_init.TIM_LOCKLevel = TIM_LockLevel_OFF;
|
||||
bdtr_init.TIM_DeadTime = DEAD_TIME_VALUE;
|
||||
TIM_BDTRConfig(EPWM, &bdtr_init);
|
||||
}
|
||||
|
||||
TIM_Cmd(EPWM, ENABLE);
|
||||
TIM_CtrlPWMOutputs(EPWM, ENABLE);
|
||||
EPWM->CCMR1_OUTPUT_b.OC1PE = 1; // Output Compare 1 preload enable
|
||||
}
|
||||
//===================================================================================
|
||||
void tim0_init(void)
|
||||
{
|
||||
LPTIM_InitTypeDef tim0_init = {
|
||||
.LPTIM_Prescaler = 0,
|
||||
.LPTIM_ClockSource = LPTIM_CLK_Src_SysClk,
|
||||
.LPTIM_MatchMode = LPTIM_MatchMode_IRQ | LPTIM_MatchMode_Reset,
|
||||
.LPTIM_MatchValue = TIM0_PERIOD,
|
||||
};
|
||||
LPTIM_Init(TIM0, &tim0_init);
|
||||
|
||||
LPTIM_Enable(TIM0);
|
||||
}
|
||||
//===================================================================================
|
||||
void sysclk_init(void)
|
||||
{
|
||||
SYSCFG_ClkInitTypeDef SysClkInit = {
|
||||
.ClkSource = SYSCFG_ClkSrc_HSI,
|
||||
};
|
||||
|
||||
SYSCFG_SysClkConfig(&SysClkInit);
|
||||
sys_config_systick(SYS_TICK_1_MS);
|
||||
}
|
||||
//===================================================================================
|
||||
void SYS_Config(void)
|
||||
{
|
||||
sysclk_init();
|
||||
|
||||
gpio_init();
|
||||
|
||||
adc_init();
|
||||
|
||||
llc_pwm_init();
|
||||
|
||||
uart_init();
|
||||
}
|
||||
@@ -0,0 +1,713 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "app.h"
|
||||
#include "init.h"
|
||||
//=============================================================================
|
||||
// Constant Definition
|
||||
//=============================================================================
|
||||
#define CAPTURE_BUF_SIZE 160
|
||||
|
||||
#define DEBOUNCE_TIME 20
|
||||
|
||||
#define CR_1P1Z_B0_Q14 6313
|
||||
#define CR_1P1Z_B1_Q14 -5113
|
||||
#define CR_1P1Z_A1_Q14 -5803
|
||||
// 前饋輸出限制(請根據您主環 Q14 格式的數值範圍調整)
|
||||
// 假設最大前饋量限制為實數值 50.0 -> 50.0 * 16384 = 819200
|
||||
#define CR_FF_MAX_Q14 1638400 // 819200 // 50 duty << 14
|
||||
#define CR_FF_MIN_Q14 -1638400 //-819200
|
||||
|
||||
//=============================================================================
|
||||
// Macro Definition
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Structure Definition
|
||||
//=============================================================================
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STATE_STOP,
|
||||
STATE_SS,
|
||||
STATE_RUN
|
||||
} SystemState_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// uint32_t timestamp;
|
||||
uint16_t iac;
|
||||
// uint16_t vac;
|
||||
// uint16_t vbus;
|
||||
// uint16_t vcr;
|
||||
} CaptureSample_t;
|
||||
|
||||
//=============================================================================
|
||||
// Global Data Definition
|
||||
//=============================================================================
|
||||
|
||||
/* PID 轉換 2P2Z係數*/
|
||||
// #define kp 250
|
||||
// #define ki 2
|
||||
// #define kd 0
|
||||
|
||||
// 2P2Z 係數(這些需要根據你的 PID 增益與控制頻率重新計算或調試)
|
||||
// int32_t b0 = kp + ki + kd; // 對應比例 + 部分積分/微分貢獻(可調整)
|
||||
// int32_t b1 = -kp - kd - kd; // e[k-1] 係數(通常為正或負)
|
||||
// int32_t b2 = kd; // e[k-2] 係數
|
||||
// int32_t a1 = 128; // -A1(因為通常寫成 u[k] = ... + A1*u[k-1] + A2*u[k-2],這裡 a1 = 128 代表 A1 ≈ 1)
|
||||
// int32_t a2 = 0; // -A2(PID 特例時 a2 常為 0)
|
||||
|
||||
SystemState_t sys_state = STATE_STOP;
|
||||
uint8_t is_zero_crossing = 0;
|
||||
|
||||
uint8_t llc_running = 0;
|
||||
uint8_t pfc_running = 0;
|
||||
uint8_t is_brown_in = 0; // 0: 關機/保護中, 1: 正常工作
|
||||
static uint8_t cur_loop_fun_en = 0;
|
||||
|
||||
static uint16_t vbus = 0;
|
||||
static uint16_t ipcs = 0;
|
||||
static uint16_t vcomp = 0;
|
||||
|
||||
static int32_t vcr_x1_q14 = 0; // x[n-1]
|
||||
static int32_t vcr_y1_q14 = 0; // y[n-1]
|
||||
static int32_t cr_feed_forward_output_q14 = 0; // 最終輸出的 Q14 補償量
|
||||
|
||||
uint32_t count1;
|
||||
|
||||
uint32_t vbus_ovp = (VBUS_OVP * 4096 / VBUS_2ADC / 3.3);
|
||||
uint32_t vbus_uvp = (VBUS_UVP * 4096 / VBUS_2ADC / 3.3);
|
||||
|
||||
uint32_t digi_vcomp_max = (LLC_PERIOD_MAX - LLC_PERIOD_MIN) << LLC_COMP_GAIN_BIT;
|
||||
int32_t vbus_comp2 = 0; // 過零點用
|
||||
uint16_t llc_ss_cnt = 0;
|
||||
//-----------------------------------------------
|
||||
|
||||
uint8_t power_on_cmd = 0;
|
||||
uint32_t vac_avg1;
|
||||
uint32_t vbus_avg = 0;
|
||||
uint32_t vcomp_avg;
|
||||
|
||||
uint32_t static digital_vcomp = (LLC_PERIOD_MAX - LLC_PERIOD_MIN) << LLC_COMP_GAIN_BIT;
|
||||
uint16_t llc_period_ss = LLC_SS_MIN;
|
||||
uint16_t llc_run_arr = LLC_PERIOD_MIN;
|
||||
uint8_t v_loop_cnt = 0;
|
||||
uint8_t v_loop_cnt2 = 0;
|
||||
|
||||
uint8_t volatile adc_trigger = 0;
|
||||
|
||||
// 全局或靜態變數(需在函數外或 static 保留狀態)
|
||||
static int32_t iac_err_1 = 0; // e[k-1]
|
||||
static int32_t iac_err_2 = 0; // e[k-2]
|
||||
static int32_t iac_comp_1 = 0; // u[k-1] (前一次輸出)
|
||||
static int32_t iac_comp_2 = 0; // u[k-2] (前兩次輸出)
|
||||
|
||||
static int32_t vbus_err_1 = 0;
|
||||
static int32_t vbus_comp_1 = 0;
|
||||
|
||||
uint16_t updata_cnt = 0;
|
||||
|
||||
int32_t vbus_comp_prev1, vbus_comp_prev2;
|
||||
int32_t vbus_err_prev1, vbus_err_prev2;
|
||||
|
||||
static volatile uint8_t capture_active = 0;
|
||||
static volatile uint8_t capture_ready = 0;
|
||||
static volatile uint16_t capture_idx = 0;
|
||||
static CaptureSample_t capture_buf[CAPTURE_BUF_SIZE];
|
||||
uint8_t capture_continuous_mode = 0;
|
||||
int16_t capture_package_cnt = 5;
|
||||
uint16_t capture_packet_gap_ms = 1000;
|
||||
|
||||
//=============================================================================
|
||||
// Private Function Definition
|
||||
//=============================================================================
|
||||
void A_Para_Reset()
|
||||
{
|
||||
digital_vcomp = (LLC_PERIOD_MAX - LLC_PERIOD_MIN) << LLC_COMP_GAIN_BIT;
|
||||
// vbus_set = (VBUS_SET * 4096 / VBUS_2ADC / 3.3);
|
||||
v_loop_cnt = 0;
|
||||
|
||||
iac_err_1 = 0;
|
||||
iac_err_2 = 0;
|
||||
iac_comp_1 = 0;
|
||||
iac_comp_2 = 0;
|
||||
|
||||
// set default value
|
||||
TIM2->ARR = PFC_PERIOD;
|
||||
TIM2->CCR1 = PFC_DUTY_MIN; // min for ss
|
||||
TIM2->EGR |= 0x01;
|
||||
EPWM->ARR = LLC_PERIOD_SS;
|
||||
EPWM->CCR1 = (LLC_PERIOD_SS >> 1);
|
||||
EPWM->EGR |= 0x01;
|
||||
llc_period_ss = 0;
|
||||
|
||||
pfc_running = 0;
|
||||
llc_running = 0;
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
void capture_start(void)
|
||||
{
|
||||
capture_idx = 0;
|
||||
capture_ready = 0;
|
||||
capture_active = 1;
|
||||
msg("capture start,size=%d\r\n", CAPTURE_BUF_SIZE);
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
static inline void Capture_Sample_ISR(void)
|
||||
{
|
||||
if (!capture_active)
|
||||
return;
|
||||
|
||||
uint16_t idx = capture_idx;
|
||||
if (idx >= CAPTURE_BUF_SIZE)
|
||||
return;
|
||||
|
||||
// capture_buf[idx].timestamp = sys_get_tick();
|
||||
// capture_buf[idx].iac = iac;
|
||||
// capture_buf[idx].vac = vac;
|
||||
// capture_buf[idx].vbus = vbus;
|
||||
// capture_buf[idx].vcr = vcr;
|
||||
|
||||
idx++;
|
||||
capture_idx = idx;
|
||||
|
||||
if (idx >= CAPTURE_BUF_SIZE)
|
||||
{
|
||||
capture_active = 0;
|
||||
capture_ready = 1;
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
static void Capture_Dump_IfReady(void)
|
||||
{
|
||||
if (!capture_ready)
|
||||
return;
|
||||
|
||||
for (uint16_t i = 0; i < CAPTURE_BUF_SIZE; i++)
|
||||
{
|
||||
msg("%d\r\n", capture_buf[i].iac);
|
||||
|
||||
// msg("%d,%d,%d,%d,%d\r\n",
|
||||
// capture_buf[i].timestamp,
|
||||
// capture_buf[i].iac,
|
||||
// capture_buf[i].vac,
|
||||
// capture_buf[i].vbus,
|
||||
// capture_buf[i].vcr);
|
||||
}
|
||||
|
||||
capture_ready = 0;
|
||||
msg("capture done,count=%d\r\n", CAPTURE_BUF_SIZE);
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
void llc_set_period(uint16_t val)
|
||||
{
|
||||
if (val > LLC_PERIOD_MAX) val = LLC_PERIOD_MAX; // 可以小,不能過大
|
||||
EPWM->ARR = val;
|
||||
EPWM->CCR1 = val >> 1;
|
||||
}
|
||||
//===================================================================================
|
||||
void llc_pwm_enable()
|
||||
{
|
||||
REG_SET_BITS(EPWM->CCER, TIM_CCER_CC1E_Msk | TIM_CCER_CC1NE_Msk);
|
||||
}
|
||||
//===================================================================================
|
||||
void llc_pwm_disable()
|
||||
{
|
||||
REG_CLR_BITS(EPWM->CCER, TIM_CCER_CC1E_Msk | TIM_CCER_CC1NE_Msk);
|
||||
}
|
||||
//===================================================================================
|
||||
// Cr 1P1Z 回授,做負載驟變補償,執行頻率 10KHZ
|
||||
// 抓取 vcr 的動態變化趨勢,並在穩態時回歸平靜
|
||||
void Load_Loop_1P1Z(void)
|
||||
{
|
||||
int32_t x0;
|
||||
int64_t temp_y0; // 使用 64 位元暫存,完全避免 32 位元相乘時溢位
|
||||
int32_t y0;
|
||||
|
||||
// 1. 讀取當前 vcr
|
||||
// x0 = vcr_avg;
|
||||
|
||||
// 2. 執行 1P1Z 差分方程計算:
|
||||
temp_y0 = ((int64_t)CR_1P1Z_B0_Q14 * x0) + ((int64_t)CR_1P1Z_B1_Q14 * vcr_x1_q14) - ((int64_t)CR_1P1Z_A1_Q14 * vcr_y1_q14);
|
||||
|
||||
// 將 Q28 格式還原回 Q14 格式(右移 14 位元
|
||||
y0 = (int32_t)(temp_y0 >> 14);
|
||||
|
||||
// 更新歷史狀態變數 (Q14 格式)
|
||||
vcr_x1_q14 = x0;
|
||||
vcr_y1_q14 = y0;
|
||||
|
||||
// 定點數安全限幅 (Saturation)
|
||||
if (y0 > CR_FF_MAX_Q14)
|
||||
y0 = CR_FF_MAX_Q14;
|
||||
else if (y0 > -CR_FF_MIN_Q14)
|
||||
y0 = -CR_FF_MIN_Q14;
|
||||
|
||||
cr_feed_forward_output_q14 = y0;
|
||||
}
|
||||
//==========================================================================
|
||||
void Vol_Loop_PFC_1P1Z(void)
|
||||
{
|
||||
// 1. 計算誤差
|
||||
int32_t vbus_err_n; // = (int32_t)vbus_set - (int32_t)vbus_avg;
|
||||
|
||||
// --- 策略 A:動態增益調整 ---
|
||||
int32_t b0 = 139;
|
||||
int32_t b1 = -129;
|
||||
|
||||
// vloop_p->b0 = 139;
|
||||
// vloop_p->b1 = -129;
|
||||
// vloop_p->a1 = -16383;
|
||||
/*
|
||||
if (vbus_err_n > 40 || vbus_err_n < -40) // ~ 20V
|
||||
{
|
||||
// 大誤差時(通常是剛啟動或大跳載),強化參數加快反應
|
||||
// b0 = 250;
|
||||
// b1 = -249;
|
||||
// b0 = 180; // 稍微調降強增益的力道
|
||||
// b1 = -178;
|
||||
b0 = 500;
|
||||
b1 = -499;
|
||||
}
|
||||
// --- 策略 B:接近目標時微調零點 (抗過衝) ---
|
||||
else if (vbus_err_n < 20 && vbus_err_n > -20) // ~ 5V
|
||||
{
|
||||
// 當誤差縮小時,稍微減小 b0 與 b1 的差值,降低積分衝力
|
||||
b0 = 120;
|
||||
b1 = -119; // 如果不能用浮點數,請維持 120 / -119,增加阻尼感
|
||||
}
|
||||
*/
|
||||
|
||||
// 2. 差分方程計算
|
||||
int64_t acc = (int64_t)b0 * vbus_err_n;
|
||||
acc += (int64_t)b1 * vbus_err_1;
|
||||
acc += ((int64_t)16383 * vbus_comp_1) >> 14; // 16384 = 1 >> 14
|
||||
|
||||
int32_t y_n = (int32_t)acc;
|
||||
|
||||
#if 0 // 有問題
|
||||
// --- 策略 C:軟限制抗過衝 (Soft Clamping) ---
|
||||
// 預設最大限制 (Duty 300 << 14)
|
||||
int32_t current_max_limit = 4915200; // duty 300
|
||||
|
||||
// 如果電壓誤差已經很小(例如剩 15V 就到達),甚至已經發生過衝 (err < 0)
|
||||
// 我們強制壓低 Duty 的允許上限,防止積分器帶著大 Duty 衝過頭
|
||||
if (vbus_err_n < 15)
|
||||
{
|
||||
// 這裡的 3276800 對應 Duty 200,您可以根據 800W 穩態時的 Duty 大約位置來設定
|
||||
// 核心目標是:不讓 Duty 在接近目標時還維持在 300 這麼高
|
||||
current_max_limit = 3276800; // duty 200
|
||||
}
|
||||
|
||||
// 如果發生明顯過衝 (電壓高於目標 5V 以上)
|
||||
if (vbus_err_n < -5)
|
||||
{
|
||||
current_max_limit = 1638400; // 強制壓低到 Duty 100 快速拉回
|
||||
}
|
||||
#endif
|
||||
|
||||
// 3. 輸出限幅執行
|
||||
if (y_n > YN_MAX)
|
||||
y_n = YN_MAX;
|
||||
else if (y_n < YN_MIN)
|
||||
y_n = YN_MIN;
|
||||
|
||||
// 4. 更新狀態變數
|
||||
vbus_err_1 = vbus_err_n;
|
||||
vbus_comp_1 = y_n;
|
||||
|
||||
// 5. 輸出 Duty >> 14
|
||||
// if (sys_state == STATE_PFC_SOFT_START || sys_state == STATE_RUN_SKIP) // 緩啟動期間直接控制 DUTY
|
||||
TIM2->CCR1 = (vbus_comp_1 >> 14); // 0 ~ 540
|
||||
|
||||
// 6. 輸出 comp >> 9 (變大 32 倍) (MAX ~ 18000) (540*32=17280)差不多,>> 9 應該是對的
|
||||
// if (sys_state == STATE_RUN_NORMAL) // 正常工作時間輸出 COMP 值
|
||||
vbus_comp2 = (vbus_comp_1 >> 9) + (cr_feed_forward_output_q14 << 1); // 太大會直接 OVP
|
||||
// vbus_comp2 = (vbus_comp_1 >> 9);
|
||||
}
|
||||
//=============================================================
|
||||
static void Vol_Loop_PFC_1P1Z_UI(void) // ZERO: 120HZ, POLE:0.1HZ, G:10
|
||||
{
|
||||
// 1. 計算誤差
|
||||
int32_t vbus_err_0; // = (int32_t)vbus_set - (int32_t)vbus_avg;
|
||||
|
||||
// 2. 2P2Z 運算 (Fixed-point Q14)
|
||||
struct bode_plot_param_t *vloop_p = &pfc_vloop_bode_plot_param;
|
||||
int64_t acc1 = (int64_t)vloop_p->b0 * vbus_err_0 + (int64_t)vloop_p->b1 * vbus_err_1;
|
||||
|
||||
int64_t acc2 = (-((int64_t)vloop_p->a1 * vbus_comp_1)) >> 14;
|
||||
|
||||
acc1 += acc2;
|
||||
int32_t y_n = acc1;
|
||||
|
||||
// 限制極限值
|
||||
if (y_n > YN_MAX)
|
||||
y_n = YN_MAX; // 540 << 14
|
||||
else if (y_n < YN_MIN)
|
||||
y_n = YN_MIN; // 12 << 14
|
||||
|
||||
// 更新狀態變數 (儲存原始計算值以保留積分能量)
|
||||
vbus_err_1 = vbus_err_0;
|
||||
|
||||
// 重要:vbus_comp_1 儲存 local_temp,確保下一個週期的 a1, a2 運算正確
|
||||
vbus_comp_1 = y_n;
|
||||
|
||||
// 5. 輸出 Duty >> 14
|
||||
// if (sys_state == STATE_PFC_SOFT_START || sys_state == STATE_RUN_SKIP) // 緩啟動期間直接控制 DUTY
|
||||
TIM2->CCR1 = (vbus_comp_1 >> 14); // 0 ~ 540
|
||||
|
||||
// 6. 輸出 comp >> 9 (變大 32 倍) (MAX ~ 18000) (540*32=17280)差不多,>> 9 應該是對的
|
||||
// if (sys_state == STATE_RUN_NORMAL) // 正常工作時間輸出 COMP 值
|
||||
vbus_comp2 = (vbus_comp_1 >> 9);
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
__attribute__((always_inline)) static inline void Cur_Loop_PFC_2P2Z(void) // 優化後 3.65us
|
||||
{
|
||||
// if (sys_state != STATE_RUN_NORMAL)
|
||||
return;
|
||||
|
||||
// if (is_zero_crossing == 1) return; // 凍結積分,改善過零後上升緣的突波
|
||||
|
||||
// 1. 取得回授與計算誤差
|
||||
int32_t local_vbus_comp2 = vbus_comp2;
|
||||
int32_t local_vac_avg1 = vac_avg1;
|
||||
|
||||
// 電流採樣處理
|
||||
int32_t local_iac; // = 3840 - iac; // OPA 電路的關係,實際值為 CURR_OFFSET - ADC
|
||||
if (local_iac < 0)
|
||||
local_iac = 0; // 避免負值
|
||||
|
||||
// 計算電流給定值
|
||||
int32_t local_iac_set = (local_vac_avg1 * local_vbus_comp2) >> 12; // >> 12 = / 4096
|
||||
int32_t local_iac_err_0 = local_iac_set - local_iac; // err = set - meas
|
||||
|
||||
// 2. 2P2Z 運算 (Fixed-point Q14)
|
||||
#if 1
|
||||
struct bode_plot_param_t *cloop_p = &pfc_cloop_bode_plot_param;
|
||||
|
||||
int64_t acc1 = ((int64_t)cloop_p->b0 * local_iac_err_0) + ((int64_t)cloop_p->b1 * iac_err_1) + ((int64_t)cloop_p->b2 * iac_err_2);
|
||||
|
||||
int64_t acc2 = -((int64_t)cloop_p->a1 * iac_comp_1);
|
||||
acc2 -= ((int64_t)cloop_p->a2 * iac_comp_2);
|
||||
#endif
|
||||
|
||||
acc1 += acc2;
|
||||
int32_t y_n = acc1 >> 14;
|
||||
|
||||
// 限制極限值
|
||||
if (y_n > YN_MAX)
|
||||
y_n = YN_MAX; // 570 << 14
|
||||
else if (y_n < YN_MIN)
|
||||
y_n = YN_MIN; // 12 << 14
|
||||
|
||||
// 更新狀態變數 (儲存原始計算值以保留積分能量)
|
||||
iac_err_2 = iac_err_1;
|
||||
iac_err_1 = local_iac_err_0;
|
||||
|
||||
// 重要:iac_comp_1 儲存 local_temp,確保下一個週期的 a1, a2 運算正確
|
||||
iac_comp_2 = iac_comp_1;
|
||||
iac_comp_1 = y_n;
|
||||
|
||||
uint16_t local_duty = 0;
|
||||
|
||||
int32_t ff_term;
|
||||
ff_term = (2800 - vac_avg1) * PFC_DUTY_MAX / 2800 - 200;
|
||||
|
||||
if (ff_term < 0) ff_term = 0;
|
||||
if (vbus_comp2 >= 1000)
|
||||
local_duty = (uint16_t)((y_n >> 14) + ff_term);
|
||||
else
|
||||
local_duty = (uint16_t)(y_n >> 14);
|
||||
|
||||
// local_duty = (uint16_t)(y_n >> 14);
|
||||
// 4. 硬體 Duty 限幅與輸出
|
||||
if (local_duty > PFC_DUTY_MAX)
|
||||
local_duty = PFC_DUTY_MAX; // MAX = 540
|
||||
else if (local_duty < PFC_DUTY_MIN)
|
||||
local_duty = PFC_DUTY_MIN; // MIN = 12
|
||||
TIM2->CCR1 = local_duty;
|
||||
}
|
||||
//============================================================================
|
||||
|
||||
void Vol_Loop_LLC(void) // 測試可工作
|
||||
{
|
||||
static uint8_t last_gpio = 0;
|
||||
static uint16_t toggle_cnt = 0;
|
||||
static uint16_t stable_timer = 0;
|
||||
|
||||
// 1. 讀取 GPIO 回授
|
||||
uint8_t gpio = GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_12);
|
||||
|
||||
// 2. 判斷是否發生翻轉 (判斷是否在平衡點附近跳動)
|
||||
if (gpio != last_gpio)
|
||||
{
|
||||
toggle_cnt++;
|
||||
last_gpio = gpio;
|
||||
stable_timer = 0; // 只要有翻轉,就重置穩定計時器
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果 GPIO 長時間沒翻轉,說明離目標還很遠
|
||||
if (stable_timer < 1000) stable_timer++;
|
||||
}
|
||||
|
||||
// 3. 根據翻轉頻率決定步長
|
||||
uint16_t current_step;
|
||||
if (toggle_cnt > STABLE_THRES)
|
||||
{
|
||||
// 頻繁翻轉:進入「死區」或「極小步長」模式
|
||||
current_step = 0; // 設為 0 表示進入死區,完全停止震盪
|
||||
|
||||
// 為了防止永久卡死,當連續相同狀態一段時間後再恢復調整
|
||||
if (stable_timer > 50) toggle_cnt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 距離目標尚遠:根據 stable_timer 決定快慢
|
||||
current_step = (stable_timer > 100) ? STEP_FAST : STEP_SLOW;
|
||||
}
|
||||
|
||||
// 4. 執行調整
|
||||
if (current_step > 0)
|
||||
{
|
||||
if (gpio == 1)
|
||||
{
|
||||
if (digital_vcomp + current_step <= digi_vcomp_max)
|
||||
digital_vcomp += current_step;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (digital_vcomp > (1000 + current_step))
|
||||
digital_vcomp -= current_step;
|
||||
}
|
||||
}
|
||||
|
||||
// 5. 計算並更新 ARR (原本的邏輯)
|
||||
uint32_t new_arr = LLC_PERIOD_MIN + (digital_vcomp >> LLC_COMP_GAIN_BIT);
|
||||
|
||||
if (new_arr > LLC_PERIOD_MAX) new_arr = LLC_PERIOD_MAX;
|
||||
if (new_arr < LLC_PERIOD_MIN) new_arr = LLC_PERIOD_MIN;
|
||||
|
||||
if (EPWM->ARR != new_arr)
|
||||
{
|
||||
EPWM->ARR = new_arr;
|
||||
EPWM->CCR1 = (new_arr >> 1);
|
||||
}
|
||||
}
|
||||
//=================================================================================
|
||||
__INTERRUPT void isr_adc_handle(void)
|
||||
{
|
||||
SAVE_IRQ_CSR_CONTEXT();
|
||||
ADC_ClearITFlag(ADC0);
|
||||
|
||||
adc_trigger = 1;
|
||||
|
||||
// get ADC value
|
||||
vbus = ADC0->DAT4_b.DATA; // PA10, AIN4
|
||||
ipcs = ADC0->DAT9_b.DATA; // PA7, AIN9
|
||||
vcomp = ADC0->DAT7_b.DATA; // PA13, AIN7
|
||||
|
||||
// if (cur_loop_fun_en) Cur_Loop_PFC_2P2Z(); // current loop
|
||||
/*
|
||||
static uint8_t cnt = 0;
|
||||
if (cnt++ >= 10)
|
||||
{
|
||||
Capture_Sample_ISR();
|
||||
cnt = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
RESTORE_IRQ_CSR_CONTEXT();
|
||||
}
|
||||
//============================================================================
|
||||
void reset_pid_parameters(void)
|
||||
{
|
||||
iac_err_1 = 0;
|
||||
iac_err_2 = 0;
|
||||
iac_comp_1 = 0;
|
||||
iac_comp_2 = 0;
|
||||
|
||||
digital_vcomp = (LLC_PERIOD_MAX - LLC_PERIOD_MIN) << LLC_COMP_GAIN_BIT;
|
||||
}
|
||||
//================================================================================
|
||||
|
||||
static void uart_rx_task(void)
|
||||
{
|
||||
// RX timeout
|
||||
if (g_rx_idx > 0 && !g_rx_ready)
|
||||
{
|
||||
if (sys_get_tick() - g_rx_last_tick >= UART_RX_TIMEOUT_MS)
|
||||
{
|
||||
UART_ResetRxFIFO(UART0);
|
||||
g_rx_idx = 0;
|
||||
g_rx_len = 0;
|
||||
g_rx_ready = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_rx_frame_ready())
|
||||
return;
|
||||
|
||||
char cmd_buf[UART_RX_BUF_SIZE];
|
||||
|
||||
uart_rx_getline(cmd_buf, sizeof(cmd_buf));
|
||||
msg("RX: %s\r\n", cmd_buf);
|
||||
uart_cmd_parse(cmd_buf, sizeof(cmd_buf));
|
||||
}
|
||||
|
||||
static void capture_continuous_task(void)
|
||||
{
|
||||
static uint32_t msg_timer = 0;
|
||||
|
||||
if (capture_continuous_mode == 1 && capture_package_cnt > 0)
|
||||
{
|
||||
if (sys_get_tick() - msg_timer >= capture_packet_gap_ms)
|
||||
{
|
||||
capture_start();
|
||||
msg_timer = sys_get_tick();
|
||||
if (capture_package_cnt-- <= 0)
|
||||
{
|
||||
capture_continuous_mode = 0;
|
||||
capture_package_cnt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//==============================================================================
|
||||
void Handle_UART_Monitor(void)
|
||||
{
|
||||
static uint32_t msg_timer2 = 0;
|
||||
if (sys_get_tick() - msg_timer2 >= 1000)
|
||||
{
|
||||
printf("%d %d %d", power_on_cmd, sys_state, vbus_comp2);
|
||||
// msg_timer2 = sys_get_tick();
|
||||
}
|
||||
}
|
||||
//=============================================================================
|
||||
// Public Function Definition
|
||||
//=============================================================================
|
||||
int main(void)
|
||||
{
|
||||
struct bode_plot_param_t *cloop_p = &pfc_cloop_bode_plot_param;
|
||||
struct bode_plot_param_t *vloop_p = &pfc_vloop_bode_plot_param;
|
||||
|
||||
// system initial configuration
|
||||
SYS_Config();
|
||||
sys_delay(10); // delay 10ms
|
||||
|
||||
// read plot param from flash
|
||||
msg("read plot param from flash\r\n");
|
||||
read_bodeplot_params_from_flash(cloop_p, vloop_p, FLASH_PROG_ADDR_USER_CALI);
|
||||
print_bodeplot_params(cloop_p, vloop_p);
|
||||
|
||||
// main loop ===============================================================================
|
||||
|
||||
/* PFC 電流環參數*/
|
||||
// Z1=200, Z2=100000, P1=10, P2=20000, G=8000
|
||||
cloop_p->b0 = 3353681;
|
||||
cloop_p->b1 = -1577632;
|
||||
cloop_p->b2 = -1712512;
|
||||
cloop_p->a1 = -20114;
|
||||
cloop_p->a2 = 3737;
|
||||
|
||||
cur_loop_fun_en = 1; // 開啟電流環,專測電流環
|
||||
while (1)
|
||||
{
|
||||
uart_rx_task();
|
||||
|
||||
// 核心觸發:100kHz ~ 200KHz (由 EPWM 旗標觸發)
|
||||
if (adc_trigger == 1)
|
||||
{
|
||||
adc_trigger = 0;
|
||||
|
||||
// 高速信號濾波 (簡易位移算法減少算力消耗) ---
|
||||
vbus_avg = (vbus_avg - (vbus_avg >> 3)) + (vbus >> 3);
|
||||
vcomp_avg = (vcomp_avg - (vcomp_avg >> 3)) + (vcomp >> 3);
|
||||
|
||||
// vbus ovp, uvp, 超出工作電壓範圍就不工作
|
||||
if (vbus_avg > vbus_ovp || vbus_avg < vbus_uvp)
|
||||
{
|
||||
sys_state = STATE_STOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sys_state == STATE_STOP) sys_state = STATE_SS;
|
||||
}
|
||||
|
||||
#if 1
|
||||
// --- 2. 核心狀態機邏輯 -----------------------------------------------------------------------
|
||||
switch (sys_state)
|
||||
{
|
||||
case STATE_STOP: // 0
|
||||
llc_pwm_disable(); // 關閉 PWM
|
||||
A_Para_Reset(); // 重置參數
|
||||
break;
|
||||
|
||||
case STATE_SS: // 1
|
||||
// LLC 軟啟動:頻率由高往低掃描 (掃向 1倍諧振頻率)
|
||||
llc_period_ss++;
|
||||
llc_ss_cnt++;
|
||||
llc_set_period(llc_period_ss >> 2); // 放大 4 倍,要除 4 回來
|
||||
|
||||
if (llc_running == 0)
|
||||
{
|
||||
llc_pwm_enable();
|
||||
llc_running = 1;
|
||||
}
|
||||
|
||||
if (llc_ss_cnt >= LLC_SS_COUNT)
|
||||
{
|
||||
sys_state = STATE_RUN;
|
||||
// sys_state = STATE_PAUSE; // 測試用
|
||||
// 重要動作 =====================================
|
||||
// vbus_comp_1 = YN_MIN; // 假設從一個極小的係數開始
|
||||
// vbus_comp2 = (vbus_comp_1 >> 9);
|
||||
// vbus_err_1 = 0; // 清除誤差歷史
|
||||
// iac_err_2 = 0;
|
||||
// iac_err_1 = 0;
|
||||
// iac_comp_2 = YN_MIN;
|
||||
// iac_comp_1 = YN_MIN;
|
||||
// msg("%d %d %d %d \r\n", power_on_cmd, sys_state, vbus_comp_1, vbus_comp2);
|
||||
// 1 4 196608, = 12 << 14
|
||||
// E LOAD 抽太慢,導致 OVP ?? (是的)
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_RUN: // 2
|
||||
// 根據電壓環、電流環調整頻率
|
||||
/*
|
||||
if (++v_loop_cnt >= 10) // 10KHZ
|
||||
{
|
||||
Vol_Loop_PFC_1P1Z();
|
||||
// Vol_Loop_PFC_1P1Z();
|
||||
v_loop_cnt = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
break;
|
||||
} // switch case
|
||||
#endif
|
||||
|
||||
} // if tim0_trigger
|
||||
|
||||
// --- 3. 非即時任務 (UI、通訊、Data Log) ---
|
||||
Handle_UART_Monitor();
|
||||
// Capture_Dump_IfReady();
|
||||
|
||||
// capture_continuous_task();
|
||||
} // while --------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
#include "app.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
app();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user