diff options
author | Christian Hammacher <bmasterc@gmail.com> | 2021-05-24 13:25:00 +0300 |
---|---|---|
committer | Christian Hammacher <bmasterc@gmail.com> | 2021-05-24 13:25:00 +0300 |
commit | 60b1fd9c28ba7a49bdd45e4f983bc72c1d641a60 (patch) | |
tree | be72b6938670f76c677afaacfadeec1ae794a1d5 | |
parent | 7aaac7e1911ebe52a9260f147425627725d605c5 (diff) | |
parent | 214d486c4c9fe3639f2f861605c89d1b0dc56a8f (diff) |
Merge remote-tracking branch 'origin/3.3-dev' into v3-chrishamm
-rw-r--r-- | .cproject | 174 | ||||
-rw-r--r-- | src/CAN/CanInterface.cpp | 41 | ||||
-rw-r--r-- | src/CAN/CanInterface.h | 2 | ||||
-rw-r--r-- | src/GCodes/GCodes.cpp | 10 | ||||
-rw-r--r-- | src/GCodes/GCodes.h | 1 | ||||
-rw-r--r-- | src/GCodes/GCodes2.cpp | 6 | ||||
-rw-r--r-- | src/GCodes/GCodes3.cpp | 2 | ||||
-rw-r--r-- | src/Hardware/ExceptionHandlers.cpp | 7 | ||||
-rw-r--r-- | src/Movement/Move.cpp | 6 | ||||
-rw-r--r-- | src/Movement/Move.h | 8 | ||||
-rw-r--r-- | src/ObjectModel/Variable.cpp | 2 | ||||
-rw-r--r-- | src/ObjectModel/Variable.h | 2 | ||||
-rw-r--r-- | src/Platform/Platform.cpp | 4 | ||||
-rw-r--r-- | src/Platform/Platform.h | 12 | ||||
-rw-r--r-- | src/Platform/RepRap.cpp | 6 | ||||
-rw-r--r-- | src/Platform/RepRap.h | 8 | ||||
-rw-r--r-- | src/Platform/Tasks.cpp | 26 | ||||
-rw-r--r-- | src/Platform/Tasks.h | 1 | ||||
-rw-r--r-- | src/Tools/Tool.cpp | 4 | ||||
-rw-r--r-- | src/Tools/Tool.h | 6 | ||||
-rw-r--r-- | src/Version.h | 2 |
21 files changed, 113 insertions, 217 deletions
@@ -948,7 +948,7 @@ <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.1969972072" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.c.optimization.level.more" valueType="enumerated"/> <option id="gnu.c.compiler.option.debugging.level.1649249275" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/> <option id="gnu.c.compiler.option.misc.verbose.744370390" name="Verbose (-v)" superClass="gnu.c.compiler.option.misc.verbose" useByScannerDiscovery="false" value="false" valueType="boolean"/> - <option id="gnu.c.compiler.option.misc.other.586762948" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="true" value="-c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -nostdlib -Wundef -Wdouble-promotion -Werror=return-type -Werror=implicit -fsingle-precision-constant "-Wa,-ahl=$*.s"" valueType="string"/> + <option id="gnu.c.compiler.option.misc.other.586762948" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="true" value="-c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -nostdlib -Wundef -Wdouble-promotion -Werror=return-type -Werror=implicit -fsingle-precision-constant "-Wa,-ahl=$*.s" -fstack-usage -fdump-rtl-expand" valueType="string"/> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.55492871" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> <listOptionValue builtIn="false" value=""${workspace_loc:/CoreN2G}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/CoreN2G/src}""/> @@ -995,7 +995,7 @@ <option id="gnu.cpp.compiler.option.optimization.level.787596539" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.more" valueType="enumerated"/> <option id="gnu.cpp.compiler.option.debugging.level.1654001240" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> <option id="gnu.cpp.compiler.option.other.verbose.434057491" name="Verbose (-v)" superClass="gnu.cpp.compiler.option.other.verbose" useByScannerDiscovery="false" value="false" valueType="boolean"/> - <option id="gnu.cpp.compiler.option.other.other.1892624010" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" useByScannerDiscovery="true" value="-c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -fno-threadsafe-statics -fno-rtti -fexceptions -nostdlib -Wundef -Wdouble-promotion -Werror=return-type -fsingle-precision-constant "-Wa,-ahl=$*.s" -fstack-usage" valueType="string"/> + <option id="gnu.cpp.compiler.option.other.other.1892624010" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" useByScannerDiscovery="true" value="-c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -fno-threadsafe-statics -fno-rtti -fexceptions -nostdlib -Wundef -Wdouble-promotion -Werror=return-type -fsingle-precision-constant "-Wa,-ahl=$*.s" -fstack-usage -fdump-rtl-expand" valueType="string"/> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.828643136" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> <listOptionValue builtIn="false" value=""${workspace_loc:/CoreN2G}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/src/include}""/> @@ -1222,176 +1222,6 @@ </externalSettings> </storageModule> </cconfiguration> - <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.241502451.1275216290.274082366.1645191116.1852610203.289083307.712841925.1449134157"> - <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.241502451.1275216290.274082366.1645191116.1852610203.289083307.712841925.1449134157" moduleId="org.eclipse.cdt.core.settings" name="Duet3ATE"> - <macros> - <stringMacro name="LinkFlags2" type="VALUE_TEXT" value="-Wl,--end-group -lm"/> - <stringMacro name="LinkFlags1" type="VALUE_TEXT" value="-mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group"/> - <stringMacro name="CoreName" type="VALUE_TEXT" value="CoreNG"/> - </macros> - <externalSettings/> - <extensions> - <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> - <extension id="org.eclipse.cdt.core.GmakeErrorParser" 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"/> - <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> - <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> - </extensions> - </storageModule> - <storageModule moduleId="cdtBuildSystem" version="4.0.0"> - <configuration artifactExtension="elf" artifactName="Duet3Firmware_MB6HC_ATE" 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="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.241502451.1275216290.274082366.1645191116.1852610203.289083307.712841925.1449134157" name="Duet3ATE" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="cdt.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary file" postbuildStep="arm-none-eabi-objcopy -O binary "${workspace_loc:/${ProjName}/${ConfigName}}/${BuildArtifactFileBaseName}.elf" "${workspace_loc:/${ProjName}/${ConfigName}}/${BuildArtifactFileBaseName}.bin" && crc32appender "${workspace_loc:/${ProjName}/${ConfigName}}/${BuildArtifactFileBaseName}.bin""> - <folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.241502451.1275216290.274082366.1645191116.1852610203.289083307.712841925.1449134157." name="/" resourcePath=""> - <toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.976782357" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release"> - <option id="cdt.managedbuild.option.gnu.cross.path.1068336474" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path" useByScannerDiscovery="false" value="${ArmGccPath}" valueType="string"/> - <option id="cdt.managedbuild.option.gnu.cross.prefix.1827229070" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix" useByScannerDiscovery="false" value="arm-none-eabi-" valueType="string"/> - <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.981044219" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/> - <builder buildPath="${workspace_loc:/RepRapFirmware}/Release" id="cdt.managedbuild.builder.gnu.cross.1493338686" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross"/> - <tool id="cdt.managedbuild.tool.gnu.cross.assembler.844930045" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler"> - <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="gnu.both.asm.option.include.paths.499035474" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" useByScannerDiscovery="false" valueType="includePath"/> - <inputType id="cdt.managedbuild.tool.gnu.assembler.input.917146879" superClass="cdt.managedbuild.tool.gnu.assembler.input"/> - </tool> - <tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.cross.c.compiler.1969940049" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler"> - <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.681412901" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.c.optimization.level.more" valueType="enumerated"/> - <option id="gnu.c.compiler.option.debugging.level.2055551087" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/> - <option id="gnu.c.compiler.option.misc.verbose.407868395" name="Verbose (-v)" superClass="gnu.c.compiler.option.misc.verbose" useByScannerDiscovery="false" value="false" valueType="boolean"/> - <option id="gnu.c.compiler.option.misc.other.1536178980" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="true" value="-c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -nostdlib -Wundef -Wdouble-promotion -Werror=return-type -Werror=implicit -fsingle-precision-constant "-Wa,-ahl=$*.s"" valueType="string"/> - <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.75495603" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/cores/arduino}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/common/utils}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/common/services/clock}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/common/services/ioport}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/sam/drivers}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/sam/utils}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/sam/utils/cmsis/same70/include}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/sam/utils/header_files}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/sam/utils/preprocessor}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/thirdparty/CMSIS/Include}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/variants/same70}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/Networking/LwipEthernet/Lwip}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/Networking/LwipEthernet/Lwip/src/include}""/> - </option> - <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.preprocessor.def.symbols.1105921203" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols"> - <listOptionValue builtIn="false" value="__SAME70Q20B__"/> - <listOptionValue builtIn="false" value="RTOS"/> - <listOptionValue builtIn="false" value="DUET3_V06"/> - <listOptionValue builtIn="false" value="DUET3_ATE"/> - <listOptionValue builtIn="false" value="noexcept="/> - </option> - <option id="gnu.c.compiler.option.dialect.std.1937206893" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/> - <option id="gnu.c.compiler.option.dialect.flags.378426812" name="Other dialect flags" superClass="gnu.c.compiler.option.dialect.flags" useByScannerDiscovery="true" value="-std=gnu99" valueType="string"/> - <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.556751766" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> - </tool> - <tool id="cdt.managedbuild.tool.gnu.cross.c.linker.500867444" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/> - <tool id="cdt.managedbuild.tool.gnu.cross.archiver.8122538" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/> - <tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${LinkFlags1} ${INPUTS} ${LinkFlags2}" id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1730891053" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"> - <option id="gnu.cpp.link.option.nostdlibs.1235848969" name="No startup or default libs (-nostdlib)" superClass="gnu.cpp.link.option.nostdlibs" useByScannerDiscovery="false" value="false" valueType="boolean"/> - <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.link.option.paths.1649744386" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths"> - <listOptionValue builtIn="false" value=""${workspace_loc:/Duet3ATE/MB6HC}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/SAME70}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/CoreNG/SAME70}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/CANlib/SAME70_RTOS}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/RRFLibraries/SAME70_RTOS}""/> - </option> - <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.link.option.libs.1961200750" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" useByScannerDiscovery="false" valueType="libs"> - <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="Duet3ATE"/> - <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="RRFLibraries"/> - <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="FreeRTOS"/> - <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="CoreNG"/> - <listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="CANlib"/> - <listOptionValue builtIn="false" value="supc++"/> - </option> - <option id="gnu.cpp.link.option.flags.509512771" name="Linker flags" superClass="gnu.cpp.link.option.flags" useByScannerDiscovery="false" value="--specs=nosys.specs -Os -Wl,--gc-sections -Wl,--fatal-warnings -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -T"${workspace_loc:/${CoreName}/variants/same70/linker_scripts/gcc/flash.ld}" -Wl,-Map,"${workspace_loc:/${ProjName}/${ConfigName}}/${BuildArtifactFileBaseName}.map"" valueType="string"/> - <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.488472010" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input"> - <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> - <additionalInput kind="additionalinput" paths="$(LIBS)"/> - </inputType> - </tool> - <tool command="g++" id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.760321736" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler"> - <option id="gnu.cpp.compiler.option.optimization.level.2126449879" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.more" valueType="enumerated"/> - <option id="gnu.cpp.compiler.option.debugging.level.1448051548" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> - <option id="gnu.cpp.compiler.option.other.verbose.1866586738" name="Verbose (-v)" superClass="gnu.cpp.compiler.option.other.verbose" useByScannerDiscovery="false" value="false" valueType="boolean"/> - <option id="gnu.cpp.compiler.option.other.other.769489868" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" useByScannerDiscovery="true" value="-c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -mno-unaligned-access -ffunction-sections -fdata-sections -fno-threadsafe-statics -fno-rtti -fexceptions -nostdlib -Wundef -Wdouble-promotion -Werror=return-type -fsingle-precision-constant "-Wa,-ahl=$*.s" -fstack-usage" valueType="string"/> - <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.1118183229" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/cores/arduino}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/libraries/Flash}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/libraries/Wire}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/common/utils}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/common/services/clock}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/common/services/ioport}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/sam/drivers}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/sam/drivers/gmac}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/sam/utils}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/sam/utils/cmsis/same70/include}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/sam/utils/header_files}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/sam/utils/preprocessor}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/asf/thirdparty/CMSIS/Include}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${CoreName}/variants/same70}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/Hardware/SAME70}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/Networking}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/Networking/LwipEthernet/Lwip}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/Networking/LwipEthernet/Lwip/src/include}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/DuetWiFiSocketServer/src/include}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/src/include}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/FreeRTOS/src/portable/GCC/ARM_CM7/r0p1}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/RRFLibraries/src}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/CANlib/src}""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/Duet3ATE/include}""/> - </option> - <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.preprocessor.def.1915144378" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols"> - <listOptionValue builtIn="false" value="__SAME70Q20B__"/> - <listOptionValue builtIn="false" value="RTOS"/> - <listOptionValue builtIn="false" value="DUET3_V06"/> - <listOptionValue builtIn="false" value="DUET3_ATE"/> - <listOptionValue builtIn="false" value="_XOPEN_SOURCE"/> - </option> - <option id="gnu.cpp.compiler.option.dialect.std.1524098890" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/> - <option id="gnu.cpp.compiler.option.dialect.flags.1995755388" name="Other dialect flags" superClass="gnu.cpp.compiler.option.dialect.flags" useByScannerDiscovery="true" value="-std=gnu++17" valueType="string"/> - <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.478486523" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> - </tool> - </toolChain> - </folderInfo> - <sourceEntries> - <entry excluding="src/Hardware/SAM4E|src/Duet3Mini|/src/Networking/LwipEthernet/Lwip/test|src/DuetNG|src/Networking/W5500Ethernet|src/Display|src/Pccb|/src/Networking/LwipEthernet/Lwip/src/apps/mqtt|src/Networking/LwipEthernet/Lwip/doc|src/Networking/LwipEthernet/Lwip/src/apps/smtp|src/Networking/LwipEthernet/Lwip/src/apps/snmp|src/Networking/LwipEthernet/Lwip/src/apps/httpd|src/Hardware/SAME5x|src/Networking/LwipEthernet/Lwip/src/apps/tftp|src/Networking/LwipEthernet/Lwip/src/netif/ppp|src/Networking/LwipEthernet/Lwip/src/apps/lwiperf|src/Networking/LwipEthernet/Lwip/src/apps/altcp_tls|src/Networking/LwipEthernet/Lwip/src/apps/sntp|src/Networking/LwipEthernet/Lwip/src/apps/http|src/Networking/ESP8266WiFi|src/DuetM|src/Hardware/SAM4S" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name=""/> - </sourceEntries> - </configuration> - </storageModule> - <storageModule moduleId="org.eclipse.cdt.core.externalSettings"> - <externalSettings containerId="CANlib;cdt.managedbuild.config.gnu.cross.lib.release.1485070058" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> - <externalSetting> - <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/CANlib/SAME70_RTOS"/> - <entry flags="RESOLVED" kind="libraryFile" name="CANlib" srcPrefixMapping="" srcRootPath=""/> - </externalSetting> - </externalSettings> - <externalSettings containerId="CoreNG;cdt.managedbuild.config.gnu.cross.lib.release.897729483.161018050.906601308" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> - <externalSetting> - <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/CoreNG/SAME70"/> - <entry flags="RESOLVED" kind="libraryFile" name="CoreNG" srcPrefixMapping="" srcRootPath=""/> - </externalSetting> - </externalSettings> - <externalSettings containerId="FreeRTOS;cdt.managedbuild.config.gnu.cross.exe.release.487753828.694459458" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> - <externalSetting> - <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/FreeRTOS/SAME70"/> - <entry flags="RESOLVED" kind="libraryFile" name="FreeRTOS" srcPrefixMapping="" srcRootPath=""/> - </externalSetting> - </externalSettings> - <externalSettings containerId="RRFLibraries;cdt.managedbuild.config.gnu.cross.lib.release.1693990866.1913177425" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> - <externalSetting> - <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/RRFLibraries/SAME70_RTOS"/> - <entry flags="RESOLVED" kind="libraryFile" name="RRFLibraries" srcPrefixMapping="" srcRootPath=""/> - </externalSetting> - </externalSettings> - <externalSettings containerId="Duet3ATE;cdt.managedbuild.config.gnu.cross.lib.debug.299393999.1140290778" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> - <externalSetting> - <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/Duet3ATE/MB6HC"/> - <entry flags="RESOLVED" kind="libraryFile" name="Duet3ATE" srcPrefixMapping="" srcRootPath=""/> - </externalSetting> - </externalSettings> - </storageModule> - </cconfiguration> <cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.241502451.170574622.649587786.957471317.1222249630.1359583846.373184287"> <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.516195201.976458850.241502451.170574622.649587786.957471317.1222249630.1359583846.373184287" moduleId="org.eclipse.cdt.core.settings" name="Duet3MiniATE"> <macros> diff --git a/src/CAN/CanInterface.cpp b/src/CAN/CanInterface.cpp index 33056ede..5c0a4a96 100644 --- a/src/CAN/CanInterface.cpp +++ b/src/CAN/CanInterface.cpp @@ -16,6 +16,7 @@ #include <Movement/DDA.h> #include <Movement/DriveMovement.h> #include <Movement/StepTimer.h> +#include <Movement/Move.h> #include <RTOSIface/RTOSIface.h> #include <Platform/TaskPriorities.h> #include <GCodes/GCodeException.h> @@ -159,7 +160,7 @@ static Task<CanSenderTaskStackWords> canSenderTask; constexpr size_t CanReceiverTaskStackWords = 1000; static Task<CanReceiverTaskStackWords> canReceiverTask; -constexpr size_t CanClockTaskStackWords = 300; +constexpr size_t CanClockTaskStackWords = 400; // used to be 300 but RD had a stack overflow static Task<CanSenderTaskStackWords> canClockTask; static CanMessageBuffer * volatile pendingBuffers; @@ -293,7 +294,7 @@ CanRequestId CanInterface::AllocateRequestId(CanAddress destination) noexcept { static uint16_t rid = 0; - CanRequestId rslt = rid & 0x07FF; + CanRequestId rslt = rid & CanRequestIdMask; ++rid; return rslt; } @@ -525,9 +526,14 @@ template<class T> static GCodeResult SetRemoteDriverValues(const CanDriversData< return rslt; } +// Set remote drivers to enabled, disabled, or idle +// This function is called by both the main task and the Move task. +// As there is no mutual exclusion on putting messages in buffers or receiving replies, when this is called by the Move task +// we send the commands through the FIFO and we use a special RequestId to say that we do not expect a response static GCodeResult SetRemoteDriverStates(const CanDriversList& drivers, const StringRef& reply, DriverStateControl state) noexcept { GCodeResult rslt = GCodeResult::ok; + const bool fromMoveTask = TaskBase::GetCallerTaskHandle() == Move::GetMoveTaskHandle(); size_t start = 0; for (;;) { @@ -543,7 +549,7 @@ static GCodeResult SetRemoteDriverStates(const CanDriversList& drivers, const St reply.lcat(NoCanBufferMessage); return GCodeResult::error; } - const CanRequestId rid = CanInterface::AllocateRequestId(boardAddress); + const CanRequestId rid = (fromMoveTask) ? CanRequestIdNoReplyNeeded : CanInterface::AllocateRequestId(boardAddress); const auto msg = buf->SetupRequestMessage<CanMessageMultipleDrivesRequest<DriverStateControl>>(rid, CanInterface::GetCanAddress(), boardAddress, CanMessageType::setDriverStates); msg->driversToUpdate = driverBits.GetRaw(); const size_t numDrivers = driverBits.CountSetBits(); @@ -552,7 +558,14 @@ static GCodeResult SetRemoteDriverStates(const CanDriversList& drivers, const St msg->values[i] = state; } buf->dataLength = msg->GetActualDataLength(numDrivers); - rslt = max(rslt, CanInterface::SendRequestAndGetStandardReply(buf, rid, reply)); + if (fromMoveTask) + { + CanInterface::SendMotion(buf); // if it's coming from the Move task then we must send the command via the fifo + } + else + { + rslt = max(rslt, CanInterface::SendRequestAndGetStandardReply(buf, rid, reply)); // send the command via the usual mechanism + } } return rslt; } @@ -585,18 +598,30 @@ GCodeResult CanInterface::SendRequestAndGetStandardReply(CanMessageBuffer *buf, } // Send a request to an expansion board and append the response to 'reply'. The response may either be a standard reply or 'replyType'. -GCodeResult CanInterface::SendRequestAndGetCustomReply(CanMessageBuffer *buf, CanRequestId rid, const StringRef& reply, uint8_t *extra, CanMessageType replyType, stdext::inplace_function<void(const CanMessageBuffer*) /*noexcept*/> callback) noexcept +GCodeResult CanInterface::SendRequestAndGetCustomReply(CanMessageBuffer *buf, CanRequestId rid, const StringRef& reply, uint8_t *extra, CanMessageType replyType, function_ref<void(const CanMessageBuffer*) /*noexcept*/> callback) noexcept { if (can0dev == nullptr) { // Transactions sometimes get requested after we have shut down CAN, e.g. when we destroy filament monitors + CanMessageBuffer::Free(buf); return GCodeResult::error; } + const CanAddress dest = buf->id.Dst(); + const CanMessageType msgType = buf->id.MsgType(); // save for possible error message + + // This code isn't re-entrant, so check that we are the main task + if (TaskBase::GetCallerTaskHandle() != Tasks::GetMainTask()) + { + reply.printf("SendReq call from wrong task type=%u dst=%u",(unsigned int)msgType, (unsigned int)dest); + reprap.GetPlatform().MessageF(ErrorMessage, "%s\n", reply.c_str()); // send it directly in case the caller discards the reply + CanMessageBuffer::Free(buf); + return GCodeResult::error; + } + can0dev->SendMessage(TxBufferIndexRequest, MaxRequestSendWait, buf); const uint32_t whenStartedWaiting = millis(); unsigned int fragmentsReceived = 0; - const CanMessageType msgType = buf->id.MsgType(); // save for possible error message for (;;) { const uint32_t timeWaiting = millis() - whenStartedWaiting; @@ -643,7 +668,7 @@ GCodeResult CanInterface::SendRequestAndGetCustomReply(CanMessageBuffer *buf, Ca } ++fragmentsReceived; } - else if (matchesRequest &&buf->id.MsgType() == replyType && fragmentsReceived == 0) + else if (matchesRequest && buf->id.MsgType() == replyType && fragmentsReceived == 0) { callback(buf); CanMessageBuffer::Free(buf); @@ -718,7 +743,7 @@ GCodeResult CanInterface::EnableRemoteDrivers(const CanDriversList& drivers, con return SetRemoteDriverStates(drivers, reply, DriverStateControl(DriverStateControl::driverActive)); } -// This one is used by Prepare +// This one is used by Prepare and by M17 void CanInterface::EnableRemoteDrivers(const CanDriversList& drivers) noexcept { String<1> dummy; diff --git a/src/CAN/CanInterface.h b/src/CAN/CanInterface.h index d19feef4..50aecfd7 100644 --- a/src/CAN/CanInterface.h +++ b/src/CAN/CanInterface.h @@ -74,7 +74,7 @@ namespace CanInterface CanRequestId AllocateRequestId(CanAddress destination) noexcept; GCodeResult SendRequestAndGetStandardReply(CanMessageBuffer *buf, CanRequestId rid, const StringRef& reply, uint8_t *extra = nullptr) noexcept; - GCodeResult SendRequestAndGetCustomReply(CanMessageBuffer *buf, CanRequestId rid, const StringRef& reply, uint8_t *extra, CanMessageType replyType, stdext::inplace_function<void(const CanMessageBuffer*) /*noexcept*/> callback) noexcept; + GCodeResult SendRequestAndGetCustomReply(CanMessageBuffer *buf, CanRequestId rid, const StringRef& reply, uint8_t *extra, CanMessageType replyType, function_ref<void(const CanMessageBuffer*) /*noexcept*/> callback) noexcept; void SendResponseNoFree(CanMessageBuffer *buf) noexcept; void SendBroadcastNoFree(CanMessageBuffer *buf) noexcept; void SendMessageNoReplyNoFree(CanMessageBuffer *buf) noexcept; diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp index 805aa675..8887534c 100644 --- a/src/GCodes/GCodes.cpp +++ b/src/GCodes/GCodes.cpp @@ -557,7 +557,15 @@ bool GCodes::SpinGCodeBuffer(GCodeBuffer& gb) noexcept // Start a new gcode, or continue to execute one that has already been started. Return true if we found something significant to do. bool GCodes::StartNextGCode(GCodeBuffer& gb, const StringRef& reply) noexcept { - if (&gb == fileGCode && ((pauseState != PauseState::notPaused && pauseState != PauseState::pausing) || (deferredPauseCommandPending != nullptr && !gb.IsDoingFileMacro()))) + // There are special rules for fileGCode because it needs to suspend when paused: + // - if the pause state is paused or resuming, don't execute + // - if the state is pausing then don't execute, unless we are executing a macro (because it could be the pause macro or filament change macro) + // - if there is a deferred pause pending, don't execute once we have finished the current macro + if (&gb == fileGCode + && ( pauseState > PauseState::pausing // paused or resuming + || (!gb.IsDoingFileMacro() && (deferredPauseCommandPending != nullptr || pauseState == PauseState::pausing)) + ) + ) { // We are paused or pausing, so don't process any more gcodes from the file being printed. // There is a potential issue here if fileGCode holds any locks, so unlock everything. diff --git a/src/GCodes/GCodes.h b/src/GCodes/GCodes.h index 933aa4b7..5ef2bfa7 100644 --- a/src/GCodes/GCodes.h +++ b/src/GCodes/GCodes.h @@ -77,6 +77,7 @@ enum class StopPrintReason enum class PauseState : uint8_t { + // Do not change the order of these! We rely on notPaused < pausing < { paused, resuming} notPaused = 0, pausing, paused, diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp index ec036535..9f50364f 100644 --- a/src/GCodes/GCodes2.cpp +++ b/src/GCodes/GCodes2.cpp @@ -2524,10 +2524,10 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx gb.SetState(GCodeState::waitingForAcknowledgement); } #endif - if (Push(gb, true)) // stack the machine state including the file position + if (Push(gb, true)) // stack the machine state including the file position { - UnlockMovement(gb); // allow movement so that e.g. an SD card print can call M291 and then DWC or PanelDue can be used to jog axes - gb.WaitForAcknowledgement(); // flag that we are waiting for acknowledgement + UnlockMovement(gb); // allow movement so that e.g. an SD card print can call M291 and then DWC or PanelDue can be used to jog axes + gb.WaitForAcknowledgement(); // flag that we are waiting for acknowledgement } } diff --git a/src/GCodes/GCodes3.cpp b/src/GCodes/GCodes3.cpp index 3ff14db0..ed140fb7 100644 --- a/src/GCodes/GCodes3.cpp +++ b/src/GCodes/GCodes3.cpp @@ -865,7 +865,7 @@ GCodeResult GCodes::StraightProbe(GCodeBuffer& gb, const StringRef& reply) THROW ToolOffsetTransform(userPositionTarget, straightProbeSettings.GetTarget()); // See whether we are using a user-defined Z probe or just current one - const size_t probeToUse = gb.Seen('P') ? gb.GetUIValue() : 0; + const size_t probeToUse = (gb.Seen('K') || gb.Seen('P')) ? gb.GetUIValue() : 0; // Check if this probe exists to not run into a nullptr dereference later if (platform.GetEndstops().GetZProbe(probeToUse).IsNull()) diff --git a/src/Hardware/ExceptionHandlers.cpp b/src/Hardware/ExceptionHandlers.cpp index 7253f5cf..640c0a41 100644 --- a/src/Hardware/ExceptionHandlers.cpp +++ b/src/Hardware/ExceptionHandlers.cpp @@ -8,6 +8,7 @@ #include "ExceptionHandlers.h" #include <Platform/RepRap.h> #include <Platform/Platform.h> +#include <Platform/Tasks.h> #include <Hardware/NonVolatileMemory.h> #include <Cache.h> #if SAME70 || SAM4S || SAM4E @@ -62,10 +63,10 @@ } // Record the reason for the software reset - NonVolatileMemory mem; - SoftwareResetData * const srd = mem.AllocateResetDataSlot(); + NonVolatileMemory * const mem = new(Tasks::GetNVMBuffer(stk)) NonVolatileMemory; + SoftwareResetData * const srd = mem->AllocateResetDataSlot(); srd->Populate(fullReason, stk); - mem.EnsureWritten(); + mem->EnsureWritten(); } #if defined(__LPC17xx__) diff --git a/src/Movement/Move.cpp b/src/Movement/Move.cpp index 2feadeb5..e3f073f9 100644 --- a/src/Movement/Move.cpp +++ b/src/Movement/Move.cpp @@ -49,11 +49,7 @@ # include <CAN/CanMotion.h> #endif -// Move task stack size -// 250 is not enough when Move and DDA debug are enabled -// deckingman's system (MB6HC with CAN expansion) needs at least 365 in 3.3beta3 -constexpr unsigned int MoveTaskStackWords = 450; -static Task<MoveTaskStackWords> moveTask; +Task<Move::MoveTaskStackWords> Move::moveTask; constexpr uint32_t MoveTimeout = 20; // normal timeout when the Move process is waiting for a new move diff --git a/src/Movement/Move.h b/src/Movement/Move.h index 5cfcf29e..940cfe8b 100644 --- a/src/Movement/Move.h +++ b/src/Movement/Move.h @@ -194,6 +194,8 @@ public: static void WakeMoveTaskFromISR() noexcept; + static const TaskBase *GetMoveTaskHandle() noexcept { return &moveTask; } + #if SUPPORT_REMOTE_COMMANDS void AddMoveFromRemote(const CanMessageMovementLinear& msg) noexcept // add a move from the ATE to the movement queue { @@ -222,6 +224,12 @@ private: const char *GetCompensationTypeString() const noexcept; + // Move task stack size + // 250 is not enough when Move and DDA debug are enabled + // deckingman's system (MB6HC with CAN expansion) needs at least 365 in 3.3beta3 + static constexpr unsigned int MoveTaskStackWords = 450; + static Task<MoveTaskStackWords> moveTask; + #if SUPPORT_ASYNC_MOVES DDARing rings[2]; DDARing& auxDDARing = rings[1]; // the DDA ring used for live babystepping, height following and other asynchronous moves diff --git a/src/ObjectModel/Variable.cpp b/src/ObjectModel/Variable.cpp index 65e6b55f..fd07fee4 100644 --- a/src/ObjectModel/Variable.cpp +++ b/src/ObjectModel/Variable.cpp @@ -126,7 +126,7 @@ void VariableSet::AssignFrom(VariableSet& other) noexcept other.root = nullptr; } -void VariableSet::IterateWhile(stdext::inplace_function<bool(unsigned int, const Variable&) /*noexcept*/ > func) const noexcept +void VariableSet::IterateWhile(function_ref<bool(unsigned int, const Variable&) /*noexcept*/ > func) const noexcept { unsigned int num = 0; for (const Variable *v = root; v != nullptr; v = v->GetNext()) diff --git a/src/ObjectModel/Variable.h b/src/ObjectModel/Variable.h index 28717688..164fb2c1 100644 --- a/src/ObjectModel/Variable.h +++ b/src/ObjectModel/Variable.h @@ -57,7 +57,7 @@ public: void Delete(const char *str) noexcept; void Clear() noexcept; - void IterateWhile(stdext::inplace_function<bool(unsigned int index, const Variable& v) /*noexcept*/ > func) const noexcept; + void IterateWhile(function_ref<bool(unsigned int index, const Variable& v) /*noexcept*/ > func) const noexcept; private: Variable *root; diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index 7122f7a8..3c1c8946 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -2572,7 +2572,7 @@ bool Platform::WriteAxisLimits(FileStore *f, AxesBitmap axesProbed, const float #if SUPPORT_CAN_EXPANSION // Function to identify and iterate through all drivers attached to an axis or extruder -void Platform::IterateDrivers(size_t axisOrExtruder, stdext::inplace_function<void(uint8_t)> localFunc, stdext::inplace_function<void(DriverId)> remoteFunc) noexcept +void Platform::IterateDrivers(size_t axisOrExtruder, function_ref<void(uint8_t)> localFunc, function_ref<void(DriverId)> remoteFunc) noexcept { if (axisOrExtruder < reprap.GetGCodes().GetTotalAxes()) { @@ -2606,7 +2606,7 @@ void Platform::IterateDrivers(size_t axisOrExtruder, stdext::inplace_function<vo #else // Function to identify and iterate through all drivers attached to an axis or extruder -void Platform::IterateDrivers(size_t axisOrExtruder, stdext::inplace_function<void(uint8_t)> localFunc) noexcept +void Platform::IterateDrivers(size_t axisOrExtruder, function_ref<void(uint8_t)> localFunc) noexcept { if (axisOrExtruder < reprap.GetGCodes().GetTotalAxes()) { diff --git a/src/Platform/Platform.h b/src/Platform/Platform.h index dbf122c9..ac73580e 100644 --- a/src/Platform/Platform.h +++ b/src/Platform/Platform.h @@ -40,7 +40,7 @@ Licence: GPL #include <Comms/AuxDevice.h> #include <Comms/PanelDueUpdater.h> #include <General/IPAddress.h> -#include <General/inplace_function.h> +#include <General/function_ref.h> #if defined(DUET_NG) # include "DueXn.h" @@ -655,12 +655,12 @@ private: float GetCpuTemperature() const noexcept; #if SUPPORT_CAN_EXPANSION - void IterateDrivers(size_t axisOrExtruder, stdext::inplace_function<void(uint8_t) /*noexcept*/ > localFunc, stdext::inplace_function<void(DriverId) /*noexcept*/ > remoteFunc) noexcept; - void IterateLocalDrivers(size_t axisOrExtruder, stdext::inplace_function<void(uint8_t) /*noexcept*/ > func) noexcept { IterateDrivers(axisOrExtruder, func, [](DriverId) noexcept {}); } - void IterateRemoteDrivers(size_t axisOrExtruder, stdext::inplace_function<void(DriverId) /*noexcept*/ > func) noexcept { IterateDrivers(axisOrExtruder, [](uint8_t) noexcept {}, func); } + void IterateDrivers(size_t axisOrExtruder, function_ref<void(uint8_t) /*noexcept*/ > localFunc, function_ref<void(DriverId) /*noexcept*/ > remoteFunc) noexcept; + void IterateLocalDrivers(size_t axisOrExtruder, function_ref<void(uint8_t) /*noexcept*/ > func) noexcept { IterateDrivers(axisOrExtruder, func, [](DriverId) noexcept {}); } + void IterateRemoteDrivers(size_t axisOrExtruder, function_ref<void(DriverId) /*noexcept*/ > func) noexcept { IterateDrivers(axisOrExtruder, [](uint8_t) noexcept {}, func); } #else - void IterateDrivers(size_t axisOrExtruder, stdext::inplace_function<void(uint8_t) /*noexcept*/ > localFunc) noexcept; - void IterateLocalDrivers(size_t axisOrExtruder, stdext::inplace_function<void(uint8_t) /*noexcept*/ > func) noexcept { IterateDrivers(axisOrExtruder, func); } + void IterateDrivers(size_t axisOrExtruder, function_ref<void(uint8_t) /*noexcept*/ > localFunc) noexcept; + void IterateLocalDrivers(size_t axisOrExtruder, function_ref<void(uint8_t) /*noexcept*/ > func) noexcept { IterateDrivers(axisOrExtruder, func); } #endif #if SUPPORT_REMOTE_COMMANDS diff --git a/src/Platform/RepRap.cpp b/src/Platform/RepRap.cpp index 79d11b55..48ee430a 100644 --- a/src/Platform/RepRap.cpp +++ b/src/Platform/RepRap.cpp @@ -2315,7 +2315,7 @@ GCodeResult RepRap::GetFileInfoResponse(const char *filename, OutputBuffer *&res // Helper functions to write JSON arrays // Append float array using 1 decimal place -void RepRap::AppendFloatArray(OutputBuffer *buf, const char *name, size_t numValues, stdext::inplace_function<float(size_t)> func, unsigned int numDecimalDigits) noexcept +void RepRap::AppendFloatArray(OutputBuffer *buf, const char *name, size_t numValues, function_ref<float(size_t)> func, unsigned int numDecimalDigits) noexcept { if (name != nullptr) { @@ -2333,7 +2333,7 @@ void RepRap::AppendFloatArray(OutputBuffer *buf, const char *name, size_t numVal buf->cat(']'); } -void RepRap::AppendIntArray(OutputBuffer *buf, const char *name, size_t numValues, stdext::inplace_function<int(size_t)> func) noexcept +void RepRap::AppendIntArray(OutputBuffer *buf, const char *name, size_t numValues, function_ref<int(size_t)> func) noexcept { if (name != nullptr) { @@ -2351,7 +2351,7 @@ void RepRap::AppendIntArray(OutputBuffer *buf, const char *name, size_t numValue buf->cat(']'); } -void RepRap::AppendStringArray(OutputBuffer *buf, const char *name, size_t numValues, stdext::inplace_function<const char *(size_t)> func) noexcept +void RepRap::AppendStringArray(OutputBuffer *buf, const char *name, size_t numValues, function_ref<const char *(size_t)> func) noexcept { if (name != nullptr) { diff --git a/src/Platform/RepRap.h b/src/Platform/RepRap.h index 4f7195f5..80cac81b 100644 --- a/src/Platform/RepRap.h +++ b/src/Platform/RepRap.h @@ -24,7 +24,7 @@ Licence: GPL #include <RepRapFirmware.h> #include <ObjectModel/ObjectModel.h> #include <RTOSIface/RTOSIface.h> -#include <General/inplace_function.h> +#include <General/function_ref.h> #include <ObjectModel/GlobalVariables.h> #if SUPPORT_CAN_EXPANSION @@ -216,9 +216,9 @@ protected: private: static void EncodeString(StringRef& response, const char* src, size_t spaceToLeave, bool allowControlChars = false, char prefix = 0) noexcept; - static void AppendFloatArray(OutputBuffer *buf, const char *name, size_t numValues, stdext::inplace_function<float(size_t)> func, unsigned int numDecimalDigits) noexcept; - static void AppendIntArray(OutputBuffer *buf, const char *name, size_t numValues, stdext::inplace_function<int(size_t)> func) noexcept; - static void AppendStringArray(OutputBuffer *buf, const char *name, size_t numValues, stdext::inplace_function<const char *(size_t)> func) noexcept; + static void AppendFloatArray(OutputBuffer *buf, const char *name, size_t numValues, function_ref<float(size_t)> func, unsigned int numDecimalDigits) noexcept; + static void AppendIntArray(OutputBuffer *buf, const char *name, size_t numValues, function_ref<int(size_t)> func) noexcept; + static void AppendStringArray(OutputBuffer *buf, const char *name, size_t numValues, function_ref<const char *(size_t)> func) noexcept; size_t GetStatusIndex() const noexcept; char GetStatusCharacter() const noexcept; diff --git a/src/Platform/Tasks.cpp b/src/Platform/Tasks.cpp index e5b1331c..e433b8d8 100644 --- a/src/Platform/Tasks.cpp +++ b/src/Platform/Tasks.cpp @@ -11,6 +11,7 @@ #include <Cache.h> #include <Platform/TaskPriorities.h> #include <Hardware/SoftwareReset.h> +#include <Hardware/NonVolatileMemory.h> #include <Storage/CRC32.h> #include <Movement/StepTimer.h> @@ -102,6 +103,31 @@ extern "C" void ReleaseMallocMutex() noexcept } } +// Get a 4-byte aligned NonVolatileMemory buffer suitable for the crash handler to use for reading/writing flash memory. +// We don't want to use a static buffer because that is wasteful of RAM, given that only the crash handler uses it, we have interrupts disabled while we use it, +// and we reset immediately afterwards. +// Instead we use either the bottom or top of the main task stack. +// Parameter 'stk' is the stack we are interested in, which we must not overwrite. The caller is either using the same stack a little lower, or the exception stack. +void *Tasks::GetNVMBuffer(const uint32_t *stk) noexcept +{ + constexpr size_t stackAllowance = 128; + static_assert((sizeof(NonVolatileMemory) & 3) == 0); + static_assert(MainTaskStackWords * 4 >= 2 * sizeof(NonVolatileMemory) + stackAllowance + 4); + const char * const cStack = reinterpret_cast<const char*>(stk); + + // See if we can use the bottom of the main task stack + char *ret = (char *)&mainTask + sizeof(TaskBase); + if (cStack > ret + (sizeof(NonVolatileMemory) + stackAllowance + 4)) // allow space for the buffer + 128b in case we are on that stack + { + ret += 4; // the +4 is so that we leave the stack marker alone in case the main task raised the exception + } + else + { + ret += (MainTaskStackWords * 4) - sizeof(NonVolatileMemory); // use the top area instead + } + return ret; +} + // Application entry point [[noreturn]] void AppMain() noexcept { diff --git a/src/Platform/Tasks.h b/src/Platform/Tasks.h index aff42e38..f3f8b878 100644 --- a/src/Platform/Tasks.h +++ b/src/Platform/Tasks.h @@ -21,6 +21,7 @@ namespace Tasks const char* GetHeapTop() noexcept; Mutex *GetI2CMutex() noexcept; Mutex *GetFilamentsMutex() noexcept; + void *GetNVMBuffer(const uint32_t *stk) noexcept; } #if SUPPORT_CAN_EXPANSION diff --git a/src/Tools/Tool.cpp b/src/Tools/Tool.cpp index 6806207a..8e92c31f 100644 --- a/src/Tools/Tool.cpp +++ b/src/Tools/Tool.cpp @@ -718,7 +718,7 @@ void Tool::SetSpindleRpm(uint32_t rpm) THROWS(GCodeException) } } -void Tool::IterateExtruders(stdext::inplace_function<void(unsigned int)> f) const noexcept +void Tool::IterateExtruders(function_ref<void(unsigned int)> f) const noexcept { for (size_t i = 0; i < driveCount; ++i) { @@ -726,7 +726,7 @@ void Tool::IterateExtruders(stdext::inplace_function<void(unsigned int)> f) cons } } -void Tool::IterateHeaters(stdext::inplace_function<void(int)> f) const noexcept +void Tool::IterateHeaters(function_ref<void(int)> f) const noexcept { for (size_t i = 0; i < heaterCount; ++i) { diff --git a/src/Tools/Tool.h b/src/Tools/Tool.h index 6c8f01a0..a12356ef 100644 --- a/src/Tools/Tool.h +++ b/src/Tools/Tool.h @@ -31,7 +31,7 @@ Licence: GPL #include <ObjectModel/ObjectModel.h> #include <General/FreelistManager.h> #include <General/NamedEnum.h> -#include <General/inplace_function.h> +#include <General/function_ref.h> constexpr size_t ToolNameLength = 32; // maximum allowed length for tool names @@ -110,8 +110,8 @@ public: bool HasTemperatureFault() const noexcept { return heaterFault; } - void IterateExtruders(stdext::inplace_function<void(unsigned int)> f) const noexcept; - void IterateHeaters(stdext::inplace_function<void(int)> f) const noexcept; + void IterateExtruders(function_ref<void(unsigned int)> f) const noexcept; + void IterateHeaters(function_ref<void(int)> f) const noexcept; bool UsesHeater(int8_t heater) const noexcept; void SetFansPwm(float f) const noexcept; diff --git a/src/Version.h b/src/Version.h index 0cd87871..bf4d0eee 100644 --- a/src/Version.h +++ b/src/Version.h @@ -9,7 +9,7 @@ #define SRC_VERSION_H_ #ifndef VERSION -# define MAIN_VERSION "3.3RC2+1" +# define MAIN_VERSION "3.3RC3" # ifdef USE_CAN0 # define VERSION_SUFFIX " (CAN0)" # else |