Nejnovejsi zdrojaky. Nutno zkusit ve WinAVR
This commit is contained in:
20
ActualOptiboot/optiboot/AtmelStudio/xplained168pb.atsln
Normal file
20
ActualOptiboot/optiboot/AtmelStudio/xplained168pb.atsln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Atmel Studio Solution File, Format Version 11.00
|
||||
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "xplained168pb", "xplained168pb.cproj", "{02F0BC88-77BD-42CC-A94C-4CC452F0F909}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|AVR = Debug|AVR
|
||||
Release|AVR = Release|AVR
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Debug|AVR.ActiveCfg = Debug|AVR
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Debug|AVR.Build.0 = Debug|AVR
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Release|AVR.ActiveCfg = Release|AVR
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Release|AVR.Build.0 = Release|AVR
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
ActualOptiboot/optiboot/AtmelStudio/xplained168pb.atsuo
Normal file
BIN
ActualOptiboot/optiboot/AtmelStudio/xplained168pb.atsuo
Normal file
Binary file not shown.
168
ActualOptiboot/optiboot/AtmelStudio/xplained168pb.cproj
Normal file
168
ActualOptiboot/optiboot/AtmelStudio/xplained168pb.cproj
Normal file
@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>6.2</ProjectVersion>
|
||||
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
|
||||
<ProjectGuid>{02f0bc88-77bd-42cc-a94c-4cc452f0f909}</ProjectGuid>
|
||||
<avrdevice>ATmega168PB</avrdevice>
|
||||
<avrdeviceseries>none</avrdeviceseries>
|
||||
<OutputType>Executable</OutputType>
|
||||
<Language>C</Language>
|
||||
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
||||
<OutputFileExtension>.elf</OutputFileExtension>
|
||||
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||
<AssemblyName>optitest</AssemblyName>
|
||||
<Name>xplained168pb</Name>
|
||||
<RootNamespace>optitest</RootNamespace>
|
||||
<ToolchainFlavour>Native</ToolchainFlavour>
|
||||
<KeepTimersRunning>true</KeepTimersRunning>
|
||||
<OverrideVtor>false</OverrideVtor>
|
||||
<CacheFlash>true</CacheFlash>
|
||||
<ProgFlashFromRam>true</ProgFlashFromRam>
|
||||
<RamSnippetAddress>0x20000000</RamSnippetAddress>
|
||||
<UncachedRange />
|
||||
<preserveEEPROM>true</preserveEEPROM>
|
||||
<OverrideVtorValue>exception_table</OverrideVtorValue>
|
||||
<BootSegment>2</BootSegment>
|
||||
<eraseonlaunchrule>0</eraseonlaunchrule>
|
||||
<AsfFrameworkConfig>
|
||||
<framework-data xmlns="">
|
||||
<options />
|
||||
<configurations />
|
||||
<files />
|
||||
<documentation help="https://github.com/Optiboot/optiboot/wiki" />
|
||||
<offline-documentation help="" />
|
||||
<dependencies>
|
||||
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.21.0" />
|
||||
</dependencies>
|
||||
</framework-data>
|
||||
</AsfFrameworkConfig>
|
||||
<avrtool>com.atmel.avrdbg.tool.medbg</avrtool>
|
||||
<com_atmel_avrdbg_tool_medbg>
|
||||
<ToolOptions>
|
||||
<InterfaceProperties>
|
||||
</InterfaceProperties>
|
||||
<InterfaceName>ISP</InterfaceName>
|
||||
</ToolOptions>
|
||||
<ToolType>com.atmel.avrdbg.tool.medbg</ToolType>
|
||||
<ToolNumber>ATML2222050200008424</ToolNumber>
|
||||
<ToolName>mEDBG</ToolName>
|
||||
</com_atmel_avrdbg_tool_medbg>
|
||||
<avrtoolinterface>
|
||||
</avrtoolinterface>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>NDEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
<UsesExternalMakeFile>True</UsesExternalMakeFile>
|
||||
<BuildTarget>xplained168pb</BuildTarget>
|
||||
<CleanTarget>clean</CleanTarget>
|
||||
<ExternalMakeFilePath>..\bootloaders\optiboot\makefile</ExternalMakeFilePath>
|
||||
<PostBuildEvent>copy optiboot_xplained168pb.* ..\..\AtmelStudio
|
||||
</PostBuildEvent>
|
||||
<OutputDirectory>..\bootloaders\optiboot</OutputDirectory>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>DEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
<UsesExternalMakeFile>True</UsesExternalMakeFile>
|
||||
<BuildTarget>xplained168pb</BuildTarget>
|
||||
<CleanTarget>clean</CleanTarget>
|
||||
<ExternalMakeFilePath>..\bootloaders\optiboot\makefile</ExternalMakeFilePath>
|
||||
<OutputFileName>optiboot_xplained168pb</OutputFileName>
|
||||
<OutputFileExtension>.hex</OutputFileExtension>
|
||||
<PostBuildEvent>copy optiboot_xplained168pb.* ..\..\AtmelStudio
|
||||
</PostBuildEvent>
|
||||
<OutputDirectory>..\bootloaders\optiboot</OutputDirectory>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\bootloaders\optiboot\Makefile">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.1284">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.1284</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.atmel">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.atmel</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.custom">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.custom</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.extras">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.extras</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.isp">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.isp</Link>
|
||||
</None>
|
||||
<None Include="optiboot_xplained168pb.hex">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<None Include="optiboot_xplained168pb.lst">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\bootloaders\optiboot\baudcheck.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>baudcheck.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bootloaders\optiboot\optiboot.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>optiboot.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bootloaders\optiboot\pin_defs.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>pin_defs.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bootloaders\optiboot\stk500.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>stk500.h</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||
</Project>
|
20
ActualOptiboot/optiboot/AtmelStudio/xplained328p.atsln
Normal file
20
ActualOptiboot/optiboot/AtmelStudio/xplained328p.atsln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Atmel Studio Solution File, Format Version 11.00
|
||||
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "xplained328p", "xplained328p.cproj", "{02F0BC88-77BD-42CC-A94C-4CC452F0F909}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|AVR = Debug|AVR
|
||||
Release|AVR = Release|AVR
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Debug|AVR.ActiveCfg = Debug|AVR
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Debug|AVR.Build.0 = Debug|AVR
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Release|AVR.ActiveCfg = Release|AVR
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Release|AVR.Build.0 = Release|AVR
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
ActualOptiboot/optiboot/AtmelStudio/xplained328p.atsuo
Normal file
BIN
ActualOptiboot/optiboot/AtmelStudio/xplained328p.atsuo
Normal file
Binary file not shown.
179
ActualOptiboot/optiboot/AtmelStudio/xplained328p.cproj
Normal file
179
ActualOptiboot/optiboot/AtmelStudio/xplained328p.cproj
Normal file
@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>6.2</ProjectVersion>
|
||||
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
|
||||
<ProjectGuid>{02f0bc88-77bd-42cc-a94c-4cc452f0f909}</ProjectGuid>
|
||||
<avrdevice>ATmega328P</avrdevice>
|
||||
<avrdeviceseries>none</avrdeviceseries>
|
||||
<OutputType>Executable</OutputType>
|
||||
<Language>C</Language>
|
||||
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
||||
<OutputFileExtension>.elf</OutputFileExtension>
|
||||
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||
<AssemblyName>optitest</AssemblyName>
|
||||
<Name>optitest</Name>
|
||||
<RootNamespace>optitest</RootNamespace>
|
||||
<ToolchainFlavour>Native</ToolchainFlavour>
|
||||
<KeepTimersRunning>true</KeepTimersRunning>
|
||||
<OverrideVtor>false</OverrideVtor>
|
||||
<CacheFlash>true</CacheFlash>
|
||||
<ProgFlashFromRam>true</ProgFlashFromRam>
|
||||
<RamSnippetAddress>0x20000000</RamSnippetAddress>
|
||||
<UncachedRange />
|
||||
<preserveEEPROM>true</preserveEEPROM>
|
||||
<OverrideVtorValue>exception_table</OverrideVtorValue>
|
||||
<BootSegment>2</BootSegment>
|
||||
<eraseonlaunchrule>0</eraseonlaunchrule>
|
||||
<AsfFrameworkConfig>
|
||||
<framework-data xmlns="">
|
||||
<options />
|
||||
<configurations />
|
||||
<files />
|
||||
<documentation help="https://github.com/Optiboot/optiboot/wiki" />
|
||||
<offline-documentation help="" />
|
||||
<dependencies>
|
||||
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.21.0" />
|
||||
</dependencies>
|
||||
</framework-data>
|
||||
</AsfFrameworkConfig>
|
||||
<avrtool>
|
||||
</avrtool>
|
||||
<com_atmel_avrdbg_tool_medbg>
|
||||
<ToolOptions>
|
||||
<InterfaceProperties>
|
||||
</InterfaceProperties>
|
||||
<InterfaceName>ISP</InterfaceName>
|
||||
</ToolOptions>
|
||||
<ToolType>com.atmel.avrdbg.tool.medbg</ToolType>
|
||||
<ToolNumber>ATML2222050200008424</ToolNumber>
|
||||
<ToolName>mEDBG</ToolName>
|
||||
</com_atmel_avrdbg_tool_medbg>
|
||||
<avrtoolinterface>ISP</avrtoolinterface>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>NDEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
<UsesExternalMakeFile>True</UsesExternalMakeFile>
|
||||
<OutputDirectory>..\bootloaders\optiboot</OutputDirectory>
|
||||
<BuildTarget>xplained328p</BuildTarget>
|
||||
<CleanTarget>clean</CleanTarget>
|
||||
<ExternalMakeFilePath>..\bootloaders\optiboot\Makefile</ExternalMakeFilePath>
|
||||
<PostBuildEvent>copy optiboot_xplained328p.* ..\..\AtmelStudio
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>DEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
<UsesExternalMakeFile>True</UsesExternalMakeFile>
|
||||
<BuildTarget>xplained328p</BuildTarget>
|
||||
<CleanTarget>clean</CleanTarget>
|
||||
<ExternalMakeFilePath>..\bootloaders\optiboot\Makefile</ExternalMakeFilePath>
|
||||
<OutputFileName>optiboot_xplained328p</OutputFileName>
|
||||
<OutputFileExtension>.hex</OutputFileExtension>
|
||||
<OutputDirectory>..\bootloaders\optiboot</OutputDirectory>
|
||||
<PostBuildEvent>copy optiboot_xplained328p.* ..\..\AtmelStudio
|
||||
|
||||
</PostBuildEvent>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\bootloaders\optiboot\Makefile">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.1284">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.1284</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.atmel">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.atmel</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.custom">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.custom</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.extras">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.extras</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.isp">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.isp</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\bootloaders\optiboot\baudcheck.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>baudcheck.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bootloaders\optiboot\boot.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>boot.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bootloaders\optiboot\optiboot.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>optiboot.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bootloaders\optiboot\pin_defs.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>pin_defs.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bootloaders\optiboot\stk500.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>stk500.h</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||
</Project>
|
20
ActualOptiboot/optiboot/AtmelStudio/xplained328pb.atsln
Normal file
20
ActualOptiboot/optiboot/AtmelStudio/xplained328pb.atsln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Atmel Studio Solution File, Format Version 11.00
|
||||
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "xplained328pb", "xplained328pb.cproj", "{02F0BC88-77BD-42CC-A94C-4CC452F0F909}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|AVR = Debug|AVR
|
||||
Release|AVR = Release|AVR
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Debug|AVR.ActiveCfg = Release|AVR
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Debug|AVR.Build.0 = Release|AVR
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Release|AVR.ActiveCfg = Release|AVR
|
||||
{02F0BC88-77BD-42CC-A94C-4CC452F0F909}.Release|AVR.Build.0 = Release|AVR
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
ActualOptiboot/optiboot/AtmelStudio/xplained328pb.atsuo
Normal file
BIN
ActualOptiboot/optiboot/AtmelStudio/xplained328pb.atsuo
Normal file
Binary file not shown.
179
ActualOptiboot/optiboot/AtmelStudio/xplained328pb.cproj
Normal file
179
ActualOptiboot/optiboot/AtmelStudio/xplained328pb.cproj
Normal file
@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>6.2</ProjectVersion>
|
||||
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
|
||||
<ProjectGuid>{02f0bc88-77bd-42cc-a94c-4cc452f0f909}</ProjectGuid>
|
||||
<avrdevice>ATmega328PB</avrdevice>
|
||||
<avrdeviceseries>none</avrdeviceseries>
|
||||
<OutputType>Executable</OutputType>
|
||||
<Language>C</Language>
|
||||
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
||||
<OutputFileExtension>.elf</OutputFileExtension>
|
||||
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||
<AssemblyName>optitest</AssemblyName>
|
||||
<Name>optitest</Name>
|
||||
<RootNamespace>optitest</RootNamespace>
|
||||
<ToolchainFlavour>Native</ToolchainFlavour>
|
||||
<KeepTimersRunning>true</KeepTimersRunning>
|
||||
<OverrideVtor>false</OverrideVtor>
|
||||
<CacheFlash>true</CacheFlash>
|
||||
<ProgFlashFromRam>true</ProgFlashFromRam>
|
||||
<RamSnippetAddress>0x20000000</RamSnippetAddress>
|
||||
<UncachedRange />
|
||||
<preserveEEPROM>true</preserveEEPROM>
|
||||
<OverrideVtorValue>exception_table</OverrideVtorValue>
|
||||
<BootSegment>2</BootSegment>
|
||||
<eraseonlaunchrule>0</eraseonlaunchrule>
|
||||
<AsfFrameworkConfig>
|
||||
<framework-data xmlns="">
|
||||
<options />
|
||||
<configurations />
|
||||
<files />
|
||||
<documentation help="https://github.com/Optiboot/optiboot/wiki" />
|
||||
<offline-documentation help="" />
|
||||
<dependencies>
|
||||
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.21.0" />
|
||||
</dependencies>
|
||||
</framework-data>
|
||||
</AsfFrameworkConfig>
|
||||
<avrtool>com.atmel.avrdbg.tool.medbg</avrtool>
|
||||
<com_atmel_avrdbg_tool_medbg>
|
||||
<ToolOptions>
|
||||
<InterfaceProperties>
|
||||
</InterfaceProperties>
|
||||
<InterfaceName>ISP</InterfaceName>
|
||||
</ToolOptions>
|
||||
<ToolType>com.atmel.avrdbg.tool.medbg</ToolType>
|
||||
<ToolNumber>ATML2222050200008424</ToolNumber>
|
||||
<ToolName>mEDBG</ToolName>
|
||||
</com_atmel_avrdbg_tool_medbg>
|
||||
<avrtoolinterface>ISP</avrtoolinterface>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>NDEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
<UsesExternalMakeFile>True</UsesExternalMakeFile>
|
||||
<OutputDirectory>..\bootloaders\optiboot</OutputDirectory>
|
||||
<BuildTarget>xplained328pb</BuildTarget>
|
||||
<CleanTarget>clean</CleanTarget>
|
||||
<ExternalMakeFilePath>..\bootloaders\optiboot\Makefile</ExternalMakeFilePath>
|
||||
<PostBuildEvent>copy optiboot_xplained328pb.* ..\..\AtmelStudio</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>DEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
<UsesExternalMakeFile>True</UsesExternalMakeFile>
|
||||
<BuildTarget>xplained328pb</BuildTarget>
|
||||
<CleanTarget>clean</CleanTarget>
|
||||
<ExternalMakeFilePath>..\bootloaders\optiboot\Makefile</ExternalMakeFilePath>
|
||||
<OutputFileName>optiboot_xplained328pb</OutputFileName>
|
||||
<OutputFileExtension>.hex</OutputFileExtension>
|
||||
<OutputDirectory>..\bootloaders\optiboot</OutputDirectory>
|
||||
<PostBuildEvent>copy optiboot_xplained328pb.* ..\..\AtmelStudio</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\bootloaders\optiboot\Makefile">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.1284">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.1284</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.atmel">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.atmel</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.custom">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.custom</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.extras">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.extras</Link>
|
||||
</None>
|
||||
<None Include="..\bootloaders\optiboot\Makefile.isp">
|
||||
<SubType>compile</SubType>
|
||||
<Link>Makefile.isp</Link>
|
||||
</None>
|
||||
<None Include="optiboot_xplained328pb.hex">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<None Include="optiboot_xplained328pb.lst">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\bootloaders\optiboot\baudcheck.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>baudcheck.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bootloaders\optiboot\boot.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>boot.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bootloaders\optiboot\optiboot.c">
|
||||
<SubType>compile</SubType>
|
||||
<Link>optiboot.c</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bootloaders\optiboot\pin_defs.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>pin_defs.h</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\bootloaders\optiboot\stk500.h">
|
||||
<SubType>compile</SubType>
|
||||
<Link>stk500.h</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||
</Project>
|
461
ActualOptiboot/optiboot/boards-1.6.txt
Normal file
461
ActualOptiboot/optiboot/boards-1.6.txt
Normal file
@ -0,0 +1,461 @@
|
||||
#
|
||||
# Boards.txt file for Optiboot platforms, in format for Arduino 1.5.x and later.
|
||||
#
|
||||
# See: http://github.com/Arduino/arduino/
|
||||
|
||||
name=[Optiboot]
|
||||
version=6.2
|
||||
|
||||
##############################################################
|
||||
## Optiboot on 28-pin processors (atmega8/88/168/328/etc)
|
||||
|
||||
menu.cpu=Processor
|
||||
menu.mhz=CPU Speed
|
||||
|
||||
optiboot28.name=Optiboot on 28-pin cpus
|
||||
|
||||
optiboot28.upload.tool=arduino:avrdude
|
||||
optiboot28.upload.protocol=arduino
|
||||
optiboot28.upload.speed=115200
|
||||
|
||||
optiboot28.bootloader.tool=arduino:avrdude
|
||||
optiboot28.bootloader.low_fuses=0xF7
|
||||
optiboot28.bootloader.unlock_bits=0x3F
|
||||
optiboot28.bootloader.lock_bits=0x2F
|
||||
optiboot28.build.f_cpu=16000000L
|
||||
|
||||
|
||||
#
|
||||
# Other Clock speeds.
|
||||
# For 8MHz using the internal RC Oscillator, we adjust fuses, use the same
|
||||
# bootloader binary, and halve the upload rate.
|
||||
#
|
||||
optiboot28.menu.mhz.16MHz=16MHz
|
||||
optiboot28.menu.mhz.16MHz.upload.speed=115200
|
||||
optiboot28.menu.mhz.8MHz=8MHz (int)
|
||||
optiboot28.menu.mhz.8MHz.build.f_cpu=8000000L
|
||||
optiboot28.menu.mhz.8MHz.bootloader.low_fuses=0xE2
|
||||
optiboot28.menu.mhz.8MHz.upload.speed=57600
|
||||
optiboot28.menu.mhz.1MHz=1MHz (int)
|
||||
optiboot28.menu.mhz.1MHz.build.f_cpu=1000000L
|
||||
optiboot28.menu.mhz.1MHz.bootloader.low_fuses=0x62
|
||||
optiboot28.menu.mhz.1MHz.upload.speed=9600
|
||||
|
||||
# optiboot platforms should be UNO-like more than anything else.
|
||||
optiboot28.build.board=AVR_UNO
|
||||
optiboot28.build.core=arduino:arduino
|
||||
optiboot28.build.variant=arduino:standard
|
||||
|
||||
|
||||
## Optiboot for ATmega328p
|
||||
## ---------------------------------------------
|
||||
optiboot28.menu.cpu.atmega328p=ATmega328p
|
||||
optiboot28.menu.cpu.atmega328p.upload.maximum_size=32256
|
||||
optiboot28.menu.cpu.atmega328p.upload.maximum_data_size=2048
|
||||
|
||||
optiboot28.menu.cpu.atmega328p.bootloader.high_fuses=0xDE
|
||||
optiboot28.menu.cpu.atmega328p.bootloader.extended_fuses=0x05
|
||||
optiboot28.menu.cpu.atmega328p.bootloader.file=optiboot/optiboot_atmega328.hex
|
||||
|
||||
optiboot28.menu.cpu.atmega328p.build.mcu=atmega328p
|
||||
|
||||
## Optiboot for ATmega328
|
||||
## ---------------------------------------------
|
||||
optiboot28.menu.cpu.atmega328=ATmega328
|
||||
optiboot28.menu.cpu.atmega328.upload.maximum_size=32256
|
||||
optiboot28.menu.cpu.atmega328.upload.maximum_data_size=2048
|
||||
|
||||
optiboot28.menu.cpu.atmega328.bootloader.high_fuses=0xDE
|
||||
optiboot28.menu.cpu.atmega328.bootloader.extended_fuses=0x05
|
||||
optiboot28.menu.cpu.atmega328.bootloader.file=optiboot/optiboot_atmega328.hex
|
||||
# lie! Arduino wise, these are compatible
|
||||
optiboot28.menu.cpu.atmega328.build.mcu=atmega328p
|
||||
|
||||
|
||||
## Optiboot ATmega168
|
||||
## ---------------------------------------------
|
||||
optiboot28.menu.cpu.atmega168=ATmega168
|
||||
|
||||
optiboot28.menu.cpu.atmega168.upload.maximum_size=15872
|
||||
optiboot28.menu.cpu.atmega168.upload.maximum_data_size=1024
|
||||
|
||||
optiboot28.menu.cpu.atmega168.bootloader.high_fuses=0xDD
|
||||
optiboot28.menu.cpu.atmega168.bootloader.extended_fuses=0xFC
|
||||
optiboot28.menu.cpu.atmega168.bootloader.file=optiboot/optiboot_atmega168.hex
|
||||
|
||||
optiboot28.menu.cpu.atmega168.build.mcu=atmega168
|
||||
|
||||
## ---------------------------------------------
|
||||
optiboot28.menu.cpu.atmega168p=ATmega168p
|
||||
|
||||
optiboot28.menu.cpu.atmega168p.upload.maximum_size=15872
|
||||
optiboot28.menu.cpu.atmega168p.upload.maximum_data_size=1024
|
||||
|
||||
optiboot28.menu.cpu.atmega168p.bootloader.high_fuses=0xDD
|
||||
optiboot28.menu.cpu.atmega168p.bootloader.extended_fuses=0xFC
|
||||
optiboot28.menu.cpu.atmega168p.bootloader.file=optiboot/optiboot_atmega168.hex
|
||||
|
||||
optiboot28.menu.cpu.atmega168p.build.mcu=atmega168p
|
||||
|
||||
|
||||
## optiboot for ATmega8
|
||||
## ---------------------------------------------
|
||||
optiboot28.menu.cpu.atmega8=ATmega8
|
||||
|
||||
optiboot28.menu.cpu.atmega8.upload.maximum_size=7680
|
||||
optiboot28.menu.cpu.atmega8.upload.maximum_data_size=1024
|
||||
|
||||
optiboot28.menu.cpu.atmega8.bootloader.high_fuses=0xCC
|
||||
optiboot28.menu.cpu.atmega8.bootloader.low_fuses=0xBF
|
||||
# optiboot28.menu.cpu.atmega8.bootloader.extended_fuses=0x00
|
||||
optiboot28.menu.cpu.atmega8.bootloader.file=optiboot/optiboot_atmega8.hex
|
||||
|
||||
optiboot28.menu.cpu.atmega8.build.mcu=atmega8
|
||||
|
||||
## Atmega88
|
||||
## ---------------------------------------------
|
||||
optiboot28.menu.cpu.atmega88=ATmega88
|
||||
|
||||
optiboot28.menu.cpu.atmega88.upload.maximum_size=7680
|
||||
optiboot28.menu.cpu.atmega88.upload.maximum_data_size=1024
|
||||
|
||||
optiboot28.menu.cpu.atmega88.bootloader.high_fuses=0xDD
|
||||
optiboot28.menu.cpu.atmega88.bootloader.extended_fuses=0xFC
|
||||
optiboot28.menu.cpu.atmega88.bootloader.file=optiboot/optiboot_atmega88.hex
|
||||
|
||||
optiboot28.menu.cpu.atmega88.build.mcu=atmega88p
|
||||
|
||||
|
||||
##############################################################
|
||||
## Optiboot on 32pin (SMT) CPUs (Nano, Pro Micro, etc.)
|
||||
##############################################################
|
||||
|
||||
optiboot32.name=Optiboot on 32-pin cpus
|
||||
|
||||
optiboot32.upload.tool=arduino:avrdude
|
||||
optiboot32.upload.protocol=arduino
|
||||
optiboot32.upload.speed=115200
|
||||
|
||||
optiboot32.bootloader.tool=arduino:avrdude
|
||||
optiboot32.bootloader.low_fuses=0xF7
|
||||
optiboot32.bootloader.unlock_bits=0x3F
|
||||
optiboot32.bootloader.lock_bits=0x2F
|
||||
optiboot32.build.f_cpu=16000000L
|
||||
|
||||
#
|
||||
# Other Clock speeds.
|
||||
# For 8MHz using the internal RC Oscillator, we adjust fuses, use the same
|
||||
# bootloader binary, and halve the upload rate.
|
||||
#
|
||||
optiboot32.menu.mhz.16MHz=16MHz
|
||||
optiboot32.menu.mhz.16MHz.upload.speed=115200
|
||||
optiboot32.menu.mhz.8MHz=8MHz (int)
|
||||
optiboot32.menu.mhz.8MHz.build.f_cpu=8000000L
|
||||
optiboot32.menu.mhz.8MHz.bootloader.low_fuses=0xE2
|
||||
optiboot32.menu.mhz.8MHz.upload.speed=57600
|
||||
optiboot32.menu.mhz.1MHz=1MHz (int)
|
||||
optiboot32.menu.mhz.1MHz.build.f_cpu=1000000L
|
||||
optiboot32.menu.mhz.1MHz.bootloader.low_fuses=0x62
|
||||
optiboot32.menu.mhz.1MHz.upload.speed=9600
|
||||
|
||||
# optiboot platforms should be UNO-like more than anything else.
|
||||
optiboot32.build.board=AVR_UNO
|
||||
optiboot32.build.core=arduino:arduino
|
||||
optiboot32.build.variant=arduino:eightanaloginputs
|
||||
|
||||
|
||||
## Optiboot for ATmega328p
|
||||
## ---------------------------------------------
|
||||
optiboot32.menu.cpu.atmega328p=ATmega328p
|
||||
optiboot32.menu.cpu.atmega328p.upload.maximum_size=32256
|
||||
optiboot32.menu.cpu.atmega328p.upload.maximum_data_size=2048
|
||||
|
||||
optiboot32.menu.cpu.atmega328p.bootloader.high_fuses=0xDE
|
||||
optiboot32.menu.cpu.atmega328p.bootloader.extended_fuses=0x05
|
||||
optiboot32.menu.cpu.atmega328p.bootloader.file=optiboot/optiboot_atmega328.hex
|
||||
|
||||
optiboot32.menu.cpu.atmega328p.build.mcu=atmega328p
|
||||
|
||||
## Optiboot for ATmega328
|
||||
## ---------------------------------------------
|
||||
optiboot32.menu.cpu.atmega328=ATmega328
|
||||
optiboot32.menu.cpu.atmega328.upload.maximum_size=32256
|
||||
optiboot32.menu.cpu.atmega328.upload.maximum_data_size=2048
|
||||
|
||||
optiboot32.menu.cpu.atmega328.bootloader.high_fuses=0xDE
|
||||
optiboot32.menu.cpu.atmega328.bootloader.extended_fuses=0x05
|
||||
optiboot32.menu.cpu.atmega328.bootloader.file=optiboot/optiboot_atmega328.hex
|
||||
# lie! Arduino wise, these are compatible
|
||||
optiboot32.menu.cpu.atmega328.build.mcu=atmega328p
|
||||
|
||||
|
||||
## Optiboot ATmega168
|
||||
## ---------------------------------------------
|
||||
optiboot32.menu.cpu.atmega168=ATmega168
|
||||
|
||||
optiboot32.menu.cpu.atmega168.upload.maximum_size=15872
|
||||
optiboot32.menu.cpu.atmega168.upload.maximum_data_size=1024
|
||||
|
||||
optiboot32.menu.cpu.atmega168.bootloader.high_fuses=0xDD
|
||||
optiboot32.menu.cpu.atmega168.bootloader.extended_fuses=0xFC
|
||||
optiboot32.menu.cpu.atmega168.bootloader.file=optiboot/optiboot_atmega168.hex
|
||||
|
||||
optiboot32.menu.cpu.atmega168.build.mcu=atmega168
|
||||
|
||||
## ---------------------------------------------
|
||||
optiboot32.menu.cpu.atmega168p=ATmega168p
|
||||
|
||||
optiboot32.menu.cpu.atmega168p.upload.maximum_size=15872
|
||||
optiboot32.menu.cpu.atmega168p.upload.maximum_data_size=1024
|
||||
|
||||
optiboot32.menu.cpu.atmega168p.bootloader.high_fuses=0xDD
|
||||
optiboot32.menu.cpu.atmega168p.bootloader.extended_fuses=0xFC
|
||||
optiboot32.menu.cpu.atmega168p.bootloader.file=optiboot/optiboot_atmega168.hex
|
||||
|
||||
optiboot32.menu.cpu.atmega168p.build.mcu=atmega168p
|
||||
|
||||
|
||||
|
||||
##############################################################
|
||||
## Other optiboot platforms
|
||||
##############################################################
|
||||
|
||||
optiboot1280.name=Optiboot on Mega1280
|
||||
|
||||
optiboot1280.upload.tool=arduino:avrdude
|
||||
optiboot1280.upload.protocol=arduino
|
||||
optiboot1280.upload.speed=115200
|
||||
|
||||
optiboot1280.bootloader.tool=arduino:avrdude
|
||||
optiboot1280.bootloader.unlock_bits=0x3F
|
||||
optiboot1280.bootloader.lock_bits=0x2F
|
||||
|
||||
optiboot1280.build.f_cpu=16000000L
|
||||
|
||||
optiboot1280.build.board=AVR_MEGA
|
||||
optiboot1280.build.core=arduino:arduino
|
||||
optiboot1280.build.variant=arduino:mega
|
||||
|
||||
optiboot1280.upload.maximum_size=130048
|
||||
optiboot1280.upload.maximum_data_size=8192
|
||||
|
||||
optiboot1280.bootloader.low_fuses=0xFF
|
||||
optiboot1280.bootloader.high_fuses=0xDE
|
||||
optiboot1280.bootloader.extended_fuses=0x05
|
||||
optiboot1280.bootloader.file=optiboot/optiboot_atmega1280.hex
|
||||
|
||||
optiboot1280.build.mcu=atmega1280
|
||||
|
||||
##############################################################
|
||||
|
||||
|
||||
optiboot1284.name=Optiboot on (generic) Mega1284
|
||||
|
||||
optiboot1284.upload.tool=arduino:avrdude
|
||||
optiboot1284.upload.protocol=arduino
|
||||
optiboot1284.upload.speed=115200
|
||||
|
||||
optiboot1284.bootloader.tool=arduino:avrdude
|
||||
optiboot1284.bootloader.unlock_bits=0x3F
|
||||
optiboot1284.bootloader.lock_bits=0x2F
|
||||
|
||||
optiboot1284.build.f_cpu=16000000L
|
||||
|
||||
optiboot1284.build.board=AVR_M1284
|
||||
optiboot1284.build.core=arduino:arduino
|
||||
optiboot1284.build.variant=arduino:standard
|
||||
|
||||
optiboot1284.upload.maximum_size=130048
|
||||
optiboot1284.upload.maximum_data_size=16384
|
||||
|
||||
# Select full swing crystal oscillator (F7 rather than FF)
|
||||
optiboot1284.bootloader.low_fuses=0xF7
|
||||
optiboot1284.bootloader.high_fuses=0xDE
|
||||
optiboot1284.bootloader.extended_fuses=0x05
|
||||
optiboot1284.bootloader.file=optiboot/optiboot_atmega1284p.hex
|
||||
|
||||
optiboot1284.build.mcu=atmega1284p
|
||||
|
||||
##############################################################
|
||||
|
||||
|
||||
optibootm32.name=Optiboot on Mega32
|
||||
|
||||
optibootm32.upload.tool=arduino:avrdude
|
||||
optibootm32.upload.protocol=arduino
|
||||
optibootm32.upload.speed=115200
|
||||
|
||||
optibootm32.bootloader.tool=arduino:avrdude
|
||||
optibootm32.bootloader.unlock_bits=0x3F
|
||||
optibootm32.bootloader.lock_bits=0x2F
|
||||
|
||||
optibootm32.build.f_cpu=16000000L
|
||||
|
||||
optibootm32.build.board=AVR_M32
|
||||
optibootm32.build.core=arduino:arduino
|
||||
optibootm32.build.variant=arduino:standard
|
||||
|
||||
optibootm32.upload.maximum_size=130048
|
||||
optibootm32.upload.maximum_data_size=8192
|
||||
|
||||
optibootm32.bootloader.low_fuses=0xBF
|
||||
optibootm32.bootloader.high_fuses=0xCE
|
||||
optibootm32.bootloader.extended_fuses=0xFF
|
||||
optibootm32.bootloader.file=optiboot/optiboot_atmega32.hex
|
||||
|
||||
optibootm32.build.mcu=atmega32
|
||||
|
||||
|
||||
##############################################################
|
||||
|
||||
optiboott84.name=Optiboot on Tiny84
|
||||
|
||||
optiboott84.menu.mhz.8MHz=8MHz (int)
|
||||
optiboott84.menu.mhz.8MHz.build.f_cpu=8000000L
|
||||
optiboott84.menu.mhz.8MHz.upload.speed=57600
|
||||
optiboott84.menu.mhz.8MHz.bootloader.file=optiboot/optiboot_attiny84_8mhz.hex
|
||||
optiboott84.menu.mhz.8MHz.bootloader.low_fuses=0xE2
|
||||
optiboott84.menu.mhz.8MHz.bootloader.high_fuses=0xDE
|
||||
optiboott84.menu.mhz.8MHz.bootloader.extended_fuses=0xFE
|
||||
|
||||
optiboott84.menu.mhz.1MHz=1MHz (int)
|
||||
optiboott84.menu.mhz.1MHz.build.f_cpu=1000000L
|
||||
optiboott84.menu.mhz.1MHz.upload.speed=9600
|
||||
optiboott84.menu.mhz.1MHz.bootloader.file=optiboot/optiboot_attiny84.hex
|
||||
optiboott84.menu.mhz.1MHz.bootloader.low_fuses=0x62
|
||||
optiboott84.menu.mhz.1MHz.bootloader.high_fuses=0xDE
|
||||
optiboott84.menu.mhz.1MHz.bootloader.extended_fuses=0xFE
|
||||
|
||||
optiboott84.upload.tool=arduino:avrdude
|
||||
optiboott84.upload.protocol=arduino
|
||||
optiboott84.upload.speed=9600
|
||||
|
||||
optiboott84.bootloader.tool=arduino:avrdude
|
||||
optiboott84.bootloader.unlock_bits=0x3F
|
||||
optiboott84.bootloader.lock_bits=0x2F
|
||||
|
||||
optiboott84.build.f_cpu=1000000L
|
||||
|
||||
optiboott84.build.board=AVR_TINY
|
||||
optiboott84.build.core=tiny:tiny
|
||||
optiboott84.build.variant=tiny:tiny
|
||||
|
||||
optiboott84.upload.maximum_size=7600
|
||||
optiboott84.upload.maximum_data_size=512
|
||||
|
||||
optiboott84.build.mcu=attiny84
|
||||
|
||||
##############################################################
|
||||
|
||||
optiboot2560.name=Optiboot on Mega2560
|
||||
|
||||
optiboot2560.upload.tool=arduino:avrdude
|
||||
optiboot2560.upload.protocol=arduino
|
||||
optiboot2560.upload.speed=115200
|
||||
|
||||
optiboot2560.bootloader.tool=arduino:avrdude
|
||||
optiboot2560.bootloader.unlock_bits=0x3F
|
||||
optiboot2560.bootloader.lock_bits=0x2F
|
||||
|
||||
optiboot2560.build.f_cpu=16000000L
|
||||
|
||||
optiboot2560.build.board=AVR_MEGA
|
||||
optiboot2560.build.core=arduino:arduino
|
||||
optiboot2560.build.variant=arduino:mega
|
||||
|
||||
optiboot2560.upload.maximum_size=261120
|
||||
optiboot2560.upload.maximum_data_size=8192
|
||||
|
||||
optiboot2560.bootloader.low_fuses=0xF7
|
||||
optiboot2560.bootloader.high_fuses=0xDE
|
||||
optiboot2560.bootloader.extended_fuses=0xFD
|
||||
optiboot2560.bootloader.file=optiboot/optiboot_atmega2560.hex
|
||||
|
||||
optiboot2560.build.mcu=atmega2560
|
||||
|
||||
##############################################################
|
||||
|
||||
|
||||
optibootxmini168b.name=Optiboot Xplained Mini 168pb
|
||||
|
||||
optibootxmini168b.upload.tool=arduino:avrdude
|
||||
optibootxmini168b.upload.protocol=arduino
|
||||
optibootxmini168b.upload.speed=57600
|
||||
|
||||
optibootxmini168b.bootloader.tool=arduino:avrdude
|
||||
optibootxmini168b.bootloader.unlock_bits=0x3F
|
||||
optibootxmini168b.bootloader.lock_bits=0x2F
|
||||
|
||||
optibootxmini168b.build.f_cpu=16000000L
|
||||
|
||||
optibootxmini168b.build.board=AVR_UNO
|
||||
optibootxmini168b.build.core=arduino:arduino
|
||||
optibootxmini168b.build.variant=arduino:standard
|
||||
|
||||
optibootxmini168b.upload.maximum_size=15872
|
||||
optibootxmini168b.upload.maximum_data_size=1024
|
||||
|
||||
optibootxmini168b.bootloader.low_fuses=0xBF
|
||||
optibootxmini168b.bootloader.high_fuses=0xCE
|
||||
optibootxmini168b.bootloader.extended_fuses=0xFF
|
||||
optibootxmini168b.bootloader.file=optiboot/optiboot_xplained168b.hex
|
||||
|
||||
optibootxmini168b.build.mcu=atmega168
|
||||
|
||||
#############################
|
||||
|
||||
|
||||
optibootxmini328pb.name=Optiboot Xplained Mini 328pb
|
||||
|
||||
optibootxmini328pb.upload.tool=arduino:avrdude
|
||||
optibootxmini328pb.upload.protocol=arduino
|
||||
optibootxmini328pb.upload.speed=57600
|
||||
|
||||
optibootxmini328pb.bootloader.tool=arduino:avrdude
|
||||
optibootxmini328pb.bootloader.unlock_bits=0x3F
|
||||
optibootxmini328pb.bootloader.lock_bits=0x2F
|
||||
|
||||
optibootxmini328pb.build.f_cpu=16000000L
|
||||
|
||||
optibootxmini328pb.build.board=AVR_UNO
|
||||
optibootxmini328pb.build.core=arduino:arduino
|
||||
optibootxmini328pb.build.variant=arduino:standard
|
||||
|
||||
optibootxmini328pb.upload.maximum_size=32128
|
||||
optibootxmini328pb.upload.maximum_data_size=1024
|
||||
|
||||
optibootxmini328pb.bootloader.low_fuses=0xBF
|
||||
optibootxmini328pb.bootloader.high_fuses=0xCE
|
||||
optibootxmini328pb.bootloader.extended_fuses=0xFF
|
||||
optibootxmini328pb.bootloader.file=optiboot/optiboot_xplained328pb.hex
|
||||
|
||||
optibootxmini328pb.build.mcu=atmega328p
|
||||
|
||||
#############################
|
||||
|
||||
|
||||
optibootxmini328p.name=Optiboot Xplained Mini 328p
|
||||
|
||||
optibootxmini328p.upload.tool=arduino:avrdude
|
||||
optibootxmini328p.upload.protocol=arduino
|
||||
optibootxmini328p.upload.speed=57600
|
||||
|
||||
optibootxmini328p.bootloader.tool=arduino:avrdude
|
||||
optibootxmini328p.bootloader.unlock_bits=0x3F
|
||||
optibootxmini328p.bootloader.lock_bits=0x2F
|
||||
|
||||
optibootxmini328p.build.f_cpu=16000000L
|
||||
|
||||
optibootxmini328p.build.board=AVR_UNO
|
||||
optibootxmini328p.build.core=arduino:arduino
|
||||
optibootxmini328p.build.variant=arduino:standard
|
||||
|
||||
optibootxmini328p.upload.maximum_size=32128
|
||||
optibootxmini328p.upload.maximum_data_size=1024
|
||||
|
||||
optibootxmini328p.bootloader.low_fuses=0xBF
|
||||
optibootxmini328p.bootloader.high_fuses=0xCE
|
||||
optibootxmini328p.bootloader.extended_fuses=0xFF
|
||||
optibootxmini328p.bootloader.file=optiboot/optiboot_xplained328p.hex
|
||||
|
||||
optibootxmini328p.build.mcu=atmega328p
|
351
ActualOptiboot/optiboot/boards.txt
Normal file
351
ActualOptiboot/optiboot/boards.txt
Normal file
@ -0,0 +1,351 @@
|
||||
# Optiboot Arduino support
|
||||
# http://optiboot.googlecode.com
|
||||
# Peter Knight, 2010
|
||||
# Bill Westfield, 2013 - now includes build.variant for 1.0.2 and later
|
||||
|
||||
##############################################################
|
||||
|
||||
atmega328o.name=[Optiboot] Arduino Duemilanove or Nano w/ ATmega328
|
||||
atmega328o.upload.protocol=arduino
|
||||
atmega328o.upload.maximum_size=32256
|
||||
atmega328o.upload.speed=115200
|
||||
atmega328o.bootloader.low_fuses=0xff
|
||||
atmega328o.bootloader.high_fuses=0xde
|
||||
atmega328o.bootloader.extended_fuses=0x05
|
||||
atmega328o.bootloader.path=optiboot
|
||||
atmega328o.bootloader.file=optiboot_atmega328.hex
|
||||
atmega328o.bootloader.unlock_bits=0x3F
|
||||
atmega328o.bootloader.lock_bits=0x0F
|
||||
atmega328o.build.mcu=atmega328p
|
||||
atmega328o.build.f_cpu=16000000L
|
||||
atmega328o.build.core=arduino:arduino
|
||||
atmega328o.build.variant=arduino:standard
|
||||
|
||||
##############################################################
|
||||
|
||||
diecimilao.name=[Optiboot] Arduino Diecimila, Duemilanove, Nano, NG w/ ATmega168
|
||||
diecimilao.upload.protocol=arduino
|
||||
diecimilao.upload.maximum_size=15872
|
||||
diecimilao.upload.speed=115200
|
||||
diecimilao.bootloader.low_fuses=0xff
|
||||
diecimilao.bootloader.high_fuses=0xdd
|
||||
diecimilao.bootloader.extended_fuses=0x04
|
||||
diecimilao.bootloader.path=optiboot
|
||||
diecimilao.bootloader.file=optiboot_diecimila.hex
|
||||
diecimilao.bootloader.unlock_bits=0x3F
|
||||
diecimilao.bootloader.lock_bits=0x0F
|
||||
diecimilao.build.mcu=atmega168
|
||||
diecimilao.build.f_cpu=16000000L
|
||||
diecimilao.build.core=arduino:arduino
|
||||
diecimilao.build.variant=arduino:standard
|
||||
|
||||
##############################################################
|
||||
|
||||
minio.name=[Optiboot] Arduino Mini
|
||||
minio.upload.protocol=arduino
|
||||
minio.upload.maximum_size=15872
|
||||
minio.upload.speed=115200
|
||||
minio.bootloader.low_fuses=0xff
|
||||
minio.bootloader.high_fuses=0xdd
|
||||
minio.bootloader.extended_fuses=0x02
|
||||
minio.bootloader.path=optiboot
|
||||
minio.bootloader.file=optiboot_ng.hex
|
||||
minio.bootloader.unlock_bits=0x3F
|
||||
minio.bootloader.lock_bits=0x0F
|
||||
minio.build.mcu=atmega168
|
||||
minio.build.f_cpu=16000000L
|
||||
minio.build.core=arduino:arduino
|
||||
minio.build.variant=arduino:eightanaloginputs
|
||||
|
||||
##############################################################
|
||||
|
||||
lilypad328o.name=[Optiboot] LilyPad Arduino w/ ATmega328
|
||||
lilypad328o.upload.protocol=arduino
|
||||
lilypad328o.upload.maximum_size=32256
|
||||
lilypad328o.upload.speed=115200
|
||||
lilypad328o.bootloader.low_fuses=0xff
|
||||
lilypad328o.bootloader.high_fuses=0xdc
|
||||
lilypad328o.bootloader.extended_fuses=0x05
|
||||
lilypad328o.bootloader.path=optiboot
|
||||
lilypad328o.bootloader.file=optiboot_atmega328_pro_8MHz.hex
|
||||
lilypad328o.bootloader.unlock_bits=0x3F
|
||||
lilypad328o.bootloader.lock_bits=0x0F
|
||||
lilypad328o.build.mcu=atmega328p
|
||||
lilypad328o.build.f_cpu=8000000L
|
||||
lilypad328o.build.core=arduino:arduino
|
||||
lilypad328o.build.variant=arduino:standard
|
||||
|
||||
##############################################################
|
||||
|
||||
lilypado.name=[Optiboot] LilyPad Arduino w/ ATmega168
|
||||
lilypado.upload.protocol=arduino
|
||||
lilypado.upload.maximum_size=15872
|
||||
lilypado.upload.speed=115200
|
||||
lilypado.bootloader.low_fuses=0xe2
|
||||
lilypado.bootloader.high_fuses=0xdd
|
||||
lilypado.bootloader.extended_fuses=0x02
|
||||
lilypado.bootloader.path=lilypad
|
||||
lilypado.bootloader.file=optiboot_lilypad.hex
|
||||
lilypado.bootloader.unlock_bits=0x3F
|
||||
lilypado.bootloader.lock_bits=0x0F
|
||||
lilypado.build.mcu=atmega168
|
||||
lilypado.build.f_cpu=8000000L
|
||||
lilypado.build.core=arduino:arduino
|
||||
lilypado.build.variant=arduino:standard
|
||||
|
||||
##############################################################
|
||||
|
||||
pro328o.name=[Optiboot] Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328
|
||||
pro328o.upload.protocol=arduino
|
||||
pro328o.upload.maximum_size=32256
|
||||
pro328o.upload.speed=115200
|
||||
pro328o.bootloader.low_fuses=0xff
|
||||
pro328o.bootloader.high_fuses=0xdc
|
||||
pro328o.bootloader.extended_fuses=0x05
|
||||
pro328o.bootloader.path=optiboot
|
||||
pro328o.bootloader.file=optiboot_atmega328_pro_8MHz.hex
|
||||
pro328o.bootloader.unlock_bits=0x3F
|
||||
pro328o.bootloader.lock_bits=0x0F
|
||||
pro328o.build.mcu=atmega328p
|
||||
pro328o.build.f_cpu=8000000L
|
||||
pro328o.build.core=arduino:arduino
|
||||
pro328o.build.variant=arduino:standard
|
||||
|
||||
##############################################################
|
||||
|
||||
proo.name=[Optiboot] Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega168
|
||||
proo.upload.protocol=arduino
|
||||
proo.upload.maximum_size=15872
|
||||
proo.upload.speed=115200
|
||||
proo.bootloader.low_fuses=0xc6
|
||||
proo.bootloader.high_fuses=0xdd
|
||||
proo.bootloader.extended_fuses=0x02
|
||||
proo.bootloader.path=optiboot
|
||||
proo.bootloader.file=optiboot_pro_8MHz.hex
|
||||
proo.bootloader.unlock_bits=0x3F
|
||||
proo.bootloader.lock_bits=0x0F
|
||||
proo.build.mcu=atmega168
|
||||
proo.build.f_cpu=8000000L
|
||||
proo.build.core=arduino:arduino
|
||||
proo.build.variant=arduino:standard
|
||||
|
||||
##############################################################
|
||||
|
||||
megao.name=[Optiboot] Arduino Mega1280
|
||||
megao.upload.protocol=arduino
|
||||
megao.upload.maximum_size=130048
|
||||
megao.upload.speed=115200
|
||||
megao.bootloader.low_fuses=0xff
|
||||
megao.bootloader.high_fuses=0xde
|
||||
megao.bootloader.extended_fuses=0xf5
|
||||
megao.bootloader.path=optiboot
|
||||
megao.bootloader.file=optiboot_atmega1280.hex
|
||||
megao.bootloader.unlock_bits=0x3F
|
||||
megao.bootloader.lock_bits=0x0F
|
||||
megao.build.mcu=atmega1280
|
||||
megao.build.f_cpu=16000000L
|
||||
megao.build.core=arduino:arduino
|
||||
megao.build.variant=arduino:mega
|
||||
|
||||
atmega8o.name=[Optiboot] Arduino NG or older w/ ATmega8
|
||||
atmega8o.upload.protocol=arduino
|
||||
atmega8o.upload.maximum_size=7680
|
||||
atmega8o.upload.speed=115200
|
||||
atmega8o.bootloader.low_fuses=0xbf
|
||||
atmega8o.bootloader.high_fuses=0xdc
|
||||
atmega8o.bootloader.path=optiboot
|
||||
atmega8o.bootloader.file=optiboot_atmega8.hex
|
||||
atmega8o.bootloader.unlock_bits=0x3F
|
||||
atmega8o.bootloader.lock_bits=0x0F
|
||||
atmega8o.build.mcu=atmega8
|
||||
atmega8o.build.f_cpu=16000000L
|
||||
atmega8o.build.core=arduino:arduino
|
||||
atmega8o.build.variant=arduino:standard
|
||||
|
||||
atmega88o.name=[Optiboot] Arduino NG or older w/ ATmega88
|
||||
atmega88o.upload.protocol=arduino
|
||||
atmega88o.upload.maximum_size=7680
|
||||
atmega88o.upload.speed=115200
|
||||
atmega88o.bootloader.low_fuses=0xff
|
||||
atmega88o.bootloader.high_fuses=0xdd
|
||||
atmega88o.bootloader.extended_fuses=0x04
|
||||
atmega88o.bootloader.path=optiboot
|
||||
atmega88o.bootloader.file=optiboot_atmega88.hex
|
||||
atmega88o.bootloader.unlock_bits=0x3F
|
||||
atmega88o.bootloader.lock_bits=0x0F
|
||||
atmega88o.build.mcu=atmega88
|
||||
atmega88o.build.f_cpu=16000000L
|
||||
atmega88o.build.core=arduino:arduino
|
||||
atmega88o.build.variant=arduino:standard
|
||||
|
||||
##############################################################
|
||||
#
|
||||
# sanguinoo.name=[Optiboot] Sanguino (work in progress)
|
||||
# sanguinoo.upload.protocol=arduino
|
||||
# sanguinoo.upload.maximum_size=63488
|
||||
# sanguinoo.upload.speed=115200
|
||||
# sanguinoo.bootloader.low_fuses=0xff
|
||||
# sanguinoo.bootloader.high_fuses=0xdc
|
||||
# sanguinoo.bootloader.extended_fuses=0xfd
|
||||
# sanguinoo.bootloader.path=optiboot
|
||||
# sanguinoo.bootloader.file=optiboot_atmega644p.hex
|
||||
# sanguinoo.bootloader.unlock_bits=0x3F
|
||||
# sanguinoo.bootloader.lock_bits=0x0F
|
||||
# sanguinoo.build.mcu=atmega644p
|
||||
# sanguinoo.build.f_cpu=16000000L
|
||||
# sanguinoo.build.core=sanguino:sanguino
|
||||
# sanguinoo.build.variant=sanguino:sanguino
|
||||
|
||||
##############################################################
|
||||
#
|
||||
# lumineto.name=[Optiboot] Luminet (work in progress)
|
||||
# lumineto.upload.protocol=arduino
|
||||
# lumineto.upload.maximum_size=7424
|
||||
# lumineto.upload.speed=9600
|
||||
# lumineto.bootloader.low_fuses=0x62
|
||||
# lumineto.bootloader.high_fuses=0xdf
|
||||
# lumineto.bootloader.extended_fuses=0xfe
|
||||
# lumineto.bootloader.path=optiboot
|
||||
# lumineto.bootloader.file=optiboot_luminet.hex
|
||||
# lumineto.build.mcu=attiny84
|
||||
# lumineto.build.f_cpu=1000000L
|
||||
# lumineto.build.core=luminet:luminet
|
||||
|
||||
##############################################################
|
||||
|
||||
atmega32o.name=[Optiboot] ATmega32 based board
|
||||
atmega32o.upload.protocol=arduino
|
||||
atmega32o.upload.maximum_size=32256
|
||||
atmega32o.upload.speed=115200
|
||||
atmega32o.bootloader.low_fuses=0xff
|
||||
atmega32o.bootloader.high_fuses=0xde
|
||||
atmega32o.bootloader.path=optiboot
|
||||
atmega32o.bootloader.file=optiboot_atmega32.hex
|
||||
atmega32o.bootloader.unlock_bits=0x3F
|
||||
atmega32o.bootloader.lock_bits=0x0F
|
||||
atmega32o.build.mcu=atmega32
|
||||
atmega32o.build.f_cpu=16000000L
|
||||
atmega32o.build.core=arduino:arduino
|
||||
atmega32o.build.variant=arduino:standard
|
||||
|
||||
##############################################################
|
||||
|
||||
atmega1284o.name=[Optiboot] ATmega1284p
|
||||
atmega1284o.upload.protocol=arduino
|
||||
atmega1284o.upload.maximum_size=130048
|
||||
atmega1284o.upload.speed=115200
|
||||
atmega1284o.bootloader.low_fuses=0xf7
|
||||
atmega1284o.bootloader.high_fuses=0xde
|
||||
atmega1284o.bootloader.extended_fuses=0x05
|
||||
atmega1284o.bootloader.path=optiboot
|
||||
atmega1284o.bootloader.file=optiboot_atmega1284p.hex
|
||||
atmega1284o.bootloader.unlock_bits=0x3F
|
||||
atmega1284o.bootloader.lock_bits=0x0F
|
||||
atmega1284o.build.mcu=atmega1284p
|
||||
atmega1284o.build.f_cpu=16000000L
|
||||
atmega1284o.build.core=arduino:arduino
|
||||
atmega1284o.build.variant=arduino:standard
|
||||
|
||||
##############################################################
|
||||
|
||||
mega2560o.name=[Optiboot] Arduino Mega2560
|
||||
mega2560o.upload.protocol=arduino
|
||||
mega2560o.upload.maximum_size=261120
|
||||
mega2560o.upload.speed=115200
|
||||
mega2560o.bootloader.low_fuses=0xf7
|
||||
mega2560o.bootloader.high_fuses=0xde
|
||||
mega2560o.bootloader.extended_fuses=0xfd
|
||||
mega2560o.bootloader.path=optiboot
|
||||
mega2560o.bootloader.file=optiboot_atmega2560.hex
|
||||
mega2560o.bootloader.unlock_bits=0x3F
|
||||
mega2560o.bootloader.lock_bits=0x0F
|
||||
mega2560o.build.mcu=atmega2560
|
||||
mega2560o.build.f_cpu=16000000L
|
||||
mega2560o.build.core=arduino:arduino
|
||||
mega2560o.build.variant=arduino:mega
|
||||
|
||||
##############################################################
|
||||
|
||||
optibootxmini168b.name=Optiboot Xplained Mini 168pb
|
||||
|
||||
optibootxmini168b.upload.tool=arduino:avrdude
|
||||
optibootxmini168b.upload.protocol=arduino
|
||||
optibootxmini168b.upload.speed=57600
|
||||
|
||||
optibootxmini168b.bootloader.tool=arduino:avrdude
|
||||
optibootxmini168b.bootloader.unlock_bits=0x3F
|
||||
optibootxmini168b.bootloader.lock_bits=0x2F
|
||||
|
||||
optibootxmini168b.build.f_cpu=16000000L
|
||||
|
||||
optibootxmini168b.build.board=AVR_UNO
|
||||
optibootxmini168b.build.core=arduino:arduino
|
||||
optibootxmini168b.build.variant=arduino:standard
|
||||
|
||||
optibootxmini168b.upload.maximum_size=15872
|
||||
optibootxmini168b.upload.maximum_data_size=1024
|
||||
|
||||
optibootxmini168b.bootloader.low_fuses=0xBF
|
||||
optibootxmini168b.bootloader.high_fuses=0xCE
|
||||
optibootxmini168b.bootloader.extended_fuses=0xFF
|
||||
optibootxmini168b.bootloader.file=optiboot/optiboot_xplained168b.hex
|
||||
|
||||
optibootxmini168b.build.mcu=atmega168
|
||||
|
||||
#############################
|
||||
|
||||
|
||||
optibootxmini328pb.name=Optiboot Xplained Mini 328pb
|
||||
|
||||
optibootxmini328pb.upload.tool=arduino:avrdude
|
||||
optibootxmini328pb.upload.protocol=arduino
|
||||
optibootxmini328pb.upload.speed=57600
|
||||
|
||||
optibootxmini328pb.bootloader.tool=arduino:avrdude
|
||||
optibootxmini328pb.bootloader.unlock_bits=0x3F
|
||||
optibootxmini328pb.bootloader.lock_bits=0x2F
|
||||
|
||||
optibootxmini328pb.build.f_cpu=16000000L
|
||||
|
||||
optibootxmini328pb.build.board=AVR_UNO
|
||||
optibootxmini328pb.build.core=arduino:arduino
|
||||
optibootxmini328pb.build.variant=arduino:standard
|
||||
|
||||
optibootxmini328pb.upload.maximum_size=32128
|
||||
optibootxmini328pb.upload.maximum_data_size=1024
|
||||
|
||||
optibootxmini328pb.bootloader.low_fuses=0xBF
|
||||
optibootxmini328pb.bootloader.high_fuses=0xCE
|
||||
optibootxmini328pb.bootloader.extended_fuses=0xFF
|
||||
optibootxmini328pb.bootloader.file=optiboot/optiboot_xplained328pb.hex
|
||||
|
||||
optibootxmini328pb.build.mcu=atmega328p
|
||||
|
||||
#############################
|
||||
|
||||
|
||||
optibootxmini328p.name=Optiboot Xplained Mini 328p
|
||||
|
||||
optibootxmini328p.upload.tool=arduino:avrdude
|
||||
optibootxmini328p.upload.protocol=arduino
|
||||
optibootxmini328p.upload.speed=57600
|
||||
|
||||
optibootxmini328p.bootloader.tool=arduino:avrdude
|
||||
optibootxmini328p.bootloader.unlock_bits=0x3F
|
||||
optibootxmini328p.bootloader.lock_bits=0x2F
|
||||
|
||||
optibootxmini328p.build.f_cpu=16000000L
|
||||
|
||||
optibootxmini328p.build.board=AVR_UNO
|
||||
optibootxmini328p.build.core=arduino:arduino
|
||||
optibootxmini328p.build.variant=arduino:standard
|
||||
|
||||
optibootxmini328p.upload.maximum_size=32128
|
||||
optibootxmini328p.upload.maximum_data_size=1024
|
||||
|
||||
optibootxmini328p.bootloader.low_fuses=0xBF
|
||||
optibootxmini328p.bootloader.high_fuses=0xCE
|
||||
optibootxmini328p.bootloader.extended_fuses=0xFF
|
||||
optibootxmini328p.bootloader.file=optiboot/optiboot_xplained328p.hex
|
||||
|
||||
optibootxmini328p.build.mcu=atmega328p
|
616
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile
Normal file
616
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile
Normal file
@ -0,0 +1,616 @@
|
||||
# Makefile for ATmegaBOOT
|
||||
# E.Lins, 18.7.2005
|
||||
# $Id$
|
||||
#
|
||||
# Instructions
|
||||
#
|
||||
# To make bootloader .hex file:
|
||||
# make diecimila
|
||||
# make lilypad
|
||||
# make ng
|
||||
# etc...
|
||||
#
|
||||
# To burn bootloader .hex file:
|
||||
# make diecimila_isp
|
||||
# make lilypad_isp
|
||||
# make ng_isp
|
||||
# etc...
|
||||
#
|
||||
# Edit History
|
||||
# 201406xx: WestfW: More Makefile restructuring.
|
||||
# Split off Makefile.1284, Makefile.extras, Makefile.custom
|
||||
# So that in theory, the main Makefile contains only the
|
||||
# official platforms, and does not need to be modified to
|
||||
# add "less supported" chips and boards.
|
||||
# 201303xx: WestfW: Major Makefile restructuring.
|
||||
# Allows options on Make command line "make xx LED=B3"
|
||||
# (see also pin_defs.h)
|
||||
# Divide into "chip" targets and "board" targets.
|
||||
# Most boards are (recursive) board targets with options.
|
||||
# Move isp target to separate makefile (fixes m8 EFUSE)
|
||||
# Some (many) targets will now be rebuilt when not
|
||||
# strictly necessary, so that options will be included.
|
||||
# (any "make" with options will always compile.)
|
||||
# Set many variables with ?= so they can be overridden
|
||||
# Use arduinoISP settings as default for ISP targets
|
||||
#
|
||||
#
|
||||
# * Copyright 2013-2015 by Bill Westfield. Part of Optiboot.
|
||||
# * This software is licensed under version 2 of the Gnu Public Licence.
|
||||
# * See optiboot.c for details.
|
||||
|
||||
HELPTEXT = ""
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# program name should not be changed...
|
||||
PROGRAM = optiboot
|
||||
|
||||
# The default behavior is to build using tools that are in the users
|
||||
# current path variables, but we can also build using an installed
|
||||
# Arduino user IDE setup, or the Arduino source tree.
|
||||
# Uncomment this next lines to build within the arduino environment,
|
||||
# using the arduino-included avrgcc toolset (mac and pc)
|
||||
# ENV ?= arduino
|
||||
# ENV ?= arduinodev
|
||||
# OS ?= macosx
|
||||
# OS ?= windows
|
||||
|
||||
# export symbols to recursive makes (for ISP)
|
||||
export
|
||||
|
||||
# defaults
|
||||
MCU_TARGET = atmega168
|
||||
LDSECTIONS = -Wl,--section-start=.text=0x3e00 -Wl,--section-start=.version=0x3ffe
|
||||
|
||||
# Build environments
|
||||
# Start of some ugly makefile-isms to allow optiboot to be built
|
||||
# in several different environments. See the README.TXT file for
|
||||
# details.
|
||||
|
||||
# default
|
||||
fixpath = $(1)
|
||||
SH := bash
|
||||
|
||||
ifeq ($(ENV), arduino)
|
||||
# For Arduino, we assume that we're connected to the optiboot directory
|
||||
# included with the arduino distribution, which means that the full set
|
||||
# of avr-tools are "right up there" in standard places.
|
||||
# (except that in 1.5.x, there's an additional level of "up")
|
||||
TESTDIR := $(firstword $(wildcard ../../../tools/*))
|
||||
ifeq (,$(TESTDIR))
|
||||
# Arduino 1.5.x tool location compared to optiboot dir
|
||||
TOOLROOT = ../../../../tools
|
||||
else
|
||||
# Arduino 1.0 (and earlier) tool location
|
||||
TOOLROOT = ../../../tools
|
||||
endif
|
||||
GCCROOT = $(TOOLROOT)/avr/bin/
|
||||
|
||||
ifeq ($(OS), windows)
|
||||
# On windows, SOME of the tool paths will need to have backslashes instead
|
||||
# of forward slashes (because they use windows cmd.exe for execution instead
|
||||
# of a unix/mingw shell?) We also have to ensure that a consistent shell
|
||||
# is used even if a unix shell is installed (ie as part of WINAVR)
|
||||
fixpath = $(subst /,\,$1)
|
||||
SHELL = cmd.exe
|
||||
SH = sh
|
||||
endif
|
||||
|
||||
else ifeq ($(ENV), arduinodev)
|
||||
# Arduino IDE source code environment. Use the unpacked compilers created
|
||||
# by the build (you'll need to do "ant build" first.)
|
||||
ifeq ($(OS), macosx)
|
||||
TOOLROOT = ../../../../build/macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools
|
||||
endif
|
||||
ifeq ($(OS), windows)
|
||||
TOOLROOT = ../../../../build/windows/work/hardware/tools
|
||||
endif
|
||||
|
||||
GCCROOT = $(TOOLROOT)/avr/bin/
|
||||
AVRDUDE_CONF = -C$(TOOLROOT)/avr/etc/avrdude.conf
|
||||
|
||||
else
|
||||
GCCROOT =
|
||||
AVRDUDE_CONF =
|
||||
endif
|
||||
|
||||
STK500 = "C:\Program Files\Atmel\AVR Tools\STK500\Stk500.exe"
|
||||
STK500-1 = $(STK500) -e -d$(MCU_TARGET) -pf -vf -if$(PROGRAM)_$(TARGET).hex \
|
||||
-lFF -LFF -f$(HFUSE)$(LFUSE) -EF8 -ms -q -cUSB -I200kHz -s -wt
|
||||
STK500-2 = $(STK500) -d$(MCU_TARGET) -ms -q -lCF -LCF -cUSB -I200kHz -s -wt
|
||||
#
|
||||
# End of build environment code.
|
||||
|
||||
|
||||
OBJ = $(PROGRAM).o
|
||||
OPTIMIZE = -Os -fno-split-wide-types -mrelax
|
||||
|
||||
DEFS =
|
||||
|
||||
CC = $(GCCROOT)avr-gcc
|
||||
|
||||
# Override is only needed by avr-lib build system.
|
||||
|
||||
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS)
|
||||
override LDFLAGS = $(LDSECTIONS) -Wl,--relax -nostartfiles
|
||||
|
||||
OBJCOPY = $(GCCROOT)avr-objcopy
|
||||
OBJDUMP = $(call fixpath,$(GCCROOT)avr-objdump)
|
||||
|
||||
SIZE = $(GCCROOT)avr-size
|
||||
|
||||
#
|
||||
# Make command-line Options.
|
||||
# Permit commands like "make atmega328 LED_START_FLASHES=10" to pass the
|
||||
# appropriate parameters ("-DLED_START_FLASHES=10") to gcc
|
||||
#
|
||||
|
||||
HELPTEXT += "Option BAUD_RATE=nnnn - set the bit rate for communications\n"
|
||||
ifdef BAUD_RATE
|
||||
BAUD_RATE_CMD = -DBAUD_RATE=$(BAUD_RATE)
|
||||
dummy = FORCE
|
||||
else
|
||||
BAUD_RATE_CMD = -DBAUD_RATE=115200
|
||||
endif
|
||||
|
||||
HELPTEXT += "Option LED=B3 - set LED pin to particular port/bit\n"
|
||||
ifdef LED
|
||||
LED_CMD = -DLED=$(LED)
|
||||
dummy = FORCE
|
||||
endif
|
||||
|
||||
HELPTEXT += "Option LED_START_FLASHES=n - set number of LED flashes when bootloader starts\n"
|
||||
ifdef LED_START_FLASHES
|
||||
LED_START_FLASHES_CMD = -DLED_START_FLASHES=$(LED_START_FLASHES)
|
||||
dummy = FORCE
|
||||
else
|
||||
LED_START_FLASHES_CMD = -DLED_START_FLASHES=3
|
||||
endif
|
||||
|
||||
HELPTEXT += "Option LED_DATA_FLASH=1 - flash the LED each time data is received.\n"
|
||||
ifdef LED_DATA_FLASH
|
||||
ifneq ($(LED_DATA_FLASH), 0)
|
||||
LED_DATA_FLASH_CMD = -DLED_DATA_FLASH=1
|
||||
dummy = FORCE
|
||||
endif
|
||||
endif
|
||||
|
||||
HELPTEXT += "Option LED_START_ON=1 - Turn the LED on at bootload start\n"
|
||||
ifdef LED_START_ON
|
||||
ifneq ($(LED_START_ON), 0)
|
||||
LED_START_ON_CMD = -DLED_START_ON=1
|
||||
endif
|
||||
dummy = FORCE
|
||||
endif
|
||||
|
||||
HELPTEXT += "Option BIGBOOT=1 - enable extra features up to 1kbytes\n"
|
||||
# BIGBOOT: Include extra features, up to 1K.
|
||||
ifdef BIGBOOT
|
||||
ifneq ($(BIGBOOT), 0)
|
||||
BIGBOOT_CMD = -DBIGBOOT=1
|
||||
dummy = FORCE
|
||||
endif
|
||||
endif
|
||||
|
||||
HELPTEXT += "Option SUPPORT_EEPROM=1 - Include code to read/write EEPROM\n"
|
||||
ifdef SUPPORT_EEPROM
|
||||
ifneq ($(SUPPORT_EEPROM), 0)
|
||||
SUPPORT_EEPROM_CMD = -DSUPPORT_EEPROM
|
||||
dummy = FORCE
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
HELPTEXT += "Option SOFT_UART=1 - use a software (bit-banged) UART\n"
|
||||
ifdef SOFT_UART
|
||||
ifneq ($(SOFT_UART), 0)
|
||||
SOFT_UART_CMD = -DSOFT_UART=1
|
||||
dummy = FORCE
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef SINGLESPEED
|
||||
ifneq ($(SINGLESPEED), 0)
|
||||
SS_CMD = -DSINGLESPEED=1
|
||||
endif
|
||||
endif
|
||||
|
||||
COMMON_OPTIONS = $(BAUD_RATE_CMD) $(LED_START_FLASHES_CMD) $(BIGBOOT_CMD)
|
||||
COMMON_OPTIONS += $(SOFT_UART_CMD) $(LED_DATA_FLASH_CMD) $(LED_CMD) $(SS_CMD)
|
||||
COMMON_OPTIONS += $(SUPPORT_EEPROM_CMD) $(LED_START_ON_CMD)
|
||||
|
||||
#UART is handled separately and only passed for devices with more than one.
|
||||
HELPTEXT += "Option UART=n - use UARTn for communications\n"
|
||||
ifdef UART
|
||||
UART_CMD = -DUART=$(UART)
|
||||
endif
|
||||
|
||||
|
||||
# Not supported yet
|
||||
# ifdef TIMEOUT_MS
|
||||
# TIMEOUT_MS_CMD = -DTIMEOUT_MS=$(TIMEOUT_MS)
|
||||
# dummy = FORCE
|
||||
# endif
|
||||
#
|
||||
|
||||
#.PRECIOUS: %.elf
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# "Chip-level Platform" targets.
|
||||
# A "Chip-level Platform" compiles for a particular chip, but probably does
|
||||
# not have "standard" values for things like clock speed, LED pin, etc.
|
||||
# Makes for chip-level platforms should usually explicitly define their
|
||||
# options like: "make atmega1285 AVR_FREQ=16000000L LED=D0"
|
||||
#---------------------------------------------------------------------------
|
||||
#
|
||||
# Note about fuses:
|
||||
# the efuse should really be 0xf8; since, however, only the lower
|
||||
# three bits of that byte are used on the atmega168, avrdude gets
|
||||
# confused if you specify 1's for the higher bits, see:
|
||||
# http://tinker.it/now/2007/02/24/the-tale-of-avrdude-atmega168-and-extended-bits-fuses/
|
||||
#
|
||||
# similarly, the lock bits should be 0xff instead of 0x3f (to
|
||||
# unlock the bootloader section) and 0xcf instead of 0x2f (to
|
||||
# lock it), but since the high two bits of the lock byte are
|
||||
# unused, avrdude would get confused.
|
||||
#---------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
HELPTEXT += "\n-------------\n\n"
|
||||
|
||||
# Test platforms
|
||||
# Virtual boot block test
|
||||
HELPTEXT += "target virboot8 - ATmega8 with virtual boot partition\n"
|
||||
virboot8: TARGET = atmega8
|
||||
virboot8: MCU_TARGET = atmega8
|
||||
virboot8: CFLAGS += $(COMMON_OPTIONS) '-DVIRTUAL_BOOT_PARTITION' '-Dsave_vect_num=EE_RDY_vect_num'
|
||||
virboot8: AVR_FREQ ?= 16000000L
|
||||
# Start address of 1D80 allows for size up to 640 bytes, app up to 7552
|
||||
virboot8: LDSECTIONS = -Wl,--section-start=.text=0x1d80 -Wl,--section-start=.version=0x1ffe
|
||||
virboot8: $(PROGRAM)_virboot8.hex
|
||||
virboot8: $(PROGRAM)_virboot8.lst
|
||||
|
||||
|
||||
HELPTEXT += "target virboot328p - ATmega328 with virtual boot partition\n"
|
||||
virboot328: TARGET = atmega328
|
||||
virboot328: MCU_TARGET = atmega328p
|
||||
virboot328: CFLAGS += $(COMMON_OPTIONS) '-DVIRTUAL_BOOT_PARTITION'
|
||||
virboot328: AVR_FREQ ?= 16000000L
|
||||
virboot328: LDSECTIONS = -Wl,--section-start=.text=0x7d80 -Wl,--section-start=.version=0x7ffe
|
||||
virboot328: $(PROGRAM)_virboot328.hex
|
||||
virboot328: $(PROGRAM)_virboot328.lst
|
||||
|
||||
virboot328_isp: virboot328
|
||||
virboot328_isp: TARGET = virboot328
|
||||
virboot328_isp: MCU_TARGET = atmega328p
|
||||
# no boot section, SPIEN
|
||||
virboot328_isp: HFUSE ?= DF
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
virboot328_isp: LFUSE ?= FF
|
||||
# 2.7V brownout
|
||||
virboot328_isp: EFUSE ?= FD
|
||||
virboot328_isp: isp
|
||||
|
||||
virboot8_isp: virboot8
|
||||
virboot8_isp: TARGET = virboot8
|
||||
virboot8_isp: MCU_TARGET = atmega8
|
||||
# SPIEN, CKOPT (for full swing xtal), boot section 1k
|
||||
# Note that we need boot section to include our SPM instructions,
|
||||
# even though we do not enable BOOTRST
|
||||
virboot8_isp: HFUSE ?= CB
|
||||
# 2.7V brownout, 16MHz Xtal, 16KCK/14CK+65ms
|
||||
virboot8_isp: LFUSE ?= BF
|
||||
virboot8_isp: isp
|
||||
|
||||
|
||||
|
||||
# Diecimila, Duemilanove with m168, and NG use identical bootloaders
|
||||
# Call it "atmega168" for generality and clarity, keep "diecimila" for
|
||||
# backward compatibility of makefile
|
||||
|
||||
# ATmega8
|
||||
#
|
||||
HELPTEXT += "target atmega8 - ATmega8, ATmega8A, ATmega8L\n"
|
||||
atmega8: TARGET = atmega8
|
||||
atmega8: MCU_TARGET = atmega8
|
||||
atmega8: CFLAGS += $(COMMON_OPTIONS)
|
||||
atmega8: AVR_FREQ ?= 16000000L
|
||||
ifndef BIGBOOT
|
||||
atmega8: LDSECTIONS = -Wl,--section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe -Wl,--gc-sections -Wl,--undefined=optiboot_version
|
||||
else
|
||||
atmega8: LDSECTIONS = -Wl,--section-start=.text=0x1c00 -Wl,--section-start=.version=0x1ffe -Wl,--gc-sections -Wl,--undefined=optiboot_version
|
||||
endif
|
||||
atmega8: $(PROGRAM)_atmega8.hex
|
||||
atmega8: $(PROGRAM)_atmega8.lst
|
||||
|
||||
atmega8_isp: atmega8
|
||||
atmega8_isp: TARGET = atmega8
|
||||
atmega8_isp: MCU_TARGET = atmega8
|
||||
ifndef BIGBOOT
|
||||
# SPIEN, CKOPT (for full swing xtal), Bootsize=512B
|
||||
atmega8_isp: HFUSE ?= CC
|
||||
else
|
||||
# SPIEN, CKOPT (for full swing xtal), Bootsize=1024B
|
||||
atmega8_isp: HFUSE ?= CA
|
||||
endif
|
||||
# 2.7V brownout, 16MHz Xtal, 16KCK/14CK+65ms
|
||||
atmega8_isp: LFUSE ?= BF
|
||||
atmega8_isp: isp
|
||||
|
||||
HELPTEXT += "target atmega168 - ATmega168, ATmega168A\n"
|
||||
atmega168: TARGET = atmega168
|
||||
atmega168: MCU_TARGET = atmega168
|
||||
atmega168: CFLAGS += $(COMMON_OPTIONS)
|
||||
atmega168: AVR_FREQ ?= 16000000L
|
||||
ifndef BIGBOOT
|
||||
atmega168: LDSECTIONS = -Wl,--section-start=.text=0x3e00 -Wl,--section-start=.version=0x3ffe
|
||||
else
|
||||
atmeg168: LDSECTIONS = -Wl,--section-start=.text=0x3c00 -Wl,--section-start=.version=0x3ffe
|
||||
endif
|
||||
atmega168: $(PROGRAM)_atmega168.hex
|
||||
atmega168: $(PROGRAM)_atmega168.lst
|
||||
|
||||
atmega168_isp: atmega168
|
||||
atmega168_isp: TARGET = atmega168
|
||||
# 2.7V brownout
|
||||
atmega168_isp: HFUSE ?= DD
|
||||
# Full swing (16MHz) 16KCK/14CK+65ms
|
||||
atmega168_isp: LFUSE ?= F7
|
||||
ifndef BIGBOOT
|
||||
# 512 byte boot
|
||||
atmega168_isp: EFUSE ?= 04
|
||||
else
|
||||
# 1024byte boot
|
||||
atmega168_isp: EFUSE ?= FA
|
||||
endif
|
||||
atmega168_isp: isp
|
||||
|
||||
HELPTEXT += "target atmega328 - ATmega328p\n"
|
||||
atmega328: TARGET = atmega328
|
||||
atmega328: MCU_TARGET = atmega328p
|
||||
atmega328: CFLAGS += $(COMMON_OPTIONS)
|
||||
atmega328: AVR_FREQ ?= 16000000L
|
||||
ifndef BIGBOOT
|
||||
atmega328: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
|
||||
else
|
||||
# bigboot version is 1k long; starts earlier
|
||||
atmega328: LDSECTIONS = -Wl,--section-start=.text=0x7c00 -Wl,--section-start=.version=0x7ffe
|
||||
endif
|
||||
atmega328: $(PROGRAM)_atmega328.hex
|
||||
atmega328: $(PROGRAM)_atmega328.lst
|
||||
|
||||
atmega328_isp: atmega328
|
||||
atmega328_isp: TARGET = atmega328
|
||||
atmega328_isp: MCU_TARGET = atmega328p
|
||||
ifndef BIGBOOT
|
||||
# 512 byte boot, SPIEN
|
||||
atmega328_isp: HFUSE ?= DE
|
||||
else
|
||||
# 1k byte boot, SPIEN
|
||||
atmega328_isp: HFUSE ?= DC
|
||||
endif
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega328_isp: LFUSE ?= FF
|
||||
# 2.7V brownout
|
||||
atmega328_isp: EFUSE ?= FD
|
||||
atmega328_isp: isp
|
||||
|
||||
#Atmega1280
|
||||
HELPTEXT += "target atmega1280 - ATmega1280 (100pin, 128k)\n"
|
||||
atmega1280: MCU_TARGET = atmega1280
|
||||
atmega1280: CFLAGS += $(COMMON_OPTIONS) -DBIGBOOT $(UART_CMD)
|
||||
atmega1280: AVR_FREQ ?= 16000000L
|
||||
atmega1280: LDSECTIONS = -Wl,--section-start=.text=0x1fc00 -Wl,--section-start=.version=0x1fffe
|
||||
atmega1280: $(PROGRAM)_atmega1280.hex
|
||||
atmega1280: $(PROGRAM)_atmega1280.lst
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# "Board-level Platform" targets.
|
||||
# A "Board-level Platform" implies a manufactured platform with a particular
|
||||
# AVR_FREQ, LED, and so on. Parameters are not particularly changable from
|
||||
# the "make" command line.
|
||||
# Most of the board-level platform builds should envoke make recursively
|
||||
# appropriate specific options
|
||||
#---------------------------------------------------------------------------
|
||||
# 20MHz clocked platforms
|
||||
#
|
||||
# These are capable of 230400 baud, or 115200 baud on PC (Arduino Avrdude issue)
|
||||
#
|
||||
|
||||
pro20: TARGET = pro_20mhz
|
||||
pro20: CHIP = atmega168
|
||||
pro20:
|
||||
"$(MAKE)" atmega168 AVR_FREQ=20000000L LED_START_FLASHES=3
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
pro20_isp: pro20
|
||||
pro20_isp: TARGET = pro_20mhz
|
||||
# 4.3V brownout (for max speed!)
|
||||
pro20_isp: HFUSE ?= DC
|
||||
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
|
||||
pro20_isp: LFUSE ?= F7
|
||||
# 512 byte boot
|
||||
pro20_isp: EFUSE ?= 04
|
||||
pro20_isp: isp
|
||||
|
||||
# 16MHz clocked platforms
|
||||
#
|
||||
# These are capable of 230400 baud, or 115200 baud on PC (Arduino Avrdude issue)
|
||||
#
|
||||
|
||||
pro16: TARGET = pro_16MHz
|
||||
pro16: CHIP = atmega168
|
||||
pro16:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L LED_START_FLASHES=3
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
pro16_isp: pro16
|
||||
pro16_isp: TARGET = pro_16MHz
|
||||
# 2.7V brownout
|
||||
pro16_isp: HFUSE ?= DD
|
||||
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
|
||||
pro16_isp: LFUSE ?= F7
|
||||
# 512 byte boot
|
||||
pro16_isp: EFUSE ?= 04
|
||||
pro16_isp: isp
|
||||
|
||||
diecimila: TARGET = diecimila
|
||||
diecimila: CHIP = atmega168
|
||||
diecimila:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L LED_START_FLASHES=3
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
diecimila_isp: diecimila
|
||||
diecimila_isp: TARGET = diecimila
|
||||
# 2.7V brownout
|
||||
diecimila_isp: HFUSE ?= DD
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
diecimila_isp: LFUSE ?= F7
|
||||
# 512 byte boot
|
||||
diecimila_isp: EFUSE ?= 04
|
||||
diecimila_isp: isp
|
||||
|
||||
# MEGA1280 Board (this is different from the atmega1280 chip platform)
|
||||
# Mega has a minimum boot size of 1024 bytes, so enable extra functions
|
||||
# Note that optiboot does not (can not) work on the MEGA2560
|
||||
#mega: TARGET = atmega1280
|
||||
mega1280: atmega1280
|
||||
|
||||
mega1280_isp: mega1280
|
||||
mega1280_isp: TARGET = atmega1280
|
||||
mega1280_isp: MCU_TARGET = atmega1280
|
||||
# 1024 byte boot
|
||||
mega1280_isp: HFUSE ?= DE
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
mega1280_isp: LFUSE ?= FF
|
||||
# 2.7V brownout; wants F5 for some reason...
|
||||
mega1280_isp: EFUSE ?= F5
|
||||
mega1280_isp: isp
|
||||
|
||||
# 8MHz clocked platforms
|
||||
#
|
||||
# These are capable of 115200 baud
|
||||
# Note that "new" Arduinos with an AVR as USB/Serial converter will NOT work
|
||||
# with an 8MHz target Arduino. The bitrate errors are in opposite directions,
|
||||
# and total too large a number.
|
||||
#
|
||||
|
||||
lilypad: TARGET = $@
|
||||
lilypad: CHIP = atmega168
|
||||
lilypad:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=8000000L LED_START_FLASHES=3
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
lilypad_isp: lilypad
|
||||
lilypad_isp: TARGET = lilypad
|
||||
# 2.7V brownout
|
||||
lilypad_isp: HFUSE ?= DD
|
||||
# Internal 8MHz osc (8MHz) Slow rising power
|
||||
lilypad_isp: LFUSE ?= E2
|
||||
# 512 byte boot
|
||||
lilypad_isp: EFUSE ?= 04
|
||||
lilypad_isp: isp
|
||||
|
||||
# lilypad_resonator is the same as a 8MHz lilypad, except for fuses.
|
||||
lilypad_resonator: lilypad
|
||||
|
||||
lilypad_resonator_isp: lilypad
|
||||
lilypad_resonator_isp: TARGET = lilypad
|
||||
# 2.7V brownout
|
||||
lilypad_resonator_isp: HFUSE ?= DD
|
||||
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
|
||||
lilypad_resonator_isp: LFUSE ?= C6
|
||||
# 512 byte boot
|
||||
lilypad_resonator_isp: EFUSE ?= 04
|
||||
lilypad_resonator_isp: isp
|
||||
|
||||
pro8: TARGET = pro_8MHz
|
||||
pro8: CHIP = atmega168
|
||||
pro8:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=8000000L LED_START_FLASHES=3
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
pro8_isp: pro8
|
||||
pro8_isp: TARGET = pro_8MHz
|
||||
# 2.7V brownout
|
||||
pro8_isp: HFUSE ?= DD
|
||||
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
|
||||
pro8_isp: LFUSE ?= C6
|
||||
# 512 byte boot
|
||||
pro8_isp: EFUSE ?= 04
|
||||
pro8_isp: isp
|
||||
|
||||
atmega328_pro8: TARGET = atmega328_pro_8MHz
|
||||
atmega328_pro8: CHIP = atmega328
|
||||
atmega328_pro8:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=8000000L LED_START_FLASHES=3
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
atmega328_pro8_isp: atmega328_pro8
|
||||
atmega328_pro8_isp: TARGET = atmega328_pro_8MHz
|
||||
atmega328_pro8_isp: MCU_TARGET = atmega328p
|
||||
# 512 byte boot, SPIEN
|
||||
atmega328_pro8_isp: HFUSE ?= DE
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega328_pro8_isp: LFUSE ?= FF
|
||||
# 2.7V brownout
|
||||
atmega328_pro8_isp: EFUSE ?= 05
|
||||
atmega328_pro8_isp: isp
|
||||
|
||||
#
|
||||
# Include additional platforms
|
||||
include Makefile.atmel
|
||||
include Makefile.extras
|
||||
include Makefile.1284
|
||||
include Makefile.custom
|
||||
include Makefile.2560
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
#
|
||||
# Generic build instructions
|
||||
#
|
||||
|
||||
FORCE:
|
||||
|
||||
baudcheck: FORCE
|
||||
- @$(CC) --version
|
||||
- @$(CC) $(CFLAGS) -E baudcheck.c -o baudcheck.tmp.sh
|
||||
- @$(SH) baudcheck.tmp.sh
|
||||
|
||||
isp: $(TARGET)
|
||||
"$(MAKE)" -f Makefile.isp isp TARGET=$(TARGET)
|
||||
|
||||
isp-stk500: $(PROGRAM)_$(TARGET).hex
|
||||
$(STK500-1)
|
||||
$(STK500-2)
|
||||
|
||||
%.elf: $(OBJ) baudcheck $(dummy)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
|
||||
$(SIZE) $@
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex *.tmp.sh
|
||||
|
||||
%.lst: %.elf
|
||||
$(OBJDUMP) -h -S $< > $@
|
||||
|
||||
%.hex: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O ihex $< $@
|
||||
|
||||
%.srec: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O srec $< $@
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O binary $< $@
|
||||
|
||||
help:
|
||||
@echo $(HELPTEXT)
|
146
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.1284
Normal file
146
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.1284
Normal file
@ -0,0 +1,146 @@
|
||||
#
|
||||
# Makefile for 40-pin AVR chips, including ATmega644 and ATmega1284
|
||||
#
|
||||
# * Copyright 2013-2015 by Bill Westfield. Part of Optiboot.
|
||||
# * This software is licensed under version 2 of the Gnu Public Licence.
|
||||
# * See optiboot.c for details.
|
||||
|
||||
# Chip level targets
|
||||
#
|
||||
HELPTEXT += "target atmega644p - ATmega644p\n"
|
||||
atmega644p: TARGET = atmega644p
|
||||
atmega644p: MCU_TARGET = atmega644p
|
||||
atmega644p: CFLAGS += $(COMMON_OPTIONS) -DBIGBOOT
|
||||
atmega644p: AVR_FREQ ?= 16000000L
|
||||
atmega644p: LDSECTIONS = -Wl,--section-start=.text=0xfc00 -Wl,--section-start=.version=0xfffe
|
||||
atmega644p: CFLAGS += $(UART_CMD)
|
||||
atmega644p: $(PROGRAM)_atmega644p.hex
|
||||
atmega644p: $(PROGRAM)_atmega644p.lst
|
||||
|
||||
HELPTEXT += "target atmega1284 - ATmega1284p (40 pin, 128k)\n"
|
||||
atmega1284: TARGET = atmega1284p
|
||||
atmega1284: MCU_TARGET = atmega1284p
|
||||
atmega1284: CFLAGS += $(COMMON_OPTIONS) -DBIGBOOT
|
||||
atmega1284: AVR_FREQ ?= 16000000L
|
||||
atmega1284: LDSECTIONS = -Wl,--section-start=.text=0x1fc00 -Wl,--section-start=.version=0x1fffe
|
||||
atmega1284: CFLAGS += $(UART_CMD)
|
||||
atmega1284: $(PROGRAM)_atmega1284p.hex
|
||||
atmega1284: $(PROGRAM)_atmega1284p.lst
|
||||
|
||||
atmega1284p: atmega1284
|
||||
|
||||
atmega1284_isp: atmega1284
|
||||
atmega1284_isp: TARGET = atmega1284p
|
||||
atmega1284_isp: MCU_TARGET = atmega1284p
|
||||
# 1024 byte boot
|
||||
atmega1284_isp: HFUSE ?= DE
|
||||
# Full Swing xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega1284_isp: LFUSE ?= F7
|
||||
# 2.7V brownout
|
||||
atmega1284_isp: EFUSE ?= FD
|
||||
atmega1284_isp: isp
|
||||
|
||||
#
|
||||
# Board-level targets
|
||||
#
|
||||
|
||||
# Sanguino has a minimum boot size of 1024 bytes, so enable extra functions
|
||||
#
|
||||
HELPTEXT += "target sanguino - ATmega644p board\n"
|
||||
sanguino: TARGET = $@
|
||||
sanguino: CHIP = atmega644p
|
||||
sanguino:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L LED=B0
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
sanguino_isp: sanguino
|
||||
sanguino_isp: TARGET = sanguino
|
||||
sanguino_isp: MCU_TARGET = atmega644p
|
||||
# 1024 byte boot
|
||||
sanguino_isp: HFUSE ?= DE
|
||||
# Full swing xtal (16MHz) 16KCK/14CK+65ms
|
||||
sanguino_isp: LFUSE ?= F7
|
||||
# 2.7V brownout
|
||||
sanguino_isp: EFUSE ?= FD
|
||||
sanguino_isp: isp
|
||||
|
||||
HELPTEXT += "target mighty1284 - ManiacBug Mighty1284 board\n"
|
||||
mighty1284: TARGET = $@
|
||||
mighty1284: CHIP = atmega1284p
|
||||
mighty1284:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L LED=B7
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
mighty1284_isp: mighty1284
|
||||
mighty1284_isp: TARGET = mighty1284
|
||||
mighty1284_isp: MCU_TARGET = atmega1284p
|
||||
# 1024 byte boot
|
||||
mighty1284_isp: HFUSE ?= DE
|
||||
# Full swing xtal (16MHz) 16KCK/14CK+65ms
|
||||
mighty1284_isp: LFUSE ?= F7
|
||||
# 2.7V brownout
|
||||
mighty1284_isp: EFUSE ?= FD
|
||||
mighty1284_isp: isp
|
||||
|
||||
HELPTEXT += "target bobuino - Crossroads 1284 board\n"
|
||||
bobuino: TARGET = $@
|
||||
bobuino: CHIP = atmega1284p
|
||||
bobuino:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L LED=B7
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
bobuino_isp: bobuino
|
||||
bobuino_isp: TARGET = bobuino
|
||||
bobuino_isp: MCU_TARGET = atmega1284p
|
||||
# 1024 byte boot
|
||||
bobuino_isp: HFUSE ?= DE
|
||||
# Full swing xtal (16MHz) 16KCK/14CK+65ms
|
||||
bobuino_isp: LFUSE ?= F7
|
||||
# 2.7V brownout
|
||||
bobuino_isp: EFUSE ?= FD
|
||||
bobuino_isp: isp
|
||||
|
||||
#
|
||||
# Wicked Devices "Wildfire" boards (1284 with wireless!)
|
||||
#
|
||||
|
||||
HELPTEXT += "target wildfirev2 - Wicked Devices board\n"
|
||||
wildfirev2: TARGET = $@
|
||||
wildfirev2: CHIP = atmega1284p
|
||||
wildfirev2:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L LED=B7 BAUD_RATE=1000000
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
wildfirev2_isp: wildfirev2
|
||||
wildfirev2_isp: TARGET = wildfirev2
|
||||
wildfirev2_isp: MCU_TARGET = atmega1284p
|
||||
# 1024 byte boot
|
||||
wildfirev2_isp: HFUSE ?= DE
|
||||
# Full swing xtal (16MHz) 16KCK/14CK+65ms
|
||||
wildfirev2_isp: LFUSE ?= F7
|
||||
# 2.7V brownout
|
||||
wildfirev2_isp: EFUSE ?= FD
|
||||
wildfirev2_isp: isp
|
||||
|
||||
HELPTEXT += "target wildfirev3 - Wicked Devices board\n"
|
||||
wildfirev3: TARGET = $@
|
||||
wildfirev3: CHIP = atmega1284p
|
||||
wildfirev3:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L LED=B5
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
wildfirev3_isp: wildfirev3
|
||||
wildfirev3_isp: TARGET = wildfirev3
|
||||
wildfirev3_isp: MCU_TARGET = atmega1284p
|
||||
# 1024 byte boot
|
||||
wildfirev3_isp: HFUSE ?= DE
|
||||
# Full swing xtal (16MHz) 16KCK/14CK+65ms
|
||||
wildfirev3_isp: LFUSE ?= F7
|
||||
# 2.7V brownout
|
||||
wildfirev3_isp: EFUSE ?= FD
|
||||
wildfirev3_isp: isp
|
56
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.2560
Normal file
56
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.2560
Normal file
@ -0,0 +1,56 @@
|
||||
#
|
||||
# Makefile for 2560 AVR chips
|
||||
#
|
||||
# * Copyright 2013-2015 by Bill Westfield, Marek Wodzinski. Part of Optiboot.
|
||||
# * This software is licensed under version 2 of the Gnu Public Licence.
|
||||
# * See optiboot.c for details.
|
||||
|
||||
# Chip level targets
|
||||
#
|
||||
HELPTEXT += "target atmega2560 - ATmega2560p (100pin, 256k)\n"
|
||||
atmega2560: TARGET = atmega2560
|
||||
atmega2560: MCU_TARGET = atmega2560
|
||||
atmega2560: CFLAGS += $(COMMON_OPTIONS) -DBIGBOOT
|
||||
atmega2560: AVR_FREQ ?= 16000000L
|
||||
atmega2560: LDSECTIONS = -Wl,--section-start=.text=0x3fc00 -Wl,--section-start=.version=0x3fffe
|
||||
atmega2560: CFLAGS += $(UART_CMD)
|
||||
atmega2560: $(PROGRAM)_atmega2560.hex
|
||||
atmega2560: $(PROGRAM)_atmega2560.lst
|
||||
|
||||
|
||||
atmega2560_isp: atmega2560
|
||||
atmega2560_isp: TARGET = atmega2560
|
||||
atmega2560_isp: MCU_TARGET = atmega2560
|
||||
# 1024 byte boot, JTAG disabled
|
||||
atmega2560_isp: HFUSE ?= DE
|
||||
# Full Swing xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega2560_isp: LFUSE ?= F7
|
||||
# 2.7V brownout
|
||||
atmega2560_isp: EFUSE ?= FD
|
||||
atmega2560_isp: isp
|
||||
|
||||
#
|
||||
# Board-level targets
|
||||
#
|
||||
|
||||
# Arduino/Geniuno MEGA 256 has a minimum boot size of 1024 bytes, so enable extra functions
|
||||
#
|
||||
HELPTEXT += "target mega2560 - Arduino MEGA2560 board, 2560ADK\n"
|
||||
mega2560: TARGET = $@
|
||||
mega2560: CHIP = atmega2560
|
||||
mega2560:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
mega2560_isp: mega256
|
||||
mega2560_isp: TARGET = mega2560
|
||||
mega2560_isp: MCU_TARGET = atmega2560
|
||||
# 1024 byte boot, JTAG disabled
|
||||
mega2560_isp: HFUSE ?= DE
|
||||
# Full swing xtal (16MHz) 16KCK/14CK+65ms
|
||||
mega2560_isp: LFUSE ?= F7
|
||||
# 2.7V brownout
|
||||
mega2560_isp: EFUSE ?= FD
|
||||
mega2560_isp: isp
|
||||
|
37
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.atmel
Normal file
37
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.atmel
Normal file
@ -0,0 +1,37 @@
|
||||
#
|
||||
# Support for the Atmel Xplained mini eval boards that are mostly
|
||||
# compatible with Arduino. (168pb, 328p, and 328pb chips.)
|
||||
#
|
||||
# Currently these all masquerade as 168 or 328p, because the IDE
|
||||
# does not yet have compiler support for the -pb variants.
|
||||
#
|
||||
# These boards have an mEDBG debug chip that:
|
||||
# 1) means that optiboot can only be programmed via Atmel Studio
|
||||
# 2) prevents optiboot from working at 115200bps.
|
||||
# 3) provides 16MHz (at 5V) via Xin on the chip.
|
||||
#
|
||||
#
|
||||
#
|
||||
HELPTEXT += "target xplained168pb - Atmel Xplained Mini 168pb Eval board\n"
|
||||
xplained168pb: TARGET = $@
|
||||
xplained168pb: CHIP = atmega168
|
||||
xplained168pb:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L BAUD_RATE=57600
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
HELPTEXT += "target xplained328pb - Atmel Xplained Mini 328pb Eval board\n"
|
||||
xplained328pb: TARGET = $@
|
||||
xplained328pb: CHIP = atmega328
|
||||
xplained328pb:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L BAUD_RATE=57600
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
HELPTEXT += "target xplained328p - Atmel Xplained Mini 328p Eval board\n"
|
||||
xplained328p: TARGET = $@
|
||||
xplained328p: CHIP = atmega328
|
||||
xplained328p:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L BAUD_RATE=57600
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
16
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.custom
Normal file
16
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.custom
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# Makefile for "custom" platforms. Add your board here.
|
||||
#
|
||||
# * Copyright 2013-2015 by Bill Westfield. Part of Optiboot.
|
||||
# * This software is licensed under version 2 of the Gnu Public Licence.
|
||||
# * See optiboot.c for details.
|
||||
|
||||
|
||||
HELPTEXT += "target wildfire - Wicked Devices Wildfire v1 board\n"
|
||||
wildfire: TARGET = $@
|
||||
wildfire: CHIP = atmega1284p
|
||||
wildfire:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=16000000L LED=B5
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
135
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.extras
Normal file
135
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.extras
Normal file
@ -0,0 +1,135 @@
|
||||
#
|
||||
# Makefile for "other" implemented platforms.
|
||||
#
|
||||
# * Copyright 2013-2015 by Bill Westfield. Part of Optiboot.
|
||||
# * This software is licensed under version 2 of the Gnu Public Licence.
|
||||
# * See optiboot.c for details.
|
||||
#
|
||||
|
||||
#
|
||||
# Extra chips (maybe) supported by optiboot
|
||||
# Note that these are usually only minimally tested.
|
||||
#
|
||||
|
||||
#
|
||||
# ATmega88
|
||||
#
|
||||
HELPTEXT += "target atmega88 - ATmega88 or ATmega88p (28pin, 8k)\n"
|
||||
atmega88: TARGET = atmega88
|
||||
atmega88: MCU_TARGET = atmega88
|
||||
atmega88: CFLAGS += $(COMMON_OPTIONS)
|
||||
atmega88: AVR_FREQ ?= 16000000L
|
||||
atmega88: LDSECTIONS = -Wl,--section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe -Wl,--gc-sections -Wl,--undefined=optiboot_version
|
||||
atmega88: $(PROGRAM)_atmega88.hex
|
||||
atmega88: $(PROGRAM)_atmega88.lst
|
||||
|
||||
atmega88_isp: atmega88
|
||||
atmega88_isp: TARGET = atmega88
|
||||
atmega88_isp: MCU_TARGET = atmega88
|
||||
# 2.7V brownout
|
||||
atmega88_isp: HFUSE ?= DD
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega88_isp: LFUSE ?= FF
|
||||
# 512 byte boot
|
||||
atmega88_isp: EFUSE ?= 04
|
||||
atmega88_isp: isp
|
||||
|
||||
atmega88p_isp: atmega88
|
||||
atmega88p_isp: TARGET = atmega88
|
||||
atmega88p_isp: MCU_TARGET = atmega88p
|
||||
# 2.7V brownout
|
||||
atmega88p_isp: HFUSE ?= DD
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega88p_isp: LFUSE ?= FF
|
||||
# 512 byte boot
|
||||
atmega88p_isp: EFUSE ?= 04
|
||||
atmega88p_isp: isp
|
||||
|
||||
#
|
||||
# ATmega168p [QFN32]
|
||||
#
|
||||
HELPTEXT += "target atmega168p - ATmega168p\n"
|
||||
atmega168p: TARGET = atmega168p
|
||||
atmega168p: MCU_TARGET = atmega168p
|
||||
atmega168p: CFLAGS += $(COMMON_OPTIONS)
|
||||
atmega168p: AVR_FREQ ?= 16000000L
|
||||
atmega168p: $(PROGRAM)_atmega168p_16MHz.hex
|
||||
atmega168p: $(PROGRAM)_atmega168p_16MHz.lst
|
||||
|
||||
atmega168p_isp: atmega168p
|
||||
atmega168p_isp: TARGET = atmega168p
|
||||
# 2.7V brownout
|
||||
atmega168p_isp: HFUSE ?= DD
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega168p_isp: LFUSE ?= FF
|
||||
# 512 byte boot
|
||||
atmega168p_isp: EFUSE ?= 04
|
||||
atmega168p_isp: isp
|
||||
|
||||
HELPTEXT += "target atmega16 - ATmega16 (40pin, 16k)\n"
|
||||
atmega16: TARGET = atmega16
|
||||
atmega16: MCU_TARGET = atmega16
|
||||
atmega16: CFLAGS += $(COMMON_OPTIONS)
|
||||
atmega16: AVR_FREQ ?= 16000000L
|
||||
atmega16: $(PROGRAM)_atmega16.hex
|
||||
atmega16: $(PROGRAM)_atmega16.lst
|
||||
|
||||
#
|
||||
# ATmega32
|
||||
#
|
||||
HELPTEXT += "target atmega32 - ATmega32 (40pin, 32k)\n"
|
||||
atmega32: TARGET = atmega32
|
||||
atmega32: MCU_TARGET = atmega32
|
||||
atmega32: CFLAGS += $(COMMON_OPTIONS)
|
||||
atmega32: AVR_FREQ ?= 11059200L
|
||||
atmega32: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
|
||||
atmega32: $(PROGRAM)_atmega32.hex
|
||||
atmega32: $(PROGRAM)_atmega32.lst
|
||||
|
||||
atmega32_isp: atmega32
|
||||
atmega32_isp: TARGET = atmega32
|
||||
atmega32_isp: MCU_TARGET = atmega32
|
||||
# No OCD or JTAG, SPIEN, CKOPT (for full swing xtal), Bootsize=512B
|
||||
atmega32_isp: HFUSE ?= CE
|
||||
# 2.7V brownout, 16MHz Xtal, 16KCK/14CK+65ms
|
||||
atmega32_isp: LFUSE ?= BF
|
||||
atmega32_isp: isp
|
||||
|
||||
|
||||
|
||||
#
|
||||
# ATtiny84
|
||||
#
|
||||
attiny84: TARGET = attiny84
|
||||
attiny84: MCU_TARGET = attiny84
|
||||
attiny84: CFLAGS += $(COMMON_OPTIONS) -DSOFT_UART -DVIRTUAL_BOOT_PARTITION -Dsave_vect_num=4
|
||||
attiny84: LDSECTIONS = -Wl,--section-start=.text=0x1d00 -Wl,--section-start=.version=0x1ffe -Wl,--gc-sections -Wl,--undefined=optiboot_version
|
||||
attiny84: $(PROGRAM)_attiny84.hex
|
||||
attiny84: $(PROGRAM)_attiny84.lst
|
||||
|
||||
|
||||
|
||||
# 1MHz clocked platforms/boards
|
||||
#
|
||||
# These are capable of 9600 baud
|
||||
#
|
||||
|
||||
luminet: TARGET = $@
|
||||
luminet: CHIP = attiny84
|
||||
luminet:
|
||||
"$(MAKE)" $(CHIP) AVR_FREQ=1000000L LED_START_FLASHES=0 BAUD_RATE=9600
|
||||
mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
|
||||
mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst
|
||||
|
||||
luminet_isp: luminet
|
||||
luminet_isp: TARGET = luminet
|
||||
luminet_isp: MCU_TARGET = attiny84
|
||||
# Brownout disabled
|
||||
luminet_isp: HFUSE ?= DF
|
||||
# 1MHz internal oscillator, slowly rising power
|
||||
luminet_isp: LFUSE ?= 62
|
||||
# Self-programming enable
|
||||
luminet_isp: EFUSE ?= FE
|
||||
luminet_isp: isp
|
||||
|
||||
|
90
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.isp
Normal file
90
ActualOptiboot/optiboot/bootloaders/optiboot/Makefile.isp
Normal file
@ -0,0 +1,90 @@
|
||||
# Makefile.isp for Optiboot
|
||||
# Bill Westfield (WestfW@yahoo.com) March, 2013
|
||||
# $Id$
|
||||
#
|
||||
# Instructions:
|
||||
#
|
||||
# This is a "daughter" Makefile that burns the bootloader using a ISP
|
||||
# device programmer. It is designed to inherit assorted variables from
|
||||
# the parent optiboot "Makefile"... Using a daughter makefile makes
|
||||
# certain variable manipulations more obvious.
|
||||
#
|
||||
# To burn bootloader .hex file, invoke the main Makefile using:
|
||||
# make diecimila_isp
|
||||
# make lilypad_isp
|
||||
# make ng_isp
|
||||
# etc...
|
||||
#
|
||||
#
|
||||
# Note: inherit paths/etc from parent Makefile.
|
||||
#
|
||||
#---------------------------------------------------------------------------
|
||||
#
|
||||
# * Copyright 2013-2015 by Bill Westfield. Part of Optiboot.
|
||||
# * This software is licensed under version 2 of the Gnu Public Licence.
|
||||
# * See optiboot.c for details.
|
||||
#
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# enter the parameters for the avrdude isp tool -b19200
|
||||
#
|
||||
|
||||
# Inherit avrdude paths from top-level makefile
|
||||
AVRDUDE_ROOT ?= $(GCCROOT)
|
||||
AVRDUDE_CONF ?= -C$(TOOLROOT)/avr/etc/avrdude.conf
|
||||
|
||||
# These are the parameters for a usb-based STK500v2 programmer.
|
||||
# Exact type unknown. (historical Makefile values.)
|
||||
#ISPTOOL = stk500v2
|
||||
#ISPPORT = usb
|
||||
#ISPSPEED = -b 115200
|
||||
#
|
||||
#
|
||||
# These are parameters for using an Arduino with the ArduinoISP sketch
|
||||
# as the programmer. On a mac, for a particular Uno as programmer.
|
||||
ISPTOOL ?= stk500v1
|
||||
ISPPORT ?= /dev/tty.usbserial-FTD61T6Q
|
||||
ISPSPEED ?= -b19200
|
||||
|
||||
|
||||
|
||||
# Not all chips have EFUSE.
|
||||
|
||||
ifdef EFUSE
|
||||
EFUSE_CMD= -U efuse:w:0x$(EFUSE):m
|
||||
endif
|
||||
|
||||
#
|
||||
# avrdude commands to erase chip, unlock memory, and program fuses.
|
||||
#
|
||||
ISPFUSES = -e -u -U lock:w:0x3f:m $(EFUSE_CMD) \
|
||||
-U hfuse:w:0x$(HFUSE):m -U lfuse:w:0x$(LFUSE):m
|
||||
|
||||
|
||||
#
|
||||
# avrdude commands to program the new bootloader, and protect the bootloader
|
||||
# space from accidental SPM writes. Note: "2f" allows boot section to be read
|
||||
# by the application, which is different than the arduino default.
|
||||
#
|
||||
ISPFLASH = -U flash:w:$(PROGRAM)_$(TARGET).hex -U lock:w:0x2f:m
|
||||
|
||||
# There are certain complicated caused by the fact that the default state
|
||||
# of a fuse is a "1" rather than a "0", especially with respect to fuse bits
|
||||
# that have not been implemented. Those would normally not be included, but
|
||||
# unimplemented fuses still default to being "1"
|
||||
#
|
||||
# the efuse should really be 0xf8; since, however, only the lower
|
||||
# three bits of that byte are used on the atmega168, avrdude gets
|
||||
# confused if you specify 1's for the higher bits, see:
|
||||
# http://tinker.it/now/2007/02/24/the-tale-of-avrdude-atmega168-and-extended-bits-fuses/
|
||||
#
|
||||
# similarly, the lock bits should be 0xff instead of 0x3f (to
|
||||
# unlock the bootloader section) and 0xcf instead of 0x2f (to
|
||||
# lock it), but since the high two bits of the lock byte are
|
||||
# unused, avrdude would get confused.
|
||||
|
||||
isp: $(PROGRAM)_$(TARGET).hex
|
||||
$(AVRDUDE_ROOT)avrdude $(AVRDUDE_CONF) -c $(ISPTOOL) \
|
||||
-p $(MCU_TARGET) -P $(ISPPORT) $(ISPSPEED) \
|
||||
$(ISPFUSES) \
|
||||
$(ISPFLASH)
|
99
ActualOptiboot/optiboot/bootloaders/optiboot/README.TXT
Normal file
99
ActualOptiboot/optiboot/bootloaders/optiboot/README.TXT
Normal file
@ -0,0 +1,99 @@
|
||||
This directory contains the Optiboot small bootloader for AVR
|
||||
microcontrollers, somewhat modified specifically for the Arduino
|
||||
environment.
|
||||
|
||||
Optiboot is more fully described here: http://github.com/Optiboot/optiboot
|
||||
and is the work of Peter Knight (aka Cathedrow), building on work of Jason P
|
||||
Kyle, Spiff, and Ladyada. More recent maintenance and modifications are by
|
||||
Bill Westfield (aka WestfW)
|
||||
|
||||
Arduino-specific issues are tracked as part of the Arduino project
|
||||
at http://github.com/arduino/Arduino
|
||||
|
||||
|
||||
Most of the information in this file is superceeded by the wiki content at
|
||||
https://github.com/Optiboot/optiboot/wiki
|
||||
|
||||
It's till here "just in case."
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
Building optiboot for Arduino.
|
||||
|
||||
Production builds of optiboot for Arduino are done on a Mac in "unix mode"
|
||||
using CrossPack-AVR-20100115. CrossPack tracks WINAVR (for windows), which
|
||||
is just a package of avr-gcc and related utilities, so similar builds should
|
||||
work on Windows or Linux systems.
|
||||
|
||||
One of the Arduino-specific changes is modifications to the makefile to
|
||||
allow building optiboot using only the tools installed as part of the
|
||||
Arduino environment, or the Arduino source development tree. All three
|
||||
build procedures should yield identical binaries (.hex files) (although
|
||||
this may change if compiler versions drift apart between CrossPack and
|
||||
the Arduino IDE.)
|
||||
|
||||
|
||||
Building Optiboot in the Arduino IDE Install.
|
||||
|
||||
Work in the .../hardware/arduino/bootloaders/optiboot/ and use the
|
||||
"omake <targets>" command, which just generates a command that uses
|
||||
the arduino-included "make" utility with a command like:
|
||||
make OS=windows ENV=arduino <targets>
|
||||
or make OS=macosx ENV=arduino <targets>
|
||||
On windows, this assumes you're using the windows command shell. If
|
||||
you're using a cygwin or mingw shell, or have one of those in your
|
||||
path, the build will probably break due to slash vs backslash issues.
|
||||
On a Mac, if you have the developer tools installed, you can use the
|
||||
Apple-supplied version of make.
|
||||
The makefile uses relative paths ("../../../tools/" and such) to find
|
||||
the programs it needs, so you need to work in the existing optiboot
|
||||
directory (or something created at the same "level") for it to work.
|
||||
|
||||
|
||||
Building Optiboot in the Arduino Source Development Install.
|
||||
|
||||
In this case, there is no special shell script, and you're assumed to
|
||||
have "make" installed somewhere in your path.
|
||||
Build the Arduino source ("ant build") to unpack the tools into the
|
||||
expected directory.
|
||||
Work in Arduino/hardware/arduino/bootloaders/optiboot and use
|
||||
make OS=windows ENV=arduinodev <targets>
|
||||
or make OS=macosx ENV=arduinodev <targets>
|
||||
|
||||
|
||||
Programming Chips Using the _isp Targets
|
||||
|
||||
The CPU targets have corresponding ISP targets that will actuall
|
||||
program the bootloader into a chip. "atmega328_isp" for the atmega328,
|
||||
for example. These will set the fuses and lock bits as appropriate as
|
||||
well as uploading the bootloader code.
|
||||
|
||||
ISP Targets in Version 5.0 and later:
|
||||
|
||||
The isp targets are now built using a separate "Makefile.isp" makefile,
|
||||
which should make modification easier and more obvious. This also fixes
|
||||
the atmega8_isp target problem mentioned below. The default
|
||||
configuration assumes an ArduinoISP setup, but you will probably need to
|
||||
update at least the serial port, since those are different for each
|
||||
Arduino board and/or system/
|
||||
|
||||
|
||||
ISP Targets in Version 4.6 and earlier:
|
||||
|
||||
The older makefiles default to using a USB programmer, but you can use a
|
||||
serial programmer like ArduinoISP by changing the appropriate variables
|
||||
when you invoke make:
|
||||
|
||||
make ISPTOOL=stk500v1 ISPPORT=/dev/tty.usbserial-A20e1eAN \
|
||||
ISPSPEED=-b19200 atmega328_isp
|
||||
|
||||
The "atmega8_isp" target does not currently work, because the mega8
|
||||
doesn't have the "extended" fuse that the generic ISP target wants to
|
||||
pass on to avrdude. You'll need to run avrdude manually.
|
||||
|
||||
|
||||
Standard Targets
|
||||
|
||||
I've reduced the pre-built and source-version-controlled targets
|
||||
(.hex and .lst files included in the git repository) to just the
|
||||
three basic 16MHz targets: atmega8, atmega16, atmega328.
|
56
ActualOptiboot/optiboot/bootloaders/optiboot/baudcheck.c
Normal file
56
ActualOptiboot/optiboot/bootloaders/optiboot/baudcheck.c
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* baudcheck.c
|
||||
* Mar, 2013 by Bill Westfield (WestfW@yahoo.com)
|
||||
* Exercises in executing arithmetic code on a system that we can't count
|
||||
* on having the usual languages or tools installed.
|
||||
*
|
||||
* This little "C program" is run through the C preprocessor using the same
|
||||
* arguments as our "real" target (which should assure that it gets the
|
||||
* same values for clock speed and desired baud rate), and produces as
|
||||
* output a shell script that can be run through bash, and THAT in turn
|
||||
* writes the desired output...
|
||||
*
|
||||
* Note that the C-style comments are stripped by the C preprocessor.
|
||||
*
|
||||
* Copyright 2013-2015 by Bill Westfield.
|
||||
* This software is licensed under version 2 of the Gnu Public Licence.
|
||||
* See optiboot.c for details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* First strip any trailing "L" from the defined constants. To do this
|
||||
* we need to make the constants into shell variables first.
|
||||
*/
|
||||
bpsx=BAUD_RATE
|
||||
bps=${bpsx/L/}
|
||||
bps=${bps/U/}
|
||||
fcpux=F_CPU
|
||||
fcpu=${fcpux/L/}
|
||||
fcpu=${fcpu/U/}
|
||||
|
||||
// echo f_cpu = $fcpu, baud = $bps
|
||||
/*
|
||||
* Compute the divisor
|
||||
*/
|
||||
BAUD_SETTING=$(( ( ($fcpu + $bps * 4) / (($bps * 8))) - 1 ))
|
||||
// echo baud setting = $BAUD_SETTING
|
||||
|
||||
/*
|
||||
* Based on the computer divisor, calculate the actual bitrate,
|
||||
* And the error. Since we're all integers, we have to calculate
|
||||
* the tenths part of the error separately.
|
||||
*/
|
||||
BAUD_ACTUAL=$(( ($fcpu/(8 * (($BAUD_SETTING)+1))) ))
|
||||
BAUD_ERROR=$(( (( 100*($BAUD_ACTUAL - $bps) ) / $bps) ))
|
||||
ERR_TS=$(( ((( 1000*($BAUD_ACTUAL - $bps) ) / $bps) - $BAUD_ERROR * 10) ))
|
||||
ERR_TENTHS=$(( ERR_TS > 0 ? ERR_TS: -ERR_TS ))
|
||||
|
||||
/*
|
||||
* Print a nice message containing the info we've calculated
|
||||
*/
|
||||
echo BAUD RATE CHECK: Desired: $bps, Real: $BAUD_ACTUAL, UBRRL = $BAUD_SETTING, Difference=$BAUD_ERROR.$ERR_TENTHS\%
|
||||
|
||||
|
||||
|
||||
|
||||
|
99
ActualOptiboot/optiboot/bootloaders/optiboot/boot_opt.h
Normal file
99
ActualOptiboot/optiboot/bootloaders/optiboot/boot_opt.h
Normal file
@ -0,0 +1,99 @@
|
||||
// Get all the "standard" definitions from the official boot.h
|
||||
#include <avr/boot.h>
|
||||
|
||||
|
||||
/*
|
||||
* Implement some optimized versions that will use OUT instead
|
||||
* of STS to write SPMCSR.
|
||||
* (However, omit the *_extended_short, since by the time you
|
||||
* need _extended_, the extra byte shouldn't be relevant any more)
|
||||
*
|
||||
* The C preprocessor can not determin at compile time whether SPMCSR is
|
||||
* "out of range" of the OUT instruction, but we CAN do that in the
|
||||
* assembler. We can even make it pretty with a macro.
|
||||
* With this modification, the _short functions should work on cpus
|
||||
* (like ATmega128) where STS is required.
|
||||
*/
|
||||
|
||||
asm(".macro __wr_spmcsr p, v \n\t"
|
||||
".if \\p > 0x37 \n\t"
|
||||
"sts \\p, \\v \n\t"
|
||||
".else \n\t"
|
||||
"out \\p, \\v \n\t"
|
||||
".endif \n\t"
|
||||
".endm \n");
|
||||
|
||||
|
||||
#if defined(SPMCSR) || defined(SPMCR)
|
||||
|
||||
#define __boot_page_fill_short(address, data) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"movw r0, %3\n\t" \
|
||||
"__wr_spmcsr %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
"clr r1\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_FILL), \
|
||||
"z" ((uint16_t)address), \
|
||||
"r" ((uint16_t)data) \
|
||||
: "r0" \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_erase_short(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"__wr_spmcsr %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_ERASE), \
|
||||
"z" ((uint16_t)address) \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_write_short(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"__wr_spmcsr %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_WRITE), \
|
||||
"z" ((uint16_t)address) \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_rww_enable_short() \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"__wr_spmcsr %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_RWW_ENABLE) \
|
||||
); \
|
||||
}))
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* if SPMCSR or SPMCR isn't defined, it means we have some sort of
|
||||
* new-fangled chip that post-dates the version of boot.h that we
|
||||
* know about. In this case, it's possible that the standard boot.h
|
||||
* still has workable functions, so we'll alias those.
|
||||
*/
|
||||
|
||||
#define __boot_page_fill_short(address, data) boot_page_fill(address, data)
|
||||
#define __boot_page_erase_short(address) boot_page_erase(address)
|
||||
#define __boot_page_write_short(address) boot_page_write(address)
|
||||
#define __boot_rww_enable_short() boot_rww_enable()
|
||||
|
||||
#endif
|
||||
|
34
ActualOptiboot/optiboot/bootloaders/optiboot/make-ccversions
Executable file
34
ActualOptiboot/optiboot/bootloaders/optiboot/make-ccversions
Executable file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Compile a couple of Optiboot variations using several different compilers
|
||||
#
|
||||
|
||||
|
||||
# A list of compilers that are available.
|
||||
# This is, um, 4.3.3, 4.6.2, 4.8.1, 4.9.2, and 5.4.0
|
||||
#
|
||||
COMPS='
|
||||
/usr/local/CrossPack-AVR-20100115/bin/
|
||||
/usr/local/CrossPack-AVR-20121207/bin/
|
||||
/usr/local/CrossPack-AVR-48/bin/
|
||||
/usr/local/avr8-atmel-20160624/bin/
|
||||
/usr/local/avr8-Atmel-3.6.0.487/bin/
|
||||
'
|
||||
|
||||
for c in $COMPS; do
|
||||
# Pretty print for readability
|
||||
echo
|
||||
echo
|
||||
echo ===========================================================
|
||||
echo Using compiler in $c
|
||||
$c/avr-gcc --version | head -1
|
||||
echo ===========================================================
|
||||
|
||||
echo --------------- make GCCROOT=$c atmega328
|
||||
make GCCROOT=$c atmega328
|
||||
echo --------------- make GCCROOT=$c atmega1284
|
||||
make GCCROOT=$c atmega1284
|
||||
echo --------------- make GCCROOT=$c luminet
|
||||
make GCCROOT=$c luminet
|
||||
echo --------------- make GCCROOT=$c mega1280
|
||||
make GCCROOT=$c mega1280
|
||||
done
|
32
ActualOptiboot/optiboot/bootloaders/optiboot/makeall
Executable file
32
ActualOptiboot/optiboot/bootloaders/optiboot/makeall
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
make clean
|
||||
#
|
||||
# buildable platforms of somewhat questionable support level
|
||||
make lilypad
|
||||
make pro8
|
||||
make pro16
|
||||
make pro20
|
||||
make atmega328_pro8
|
||||
make sanguino
|
||||
make mega1280
|
||||
make luminet
|
||||
make diecimila
|
||||
make bobuino
|
||||
make wildfirev2
|
||||
make atmega1284
|
||||
make atmega32
|
||||
make atmega88
|
||||
make atmega168p
|
||||
|
||||
#
|
||||
# Atmel development board targets
|
||||
make xplained168pb
|
||||
make xplained328p
|
||||
make xplained328pb
|
||||
|
||||
#
|
||||
# The "big three" standard bootloaders.
|
||||
# These need to be built AFTER the platforms, or they'll get renamed
|
||||
make atmega8
|
||||
make atmega168
|
||||
make atmega328
|
37
ActualOptiboot/optiboot/bootloaders/optiboot/makeoptions
Executable file
37
ActualOptiboot/optiboot/bootloaders/optiboot/makeoptions
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
make clean
|
||||
#
|
||||
|
||||
# don't build most of the targets already in makeall
|
||||
|
||||
# The "big three" standard bootloaders.
|
||||
# These need to be built AFTER the platforms, or they'll get renamed
|
||||
make atmega8
|
||||
make virboot8
|
||||
make atmega168
|
||||
make atmega328
|
||||
make virboot328
|
||||
|
||||
make atmega328 BIGBOOT=1
|
||||
make atmega328 SUPPORT_EEPROM=1 LED_START_FLASHES=0 LED_START_ON=1
|
||||
make atmega328 BAUD_RATE=19200
|
||||
make atmega328 SOFT_UART=1
|
||||
make atmega328 LED_START_FLASHES=20
|
||||
|
||||
make atmega1284 UART=1 LED=A1
|
||||
|
||||
echo --------------------------------------------------
|
||||
echo Expected to fail !!!!
|
||||
echo --------------------------------------------------
|
||||
|
||||
# too big
|
||||
make atmega328 SUPPORT_EEPROM=1
|
||||
# no such port
|
||||
make atmega328 LED=J1
|
||||
# no such led
|
||||
make atmega328 LED=fred
|
||||
make atmega328 UART=1
|
||||
#
|
||||
#invalid bit rates
|
||||
make atmega328 BAUD_RATE=300
|
||||
make atmega328 BAUD_RATE=3000000
|
9
ActualOptiboot/optiboot/bootloaders/optiboot/omake
Executable file
9
ActualOptiboot/optiboot/bootloaders/optiboot/omake
Executable file
@ -0,0 +1,9 @@
|
||||
#%/bin/bash
|
||||
if [ -d ../../../tools ]; then
|
||||
mypath=../../../tools/avr/bin
|
||||
else
|
||||
mypath=../../../../tools/avr/bin
|
||||
fi
|
||||
|
||||
echo $mypath/make OS=macosx ENV=arduino $*
|
||||
$mypath/make OS=macosx ENV=arduino $*
|
221
ActualOptiboot/optiboot/bootloaders/optiboot/omake.bat
Normal file
221
ActualOptiboot/optiboot/bootloaders/optiboot/omake.bat
Normal file
@ -0,0 +1,221 @@
|
||||
@echo off
|
||||
SET DEBUG=REM
|
||||
|
||||
REM Batch file to build Optiboot by searching around for the right tools, and then
|
||||
REM setting the path and invoking them with the specified arguments.
|
||||
REM Based on https://github.com/WestfW/Arduino-avr-tools-install
|
||||
|
||||
REM Batch file must run in Delayed Evaluation mode.
|
||||
%DEBUG% checking cmd mode
|
||||
call :clearerrors
|
||||
if "!x!" EQU "%x%" (
|
||||
|
||||
REM Things are good; try to set the paths and run the compile
|
||||
|
||||
REM --------------------------------------------------------
|
||||
call :findArduino
|
||||
%DEBUG% Using make %*
|
||||
make %*
|
||||
exit /b 0
|
||||
REM --------------------------------------------------------
|
||||
|
||||
)
|
||||
REM We have to run in /V mode to get late evaluation of variables inside loops
|
||||
%DEBUG% re-running in delayed eval mode
|
||||
cmd.exe /V /C "%0" %*
|
||||
exit /b 0
|
||||
|
||||
|
||||
|
||||
REM ======================================================================
|
||||
|
||||
:findArduino
|
||||
REM Here is most of the work of the script.
|
||||
REM Look through the various places where an Arduino install is likely to exist,
|
||||
REM make sure that we can find the avr-gcc binaries that should be part of that
|
||||
REM install, print out the version, and ask the user if that's what they want.
|
||||
|
||||
REM Look for existing avr-gcc in path.
|
||||
%DEBUG% Looking for avr-gcc in current path
|
||||
call :clearerrors
|
||||
call :which avr-gcc.exe
|
||||
IF "%gotwhich%" NEQ "" (
|
||||
@ECHO avr-gcc already installed at %gotwhich%
|
||||
exit /b 123
|
||||
) ELSE (
|
||||
@ECHO No avr-gcc in current path
|
||||
)
|
||||
|
||||
REM look for Arduino install.
|
||||
set picked=n
|
||||
set printed=n
|
||||
call :scandir "%ProgramFiles%"
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
if "%picked%" NEQ "y" call :scandir "%ProgramFiles(x86)%"
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
if "%picked%" NEQ "y" call :scandir "C:\bin"
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
if "%picked%" EQU "y" goto gotdir
|
||||
@echo.
|
||||
REM try some of the more unlikely places that Arduino might live.
|
||||
|
||||
:noarduino
|
||||
@echo Can't find Arduino
|
||||
exit /b 1
|
||||
|
||||
|
||||
REM Given the name of a program-containing directory (like "\bin"),
|
||||
REM See if it looks like there are any "Arduino*" directories there,
|
||||
REM and prompt the user to ask whether that's the one we want to use
|
||||
REM for avr-gcc. If so, set variables saying we picked one.
|
||||
:scandir
|
||||
%DEBUG% ScanDir %1
|
||||
SET root=%~1
|
||||
if NOT EXIST "%root%" exit /b 0
|
||||
if NOT EXIST "%root%\Arduino*" exit /b 0
|
||||
FOR /F "tokens=*" %%f IN ('dir /b /x "%root%\Arduino*"') DO (
|
||||
SET prg=!root!\%%f
|
||||
if exist "!prg!\Hardware\tools\avr\bin\avr-gcc.exe" (
|
||||
if "%printed%" NEQ "Y" (
|
||||
echo At least one Arduino install found.
|
||||
echo.
|
||||
set printed=Y
|
||||
)
|
||||
@echo Looks like !prg! has version
|
||||
call :gccversion "!prg!\Hardware\tools\avr\bin\avr-gcc.exe"
|
||||
SET aroot=!prg!
|
||||
set picked=y
|
||||
exit /b 0
|
||||
) else %DEBUG% No Arduino exe in expected spot !prg!
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
|
||||
REM prompt for arduino install location.
|
||||
@echo ****WHY DID WE GET HERE****
|
||||
@echo asking if this is OK
|
||||
SET /P confirm="Use %prg% [y/n]>"
|
||||
if "%confirm%" NEQ "y" exit /b 0
|
||||
|
||||
|
||||
:gotdir
|
||||
REM figure out arduino install version.
|
||||
%DEBUG% gotdir has aroot = !aroot!
|
||||
IF EXIST "!aroot!\hardware\tools\avr\bin\avr-gcc.exe" (
|
||||
set bin=!aroot!\hardware\tools\avr\bin
|
||||
set etc=!aroot!\hardware\tools\avr\etc
|
||||
) else (
|
||||
@echo Cant find a bin directory in !aroot!
|
||||
exit /b 963
|
||||
)
|
||||
|
||||
%DEBUG% Checking for utils at %prg%\hardware\tools\avr\utils\bin\
|
||||
IF EXIST "!aroot!\hardware\tools\avr\utils\bin\make.exe" (
|
||||
REM See if we have make and etc as well (from Arduino 1.0.x/WinAVR)
|
||||
%DEBUG% Found make.exe
|
||||
set utils=!aroot!\hardware\tools\avr\utils\bin
|
||||
) else (
|
||||
IF EXIST "C:\Program Files (X86)\GnuWin32" (
|
||||
set utils="C:\Program Files (X86)\GnuWin32\bin"
|
||||
)
|
||||
IF EXIST "C:\Program Files\GnuWin32" (
|
||||
set utils="C:\Program Files\GnuWin32\bin"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
REM find bin directory.
|
||||
REM create tentative path for binaries and put it in our tmp batch file
|
||||
%DEBUG% Setting paths to include bin and etc
|
||||
REM
|
||||
REM setx will set a permanent path in the registry, but it won't take effect
|
||||
REM until the next invocation of cmd.exe
|
||||
REM setx PATH %bin%;%etc%
|
||||
REM
|
||||
%DEBUG% adding arduin bin and etc to PATH %bin%;%etc%
|
||||
call :shorten "%bin%"
|
||||
PATH %PATH%;!shortout!
|
||||
call :shorten "%etc%"
|
||||
PATH %PATH%;!shortout!
|
||||
|
||||
%DEBUG% Have utils = %utils%
|
||||
|
||||
IF %utils% NEQ "" (
|
||||
REM Check for make already installed
|
||||
%DEBUG% Have utils; checking whether make is already installed.
|
||||
call :which make.exe
|
||||
if "%gotwhich%" EQU "" (
|
||||
echo Found Make at %utils%
|
||||
call :shorten %utils%
|
||||
PATH %PATH%;!shortout!
|
||||
)
|
||||
)
|
||||
call :clearerrors
|
||||
exit /b 0
|
||||
goto eof
|
||||
|
||||
|
||||
REM ----------------------------------------------------------------------
|
||||
REM Subroutines
|
||||
REM ----------------------------------------------------------------------
|
||||
|
||||
:which
|
||||
%DEBUG% which %1
|
||||
SET gotwhich=
|
||||
for %%i in (%1) do set fullspec=%%~$PATH:i
|
||||
if not "x!fullspec!"=="x" (
|
||||
%DEBUG% !fullspec!
|
||||
set gotwhich=!fullspec!
|
||||
)
|
||||
%DEBUG% End which %gotwhich%
|
||||
goto eof
|
||||
|
||||
|
||||
REM ----------------------------------------------------------------------
|
||||
|
||||
:gccversion
|
||||
REM This implements "gcc --version | head -1" - show the first line
|
||||
if EXIST %1 (
|
||||
FOR /F "delims=*" %%l in ('%1 --version') DO (
|
||||
@echo %%l
|
||||
REM return after we've output one line
|
||||
exit /b 0
|
||||
)
|
||||
)
|
||||
exit /b 0
|
||||
|
||||
|
||||
REM ----------------------------------------------------------------------
|
||||
|
||||
:avrdudeversion
|
||||
SETLOCAL ENABLEDELAYEDEXPANSION
|
||||
REM This implements "gcc --version | head -4" - show the first line
|
||||
set /a count=4
|
||||
FOR /F "delims=*" %%l in ('"avrdude -v 2>&1"') DO (
|
||||
@echo %%l
|
||||
set /a count=!count!-1
|
||||
if !count! equ 0 (
|
||||
ENDLOCAL
|
||||
exit /b 0
|
||||
)
|
||||
)
|
||||
exit /b 0
|
||||
goto :eof
|
||||
|
||||
|
||||
REM ----------------------------------------------------------------------
|
||||
|
||||
REM Clear the ERRORLEVEL to 0, if it happened to be set
|
||||
:clearerrors
|
||||
exit /b 0
|
||||
|
||||
|
||||
REM ----------------------------------------------------------------------
|
||||
|
||||
REM Shorten a pathname to 8.3 format filenames.
|
||||
|
||||
:shorten
|
||||
set shortout=%~s1
|
||||
exit /b 0
|
||||
|
||||
:eof
|
1060
ActualOptiboot/optiboot/bootloaders/optiboot/optiboot.c
Normal file
1060
ActualOptiboot/optiboot/bootloaders/optiboot/optiboot.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,44 @@
|
||||
:020000021000EC
|
||||
:10FC0000112484B7882349F0982F9A70923029F0F4
|
||||
:10FC100081FF02C097EF94BF10D185E080938100EF
|
||||
:10FC200082E08093C00088E18093C10086E08093E9
|
||||
:10FC3000C20080E18093C4008EE0EAD0279A86E07B
|
||||
:10FC400020E33CEF91E0309385002093840096BB45
|
||||
:10FC5000B09BFECF1F9AA8954091C00047FD02C0FF
|
||||
:10FC6000815089F7FF24F39455E0E52E61E1D62E0B
|
||||
:10FC7000C3D08134C1F4C0D0C82FD0D0C23809F469
|
||||
:10FC80003AC0C13869F487E00CC0843709F482C0F7
|
||||
:10FC9000853709F0A2C0C2D08EE1A7D087E9A5D0F0
|
||||
:10FCA00083E0A3D09FC0823411F484E103C0853483
|
||||
:10FCB00019F485E0BBD096C0853579F49DD0082F26
|
||||
:10FCC0009BD0182F87FF03C08BB7816002C08BB712
|
||||
:10FCD0008E7F8BBF000F111F84C0863581F48CD0BE
|
||||
:10FCE0008D3459F489D0CBB787D0C170880FC82B19
|
||||
:10FCF000CBBF81E09BD080E0D4CF83E0FBCF8436C4
|
||||
:10FD000009F0C3CF79D0C82FD0E0DC2FCC2774D036
|
||||
:10FD1000C82B72D0C82E5E01812C32E0932E6CD09D
|
||||
:10FD2000F40181934F01F1E0AF1AB108C1F776D029
|
||||
:10FD300085E4C81212C0DE5F4801A12C92E0B92E02
|
||||
:10FD4000AC16BD0609F44EC0F50161915F01C40116
|
||||
:10FD500082D0FFEF8F1A9F0AF3CF83E0F80187BFAD
|
||||
:10FD6000E89507B600FCFDCFA0E0B2E0F8018D9168
|
||||
:10FD70009D910C01F7BEE8951124229732962097A9
|
||||
:10FD8000B1F7F801E7BEE89507B600FCFDCFD7BE96
|
||||
:10FD9000E89528C031D0C82FD0E0DC2FCC272CD05C
|
||||
:10FDA0005E01A82A29D0982E39D0E801F5E49F12E7
|
||||
:10FDB0000BC0CE0148D019D081E0A81AB108219615
|
||||
:10FDC000A114B104B1F70EC0FE018791EF010DD06F
|
||||
:10FDD000E1E0AE1AB108C1F705C0813511F488E041
|
||||
:10FDE00017D01CD080E101D043CF9091C00095FF87
|
||||
:10FDF000FCCF8093C60008958091C00087FFFCCFA0
|
||||
:10FE00008091C00084FD01C0A8958091C60008952E
|
||||
:10FE1000E0E6F0E098E1908380830895EDDF8032A2
|
||||
:10FE200019F088E0F5DFFFCF84E1DFCFCF93C82F53
|
||||
:10FE3000E3DFC150E9F7CF91F1CF282E80E0E8DF72
|
||||
:10FE4000E0E0FF270994F999FECF92BD81BDF89AB1
|
||||
:10FE5000992780B50895262FF999FECF1FBA92BD34
|
||||
:10FE600081BD20BD0FB6F894FA9AF99A0FBE01969B
|
||||
:02FE70000895F3
|
||||
:02FFFE000007FA
|
||||
:040000031000FC00ED
|
||||
:00000001FF
|
@ -0,0 +1,726 @@
|
||||
|
||||
optiboot_atmega1280.elf: file format elf32-avr
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .data 00000000 00800200 0001fe72 00000306 2**0
|
||||
CONTENTS, ALLOC, LOAD, DATA
|
||||
1 .text 00000272 0001fc00 0001fc00 00000094 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
2 .version 00000002 0001fffe 0001fffe 00000306 2**0
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
3 .comment 0000002f 00000000 00000000 00000308 2**0
|
||||
CONTENTS, READONLY
|
||||
4 .debug_aranges 00000028 00000000 00000000 00000337 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
5 .debug_info 00000632 00000000 00000000 0000035f 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
6 .debug_abbrev 00000286 00000000 00000000 00000991 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
7 .debug_line 00000385 00000000 00000000 00000c17 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
8 .debug_frame 0000008c 00000000 00000000 00000f9c 2**2
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
9 .debug_str 0000021e 00000000 00000000 00001028 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
10 .debug_loc 00000421 00000000 00000000 00001246 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
11 .debug_ranges 00000078 00000000 00000000 00001667 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0001fc00 <main>:
|
||||
// SP points to RAMEND
|
||||
// r1 contains zero
|
||||
//
|
||||
// If not, uncomment the following instructions:
|
||||
// cli();
|
||||
asm volatile ("clr __zero_reg__");
|
||||
1fc00: 11 24 eor r1, r1
|
||||
*
|
||||
* Code by MarkG55
|
||||
* see discusion in https://github.com/Optiboot/optiboot/issues/97
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
ch = MCUSR;
|
||||
1fc02: 84 b7 in r24, 0x34 ; 52
|
||||
#else
|
||||
ch = MCUCSR;
|
||||
#endif
|
||||
// Skip all logic and run bootloader if MCUSR is cleared (application request)
|
||||
if (ch != 0) {
|
||||
1fc04: 88 23 and r24, r24
|
||||
1fc06: 49 f0 breq .+18 ; 0x1fc1a <main+0x1a>
|
||||
* 2. we clear WDRF if it's set with EXTRF to avoid loops
|
||||
* One problematic scenario: broken application code sets watchdog timer
|
||||
* without clearing MCUSR before and triggers it quickly. But it's
|
||||
* recoverable by power-on with pushed reset button.
|
||||
*/
|
||||
if ((ch & (_BV(WDRF) | _BV(EXTRF))) != _BV(EXTRF)) {
|
||||
1fc08: 98 2f mov r25, r24
|
||||
1fc0a: 9a 70 andi r25, 0x0A ; 10
|
||||
1fc0c: 92 30 cpi r25, 0x02 ; 2
|
||||
1fc0e: 29 f0 breq .+10 ; 0x1fc1a <main+0x1a>
|
||||
if (ch & _BV(EXTRF)) {
|
||||
1fc10: 81 ff sbrs r24, 1
|
||||
1fc12: 02 c0 rjmp .+4 ; 0x1fc18 <main+0x18>
|
||||
* prevent entering bootloader.
|
||||
* '&' operation is skipped to spare few bytes as bits in MCUSR
|
||||
* can only be cleared.
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
MCUSR = ~(_BV(WDRF));
|
||||
1fc14: 97 ef ldi r25, 0xF7 ; 247
|
||||
1fc16: 94 bf out 0x34, r25 ; 52
|
||||
#else
|
||||
MCUCSR = ~(_BV(WDRF));
|
||||
#endif
|
||||
}
|
||||
appStart(ch);
|
||||
1fc18: 10 d1 rcall .+544 ; 0x1fe3a <appStart>
|
||||
}
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
// Set up Timer 1 for timeout counter
|
||||
TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
|
||||
1fc1a: 85 e0 ldi r24, 0x05 ; 5
|
||||
1fc1c: 80 93 81 00 sts 0x0081, r24 ; 0x800081 <__TEXT_REGION_LENGTH__+0x7e0081>
|
||||
UCSRA = _BV(U2X); //Double speed mode USART
|
||||
UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx
|
||||
UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1
|
||||
UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
#else
|
||||
UART_SRA = _BV(U2X0); //Double speed mode USART0
|
||||
1fc20: 82 e0 ldi r24, 0x02 ; 2
|
||||
1fc22: 80 93 c0 00 sts 0x00C0, r24 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
UART_SRB = _BV(RXEN0) | _BV(TXEN0);
|
||||
1fc26: 88 e1 ldi r24, 0x18 ; 24
|
||||
1fc28: 80 93 c1 00 sts 0x00C1, r24 ; 0x8000c1 <__TEXT_REGION_LENGTH__+0x7e00c1>
|
||||
UART_SRC = _BV(UCSZ00) | _BV(UCSZ01);
|
||||
1fc2c: 86 e0 ldi r24, 0x06 ; 6
|
||||
1fc2e: 80 93 c2 00 sts 0x00C2, r24 ; 0x8000c2 <__TEXT_REGION_LENGTH__+0x7e00c2>
|
||||
UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
1fc32: 80 e1 ldi r24, 0x10 ; 16
|
||||
1fc34: 80 93 c4 00 sts 0x00C4, r24 ; 0x8000c4 <__TEXT_REGION_LENGTH__+0x7e00c4>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set up watchdog to trigger after 1s
|
||||
watchdogConfig(WATCHDOG_1S);
|
||||
1fc38: 8e e0 ldi r24, 0x0E ; 14
|
||||
1fc3a: ea d0 rcall .+468 ; 0x1fe10 <watchdogConfig>
|
||||
|
||||
#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) || defined(LED_START_ON)
|
||||
/* Set LED pin as output */
|
||||
LED_DDR |= _BV(LED);
|
||||
1fc3c: 27 9a sbi 0x04, 7 ; 4
|
||||
1fc3e: 86 e0 ldi r24, 0x06 ; 6
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
void flash_led(uint8_t count) {
|
||||
do {
|
||||
TCNT1 = -(F_CPU/(1024*16));
|
||||
1fc40: 20 e3 ldi r18, 0x30 ; 48
|
||||
1fc42: 3c ef ldi r19, 0xFC ; 252
|
||||
TIFR1 = _BV(TOV1);
|
||||
1fc44: 91 e0 ldi r25, 0x01 ; 1
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
void flash_led(uint8_t count) {
|
||||
do {
|
||||
TCNT1 = -(F_CPU/(1024*16));
|
||||
1fc46: 30 93 85 00 sts 0x0085, r19 ; 0x800085 <__TEXT_REGION_LENGTH__+0x7e0085>
|
||||
1fc4a: 20 93 84 00 sts 0x0084, r18 ; 0x800084 <__TEXT_REGION_LENGTH__+0x7e0084>
|
||||
TIFR1 = _BV(TOV1);
|
||||
1fc4e: 96 bb out 0x16, r25 ; 22
|
||||
while(!(TIFR1 & _BV(TOV1)));
|
||||
1fc50: b0 9b sbis 0x16, 0 ; 22
|
||||
1fc52: fe cf rjmp .-4 ; 0x1fc50 <main+0x50>
|
||||
#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) || defined (__AVR_ATmega16__)
|
||||
LED_PORT ^= _BV(LED);
|
||||
#else
|
||||
LED_PIN |= _BV(LED);
|
||||
1fc54: 1f 9a sbi 0x03, 7 ; 3
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
1fc56: a8 95 wdr
|
||||
* While in theory, the STK500 initial commands would be buffered
|
||||
* by the UART hardware, avrdude sends several attempts in rather
|
||||
* quick succession, some of which will be lost and cause us to
|
||||
* get out of sync. So if we see any data; stop blinking.
|
||||
*/
|
||||
if (UART_SRA & _BV(RXC0))
|
||||
1fc58: 40 91 c0 00 lds r20, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
1fc5c: 47 fd sbrc r20, 7
|
||||
1fc5e: 02 c0 rjmp .+4 ; 0x1fc64 <main+0x64>
|
||||
1fc60: 81 50 subi r24, 0x01 ; 1
|
||||
#else
|
||||
// This doesn't seem to work?
|
||||
// if ((UART_PIN & (1<<UART_RX_BIT)) == 0)
|
||||
// break; // detect start bit on soft uart too.
|
||||
#endif
|
||||
} while (--count);
|
||||
1fc62: 89 f7 brne .-30 ; 0x1fc46 <main+0x46>
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
1fc64: ff 24 eor r15, r15
|
||||
1fc66: f3 94 inc r15
|
||||
} while (len -= 2);
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
1fc68: 55 e0 ldi r21, 0x05 ; 5
|
||||
1fc6a: e5 2e mov r14, r21
|
||||
boot_spm_busy_wait();
|
||||
#if defined(RWWSRE)
|
||||
// Reenable read access to flash
|
||||
__boot_rww_enable_short();
|
||||
1fc6c: 61 e1 ldi r22, 0x11 ; 17
|
||||
#endif
|
||||
|
||||
/* Forever loop: exits by causing WDT reset */
|
||||
for (;;) {
|
||||
/* get character from UART */
|
||||
ch = getch();
|
||||
1fc6e: d6 2e mov r13, r22
|
||||
|
||||
if(ch == STK_GET_PARAMETER) {
|
||||
1fc70: c3 d0 rcall .+390 ; 0x1fdf8 <getch>
|
||||
unsigned char which = getch();
|
||||
1fc72: 81 34 cpi r24, 0x41 ; 65
|
||||
1fc74: c1 f4 brne .+48 ; 0x1fca6 <main+0xa6>
|
||||
1fc76: c0 d0 rcall .+384 ; 0x1fdf8 <getch>
|
||||
verifySpace();
|
||||
1fc78: c8 2f mov r28, r24
|
||||
1fc7a: d0 d0 rcall .+416 ; 0x1fe1c <verifySpace>
|
||||
/*
|
||||
* Send optiboot version as "SW version"
|
||||
* Note that the references to memory are optimized away.
|
||||
*/
|
||||
if (which == STK_SW_MINOR) {
|
||||
1fc7c: c2 38 cpi r28, 0x82 ; 130
|
||||
1fc7e: 09 f4 brne .+2 ; 0x1fc82 <main+0x82>
|
||||
1fc80: 3a c0 rjmp .+116 ; 0x1fcf6 <main+0xf6>
|
||||
putch(optiboot_version & 0xFF);
|
||||
} else if (which == STK_SW_MAJOR) {
|
||||
1fc82: c1 38 cpi r28, 0x81 ; 129
|
||||
1fc84: 69 f4 brne .+26 ; 0x1fca0 <main+0xa0>
|
||||
putch(optiboot_version >> 8);
|
||||
1fc86: 87 e0 ldi r24, 0x07 ; 7
|
||||
1fc88: 0c c0 rjmp .+24 ; 0x1fca2 <main+0xa2>
|
||||
writebuffer(desttype, buff, address, savelength);
|
||||
|
||||
|
||||
}
|
||||
/* Read memory block mode, length is big endian. */
|
||||
else if(ch == STK_READ_PAGE) {
|
||||
1fc8a: 84 37 cpi r24, 0x74 ; 116
|
||||
1fc8c: 09 f4 brne .+2 ; 0x1fc90 <main+0x90>
|
||||
|
||||
read_mem(desttype, address, length);
|
||||
}
|
||||
|
||||
/* Get device signature bytes */
|
||||
else if(ch == STK_READ_SIGN) {
|
||||
1fc8e: 82 c0 rjmp .+260 ; 0x1fd94 <main+0x194>
|
||||
1fc90: 85 37 cpi r24, 0x75 ; 117
|
||||
// READ SIGN - return what Avrdude wants to hear
|
||||
verifySpace();
|
||||
1fc92: 09 f0 breq .+2 ; 0x1fc96 <main+0x96>
|
||||
putch(SIGNATURE_0);
|
||||
1fc94: a2 c0 rjmp .+324 ; 0x1fdda <main+0x1da>
|
||||
1fc96: c2 d0 rcall .+388 ; 0x1fe1c <verifySpace>
|
||||
1fc98: 8e e1 ldi r24, 0x1E ; 30
|
||||
putch(SIGNATURE_1);
|
||||
1fc9a: a7 d0 rcall .+334 ; 0x1fdea <putch>
|
||||
1fc9c: 87 e9 ldi r24, 0x97 ; 151
|
||||
1fc9e: a5 d0 rcall .+330 ; 0x1fdea <putch>
|
||||
} else {
|
||||
/*
|
||||
* GET PARAMETER returns a generic 0x03 reply for
|
||||
* other parameters - enough to keep Avrdude happy
|
||||
*/
|
||||
putch(0x03);
|
||||
1fca0: 83 e0 ldi r24, 0x03 ; 3
|
||||
1fca2: a3 d0 rcall .+326 ; 0x1fdea <putch>
|
||||
1fca4: 9f c0 rjmp .+318 ; 0x1fde4 <main+0x1e4>
|
||||
}
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE) {
|
||||
1fca6: 82 34 cpi r24, 0x42 ; 66
|
||||
1fca8: 11 f4 brne .+4 ; 0x1fcae <main+0xae>
|
||||
// SET DEVICE is ignored
|
||||
getNch(20);
|
||||
1fcaa: 84 e1 ldi r24, 0x14 ; 20
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE_EXT) {
|
||||
1fcac: 03 c0 rjmp .+6 ; 0x1fcb4 <main+0xb4>
|
||||
// SET DEVICE EXT is ignored
|
||||
getNch(5);
|
||||
1fcae: 85 34 cpi r24, 0x45 ; 69
|
||||
1fcb0: 19 f4 brne .+6 ; 0x1fcb8 <main+0xb8>
|
||||
1fcb2: 85 e0 ldi r24, 0x05 ; 5
|
||||
1fcb4: bb d0 rcall .+374 ; 0x1fe2c <getNch>
|
||||
}
|
||||
else if(ch == STK_LOAD_ADDRESS) {
|
||||
1fcb6: 96 c0 rjmp .+300 ; 0x1fde4 <main+0x1e4>
|
||||
1fcb8: 85 35 cpi r24, 0x55 ; 85
|
||||
// LOAD ADDRESS
|
||||
address.bytes[0] = getch();
|
||||
1fcba: 79 f4 brne .+30 ; 0x1fcda <main+0xda>
|
||||
1fcbc: 9d d0 rcall .+314 ; 0x1fdf8 <getch>
|
||||
1fcbe: 08 2f mov r16, r24
|
||||
address.bytes[1] = getch();
|
||||
1fcc0: 9b d0 rcall .+310 ; 0x1fdf8 <getch>
|
||||
1fcc2: 18 2f mov r17, r24
|
||||
1fcc4: 87 ff sbrs r24, 7
|
||||
#ifdef RAMPZ
|
||||
// Transfer top bit to LSB in RAMPZ
|
||||
if (address.bytes[1] & 0x80) {
|
||||
1fcc6: 03 c0 rjmp .+6 ; 0x1fcce <main+0xce>
|
||||
RAMPZ |= 0x01;
|
||||
1fcc8: 8b b7 in r24, 0x3b ; 59
|
||||
1fcca: 81 60 ori r24, 0x01 ; 1
|
||||
}
|
||||
else {
|
||||
RAMPZ &= 0xFE;
|
||||
1fccc: 02 c0 rjmp .+4 ; 0x1fcd2 <main+0xd2>
|
||||
1fcce: 8b b7 in r24, 0x3b ; 59
|
||||
}
|
||||
#endif
|
||||
address.word *= 2; // Convert from word address to byte address
|
||||
1fcd0: 8e 7f andi r24, 0xFE ; 254
|
||||
1fcd2: 8b bf out 0x3b, r24 ; 59
|
||||
1fcd4: 00 0f add r16, r16
|
||||
verifySpace();
|
||||
}
|
||||
else if(ch == STK_UNIVERSAL) {
|
||||
1fcd6: 11 1f adc r17, r17
|
||||
#ifdef RAMPZ
|
||||
// LOAD_EXTENDED_ADDRESS is needed in STK_UNIVERSAL for addressing more than 128kB
|
||||
if ( AVR_OP_LOAD_EXT_ADDR == getch() ) {
|
||||
1fcd8: 84 c0 rjmp .+264 ; 0x1fde2 <main+0x1e2>
|
||||
1fcda: 86 35 cpi r24, 0x56 ; 86
|
||||
1fcdc: 81 f4 brne .+32 ; 0x1fcfe <main+0xfe>
|
||||
1fcde: 8c d0 rcall .+280 ; 0x1fdf8 <getch>
|
||||
// get address
|
||||
getch(); // get '0'
|
||||
1fce0: 8d 34 cpi r24, 0x4D ; 77
|
||||
1fce2: 59 f4 brne .+22 ; 0x1fcfa <main+0xfa>
|
||||
RAMPZ = (RAMPZ & 0x01) | ((getch() << 1) & 0xff); // get address and put it in RAMPZ
|
||||
1fce4: 89 d0 rcall .+274 ; 0x1fdf8 <getch>
|
||||
1fce6: cb b7 in r28, 0x3b ; 59
|
||||
1fce8: 87 d0 rcall .+270 ; 0x1fdf8 <getch>
|
||||
1fcea: c1 70 andi r28, 0x01 ; 1
|
||||
1fcec: 88 0f add r24, r24
|
||||
1fcee: c8 2b or r28, r24
|
||||
getNch(1); // get last '0'
|
||||
1fcf0: cb bf out 0x3b, r28 ; 59
|
||||
1fcf2: 81 e0 ldi r24, 0x01 ; 1
|
||||
// response
|
||||
putch(0x00);
|
||||
1fcf4: 9b d0 rcall .+310 ; 0x1fe2c <getNch>
|
||||
1fcf6: 80 e0 ldi r24, 0x00 ; 0
|
||||
}
|
||||
else {
|
||||
// everything else is ignored
|
||||
getNch(3);
|
||||
1fcf8: d4 cf rjmp .-88 ; 0x1fca2 <main+0xa2>
|
||||
1fcfa: 83 e0 ldi r24, 0x03 ; 3
|
||||
getNch(4);
|
||||
putch(0x00);
|
||||
#endif
|
||||
}
|
||||
/* Write memory, length is big endian and is in bytes */
|
||||
else if(ch == STK_PROG_PAGE) {
|
||||
1fcfc: fb cf rjmp .-10 ; 0x1fcf4 <main+0xf4>
|
||||
1fcfe: 84 36 cpi r24, 0x64 ; 100
|
||||
// PROGRAM PAGE - we support flash programming only, not EEPROM
|
||||
uint8_t desttype;
|
||||
uint8_t *bufPtr;
|
||||
pagelen_t savelength;
|
||||
|
||||
GETLENGTH(length);
|
||||
1fd00: 09 f0 breq .+2 ; 0x1fd04 <main+0x104>
|
||||
1fd02: c3 cf rjmp .-122 ; 0x1fc8a <main+0x8a>
|
||||
1fd04: 79 d0 rcall .+242 ; 0x1fdf8 <getch>
|
||||
1fd06: c8 2f mov r28, r24
|
||||
1fd08: d0 e0 ldi r29, 0x00 ; 0
|
||||
1fd0a: dc 2f mov r29, r28
|
||||
1fd0c: cc 27 eor r28, r28
|
||||
1fd0e: 74 d0 rcall .+232 ; 0x1fdf8 <getch>
|
||||
savelength = length;
|
||||
desttype = getch();
|
||||
1fd10: c8 2b or r28, r24
|
||||
1fd12: 72 d0 rcall .+228 ; 0x1fdf8 <getch>
|
||||
1fd14: c8 2e mov r12, r24
|
||||
// PROGRAM PAGE - we support flash programming only, not EEPROM
|
||||
uint8_t desttype;
|
||||
uint8_t *bufPtr;
|
||||
pagelen_t savelength;
|
||||
|
||||
GETLENGTH(length);
|
||||
1fd16: 5e 01 movw r10, r28
|
||||
savelength = length;
|
||||
desttype = getch();
|
||||
1fd18: 81 2c mov r8, r1
|
||||
1fd1a: 32 e0 ldi r19, 0x02 ; 2
|
||||
1fd1c: 93 2e mov r9, r19
|
||||
|
||||
// read a page worth of contents
|
||||
bufPtr = buff.bptr;
|
||||
do *bufPtr++ = getch();
|
||||
1fd1e: 6c d0 rcall .+216 ; 0x1fdf8 <getch>
|
||||
1fd20: f4 01 movw r30, r8
|
||||
1fd22: 81 93 st Z+, r24
|
||||
1fd24: 4f 01 movw r8, r30
|
||||
1fd26: f1 e0 ldi r31, 0x01 ; 1
|
||||
while (--length);
|
||||
1fd28: af 1a sub r10, r31
|
||||
1fd2a: b1 08 sbc r11, r1
|
||||
1fd2c: c1 f7 brne .-16 ; 0x1fd1e <main+0x11e>
|
||||
|
||||
// Read command terminator, start reply
|
||||
verifySpace();
|
||||
1fd2e: 76 d0 rcall .+236 ; 0x1fe1c <verifySpace>
|
||||
1fd30: 85 e4 ldi r24, 0x45 ; 69
|
||||
* void writebuffer(memtype, buffer, address, length)
|
||||
*/
|
||||
static inline void writebuffer(int8_t memtype, addr16_t mybuff,
|
||||
addr16_t address, pagelen_t len)
|
||||
{
|
||||
switch (memtype) {
|
||||
1fd32: c8 12 cpse r12, r24
|
||||
1fd34: 12 c0 rjmp .+36 ; 0x1fd5a <main+0x15a>
|
||||
1fd36: de 5f subi r29, 0xFE ; 254
|
||||
1fd38: 48 01 movw r8, r16
|
||||
1fd3a: a1 2c mov r10, r1
|
||||
1fd3c: 92 e0 ldi r25, 0x02 ; 2
|
||||
1fd3e: b9 2e mov r11, r25
|
||||
1fd40: ac 16 cp r10, r28
|
||||
case 'E': // EEPROM
|
||||
#if defined(SUPPORT_EEPROM) || defined(BIGBOOT)
|
||||
while(len--) {
|
||||
1fd42: bd 06 cpc r11, r29
|
||||
1fd44: 09 f4 brne .+2 ; 0x1fd48 <main+0x148>
|
||||
1fd46: 4e c0 rjmp .+156 ; 0x1fde4 <main+0x1e4>
|
||||
1fd48: f5 01 movw r30, r10
|
||||
eeprom_write_byte((address.bptr++), *(mybuff.bptr++));
|
||||
1fd4a: 61 91 ld r22, Z+
|
||||
1fd4c: 5f 01 movw r10, r30
|
||||
1fd4e: c4 01 movw r24, r8
|
||||
1fd50: 82 d0 rcall .+260 ; 0x1fe56 <eeprom_write_byte>
|
||||
1fd52: ff ef ldi r31, 0xFF ; 255
|
||||
1fd54: 8f 1a sub r8, r31
|
||||
1fd56: 9f 0a sbc r9, r31
|
||||
1fd58: f3 cf rjmp .-26 ; 0x1fd40 <main+0x140>
|
||||
1fd5a: 83 e0 ldi r24, 0x03 ; 3
|
||||
1fd5c: f8 01 movw r30, r16
|
||||
* Start the page erase and wait for it to finish. There
|
||||
* used to be code to do this while receiving the data over
|
||||
* the serial link, but the performance improvement was slight,
|
||||
* and we needed the space back.
|
||||
*/
|
||||
__boot_page_erase_short(address.word);
|
||||
1fd5e: 87 bf out 0x37, r24 ; 55
|
||||
1fd60: e8 95 spm
|
||||
1fd62: 07 b6 in r0, 0x37 ; 55
|
||||
1fd64: 00 fc sbrc r0, 0
|
||||
boot_spm_busy_wait();
|
||||
1fd66: fd cf rjmp .-6 ; 0x1fd62 <main+0x162>
|
||||
1fd68: a0 e0 ldi r26, 0x00 ; 0
|
||||
1fd6a: b2 e0 ldi r27, 0x02 ; 2
|
||||
1fd6c: f8 01 movw r30, r16
|
||||
1fd6e: 8d 91 ld r24, X+
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
1fd70: 9d 91 ld r25, X+
|
||||
1fd72: 0c 01 movw r0, r24
|
||||
1fd74: f7 be out 0x37, r15 ; 55
|
||||
1fd76: e8 95 spm
|
||||
1fd78: 11 24 eor r1, r1
|
||||
addrPtr += 2;
|
||||
} while (len -= 2);
|
||||
1fd7a: 22 97 sbiw r28, 0x02 ; 2
|
||||
1fd7c: 32 96 adiw r30, 0x02 ; 2
|
||||
1fd7e: 20 97 sbiw r28, 0x00 ; 0
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
1fd80: b1 f7 brne .-20 ; 0x1fd6e <main+0x16e>
|
||||
1fd82: f8 01 movw r30, r16
|
||||
1fd84: e7 be out 0x37, r14 ; 55
|
||||
boot_spm_busy_wait();
|
||||
1fd86: e8 95 spm
|
||||
#if defined(RWWSRE)
|
||||
// Reenable read access to flash
|
||||
__boot_rww_enable_short();
|
||||
1fd88: 07 b6 in r0, 0x37 ; 55
|
||||
1fd8a: 00 fc sbrc r0, 0
|
||||
1fd8c: fd cf rjmp .-6 ; 0x1fd88 <main+0x188>
|
||||
|
||||
}
|
||||
/* Read memory block mode, length is big endian. */
|
||||
else if(ch == STK_READ_PAGE) {
|
||||
uint8_t desttype;
|
||||
GETLENGTH(length);
|
||||
1fd8e: d7 be out 0x37, r13 ; 55
|
||||
1fd90: e8 95 spm
|
||||
1fd92: 28 c0 rjmp .+80 ; 0x1fde4 <main+0x1e4>
|
||||
1fd94: 31 d0 rcall .+98 ; 0x1fdf8 <getch>
|
||||
1fd96: c8 2f mov r28, r24
|
||||
1fd98: d0 e0 ldi r29, 0x00 ; 0
|
||||
1fd9a: dc 2f mov r29, r28
|
||||
1fd9c: cc 27 eor r28, r28
|
||||
1fd9e: 2c d0 rcall .+88 ; 0x1fdf8 <getch>
|
||||
|
||||
desttype = getch();
|
||||
1fda0: 5e 01 movw r10, r28
|
||||
1fda2: a8 2a or r10, r24
|
||||
1fda4: 29 d0 rcall .+82 ; 0x1fdf8 <getch>
|
||||
|
||||
verifySpace();
|
||||
1fda6: 98 2e mov r9, r24
|
||||
1fda8: 39 d0 rcall .+114 ; 0x1fe1c <verifySpace>
|
||||
1fdaa: e8 01 movw r28, r16
|
||||
|
||||
static inline void read_mem(uint8_t memtype, addr16_t address, pagelen_t length)
|
||||
{
|
||||
uint8_t ch;
|
||||
|
||||
switch (memtype) {
|
||||
1fdac: f5 e4 ldi r31, 0x45 ; 69
|
||||
|
||||
#if defined(SUPPORT_EEPROM) || defined(BIGBOOT)
|
||||
case 'E': // EEPROM
|
||||
do {
|
||||
putch(eeprom_read_byte((address.bptr++)));
|
||||
1fdae: 9f 12 cpse r9, r31
|
||||
1fdb0: 0b c0 rjmp .+22 ; 0x1fdc8 <main+0x1c8>
|
||||
1fdb2: ce 01 movw r24, r28
|
||||
1fdb4: 48 d0 rcall .+144 ; 0x1fe46 <eeprom_read_byte>
|
||||
} while (--length);
|
||||
1fdb6: 19 d0 rcall .+50 ; 0x1fdea <putch>
|
||||
1fdb8: 81 e0 ldi r24, 0x01 ; 1
|
||||
1fdba: a8 1a sub r10, r24
|
||||
1fdbc: b1 08 sbc r11, r1
|
||||
1fdbe: 21 96 adiw r28, 0x01 ; 1
|
||||
1fdc0: a1 14 cp r10, r1
|
||||
1fdc2: b1 04 cpc r11, r1
|
||||
1fdc4: b1 f7 brne .-20 ; 0x1fdb2 <main+0x1b2>
|
||||
// Since RAMPZ should already be set, we need to use EPLM directly.
|
||||
// Also, we can use the autoincrement version of lpm to update "address"
|
||||
// do putch(pgm_read_byte_near(address++));
|
||||
// while (--length);
|
||||
// read a Flash and increment the address (may increment RAMPZ)
|
||||
__asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
1fdc6: 0e c0 rjmp .+28 ; 0x1fde4 <main+0x1e4>
|
||||
1fdc8: fe 01 movw r30, r28
|
||||
1fdca: 87 91 elpm r24, Z+
|
||||
#else
|
||||
// read a Flash byte and increment the address
|
||||
__asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
#endif
|
||||
putch(ch);
|
||||
1fdcc: ef 01 movw r28, r30
|
||||
1fdce: 0d d0 rcall .+26 ; 0x1fdea <putch>
|
||||
} while (--length);
|
||||
1fdd0: e1 e0 ldi r30, 0x01 ; 1
|
||||
1fdd2: ae 1a sub r10, r30
|
||||
1fdd4: b1 08 sbc r11, r1
|
||||
1fdd6: c1 f7 brne .-16 ; 0x1fdc8 <main+0x1c8>
|
||||
1fdd8: 05 c0 rjmp .+10 ; 0x1fde4 <main+0x1e4>
|
||||
verifySpace();
|
||||
putch(SIGNATURE_0);
|
||||
putch(SIGNATURE_1);
|
||||
putch(SIGNATURE_2);
|
||||
}
|
||||
else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */
|
||||
1fdda: 81 35 cpi r24, 0x51 ; 81
|
||||
1fddc: 11 f4 brne .+4 ; 0x1fde2 <main+0x1e2>
|
||||
// Adaboot no-wait mod
|
||||
watchdogConfig(WATCHDOG_16MS);
|
||||
1fdde: 88 e0 ldi r24, 0x08 ; 8
|
||||
1fde0: 17 d0 rcall .+46 ; 0x1fe10 <watchdogConfig>
|
||||
1fde2: 1c d0 rcall .+56 ; 0x1fe1c <verifySpace>
|
||||
verifySpace();
|
||||
}
|
||||
else {
|
||||
// This covers the response to commands like STK_ENTER_PROGMODE
|
||||
verifySpace();
|
||||
1fde4: 80 e1 ldi r24, 0x10 ; 16
|
||||
1fde6: 01 d0 rcall .+2 ; 0x1fdea <putch>
|
||||
}
|
||||
putch(STK_OK);
|
||||
1fde8: 43 cf rjmp .-378 ; 0x1fc70 <main+0x70>
|
||||
|
||||
0001fdea <putch>:
|
||||
1fdea: 90 91 c0 00 lds r25, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
}
|
||||
1fdee: 95 ff sbrs r25, 5
|
||||
}
|
||||
|
||||
void putch(char ch) {
|
||||
#ifndef SOFT_UART
|
||||
while (!(UART_SRA & _BV(UDRE0)));
|
||||
1fdf0: fc cf rjmp .-8 ; 0x1fdea <putch>
|
||||
UART_UDR = ch;
|
||||
1fdf2: 80 93 c6 00 sts 0x00C6, r24 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7e00c6>
|
||||
1fdf6: 08 95 ret
|
||||
|
||||
0001fdf8 <getch>:
|
||||
[uartBit] "I" (UART_RX_BIT)
|
||||
:
|
||||
"r25"
|
||||
);
|
||||
#else
|
||||
while(!(UART_SRA & _BV(RXC0)))
|
||||
1fdf8: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
1fdfc: 87 ff sbrs r24, 7
|
||||
1fdfe: fc cf rjmp .-8 ; 0x1fdf8 <getch>
|
||||
;
|
||||
if (!(UART_SRA & _BV(FE0))) {
|
||||
1fe00: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
1fe04: 84 fd sbrc r24, 4
|
||||
1fe06: 01 c0 rjmp .+2 ; 0x1fe0a <getch+0x12>
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
1fe08: a8 95 wdr
|
||||
* don't care that an invalid char is returned...)
|
||||
*/
|
||||
watchdogReset();
|
||||
}
|
||||
|
||||
ch = UART_UDR;
|
||||
1fe0a: 80 91 c6 00 lds r24, 0x00C6 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7e00c6>
|
||||
LED_PIN |= _BV(LED);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ch;
|
||||
}
|
||||
1fe0e: 08 95 ret
|
||||
|
||||
0001fe10 <watchdogConfig>:
|
||||
"wdr\n"
|
||||
);
|
||||
}
|
||||
|
||||
void watchdogConfig(uint8_t x) {
|
||||
WDTCSR = _BV(WDCE) | _BV(WDE);
|
||||
1fe10: e0 e6 ldi r30, 0x60 ; 96
|
||||
1fe12: f0 e0 ldi r31, 0x00 ; 0
|
||||
1fe14: 98 e1 ldi r25, 0x18 ; 24
|
||||
1fe16: 90 83 st Z, r25
|
||||
WDTCSR = x;
|
||||
1fe18: 80 83 st Z, r24
|
||||
1fe1a: 08 95 ret
|
||||
|
||||
0001fe1c <verifySpace>:
|
||||
do getch(); while (--count);
|
||||
verifySpace();
|
||||
}
|
||||
|
||||
void verifySpace() {
|
||||
if (getch() != CRC_EOP) {
|
||||
1fe1c: ed df rcall .-38 ; 0x1fdf8 <getch>
|
||||
1fe1e: 80 32 cpi r24, 0x20 ; 32
|
||||
1fe20: 19 f0 breq .+6 ; 0x1fe28 <verifySpace+0xc>
|
||||
watchdogConfig(WATCHDOG_16MS); // shorten WD timeout
|
||||
1fe22: 88 e0 ldi r24, 0x08 ; 8
|
||||
1fe24: f5 df rcall .-22 ; 0x1fe10 <watchdogConfig>
|
||||
1fe26: ff cf rjmp .-2 ; 0x1fe26 <verifySpace+0xa>
|
||||
while (1) // and busy-loop so that WD causes
|
||||
; // a reset and app start.
|
||||
}
|
||||
putch(STK_INSYNC);
|
||||
1fe28: 84 e1 ldi r24, 0x14 ; 20
|
||||
1fe2a: df cf rjmp .-66 ; 0x1fdea <putch>
|
||||
|
||||
0001fe2c <getNch>:
|
||||
::[count] "M" (UART_B_VALUE)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
void getNch(uint8_t count) {
|
||||
1fe2c: cf 93 push r28
|
||||
1fe2e: c8 2f mov r28, r24
|
||||
do getch(); while (--count);
|
||||
1fe30: e3 df rcall .-58 ; 0x1fdf8 <getch>
|
||||
1fe32: c1 50 subi r28, 0x01 ; 1
|
||||
1fe34: e9 f7 brne .-6 ; 0x1fe30 <getNch+0x4>
|
||||
verifySpace();
|
||||
1fe36: cf 91 pop r28
|
||||
1fe38: f1 cf rjmp .-30 ; 0x1fe1c <verifySpace>
|
||||
|
||||
0001fe3a <appStart>:
|
||||
|
||||
void appStart(uint8_t rstFlags) {
|
||||
// save the reset flags in the designated register
|
||||
// This can be saved in a main program by putting code in .init0 (which
|
||||
// executes before normal c init code) to save R2 to a global variable.
|
||||
__asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags));
|
||||
1fe3a: 28 2e mov r2, r24
|
||||
|
||||
watchdogConfig(WATCHDOG_OFF);
|
||||
1fe3c: 80 e0 ldi r24, 0x00 ; 0
|
||||
1fe3e: e8 df rcall .-48 ; 0x1fe10 <watchdogConfig>
|
||||
1fe40: e0 e0 ldi r30, 0x00 ; 0
|
||||
// Note that appstart_vec is defined so that this works with either
|
||||
// real or virtual boot partitions.
|
||||
__asm__ __volatile__ (
|
||||
1fe42: ff 27 eor r31, r31
|
||||
1fe44: 09 94 ijmp
|
||||
|
||||
0001fe46 <eeprom_read_byte>:
|
||||
1fe46: f9 99 sbic 0x1f, 1 ; 31
|
||||
1fe48: fe cf rjmp .-4 ; 0x1fe46 <eeprom_read_byte>
|
||||
1fe4a: 92 bd out 0x22, r25 ; 34
|
||||
1fe4c: 81 bd out 0x21, r24 ; 33
|
||||
1fe4e: f8 9a sbi 0x1f, 0 ; 31
|
||||
1fe50: 99 27 eor r25, r25
|
||||
1fe52: 80 b5 in r24, 0x20 ; 32
|
||||
1fe54: 08 95 ret
|
||||
|
||||
0001fe56 <eeprom_write_byte>:
|
||||
1fe56: 26 2f mov r18, r22
|
||||
|
||||
0001fe58 <eeprom_write_r18>:
|
||||
1fe58: f9 99 sbic 0x1f, 1 ; 31
|
||||
1fe5a: fe cf rjmp .-4 ; 0x1fe58 <eeprom_write_r18>
|
||||
1fe5c: 1f ba out 0x1f, r1 ; 31
|
||||
1fe5e: 92 bd out 0x22, r25 ; 34
|
||||
1fe60: 81 bd out 0x21, r24 ; 33
|
||||
1fe62: 20 bd out 0x20, r18 ; 32
|
||||
1fe64: 0f b6 in r0, 0x3f ; 63
|
||||
1fe66: f8 94 cli
|
||||
1fe68: fa 9a sbi 0x1f, 2 ; 31
|
||||
1fe6a: f9 9a sbi 0x1f, 1 ; 31
|
||||
1fe6c: 0f be out 0x3f, r0 ; 63
|
||||
1fe6e: 01 96 adiw r24, 0x01 ; 1
|
||||
1fe70: 08 95 ret
|
@ -0,0 +1,31 @@
|
||||
:107E0000112484B7882349F0982F9A70923029F072
|
||||
:107E100081FF02C097EF94BFCCD085E080938100B2
|
||||
:107E200082E08093C00088E18093C10086E0809367
|
||||
:107E3000C20080E18093C4008EE0A6D0259A86E03F
|
||||
:107E400020E33CEF91E0309385002093840096BBC3
|
||||
:107E5000B09BFECF1D9AA8954091C00047FD02C07F
|
||||
:107E6000815089F7EE24E39495E0D92E21E1C22ECA
|
||||
:107E70007FD0813461F47CD0182F8CD01238E9F097
|
||||
:107E8000113811F487E001C083E06BD067C0823401
|
||||
:107E900011F484E103C0853419F485E083D05EC019
|
||||
:107EA000853539F465D0C82F63D0D82FCC0FDD1FAE
|
||||
:107EB00054C0863521F484E075D080E0E6CF843666
|
||||
:107EC00009F02EC055D054D0F82E52D0B82E00E074
|
||||
:107ED00011E04ED0F80181938F01FE12FACF5AD0F3
|
||||
:107EE000F5E4BF1201C0FFCF83E0FE0187BFE89534
|
||||
:107EF00007B600FCFDCFA0E0B1E0FE018D919D91A1
|
||||
:107F00000C01E7BEE89511243296FA12F7CFFE0174
|
||||
:107F1000D7BEE89507B600FCFDCFC7BEE8951EC0EA
|
||||
:107F2000843771F425D024D0F82E22D033D08E019E
|
||||
:107F3000F80185918F0115D0FA94F110F9CF0EC098
|
||||
:107F4000853739F427D08EE10CD085E90AD08FE04F
|
||||
:107F50009CCF813511F488E017D01CD080E101D08E
|
||||
:107F600087CF9091C00095FFFCCF8093C600089505
|
||||
:107F70008091C00087FFFCCF8091C00084FD01C0CC
|
||||
:107F8000A8958091C6000895E0E6F0E098E190831E
|
||||
:107F900080830895EDDF803219F088E0F5DFFFCFB0
|
||||
:107FA00084E1DFCFCF93C82FE3DFC150E9F7CF9152
|
||||
:0E7FB000F1CF282E80E0E8DFE0E0FF27099403
|
||||
:027FFE0000077A
|
||||
:0400000300007E007B
|
||||
:00000001FF
|
@ -0,0 +1,584 @@
|
||||
|
||||
optiboot_atmega328.elf: file format elf32-avr
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .data 00000000 00800100 00007fbe 00000252 2**0
|
||||
CONTENTS, ALLOC, LOAD, DATA
|
||||
1 .text 000001be 00007e00 00007e00 00000094 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
2 .version 00000002 00007ffe 00007ffe 00000252 2**0
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
3 .comment 0000002f 00000000 00000000 00000254 2**0
|
||||
CONTENTS, READONLY
|
||||
4 .debug_aranges 00000028 00000000 00000000 00000283 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
5 .debug_info 000005c8 00000000 00000000 000002ab 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
6 .debug_abbrev 00000282 00000000 00000000 00000873 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
7 .debug_line 000002f9 00000000 00000000 00000af5 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
8 .debug_frame 0000008c 00000000 00000000 00000df0 2**2
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
9 .debug_str 000001fa 00000000 00000000 00000e7c 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
10 .debug_loc 00000331 00000000 00000000 00001076 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
11 .debug_ranges 00000060 00000000 00000000 000013a7 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
00007e00 <main>:
|
||||
// SP points to RAMEND
|
||||
// r1 contains zero
|
||||
//
|
||||
// If not, uncomment the following instructions:
|
||||
// cli();
|
||||
asm volatile ("clr __zero_reg__");
|
||||
7e00: 11 24 eor r1, r1
|
||||
*
|
||||
* Code by MarkG55
|
||||
* see discusion in https://github.com/Optiboot/optiboot/issues/97
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
ch = MCUSR;
|
||||
7e02: 84 b7 in r24, 0x34 ; 52
|
||||
#else
|
||||
ch = MCUCSR;
|
||||
#endif
|
||||
// Skip all logic and run bootloader if MCUSR is cleared (application request)
|
||||
if (ch != 0) {
|
||||
7e04: 88 23 and r24, r24
|
||||
7e06: 49 f0 breq .+18 ; 0x7e1a <main+0x1a>
|
||||
* 2. we clear WDRF if it's set with EXTRF to avoid loops
|
||||
* One problematic scenario: broken application code sets watchdog timer
|
||||
* without clearing MCUSR before and triggers it quickly. But it's
|
||||
* recoverable by power-on with pushed reset button.
|
||||
*/
|
||||
if ((ch & (_BV(WDRF) | _BV(EXTRF))) != _BV(EXTRF)) {
|
||||
7e08: 98 2f mov r25, r24
|
||||
7e0a: 9a 70 andi r25, 0x0A ; 10
|
||||
7e0c: 92 30 cpi r25, 0x02 ; 2
|
||||
7e0e: 29 f0 breq .+10 ; 0x7e1a <main+0x1a>
|
||||
if (ch & _BV(EXTRF)) {
|
||||
7e10: 81 ff sbrs r24, 1
|
||||
7e12: 02 c0 rjmp .+4 ; 0x7e18 <main+0x18>
|
||||
* prevent entering bootloader.
|
||||
* '&' operation is skipped to spare few bytes as bits in MCUSR
|
||||
* can only be cleared.
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
MCUSR = ~(_BV(WDRF));
|
||||
7e14: 97 ef ldi r25, 0xF7 ; 247
|
||||
7e16: 94 bf out 0x34, r25 ; 52
|
||||
#else
|
||||
MCUCSR = ~(_BV(WDRF));
|
||||
#endif
|
||||
}
|
||||
appStart(ch);
|
||||
7e18: cc d0 rcall .+408 ; 0x7fb2 <appStart>
|
||||
}
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
// Set up Timer 1 for timeout counter
|
||||
TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
|
||||
7e1a: 85 e0 ldi r24, 0x05 ; 5
|
||||
7e1c: 80 93 81 00 sts 0x0081, r24 ; 0x800081 <__TEXT_REGION_LENGTH__+0x7e0081>
|
||||
UCSRA = _BV(U2X); //Double speed mode USART
|
||||
UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx
|
||||
UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1
|
||||
UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
#else
|
||||
UART_SRA = _BV(U2X0); //Double speed mode USART0
|
||||
7e20: 82 e0 ldi r24, 0x02 ; 2
|
||||
7e22: 80 93 c0 00 sts 0x00C0, r24 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
UART_SRB = _BV(RXEN0) | _BV(TXEN0);
|
||||
7e26: 88 e1 ldi r24, 0x18 ; 24
|
||||
7e28: 80 93 c1 00 sts 0x00C1, r24 ; 0x8000c1 <__TEXT_REGION_LENGTH__+0x7e00c1>
|
||||
UART_SRC = _BV(UCSZ00) | _BV(UCSZ01);
|
||||
7e2c: 86 e0 ldi r24, 0x06 ; 6
|
||||
7e2e: 80 93 c2 00 sts 0x00C2, r24 ; 0x8000c2 <__TEXT_REGION_LENGTH__+0x7e00c2>
|
||||
UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
7e32: 80 e1 ldi r24, 0x10 ; 16
|
||||
7e34: 80 93 c4 00 sts 0x00C4, r24 ; 0x8000c4 <__TEXT_REGION_LENGTH__+0x7e00c4>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set up watchdog to trigger after 1s
|
||||
watchdogConfig(WATCHDOG_1S);
|
||||
7e38: 8e e0 ldi r24, 0x0E ; 14
|
||||
7e3a: a6 d0 rcall .+332 ; 0x7f88 <watchdogConfig>
|
||||
|
||||
#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) || defined(LED_START_ON)
|
||||
/* Set LED pin as output */
|
||||
LED_DDR |= _BV(LED);
|
||||
7e3c: 25 9a sbi 0x04, 5 ; 4
|
||||
7e3e: 86 e0 ldi r24, 0x06 ; 6
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
void flash_led(uint8_t count) {
|
||||
do {
|
||||
TCNT1 = -(F_CPU/(1024*16));
|
||||
7e40: 20 e3 ldi r18, 0x30 ; 48
|
||||
7e42: 3c ef ldi r19, 0xFC ; 252
|
||||
TIFR1 = _BV(TOV1);
|
||||
7e44: 91 e0 ldi r25, 0x01 ; 1
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
void flash_led(uint8_t count) {
|
||||
do {
|
||||
TCNT1 = -(F_CPU/(1024*16));
|
||||
7e46: 30 93 85 00 sts 0x0085, r19 ; 0x800085 <__TEXT_REGION_LENGTH__+0x7e0085>
|
||||
7e4a: 20 93 84 00 sts 0x0084, r18 ; 0x800084 <__TEXT_REGION_LENGTH__+0x7e0084>
|
||||
TIFR1 = _BV(TOV1);
|
||||
7e4e: 96 bb out 0x16, r25 ; 22
|
||||
while(!(TIFR1 & _BV(TOV1)));
|
||||
7e50: b0 9b sbis 0x16, 0 ; 22
|
||||
7e52: fe cf rjmp .-4 ; 0x7e50 <main+0x50>
|
||||
#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) || defined (__AVR_ATmega16__)
|
||||
LED_PORT ^= _BV(LED);
|
||||
#else
|
||||
LED_PIN |= _BV(LED);
|
||||
7e54: 1d 9a sbi 0x03, 5 ; 3
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
7e56: a8 95 wdr
|
||||
* While in theory, the STK500 initial commands would be buffered
|
||||
* by the UART hardware, avrdude sends several attempts in rather
|
||||
* quick succession, some of which will be lost and cause us to
|
||||
* get out of sync. So if we see any data; stop blinking.
|
||||
*/
|
||||
if (UART_SRA & _BV(RXC0))
|
||||
7e58: 40 91 c0 00 lds r20, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
7e5c: 47 fd sbrc r20, 7
|
||||
7e5e: 02 c0 rjmp .+4 ; 0x7e64 <main+0x64>
|
||||
7e60: 81 50 subi r24, 0x01 ; 1
|
||||
#else
|
||||
// This doesn't seem to work?
|
||||
// if ((UART_PIN & (1<<UART_RX_BIT)) == 0)
|
||||
// break; // detect start bit on soft uart too.
|
||||
#endif
|
||||
} while (--count);
|
||||
7e62: 89 f7 brne .-30 ; 0x7e46 <main+0x46>
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
7e64: ee 24 eor r14, r14
|
||||
7e66: e3 94 inc r14
|
||||
} while (len -= 2);
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
7e68: 95 e0 ldi r25, 0x05 ; 5
|
||||
7e6a: d9 2e mov r13, r25
|
||||
boot_spm_busy_wait();
|
||||
#if defined(RWWSRE)
|
||||
// Reenable read access to flash
|
||||
__boot_rww_enable_short();
|
||||
7e6c: 21 e1 ldi r18, 0x11 ; 17
|
||||
#endif
|
||||
|
||||
/* Forever loop: exits by causing WDT reset */
|
||||
for (;;) {
|
||||
/* get character from UART */
|
||||
ch = getch();
|
||||
7e6e: c2 2e mov r12, r18
|
||||
|
||||
if(ch == STK_GET_PARAMETER) {
|
||||
7e70: 7f d0 rcall .+254 ; 0x7f70 <getch>
|
||||
unsigned char which = getch();
|
||||
7e72: 81 34 cpi r24, 0x41 ; 65
|
||||
7e74: 61 f4 brne .+24 ; 0x7e8e <main+0x8e>
|
||||
7e76: 7c d0 rcall .+248 ; 0x7f70 <getch>
|
||||
verifySpace();
|
||||
7e78: 18 2f mov r17, r24
|
||||
7e7a: 8c d0 rcall .+280 ; 0x7f94 <verifySpace>
|
||||
/*
|
||||
* Send optiboot version as "SW version"
|
||||
* Note that the references to memory are optimized away.
|
||||
*/
|
||||
if (which == STK_SW_MINOR) {
|
||||
7e7c: 12 38 cpi r17, 0x82 ; 130
|
||||
7e7e: e9 f0 breq .+58 ; 0x7eba <main+0xba>
|
||||
putch(optiboot_version & 0xFF);
|
||||
} else if (which == STK_SW_MAJOR) {
|
||||
7e80: 11 38 cpi r17, 0x81 ; 129
|
||||
putch(optiboot_version >> 8);
|
||||
7e82: 11 f4 brne .+4 ; 0x7e88 <main+0x88>
|
||||
7e84: 87 e0 ldi r24, 0x07 ; 7
|
||||
} else {
|
||||
/*
|
||||
* GET PARAMETER returns a generic 0x03 reply for
|
||||
* other parameters - enough to keep Avrdude happy
|
||||
*/
|
||||
putch(0x03);
|
||||
7e86: 01 c0 rjmp .+2 ; 0x7e8a <main+0x8a>
|
||||
7e88: 83 e0 ldi r24, 0x03 ; 3
|
||||
7e8a: 6b d0 rcall .+214 ; 0x7f62 <putch>
|
||||
7e8c: 67 c0 rjmp .+206 ; 0x7f5c <main+0x15c>
|
||||
}
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE) {
|
||||
7e8e: 82 34 cpi r24, 0x42 ; 66
|
||||
// SET DEVICE is ignored
|
||||
getNch(20);
|
||||
7e90: 11 f4 brne .+4 ; 0x7e96 <main+0x96>
|
||||
7e92: 84 e1 ldi r24, 0x14 ; 20
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE_EXT) {
|
||||
7e94: 03 c0 rjmp .+6 ; 0x7e9c <main+0x9c>
|
||||
// SET DEVICE EXT is ignored
|
||||
getNch(5);
|
||||
7e96: 85 34 cpi r24, 0x45 ; 69
|
||||
7e98: 19 f4 brne .+6 ; 0x7ea0 <main+0xa0>
|
||||
7e9a: 85 e0 ldi r24, 0x05 ; 5
|
||||
}
|
||||
else if(ch == STK_LOAD_ADDRESS) {
|
||||
7e9c: 83 d0 rcall .+262 ; 0x7fa4 <getNch>
|
||||
7e9e: 5e c0 rjmp .+188 ; 0x7f5c <main+0x15c>
|
||||
// LOAD ADDRESS
|
||||
address.bytes[0] = getch();
|
||||
7ea0: 85 35 cpi r24, 0x55 ; 85
|
||||
7ea2: 39 f4 brne .+14 ; 0x7eb2 <main+0xb2>
|
||||
7ea4: 65 d0 rcall .+202 ; 0x7f70 <getch>
|
||||
address.bytes[1] = getch();
|
||||
7ea6: c8 2f mov r28, r24
|
||||
7ea8: 63 d0 rcall .+198 ; 0x7f70 <getch>
|
||||
}
|
||||
else {
|
||||
RAMPZ &= 0xFE;
|
||||
}
|
||||
#endif
|
||||
address.word *= 2; // Convert from word address to byte address
|
||||
7eaa: d8 2f mov r29, r24
|
||||
7eac: cc 0f add r28, r28
|
||||
7eae: dd 1f adc r29, r29
|
||||
verifySpace();
|
||||
}
|
||||
else if(ch == STK_UNIVERSAL) {
|
||||
7eb0: 54 c0 rjmp .+168 ; 0x7f5a <main+0x15a>
|
||||
getNch(3);
|
||||
putch(0x00);
|
||||
}
|
||||
#else
|
||||
// UNIVERSAL command is ignored
|
||||
getNch(4);
|
||||
7eb2: 86 35 cpi r24, 0x56 ; 86
|
||||
7eb4: 21 f4 brne .+8 ; 0x7ebe <main+0xbe>
|
||||
putch(0x00);
|
||||
7eb6: 84 e0 ldi r24, 0x04 ; 4
|
||||
7eb8: 75 d0 rcall .+234 ; 0x7fa4 <getNch>
|
||||
#endif
|
||||
}
|
||||
/* Write memory, length is big endian and is in bytes */
|
||||
else if(ch == STK_PROG_PAGE) {
|
||||
7eba: 80 e0 ldi r24, 0x00 ; 0
|
||||
7ebc: e6 cf rjmp .-52 ; 0x7e8a <main+0x8a>
|
||||
// PROGRAM PAGE - we support flash programming only, not EEPROM
|
||||
uint8_t desttype;
|
||||
uint8_t *bufPtr;
|
||||
pagelen_t savelength;
|
||||
|
||||
GETLENGTH(length);
|
||||
7ebe: 84 36 cpi r24, 0x64 ; 100
|
||||
7ec0: 09 f0 breq .+2 ; 0x7ec4 <main+0xc4>
|
||||
7ec2: 2e c0 rjmp .+92 ; 0x7f20 <main+0x120>
|
||||
7ec4: 55 d0 rcall .+170 ; 0x7f70 <getch>
|
||||
savelength = length;
|
||||
desttype = getch();
|
||||
7ec6: 54 d0 rcall .+168 ; 0x7f70 <getch>
|
||||
7ec8: f8 2e mov r15, r24
|
||||
7eca: 52 d0 rcall .+164 ; 0x7f70 <getch>
|
||||
7ecc: b8 2e mov r11, r24
|
||||
7ece: 00 e0 ldi r16, 0x00 ; 0
|
||||
|
||||
// read a page worth of contents
|
||||
bufPtr = buff.bptr;
|
||||
do *bufPtr++ = getch();
|
||||
7ed0: 11 e0 ldi r17, 0x01 ; 1
|
||||
7ed2: 4e d0 rcall .+156 ; 0x7f70 <getch>
|
||||
7ed4: f8 01 movw r30, r16
|
||||
7ed6: 81 93 st Z+, r24
|
||||
7ed8: 8f 01 movw r16, r30
|
||||
while (--length);
|
||||
7eda: fe 12 cpse r15, r30
|
||||
7edc: fa cf rjmp .-12 ; 0x7ed2 <main+0xd2>
|
||||
|
||||
// Read command terminator, start reply
|
||||
verifySpace();
|
||||
7ede: 5a d0 rcall .+180 ; 0x7f94 <verifySpace>
|
||||
7ee0: f5 e4 ldi r31, 0x45 ; 69
|
||||
* void writebuffer(memtype, buffer, address, length)
|
||||
*/
|
||||
static inline void writebuffer(int8_t memtype, addr16_t mybuff,
|
||||
addr16_t address, pagelen_t len)
|
||||
{
|
||||
switch (memtype) {
|
||||
7ee2: bf 12 cpse r11, r31
|
||||
7ee4: 01 c0 rjmp .+2 ; 0x7ee8 <main+0xe8>
|
||||
7ee6: ff cf rjmp .-2 ; 0x7ee6 <main+0xe6>
|
||||
7ee8: 83 e0 ldi r24, 0x03 ; 3
|
||||
* Start the page erase and wait for it to finish. There
|
||||
* used to be code to do this while receiving the data over
|
||||
* the serial link, but the performance improvement was slight,
|
||||
* and we needed the space back.
|
||||
*/
|
||||
__boot_page_erase_short(address.word);
|
||||
7eea: fe 01 movw r30, r28
|
||||
7eec: 87 bf out 0x37, r24 ; 55
|
||||
7eee: e8 95 spm
|
||||
7ef0: 07 b6 in r0, 0x37 ; 55
|
||||
boot_spm_busy_wait();
|
||||
7ef2: 00 fc sbrc r0, 0
|
||||
7ef4: fd cf rjmp .-6 ; 0x7ef0 <main+0xf0>
|
||||
7ef6: a0 e0 ldi r26, 0x00 ; 0
|
||||
7ef8: b1 e0 ldi r27, 0x01 ; 1
|
||||
7efa: fe 01 movw r30, r28
|
||||
7efc: 8d 91 ld r24, X+
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
7efe: 9d 91 ld r25, X+
|
||||
7f00: 0c 01 movw r0, r24
|
||||
7f02: e7 be out 0x37, r14 ; 55
|
||||
7f04: e8 95 spm
|
||||
7f06: 11 24 eor r1, r1
|
||||
7f08: 32 96 adiw r30, 0x02 ; 2
|
||||
addrPtr += 2;
|
||||
} while (len -= 2);
|
||||
7f0a: fa 12 cpse r15, r26
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
7f0c: f7 cf rjmp .-18 ; 0x7efc <main+0xfc>
|
||||
7f0e: fe 01 movw r30, r28
|
||||
boot_spm_busy_wait();
|
||||
7f10: d7 be out 0x37, r13 ; 55
|
||||
7f12: e8 95 spm
|
||||
#if defined(RWWSRE)
|
||||
// Reenable read access to flash
|
||||
__boot_rww_enable_short();
|
||||
7f14: 07 b6 in r0, 0x37 ; 55
|
||||
7f16: 00 fc sbrc r0, 0
|
||||
7f18: fd cf rjmp .-6 ; 0x7f14 <main+0x114>
|
||||
writebuffer(desttype, buff, address, savelength);
|
||||
|
||||
|
||||
}
|
||||
/* Read memory block mode, length is big endian. */
|
||||
else if(ch == STK_READ_PAGE) {
|
||||
7f1a: c7 be out 0x37, r12 ; 55
|
||||
7f1c: e8 95 spm
|
||||
uint8_t desttype;
|
||||
GETLENGTH(length);
|
||||
7f1e: 1e c0 rjmp .+60 ; 0x7f5c <main+0x15c>
|
||||
7f20: 84 37 cpi r24, 0x74 ; 116
|
||||
7f22: 71 f4 brne .+28 ; 0x7f40 <main+0x140>
|
||||
|
||||
desttype = getch();
|
||||
7f24: 25 d0 rcall .+74 ; 0x7f70 <getch>
|
||||
|
||||
verifySpace();
|
||||
7f26: 24 d0 rcall .+72 ; 0x7f70 <getch>
|
||||
7f28: f8 2e mov r15, r24
|
||||
7f2a: 22 d0 rcall .+68 ; 0x7f70 <getch>
|
||||
// while (--length);
|
||||
// read a Flash and increment the address (may increment RAMPZ)
|
||||
__asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
#else
|
||||
// read a Flash byte and increment the address
|
||||
__asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
7f2c: 33 d0 rcall .+102 ; 0x7f94 <verifySpace>
|
||||
7f2e: 8e 01 movw r16, r28
|
||||
#endif
|
||||
putch(ch);
|
||||
7f30: f8 01 movw r30, r16
|
||||
} while (--length);
|
||||
7f32: 85 91 lpm r24, Z+
|
||||
7f34: 8f 01 movw r16, r30
|
||||
7f36: 15 d0 rcall .+42 ; 0x7f62 <putch>
|
||||
7f38: fa 94 dec r15
|
||||
|
||||
read_mem(desttype, address, length);
|
||||
}
|
||||
|
||||
/* Get device signature bytes */
|
||||
else if(ch == STK_READ_SIGN) {
|
||||
7f3a: f1 10 cpse r15, r1
|
||||
7f3c: f9 cf rjmp .-14 ; 0x7f30 <main+0x130>
|
||||
// READ SIGN - return what Avrdude wants to hear
|
||||
verifySpace();
|
||||
7f3e: 0e c0 rjmp .+28 ; 0x7f5c <main+0x15c>
|
||||
7f40: 85 37 cpi r24, 0x75 ; 117
|
||||
putch(SIGNATURE_0);
|
||||
7f42: 39 f4 brne .+14 ; 0x7f52 <main+0x152>
|
||||
7f44: 27 d0 rcall .+78 ; 0x7f94 <verifySpace>
|
||||
7f46: 8e e1 ldi r24, 0x1E ; 30
|
||||
putch(SIGNATURE_1);
|
||||
7f48: 0c d0 rcall .+24 ; 0x7f62 <putch>
|
||||
7f4a: 85 e9 ldi r24, 0x95 ; 149
|
||||
7f4c: 0a d0 rcall .+20 ; 0x7f62 <putch>
|
||||
putch(SIGNATURE_2);
|
||||
7f4e: 8f e0 ldi r24, 0x0F ; 15
|
||||
7f50: 9c cf rjmp .-200 ; 0x7e8a <main+0x8a>
|
||||
}
|
||||
else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */
|
||||
7f52: 81 35 cpi r24, 0x51 ; 81
|
||||
7f54: 11 f4 brne .+4 ; 0x7f5a <main+0x15a>
|
||||
// Adaboot no-wait mod
|
||||
watchdogConfig(WATCHDOG_16MS);
|
||||
7f56: 88 e0 ldi r24, 0x08 ; 8
|
||||
7f58: 17 d0 rcall .+46 ; 0x7f88 <watchdogConfig>
|
||||
7f5a: 1c d0 rcall .+56 ; 0x7f94 <verifySpace>
|
||||
verifySpace();
|
||||
}
|
||||
else {
|
||||
// This covers the response to commands like STK_ENTER_PROGMODE
|
||||
verifySpace();
|
||||
7f5c: 80 e1 ldi r24, 0x10 ; 16
|
||||
7f5e: 01 d0 rcall .+2 ; 0x7f62 <putch>
|
||||
}
|
||||
putch(STK_OK);
|
||||
7f60: 87 cf rjmp .-242 ; 0x7e70 <main+0x70>
|
||||
|
||||
00007f62 <putch>:
|
||||
7f62: 90 91 c0 00 lds r25, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
}
|
||||
7f66: 95 ff sbrs r25, 5
|
||||
}
|
||||
|
||||
void putch(char ch) {
|
||||
#ifndef SOFT_UART
|
||||
while (!(UART_SRA & _BV(UDRE0)));
|
||||
7f68: fc cf rjmp .-8 ; 0x7f62 <putch>
|
||||
UART_UDR = ch;
|
||||
7f6a: 80 93 c6 00 sts 0x00C6, r24 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7e00c6>
|
||||
7f6e: 08 95 ret
|
||||
|
||||
00007f70 <getch>:
|
||||
[uartBit] "I" (UART_RX_BIT)
|
||||
:
|
||||
"r25"
|
||||
);
|
||||
#else
|
||||
while(!(UART_SRA & _BV(RXC0)))
|
||||
7f70: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
7f74: 87 ff sbrs r24, 7
|
||||
7f76: fc cf rjmp .-8 ; 0x7f70 <getch>
|
||||
;
|
||||
if (!(UART_SRA & _BV(FE0))) {
|
||||
7f78: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
7f7c: 84 fd sbrc r24, 4
|
||||
7f7e: 01 c0 rjmp .+2 ; 0x7f82 <getch+0x12>
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
7f80: a8 95 wdr
|
||||
* don't care that an invalid char is returned...)
|
||||
*/
|
||||
watchdogReset();
|
||||
}
|
||||
|
||||
ch = UART_UDR;
|
||||
7f82: 80 91 c6 00 lds r24, 0x00C6 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7e00c6>
|
||||
LED_PIN |= _BV(LED);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ch;
|
||||
}
|
||||
7f86: 08 95 ret
|
||||
|
||||
00007f88 <watchdogConfig>:
|
||||
"wdr\n"
|
||||
);
|
||||
}
|
||||
|
||||
void watchdogConfig(uint8_t x) {
|
||||
WDTCSR = _BV(WDCE) | _BV(WDE);
|
||||
7f88: e0 e6 ldi r30, 0x60 ; 96
|
||||
7f8a: f0 e0 ldi r31, 0x00 ; 0
|
||||
7f8c: 98 e1 ldi r25, 0x18 ; 24
|
||||
7f8e: 90 83 st Z, r25
|
||||
WDTCSR = x;
|
||||
7f90: 80 83 st Z, r24
|
||||
7f92: 08 95 ret
|
||||
|
||||
00007f94 <verifySpace>:
|
||||
do getch(); while (--count);
|
||||
verifySpace();
|
||||
}
|
||||
|
||||
void verifySpace() {
|
||||
if (getch() != CRC_EOP) {
|
||||
7f94: ed df rcall .-38 ; 0x7f70 <getch>
|
||||
7f96: 80 32 cpi r24, 0x20 ; 32
|
||||
7f98: 19 f0 breq .+6 ; 0x7fa0 <verifySpace+0xc>
|
||||
watchdogConfig(WATCHDOG_16MS); // shorten WD timeout
|
||||
7f9a: 88 e0 ldi r24, 0x08 ; 8
|
||||
7f9c: f5 df rcall .-22 ; 0x7f88 <watchdogConfig>
|
||||
7f9e: ff cf rjmp .-2 ; 0x7f9e <verifySpace+0xa>
|
||||
while (1) // and busy-loop so that WD causes
|
||||
; // a reset and app start.
|
||||
}
|
||||
putch(STK_INSYNC);
|
||||
7fa0: 84 e1 ldi r24, 0x14 ; 20
|
||||
7fa2: df cf rjmp .-66 ; 0x7f62 <putch>
|
||||
|
||||
00007fa4 <getNch>:
|
||||
::[count] "M" (UART_B_VALUE)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
void getNch(uint8_t count) {
|
||||
7fa4: cf 93 push r28
|
||||
7fa6: c8 2f mov r28, r24
|
||||
do getch(); while (--count);
|
||||
7fa8: e3 df rcall .-58 ; 0x7f70 <getch>
|
||||
7faa: c1 50 subi r28, 0x01 ; 1
|
||||
7fac: e9 f7 brne .-6 ; 0x7fa8 <getNch+0x4>
|
||||
verifySpace();
|
||||
7fae: cf 91 pop r28
|
||||
7fb0: f1 cf rjmp .-30 ; 0x7f94 <verifySpace>
|
||||
|
||||
00007fb2 <appStart>:
|
||||
|
||||
void appStart(uint8_t rstFlags) {
|
||||
// save the reset flags in the designated register
|
||||
// This can be saved in a main program by putting code in .init0 (which
|
||||
// executes before normal c init code) to save R2 to a global variable.
|
||||
__asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags));
|
||||
7fb2: 28 2e mov r2, r24
|
||||
|
||||
watchdogConfig(WATCHDOG_OFF);
|
||||
7fb4: 80 e0 ldi r24, 0x00 ; 0
|
||||
7fb6: e8 df rcall .-48 ; 0x7f88 <watchdogConfig>
|
||||
7fb8: e0 e0 ldi r30, 0x00 ; 0
|
||||
// Note that appstart_vec is defined so that this works with either
|
||||
// real or virtual boot partitions.
|
||||
__asm__ __volatile__ (
|
||||
7fba: ff 27 eor r31, r31
|
||||
7fbc: 09 94 ijmp
|
@ -0,0 +1,40 @@
|
||||
:10FC0000112484B7882349F0982F9A70923029F0F4
|
||||
:10FC100081FF02C097EF94BFFBD085E08093810005
|
||||
:10FC200082E08093C00088E18093C10086E08093E9
|
||||
:10FC3000C20080E18093C4008EE0D5D0209A86E097
|
||||
:10FC400020E33CEF91E0309385002093840096BB45
|
||||
:10FC5000B09BFECF189AA8954091C00047FD02C006
|
||||
:10FC6000815089F7FF24F39455E0E52E61E1D62E0B
|
||||
:10FC7000AED0813461F4ABD0C82FBBD0C238E9F02C
|
||||
:10FC8000C13811F487E001C083E09AD096C0823475
|
||||
:10FC900011F484E103C0853419F485E0B2D08DC03D
|
||||
:10FCA000853539F494D0082F92D0182F000F111FEA
|
||||
:10FCB00083C0863521F484E0A4D080E0E6CF84368A
|
||||
:10FCC00009F048C084D0C82FD0E0DC2FCC277FD0EB
|
||||
:10FCD000C82B7DD0C82E5E01812C9924939477D0B7
|
||||
:10FCE000F40181934F01F1E0AF1AB108C1F781D05F
|
||||
:10FCF00085E4C81212C0D3954801A12CBB24B3944B
|
||||
:10FD0000AC16BD0609F459C0F50161915F01C4014B
|
||||
:10FD10008DD0FFEF8F1A9F0AF3CF83E0F80187BFE2
|
||||
:10FD2000E89507B600FCFDCFA0E0B1E0F8018D91A9
|
||||
:10FD30009D910C01F7BEE8951124229732962097E9
|
||||
:10FD4000B1F7F801E7BEE89507B600FCFDCFD7BED6
|
||||
:10FD5000E89533C0843719F53AD0C82FD0E0DC2FAE
|
||||
:10FD6000CC2735D05E01A82A32D0982E42D0E801A7
|
||||
:10FD7000F5E49F120BC0CE0151D022D081E0A81A29
|
||||
:10FD8000B1082196A114B104B1F717C0FE01859105
|
||||
:10FD9000EF0116D0E1E0AE1AB108C1F70EC0853709
|
||||
:10FDA00039F427D08EE10CD086E90AD08AE06DCFF5
|
||||
:10FDB000813511F488E017D01CD080E101D058CFF4
|
||||
:10FDC0009091C00095FFFCCF8093C600089580916C
|
||||
:10FDD000C00087FFFCCF8091C00084FD01C0A895C2
|
||||
:10FDE0008091C6000895E0E6F0E098E1908380837A
|
||||
:10FDF0000895EDDF803219F088E0F5DFFFCF84E170
|
||||
:10FE0000DFCFCF93C82FE3DFC150E9F7CF91F1CF18
|
||||
:10FE1000282E80E0E8DFE0E0FF270994F999FECF83
|
||||
:10FE200092BD81BDF89A992780B50895262FF9993A
|
||||
:10FE3000FECF1FBA92BD81BD20BD0FB6F894FA9ACD
|
||||
:08FE4000F99A0FBE0196089526
|
||||
:02FFFE000007FA
|
||||
:040000030000FC00FD
|
||||
:00000001FF
|
@ -0,0 +1,683 @@
|
||||
|
||||
optiboot_atmega644p.elf: file format elf32-avr
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .data 00000000 00800100 0000fe48 000002dc 2**0
|
||||
CONTENTS, ALLOC, LOAD, DATA
|
||||
1 .text 00000248 0000fc00 0000fc00 00000094 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
2 .version 00000002 0000fffe 0000fffe 000002dc 2**0
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
3 .comment 0000002f 00000000 00000000 000002de 2**0
|
||||
CONTENTS, READONLY
|
||||
4 .debug_aranges 00000028 00000000 00000000 0000030d 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
5 .debug_info 00000625 00000000 00000000 00000335 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
6 .debug_abbrev 00000286 00000000 00000000 0000095a 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
7 .debug_line 0000035f 00000000 00000000 00000be0 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
8 .debug_frame 0000008c 00000000 00000000 00000f40 2**2
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
9 .debug_str 0000021d 00000000 00000000 00000fcc 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
10 .debug_loc 00000421 00000000 00000000 000011e9 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
11 .debug_ranges 00000060 00000000 00000000 0000160a 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0000fc00 <main>:
|
||||
// SP points to RAMEND
|
||||
// r1 contains zero
|
||||
//
|
||||
// If not, uncomment the following instructions:
|
||||
// cli();
|
||||
asm volatile ("clr __zero_reg__");
|
||||
fc00: 11 24 eor r1, r1
|
||||
*
|
||||
* Code by MarkG55
|
||||
* see discusion in https://github.com/Optiboot/optiboot/issues/97
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
ch = MCUSR;
|
||||
fc02: 84 b7 in r24, 0x34 ; 52
|
||||
#else
|
||||
ch = MCUCSR;
|
||||
#endif
|
||||
// Skip all logic and run bootloader if MCUSR is cleared (application request)
|
||||
if (ch != 0) {
|
||||
fc04: 88 23 and r24, r24
|
||||
fc06: 49 f0 breq .+18 ; 0xfc1a <main+0x1a>
|
||||
* 2. we clear WDRF if it's set with EXTRF to avoid loops
|
||||
* One problematic scenario: broken application code sets watchdog timer
|
||||
* without clearing MCUSR before and triggers it quickly. But it's
|
||||
* recoverable by power-on with pushed reset button.
|
||||
*/
|
||||
if ((ch & (_BV(WDRF) | _BV(EXTRF))) != _BV(EXTRF)) {
|
||||
fc08: 98 2f mov r25, r24
|
||||
fc0a: 9a 70 andi r25, 0x0A ; 10
|
||||
fc0c: 92 30 cpi r25, 0x02 ; 2
|
||||
fc0e: 29 f0 breq .+10 ; 0xfc1a <main+0x1a>
|
||||
if (ch & _BV(EXTRF)) {
|
||||
fc10: 81 ff sbrs r24, 1
|
||||
fc12: 02 c0 rjmp .+4 ; 0xfc18 <main+0x18>
|
||||
* prevent entering bootloader.
|
||||
* '&' operation is skipped to spare few bytes as bits in MCUSR
|
||||
* can only be cleared.
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
MCUSR = ~(_BV(WDRF));
|
||||
fc14: 97 ef ldi r25, 0xF7 ; 247
|
||||
fc16: 94 bf out 0x34, r25 ; 52
|
||||
#else
|
||||
MCUCSR = ~(_BV(WDRF));
|
||||
#endif
|
||||
}
|
||||
appStart(ch);
|
||||
fc18: fb d0 rcall .+502 ; 0xfe10 <appStart>
|
||||
}
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
// Set up Timer 1 for timeout counter
|
||||
TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
|
||||
fc1a: 85 e0 ldi r24, 0x05 ; 5
|
||||
fc1c: 80 93 81 00 sts 0x0081, r24 ; 0x800081 <__TEXT_REGION_LENGTH__+0x7e0081>
|
||||
UCSRA = _BV(U2X); //Double speed mode USART
|
||||
UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx
|
||||
UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1
|
||||
UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
#else
|
||||
UART_SRA = _BV(U2X0); //Double speed mode USART0
|
||||
fc20: 82 e0 ldi r24, 0x02 ; 2
|
||||
fc22: 80 93 c0 00 sts 0x00C0, r24 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
UART_SRB = _BV(RXEN0) | _BV(TXEN0);
|
||||
fc26: 88 e1 ldi r24, 0x18 ; 24
|
||||
fc28: 80 93 c1 00 sts 0x00C1, r24 ; 0x8000c1 <__TEXT_REGION_LENGTH__+0x7e00c1>
|
||||
UART_SRC = _BV(UCSZ00) | _BV(UCSZ01);
|
||||
fc2c: 86 e0 ldi r24, 0x06 ; 6
|
||||
fc2e: 80 93 c2 00 sts 0x00C2, r24 ; 0x8000c2 <__TEXT_REGION_LENGTH__+0x7e00c2>
|
||||
UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
fc32: 80 e1 ldi r24, 0x10 ; 16
|
||||
fc34: 80 93 c4 00 sts 0x00C4, r24 ; 0x8000c4 <__TEXT_REGION_LENGTH__+0x7e00c4>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set up watchdog to trigger after 1s
|
||||
watchdogConfig(WATCHDOG_1S);
|
||||
fc38: 8e e0 ldi r24, 0x0E ; 14
|
||||
fc3a: d5 d0 rcall .+426 ; 0xfde6 <watchdogConfig>
|
||||
|
||||
#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) || defined(LED_START_ON)
|
||||
/* Set LED pin as output */
|
||||
LED_DDR |= _BV(LED);
|
||||
fc3c: 20 9a sbi 0x04, 0 ; 4
|
||||
fc3e: 86 e0 ldi r24, 0x06 ; 6
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
void flash_led(uint8_t count) {
|
||||
do {
|
||||
TCNT1 = -(F_CPU/(1024*16));
|
||||
fc40: 20 e3 ldi r18, 0x30 ; 48
|
||||
fc42: 3c ef ldi r19, 0xFC ; 252
|
||||
TIFR1 = _BV(TOV1);
|
||||
fc44: 91 e0 ldi r25, 0x01 ; 1
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
void flash_led(uint8_t count) {
|
||||
do {
|
||||
TCNT1 = -(F_CPU/(1024*16));
|
||||
fc46: 30 93 85 00 sts 0x0085, r19 ; 0x800085 <__TEXT_REGION_LENGTH__+0x7e0085>
|
||||
fc4a: 20 93 84 00 sts 0x0084, r18 ; 0x800084 <__TEXT_REGION_LENGTH__+0x7e0084>
|
||||
TIFR1 = _BV(TOV1);
|
||||
fc4e: 96 bb out 0x16, r25 ; 22
|
||||
while(!(TIFR1 & _BV(TOV1)));
|
||||
fc50: b0 9b sbis 0x16, 0 ; 22
|
||||
fc52: fe cf rjmp .-4 ; 0xfc50 <main+0x50>
|
||||
#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) || defined (__AVR_ATmega16__)
|
||||
LED_PORT ^= _BV(LED);
|
||||
#else
|
||||
LED_PIN |= _BV(LED);
|
||||
fc54: 18 9a sbi 0x03, 0 ; 3
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
fc56: a8 95 wdr
|
||||
* While in theory, the STK500 initial commands would be buffered
|
||||
* by the UART hardware, avrdude sends several attempts in rather
|
||||
* quick succession, some of which will be lost and cause us to
|
||||
* get out of sync. So if we see any data; stop blinking.
|
||||
*/
|
||||
if (UART_SRA & _BV(RXC0))
|
||||
fc58: 40 91 c0 00 lds r20, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
fc5c: 47 fd sbrc r20, 7
|
||||
fc5e: 02 c0 rjmp .+4 ; 0xfc64 <main+0x64>
|
||||
fc60: 81 50 subi r24, 0x01 ; 1
|
||||
#else
|
||||
// This doesn't seem to work?
|
||||
// if ((UART_PIN & (1<<UART_RX_BIT)) == 0)
|
||||
// break; // detect start bit on soft uart too.
|
||||
#endif
|
||||
} while (--count);
|
||||
fc62: 89 f7 brne .-30 ; 0xfc46 <main+0x46>
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
fc64: ff 24 eor r15, r15
|
||||
fc66: f3 94 inc r15
|
||||
} while (len -= 2);
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
fc68: 55 e0 ldi r21, 0x05 ; 5
|
||||
fc6a: e5 2e mov r14, r21
|
||||
boot_spm_busy_wait();
|
||||
#if defined(RWWSRE)
|
||||
// Reenable read access to flash
|
||||
__boot_rww_enable_short();
|
||||
fc6c: 61 e1 ldi r22, 0x11 ; 17
|
||||
#endif
|
||||
|
||||
/* Forever loop: exits by causing WDT reset */
|
||||
for (;;) {
|
||||
/* get character from UART */
|
||||
ch = getch();
|
||||
fc6e: d6 2e mov r13, r22
|
||||
|
||||
if(ch == STK_GET_PARAMETER) {
|
||||
fc70: ae d0 rcall .+348 ; 0xfdce <getch>
|
||||
unsigned char which = getch();
|
||||
fc72: 81 34 cpi r24, 0x41 ; 65
|
||||
fc74: 61 f4 brne .+24 ; 0xfc8e <main+0x8e>
|
||||
fc76: ab d0 rcall .+342 ; 0xfdce <getch>
|
||||
verifySpace();
|
||||
fc78: c8 2f mov r28, r24
|
||||
fc7a: bb d0 rcall .+374 ; 0xfdf2 <verifySpace>
|
||||
/*
|
||||
* Send optiboot version as "SW version"
|
||||
* Note that the references to memory are optimized away.
|
||||
*/
|
||||
if (which == STK_SW_MINOR) {
|
||||
fc7c: c2 38 cpi r28, 0x82 ; 130
|
||||
fc7e: e9 f0 breq .+58 ; 0xfcba <main+0xba>
|
||||
putch(optiboot_version & 0xFF);
|
||||
} else if (which == STK_SW_MAJOR) {
|
||||
fc80: c1 38 cpi r28, 0x81 ; 129
|
||||
putch(optiboot_version >> 8);
|
||||
fc82: 11 f4 brne .+4 ; 0xfc88 <main+0x88>
|
||||
fc84: 87 e0 ldi r24, 0x07 ; 7
|
||||
} else {
|
||||
/*
|
||||
* GET PARAMETER returns a generic 0x03 reply for
|
||||
* other parameters - enough to keep Avrdude happy
|
||||
*/
|
||||
putch(0x03);
|
||||
fc86: 01 c0 rjmp .+2 ; 0xfc8a <main+0x8a>
|
||||
fc88: 83 e0 ldi r24, 0x03 ; 3
|
||||
fc8a: 9a d0 rcall .+308 ; 0xfdc0 <putch>
|
||||
fc8c: 96 c0 rjmp .+300 ; 0xfdba <main+0x1ba>
|
||||
}
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE) {
|
||||
fc8e: 82 34 cpi r24, 0x42 ; 66
|
||||
// SET DEVICE is ignored
|
||||
getNch(20);
|
||||
fc90: 11 f4 brne .+4 ; 0xfc96 <main+0x96>
|
||||
fc92: 84 e1 ldi r24, 0x14 ; 20
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE_EXT) {
|
||||
fc94: 03 c0 rjmp .+6 ; 0xfc9c <main+0x9c>
|
||||
// SET DEVICE EXT is ignored
|
||||
getNch(5);
|
||||
fc96: 85 34 cpi r24, 0x45 ; 69
|
||||
fc98: 19 f4 brne .+6 ; 0xfca0 <main+0xa0>
|
||||
fc9a: 85 e0 ldi r24, 0x05 ; 5
|
||||
}
|
||||
else if(ch == STK_LOAD_ADDRESS) {
|
||||
fc9c: b2 d0 rcall .+356 ; 0xfe02 <getNch>
|
||||
fc9e: 8d c0 rjmp .+282 ; 0xfdba <main+0x1ba>
|
||||
// LOAD ADDRESS
|
||||
address.bytes[0] = getch();
|
||||
fca0: 85 35 cpi r24, 0x55 ; 85
|
||||
fca2: 39 f4 brne .+14 ; 0xfcb2 <main+0xb2>
|
||||
fca4: 94 d0 rcall .+296 ; 0xfdce <getch>
|
||||
address.bytes[1] = getch();
|
||||
fca6: 08 2f mov r16, r24
|
||||
fca8: 92 d0 rcall .+292 ; 0xfdce <getch>
|
||||
}
|
||||
else {
|
||||
RAMPZ &= 0xFE;
|
||||
}
|
||||
#endif
|
||||
address.word *= 2; // Convert from word address to byte address
|
||||
fcaa: 18 2f mov r17, r24
|
||||
fcac: 00 0f add r16, r16
|
||||
fcae: 11 1f adc r17, r17
|
||||
verifySpace();
|
||||
}
|
||||
else if(ch == STK_UNIVERSAL) {
|
||||
fcb0: 83 c0 rjmp .+262 ; 0xfdb8 <main+0x1b8>
|
||||
getNch(3);
|
||||
putch(0x00);
|
||||
}
|
||||
#else
|
||||
// UNIVERSAL command is ignored
|
||||
getNch(4);
|
||||
fcb2: 86 35 cpi r24, 0x56 ; 86
|
||||
fcb4: 21 f4 brne .+8 ; 0xfcbe <main+0xbe>
|
||||
fcb6: 84 e0 ldi r24, 0x04 ; 4
|
||||
putch(0x00);
|
||||
fcb8: a4 d0 rcall .+328 ; 0xfe02 <getNch>
|
||||
#endif
|
||||
}
|
||||
/* Write memory, length is big endian and is in bytes */
|
||||
else if(ch == STK_PROG_PAGE) {
|
||||
fcba: 80 e0 ldi r24, 0x00 ; 0
|
||||
fcbc: e6 cf rjmp .-52 ; 0xfc8a <main+0x8a>
|
||||
// PROGRAM PAGE - we support flash programming only, not EEPROM
|
||||
uint8_t desttype;
|
||||
uint8_t *bufPtr;
|
||||
pagelen_t savelength;
|
||||
|
||||
GETLENGTH(length);
|
||||
fcbe: 84 36 cpi r24, 0x64 ; 100
|
||||
fcc0: 09 f0 breq .+2 ; 0xfcc4 <main+0xc4>
|
||||
fcc2: 48 c0 rjmp .+144 ; 0xfd54 <main+0x154>
|
||||
fcc4: 84 d0 rcall .+264 ; 0xfdce <getch>
|
||||
fcc6: c8 2f mov r28, r24
|
||||
fcc8: d0 e0 ldi r29, 0x00 ; 0
|
||||
fcca: dc 2f mov r29, r28
|
||||
fccc: cc 27 eor r28, r28
|
||||
savelength = length;
|
||||
desttype = getch();
|
||||
fcce: 7f d0 rcall .+254 ; 0xfdce <getch>
|
||||
fcd0: c8 2b or r28, r24
|
||||
// PROGRAM PAGE - we support flash programming only, not EEPROM
|
||||
uint8_t desttype;
|
||||
uint8_t *bufPtr;
|
||||
pagelen_t savelength;
|
||||
|
||||
GETLENGTH(length);
|
||||
fcd2: 7d d0 rcall .+250 ; 0xfdce <getch>
|
||||
savelength = length;
|
||||
desttype = getch();
|
||||
fcd4: c8 2e mov r12, r24
|
||||
fcd6: 5e 01 movw r10, r28
|
||||
fcd8: 81 2c mov r8, r1
|
||||
|
||||
// read a page worth of contents
|
||||
bufPtr = buff.bptr;
|
||||
do *bufPtr++ = getch();
|
||||
fcda: 99 24 eor r9, r9
|
||||
fcdc: 93 94 inc r9
|
||||
fcde: 77 d0 rcall .+238 ; 0xfdce <getch>
|
||||
fce0: f4 01 movw r30, r8
|
||||
fce2: 81 93 st Z+, r24
|
||||
while (--length);
|
||||
fce4: 4f 01 movw r8, r30
|
||||
fce6: f1 e0 ldi r31, 0x01 ; 1
|
||||
fce8: af 1a sub r10, r31
|
||||
fcea: b1 08 sbc r11, r1
|
||||
|
||||
// Read command terminator, start reply
|
||||
verifySpace();
|
||||
fcec: c1 f7 brne .-16 ; 0xfcde <main+0xde>
|
||||
fcee: 81 d0 rcall .+258 ; 0xfdf2 <verifySpace>
|
||||
* void writebuffer(memtype, buffer, address, length)
|
||||
*/
|
||||
static inline void writebuffer(int8_t memtype, addr16_t mybuff,
|
||||
addr16_t address, pagelen_t len)
|
||||
{
|
||||
switch (memtype) {
|
||||
fcf0: 85 e4 ldi r24, 0x45 ; 69
|
||||
fcf2: c8 12 cpse r12, r24
|
||||
fcf4: 12 c0 rjmp .+36 ; 0xfd1a <main+0x11a>
|
||||
fcf6: d3 95 inc r29
|
||||
fcf8: 48 01 movw r8, r16
|
||||
fcfa: a1 2c mov r10, r1
|
||||
fcfc: bb 24 eor r11, r11
|
||||
case 'E': // EEPROM
|
||||
#if defined(SUPPORT_EEPROM) || defined(BIGBOOT)
|
||||
while(len--) {
|
||||
fcfe: b3 94 inc r11
|
||||
fd00: ac 16 cp r10, r28
|
||||
fd02: bd 06 cpc r11, r29
|
||||
fd04: 09 f4 brne .+2 ; 0xfd08 <main+0x108>
|
||||
eeprom_write_byte((address.bptr++), *(mybuff.bptr++));
|
||||
fd06: 59 c0 rjmp .+178 ; 0xfdba <main+0x1ba>
|
||||
fd08: f5 01 movw r30, r10
|
||||
fd0a: 61 91 ld r22, Z+
|
||||
fd0c: 5f 01 movw r10, r30
|
||||
fd0e: c4 01 movw r24, r8
|
||||
fd10: 8d d0 rcall .+282 ; 0xfe2c <eeprom_write_byte>
|
||||
fd12: ff ef ldi r31, 0xFF ; 255
|
||||
fd14: 8f 1a sub r8, r31
|
||||
fd16: 9f 0a sbc r9, r31
|
||||
fd18: f3 cf rjmp .-26 ; 0xfd00 <main+0x100>
|
||||
* Start the page erase and wait for it to finish. There
|
||||
* used to be code to do this while receiving the data over
|
||||
* the serial link, but the performance improvement was slight,
|
||||
* and we needed the space back.
|
||||
*/
|
||||
__boot_page_erase_short(address.word);
|
||||
fd1a: 83 e0 ldi r24, 0x03 ; 3
|
||||
fd1c: f8 01 movw r30, r16
|
||||
fd1e: 87 bf out 0x37, r24 ; 55
|
||||
fd20: e8 95 spm
|
||||
boot_spm_busy_wait();
|
||||
fd22: 07 b6 in r0, 0x37 ; 55
|
||||
fd24: 00 fc sbrc r0, 0
|
||||
fd26: fd cf rjmp .-6 ; 0xfd22 <main+0x122>
|
||||
fd28: a0 e0 ldi r26, 0x00 ; 0
|
||||
fd2a: b1 e0 ldi r27, 0x01 ; 1
|
||||
fd2c: f8 01 movw r30, r16
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
fd2e: 8d 91 ld r24, X+
|
||||
fd30: 9d 91 ld r25, X+
|
||||
fd32: 0c 01 movw r0, r24
|
||||
fd34: f7 be out 0x37, r15 ; 55
|
||||
fd36: e8 95 spm
|
||||
addrPtr += 2;
|
||||
} while (len -= 2);
|
||||
fd38: 11 24 eor r1, r1
|
||||
fd3a: 22 97 sbiw r28, 0x02 ; 2
|
||||
fd3c: 32 96 adiw r30, 0x02 ; 2
|
||||
fd3e: 20 97 sbiw r28, 0x00 ; 0
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
fd40: b1 f7 brne .-20 ; 0xfd2e <main+0x12e>
|
||||
fd42: f8 01 movw r30, r16
|
||||
boot_spm_busy_wait();
|
||||
fd44: e7 be out 0x37, r14 ; 55
|
||||
fd46: e8 95 spm
|
||||
#if defined(RWWSRE)
|
||||
// Reenable read access to flash
|
||||
__boot_rww_enable_short();
|
||||
fd48: 07 b6 in r0, 0x37 ; 55
|
||||
fd4a: 00 fc sbrc r0, 0
|
||||
fd4c: fd cf rjmp .-6 ; 0xfd48 <main+0x148>
|
||||
writebuffer(desttype, buff, address, savelength);
|
||||
|
||||
|
||||
}
|
||||
/* Read memory block mode, length is big endian. */
|
||||
else if(ch == STK_READ_PAGE) {
|
||||
fd4e: d7 be out 0x37, r13 ; 55
|
||||
fd50: e8 95 spm
|
||||
uint8_t desttype;
|
||||
GETLENGTH(length);
|
||||
fd52: 33 c0 rjmp .+102 ; 0xfdba <main+0x1ba>
|
||||
fd54: 84 37 cpi r24, 0x74 ; 116
|
||||
fd56: 19 f5 brne .+70 ; 0xfd9e <main+0x19e>
|
||||
fd58: 3a d0 rcall .+116 ; 0xfdce <getch>
|
||||
fd5a: c8 2f mov r28, r24
|
||||
fd5c: d0 e0 ldi r29, 0x00 ; 0
|
||||
fd5e: dc 2f mov r29, r28
|
||||
fd60: cc 27 eor r28, r28
|
||||
|
||||
desttype = getch();
|
||||
fd62: 35 d0 rcall .+106 ; 0xfdce <getch>
|
||||
fd64: 5e 01 movw r10, r28
|
||||
fd66: a8 2a or r10, r24
|
||||
|
||||
verifySpace();
|
||||
fd68: 32 d0 rcall .+100 ; 0xfdce <getch>
|
||||
fd6a: 98 2e mov r9, r24
|
||||
|
||||
static inline void read_mem(uint8_t memtype, addr16_t address, pagelen_t length)
|
||||
{
|
||||
uint8_t ch;
|
||||
|
||||
switch (memtype) {
|
||||
fd6c: 42 d0 rcall .+132 ; 0xfdf2 <verifySpace>
|
||||
fd6e: e8 01 movw r28, r16
|
||||
fd70: f5 e4 ldi r31, 0x45 ; 69
|
||||
|
||||
#if defined(SUPPORT_EEPROM) || defined(BIGBOOT)
|
||||
case 'E': // EEPROM
|
||||
do {
|
||||
putch(eeprom_read_byte((address.bptr++)));
|
||||
fd72: 9f 12 cpse r9, r31
|
||||
fd74: 0b c0 rjmp .+22 ; 0xfd8c <main+0x18c>
|
||||
fd76: ce 01 movw r24, r28
|
||||
fd78: 51 d0 rcall .+162 ; 0xfe1c <eeprom_read_byte>
|
||||
} while (--length);
|
||||
fd7a: 22 d0 rcall .+68 ; 0xfdc0 <putch>
|
||||
fd7c: 81 e0 ldi r24, 0x01 ; 1
|
||||
fd7e: a8 1a sub r10, r24
|
||||
fd80: b1 08 sbc r11, r1
|
||||
fd82: 21 96 adiw r28, 0x01 ; 1
|
||||
fd84: a1 14 cp r10, r1
|
||||
fd86: b1 04 cpc r11, r1
|
||||
// while (--length);
|
||||
// read a Flash and increment the address (may increment RAMPZ)
|
||||
__asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
#else
|
||||
// read a Flash byte and increment the address
|
||||
__asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
fd88: b1 f7 brne .-20 ; 0xfd76 <main+0x176>
|
||||
fd8a: 17 c0 rjmp .+46 ; 0xfdba <main+0x1ba>
|
||||
#endif
|
||||
putch(ch);
|
||||
fd8c: fe 01 movw r30, r28
|
||||
fd8e: 85 91 lpm r24, Z+
|
||||
} while (--length);
|
||||
fd90: ef 01 movw r28, r30
|
||||
fd92: 16 d0 rcall .+44 ; 0xfdc0 <putch>
|
||||
fd94: e1 e0 ldi r30, 0x01 ; 1
|
||||
fd96: ae 1a sub r10, r30
|
||||
fd98: b1 08 sbc r11, r1
|
||||
|
||||
read_mem(desttype, address, length);
|
||||
}
|
||||
|
||||
/* Get device signature bytes */
|
||||
else if(ch == STK_READ_SIGN) {
|
||||
fd9a: c1 f7 brne .-16 ; 0xfd8c <main+0x18c>
|
||||
fd9c: 0e c0 rjmp .+28 ; 0xfdba <main+0x1ba>
|
||||
// READ SIGN - return what Avrdude wants to hear
|
||||
verifySpace();
|
||||
fd9e: 85 37 cpi r24, 0x75 ; 117
|
||||
fda0: 39 f4 brne .+14 ; 0xfdb0 <main+0x1b0>
|
||||
putch(SIGNATURE_0);
|
||||
fda2: 27 d0 rcall .+78 ; 0xfdf2 <verifySpace>
|
||||
fda4: 8e e1 ldi r24, 0x1E ; 30
|
||||
fda6: 0c d0 rcall .+24 ; 0xfdc0 <putch>
|
||||
putch(SIGNATURE_1);
|
||||
fda8: 86 e9 ldi r24, 0x96 ; 150
|
||||
fdaa: 0a d0 rcall .+20 ; 0xfdc0 <putch>
|
||||
fdac: 8a e0 ldi r24, 0x0A ; 10
|
||||
putch(SIGNATURE_2);
|
||||
fdae: 6d cf rjmp .-294 ; 0xfc8a <main+0x8a>
|
||||
fdb0: 81 35 cpi r24, 0x51 ; 81
|
||||
}
|
||||
else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */
|
||||
fdb2: 11 f4 brne .+4 ; 0xfdb8 <main+0x1b8>
|
||||
fdb4: 88 e0 ldi r24, 0x08 ; 8
|
||||
// Adaboot no-wait mod
|
||||
watchdogConfig(WATCHDOG_16MS);
|
||||
fdb6: 17 d0 rcall .+46 ; 0xfde6 <watchdogConfig>
|
||||
fdb8: 1c d0 rcall .+56 ; 0xfdf2 <verifySpace>
|
||||
fdba: 80 e1 ldi r24, 0x10 ; 16
|
||||
verifySpace();
|
||||
}
|
||||
else {
|
||||
// This covers the response to commands like STK_ENTER_PROGMODE
|
||||
verifySpace();
|
||||
fdbc: 01 d0 rcall .+2 ; 0xfdc0 <putch>
|
||||
fdbe: 58 cf rjmp .-336 ; 0xfc70 <main+0x70>
|
||||
|
||||
0000fdc0 <putch>:
|
||||
}
|
||||
putch(STK_OK);
|
||||
fdc0: 90 91 c0 00 lds r25, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
fdc4: 95 ff sbrs r25, 5
|
||||
}
|
||||
fdc6: fc cf rjmp .-8 ; 0xfdc0 <putch>
|
||||
}
|
||||
|
||||
void putch(char ch) {
|
||||
#ifndef SOFT_UART
|
||||
while (!(UART_SRA & _BV(UDRE0)));
|
||||
UART_UDR = ch;
|
||||
fdc8: 80 93 c6 00 sts 0x00C6, r24 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7e00c6>
|
||||
fdcc: 08 95 ret
|
||||
|
||||
0000fdce <getch>:
|
||||
[uartBit] "I" (UART_RX_BIT)
|
||||
:
|
||||
"r25"
|
||||
);
|
||||
#else
|
||||
while(!(UART_SRA & _BV(RXC0)))
|
||||
fdce: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
fdd2: 87 ff sbrs r24, 7
|
||||
fdd4: fc cf rjmp .-8 ; 0xfdce <getch>
|
||||
;
|
||||
if (!(UART_SRA & _BV(FE0))) {
|
||||
fdd6: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
fdda: 84 fd sbrc r24, 4
|
||||
fddc: 01 c0 rjmp .+2 ; 0xfde0 <getch+0x12>
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
fdde: a8 95 wdr
|
||||
* don't care that an invalid char is returned...)
|
||||
*/
|
||||
watchdogReset();
|
||||
}
|
||||
|
||||
ch = UART_UDR;
|
||||
fde0: 80 91 c6 00 lds r24, 0x00C6 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7e00c6>
|
||||
LED_PIN |= _BV(LED);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ch;
|
||||
}
|
||||
fde4: 08 95 ret
|
||||
|
||||
0000fde6 <watchdogConfig>:
|
||||
"wdr\n"
|
||||
);
|
||||
}
|
||||
|
||||
void watchdogConfig(uint8_t x) {
|
||||
WDTCSR = _BV(WDCE) | _BV(WDE);
|
||||
fde6: e0 e6 ldi r30, 0x60 ; 96
|
||||
fde8: f0 e0 ldi r31, 0x00 ; 0
|
||||
fdea: 98 e1 ldi r25, 0x18 ; 24
|
||||
fdec: 90 83 st Z, r25
|
||||
WDTCSR = x;
|
||||
fdee: 80 83 st Z, r24
|
||||
fdf0: 08 95 ret
|
||||
|
||||
0000fdf2 <verifySpace>:
|
||||
do getch(); while (--count);
|
||||
verifySpace();
|
||||
}
|
||||
|
||||
void verifySpace() {
|
||||
if (getch() != CRC_EOP) {
|
||||
fdf2: ed df rcall .-38 ; 0xfdce <getch>
|
||||
fdf4: 80 32 cpi r24, 0x20 ; 32
|
||||
fdf6: 19 f0 breq .+6 ; 0xfdfe <verifySpace+0xc>
|
||||
watchdogConfig(WATCHDOG_16MS); // shorten WD timeout
|
||||
fdf8: 88 e0 ldi r24, 0x08 ; 8
|
||||
fdfa: f5 df rcall .-22 ; 0xfde6 <watchdogConfig>
|
||||
fdfc: ff cf rjmp .-2 ; 0xfdfc <verifySpace+0xa>
|
||||
while (1) // and busy-loop so that WD causes
|
||||
; // a reset and app start.
|
||||
}
|
||||
putch(STK_INSYNC);
|
||||
fdfe: 84 e1 ldi r24, 0x14 ; 20
|
||||
fe00: df cf rjmp .-66 ; 0xfdc0 <putch>
|
||||
|
||||
0000fe02 <getNch>:
|
||||
::[count] "M" (UART_B_VALUE)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
void getNch(uint8_t count) {
|
||||
fe02: cf 93 push r28
|
||||
fe04: c8 2f mov r28, r24
|
||||
do getch(); while (--count);
|
||||
fe06: e3 df rcall .-58 ; 0xfdce <getch>
|
||||
fe08: c1 50 subi r28, 0x01 ; 1
|
||||
fe0a: e9 f7 brne .-6 ; 0xfe06 <getNch+0x4>
|
||||
verifySpace();
|
||||
fe0c: cf 91 pop r28
|
||||
fe0e: f1 cf rjmp .-30 ; 0xfdf2 <verifySpace>
|
||||
|
||||
0000fe10 <appStart>:
|
||||
|
||||
void appStart(uint8_t rstFlags) {
|
||||
// save the reset flags in the designated register
|
||||
// This can be saved in a main program by putting code in .init0 (which
|
||||
// executes before normal c init code) to save R2 to a global variable.
|
||||
__asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags));
|
||||
fe10: 28 2e mov r2, r24
|
||||
|
||||
watchdogConfig(WATCHDOG_OFF);
|
||||
fe12: 80 e0 ldi r24, 0x00 ; 0
|
||||
fe14: e8 df rcall .-48 ; 0xfde6 <watchdogConfig>
|
||||
fe16: e0 e0 ldi r30, 0x00 ; 0
|
||||
// Note that appstart_vec is defined so that this works with either
|
||||
// real or virtual boot partitions.
|
||||
__asm__ __volatile__ (
|
||||
fe18: ff 27 eor r31, r31
|
||||
fe1a: 09 94 ijmp
|
||||
|
||||
0000fe1c <eeprom_read_byte>:
|
||||
fe1c: f9 99 sbic 0x1f, 1 ; 31
|
||||
fe1e: fe cf rjmp .-4 ; 0xfe1c <eeprom_read_byte>
|
||||
fe20: 92 bd out 0x22, r25 ; 34
|
||||
fe22: 81 bd out 0x21, r24 ; 33
|
||||
fe24: f8 9a sbi 0x1f, 0 ; 31
|
||||
fe26: 99 27 eor r25, r25
|
||||
fe28: 80 b5 in r24, 0x20 ; 32
|
||||
fe2a: 08 95 ret
|
||||
|
||||
0000fe2c <eeprom_write_byte>:
|
||||
fe2c: 26 2f mov r18, r22
|
||||
|
||||
0000fe2e <eeprom_write_r18>:
|
||||
fe2e: f9 99 sbic 0x1f, 1 ; 31
|
||||
fe30: fe cf rjmp .-4 ; 0xfe2e <eeprom_write_r18>
|
||||
fe32: 1f ba out 0x1f, r1 ; 31
|
||||
fe34: 92 bd out 0x22, r25 ; 34
|
||||
fe36: 81 bd out 0x21, r24 ; 33
|
||||
fe38: 20 bd out 0x20, r18 ; 32
|
||||
fe3a: 0f b6 in r0, 0x3f ; 63
|
||||
fe3c: f8 94 cli
|
||||
fe3e: fa 9a sbi 0x1f, 2 ; 31
|
||||
fe40: f9 9a sbi 0x1f, 1 ; 31
|
||||
fe42: 0f be out 0x3f, r0 ; 63
|
||||
fe44: 01 96 adiw r24, 0x01 ; 1
|
||||
fe46: 08 95 ret
|
@ -0,0 +1,584 @@
|
||||
|
||||
optiboot_atmega168.elf: file format elf32-avr
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .data 00000000 00800100 00003fbe 00000252 2**0
|
||||
CONTENTS, ALLOC, LOAD, DATA
|
||||
1 .text 000001be 00003e00 00003e00 00000094 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
2 .version 00000002 00003ffe 00003ffe 00000252 2**0
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
3 .comment 0000002f 00000000 00000000 00000254 2**0
|
||||
CONTENTS, READONLY
|
||||
4 .debug_aranges 00000028 00000000 00000000 00000283 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
5 .debug_info 000005c8 00000000 00000000 000002ab 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
6 .debug_abbrev 00000282 00000000 00000000 00000873 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
7 .debug_line 000002f9 00000000 00000000 00000af5 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
8 .debug_frame 0000008c 00000000 00000000 00000df0 2**2
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
9 .debug_str 000001fa 00000000 00000000 00000e7c 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
10 .debug_loc 00000331 00000000 00000000 00001076 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
11 .debug_ranges 00000060 00000000 00000000 000013a7 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
00003e00 <main>:
|
||||
// SP points to RAMEND
|
||||
// r1 contains zero
|
||||
//
|
||||
// If not, uncomment the following instructions:
|
||||
// cli();
|
||||
asm volatile ("clr __zero_reg__");
|
||||
3e00: 11 24 eor r1, r1
|
||||
*
|
||||
* Code by MarkG55
|
||||
* see discusion in https://github.com/Optiboot/optiboot/issues/97
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
ch = MCUSR;
|
||||
3e02: 84 b7 in r24, 0x34 ; 52
|
||||
#else
|
||||
ch = MCUCSR;
|
||||
#endif
|
||||
// Skip all logic and run bootloader if MCUSR is cleared (application request)
|
||||
if (ch != 0) {
|
||||
3e04: 88 23 and r24, r24
|
||||
3e06: 49 f0 breq .+18 ; 0x3e1a <main+0x1a>
|
||||
* 2. we clear WDRF if it's set with EXTRF to avoid loops
|
||||
* One problematic scenario: broken application code sets watchdog timer
|
||||
* without clearing MCUSR before and triggers it quickly. But it's
|
||||
* recoverable by power-on with pushed reset button.
|
||||
*/
|
||||
if ((ch & (_BV(WDRF) | _BV(EXTRF))) != _BV(EXTRF)) {
|
||||
3e08: 98 2f mov r25, r24
|
||||
3e0a: 9a 70 andi r25, 0x0A ; 10
|
||||
3e0c: 92 30 cpi r25, 0x02 ; 2
|
||||
3e0e: 29 f0 breq .+10 ; 0x3e1a <main+0x1a>
|
||||
if (ch & _BV(EXTRF)) {
|
||||
3e10: 81 ff sbrs r24, 1
|
||||
3e12: 02 c0 rjmp .+4 ; 0x3e18 <main+0x18>
|
||||
* prevent entering bootloader.
|
||||
* '&' operation is skipped to spare few bytes as bits in MCUSR
|
||||
* can only be cleared.
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
MCUSR = ~(_BV(WDRF));
|
||||
3e14: 97 ef ldi r25, 0xF7 ; 247
|
||||
3e16: 94 bf out 0x34, r25 ; 52
|
||||
#else
|
||||
MCUCSR = ~(_BV(WDRF));
|
||||
#endif
|
||||
}
|
||||
appStart(ch);
|
||||
3e18: cc d0 rcall .+408 ; 0x3fb2 <appStart>
|
||||
}
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
// Set up Timer 1 for timeout counter
|
||||
TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
|
||||
3e1a: 85 e0 ldi r24, 0x05 ; 5
|
||||
3e1c: 80 93 81 00 sts 0x0081, r24 ; 0x800081 <__TEXT_REGION_LENGTH__+0x7e0081>
|
||||
UCSRA = _BV(U2X); //Double speed mode USART
|
||||
UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx
|
||||
UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1
|
||||
UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
#else
|
||||
UART_SRA = _BV(U2X0); //Double speed mode USART0
|
||||
3e20: 82 e0 ldi r24, 0x02 ; 2
|
||||
3e22: 80 93 c0 00 sts 0x00C0, r24 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
UART_SRB = _BV(RXEN0) | _BV(TXEN0);
|
||||
3e26: 88 e1 ldi r24, 0x18 ; 24
|
||||
3e28: 80 93 c1 00 sts 0x00C1, r24 ; 0x8000c1 <__TEXT_REGION_LENGTH__+0x7e00c1>
|
||||
UART_SRC = _BV(UCSZ00) | _BV(UCSZ01);
|
||||
3e2c: 86 e0 ldi r24, 0x06 ; 6
|
||||
3e2e: 80 93 c2 00 sts 0x00C2, r24 ; 0x8000c2 <__TEXT_REGION_LENGTH__+0x7e00c2>
|
||||
UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
3e32: 80 e1 ldi r24, 0x10 ; 16
|
||||
3e34: 80 93 c4 00 sts 0x00C4, r24 ; 0x8000c4 <__TEXT_REGION_LENGTH__+0x7e00c4>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set up watchdog to trigger after 1s
|
||||
watchdogConfig(WATCHDOG_1S);
|
||||
3e38: 8e e0 ldi r24, 0x0E ; 14
|
||||
3e3a: a6 d0 rcall .+332 ; 0x3f88 <watchdogConfig>
|
||||
|
||||
#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) || defined(LED_START_ON)
|
||||
/* Set LED pin as output */
|
||||
LED_DDR |= _BV(LED);
|
||||
3e3c: 25 9a sbi 0x04, 5 ; 4
|
||||
3e3e: 86 e0 ldi r24, 0x06 ; 6
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
void flash_led(uint8_t count) {
|
||||
do {
|
||||
TCNT1 = -(F_CPU/(1024*16));
|
||||
3e40: 20 e3 ldi r18, 0x30 ; 48
|
||||
3e42: 3c ef ldi r19, 0xFC ; 252
|
||||
TIFR1 = _BV(TOV1);
|
||||
3e44: 91 e0 ldi r25, 0x01 ; 1
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
void flash_led(uint8_t count) {
|
||||
do {
|
||||
TCNT1 = -(F_CPU/(1024*16));
|
||||
3e46: 30 93 85 00 sts 0x0085, r19 ; 0x800085 <__TEXT_REGION_LENGTH__+0x7e0085>
|
||||
3e4a: 20 93 84 00 sts 0x0084, r18 ; 0x800084 <__TEXT_REGION_LENGTH__+0x7e0084>
|
||||
TIFR1 = _BV(TOV1);
|
||||
3e4e: 96 bb out 0x16, r25 ; 22
|
||||
while(!(TIFR1 & _BV(TOV1)));
|
||||
3e50: b0 9b sbis 0x16, 0 ; 22
|
||||
3e52: fe cf rjmp .-4 ; 0x3e50 <main+0x50>
|
||||
#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) || defined (__AVR_ATmega16__)
|
||||
LED_PORT ^= _BV(LED);
|
||||
#else
|
||||
LED_PIN |= _BV(LED);
|
||||
3e54: 1d 9a sbi 0x03, 5 ; 3
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
3e56: a8 95 wdr
|
||||
* While in theory, the STK500 initial commands would be buffered
|
||||
* by the UART hardware, avrdude sends several attempts in rather
|
||||
* quick succession, some of which will be lost and cause us to
|
||||
* get out of sync. So if we see any data; stop blinking.
|
||||
*/
|
||||
if (UART_SRA & _BV(RXC0))
|
||||
3e58: 40 91 c0 00 lds r20, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
3e5c: 47 fd sbrc r20, 7
|
||||
3e5e: 02 c0 rjmp .+4 ; 0x3e64 <main+0x64>
|
||||
3e60: 81 50 subi r24, 0x01 ; 1
|
||||
#else
|
||||
// This doesn't seem to work?
|
||||
// if ((UART_PIN & (1<<UART_RX_BIT)) == 0)
|
||||
// break; // detect start bit on soft uart too.
|
||||
#endif
|
||||
} while (--count);
|
||||
3e62: 89 f7 brne .-30 ; 0x3e46 <main+0x46>
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
3e64: ee 24 eor r14, r14
|
||||
3e66: e3 94 inc r14
|
||||
} while (len -= 2);
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
3e68: 95 e0 ldi r25, 0x05 ; 5
|
||||
3e6a: d9 2e mov r13, r25
|
||||
boot_spm_busy_wait();
|
||||
#if defined(RWWSRE)
|
||||
// Reenable read access to flash
|
||||
__boot_rww_enable_short();
|
||||
3e6c: 21 e1 ldi r18, 0x11 ; 17
|
||||
#endif
|
||||
|
||||
/* Forever loop: exits by causing WDT reset */
|
||||
for (;;) {
|
||||
/* get character from UART */
|
||||
ch = getch();
|
||||
3e6e: c2 2e mov r12, r18
|
||||
|
||||
if(ch == STK_GET_PARAMETER) {
|
||||
3e70: 7f d0 rcall .+254 ; 0x3f70 <getch>
|
||||
unsigned char which = getch();
|
||||
3e72: 81 34 cpi r24, 0x41 ; 65
|
||||
3e74: 61 f4 brne .+24 ; 0x3e8e <main+0x8e>
|
||||
3e76: 7c d0 rcall .+248 ; 0x3f70 <getch>
|
||||
verifySpace();
|
||||
3e78: 18 2f mov r17, r24
|
||||
3e7a: 8c d0 rcall .+280 ; 0x3f94 <verifySpace>
|
||||
/*
|
||||
* Send optiboot version as "SW version"
|
||||
* Note that the references to memory are optimized away.
|
||||
*/
|
||||
if (which == STK_SW_MINOR) {
|
||||
3e7c: 12 38 cpi r17, 0x82 ; 130
|
||||
3e7e: e9 f0 breq .+58 ; 0x3eba <main+0xba>
|
||||
putch(optiboot_version & 0xFF);
|
||||
} else if (which == STK_SW_MAJOR) {
|
||||
3e80: 11 38 cpi r17, 0x81 ; 129
|
||||
putch(optiboot_version >> 8);
|
||||
3e82: 11 f4 brne .+4 ; 0x3e88 <main+0x88>
|
||||
3e84: 87 e0 ldi r24, 0x07 ; 7
|
||||
} else {
|
||||
/*
|
||||
* GET PARAMETER returns a generic 0x03 reply for
|
||||
* other parameters - enough to keep Avrdude happy
|
||||
*/
|
||||
putch(0x03);
|
||||
3e86: 01 c0 rjmp .+2 ; 0x3e8a <main+0x8a>
|
||||
3e88: 83 e0 ldi r24, 0x03 ; 3
|
||||
3e8a: 6b d0 rcall .+214 ; 0x3f62 <putch>
|
||||
3e8c: 67 c0 rjmp .+206 ; 0x3f5c <main+0x15c>
|
||||
}
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE) {
|
||||
3e8e: 82 34 cpi r24, 0x42 ; 66
|
||||
// SET DEVICE is ignored
|
||||
getNch(20);
|
||||
3e90: 11 f4 brne .+4 ; 0x3e96 <main+0x96>
|
||||
3e92: 84 e1 ldi r24, 0x14 ; 20
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE_EXT) {
|
||||
3e94: 03 c0 rjmp .+6 ; 0x3e9c <main+0x9c>
|
||||
// SET DEVICE EXT is ignored
|
||||
getNch(5);
|
||||
3e96: 85 34 cpi r24, 0x45 ; 69
|
||||
3e98: 19 f4 brne .+6 ; 0x3ea0 <main+0xa0>
|
||||
3e9a: 85 e0 ldi r24, 0x05 ; 5
|
||||
}
|
||||
else if(ch == STK_LOAD_ADDRESS) {
|
||||
3e9c: 83 d0 rcall .+262 ; 0x3fa4 <getNch>
|
||||
3e9e: 5e c0 rjmp .+188 ; 0x3f5c <main+0x15c>
|
||||
// LOAD ADDRESS
|
||||
address.bytes[0] = getch();
|
||||
3ea0: 85 35 cpi r24, 0x55 ; 85
|
||||
3ea2: 39 f4 brne .+14 ; 0x3eb2 <main+0xb2>
|
||||
3ea4: 65 d0 rcall .+202 ; 0x3f70 <getch>
|
||||
address.bytes[1] = getch();
|
||||
3ea6: c8 2f mov r28, r24
|
||||
3ea8: 63 d0 rcall .+198 ; 0x3f70 <getch>
|
||||
}
|
||||
else {
|
||||
RAMPZ &= 0xFE;
|
||||
}
|
||||
#endif
|
||||
address.word *= 2; // Convert from word address to byte address
|
||||
3eaa: d8 2f mov r29, r24
|
||||
3eac: cc 0f add r28, r28
|
||||
3eae: dd 1f adc r29, r29
|
||||
verifySpace();
|
||||
}
|
||||
else if(ch == STK_UNIVERSAL) {
|
||||
3eb0: 54 c0 rjmp .+168 ; 0x3f5a <main+0x15a>
|
||||
getNch(3);
|
||||
putch(0x00);
|
||||
}
|
||||
#else
|
||||
// UNIVERSAL command is ignored
|
||||
getNch(4);
|
||||
3eb2: 86 35 cpi r24, 0x56 ; 86
|
||||
3eb4: 21 f4 brne .+8 ; 0x3ebe <main+0xbe>
|
||||
putch(0x00);
|
||||
3eb6: 84 e0 ldi r24, 0x04 ; 4
|
||||
3eb8: 75 d0 rcall .+234 ; 0x3fa4 <getNch>
|
||||
#endif
|
||||
}
|
||||
/* Write memory, length is big endian and is in bytes */
|
||||
else if(ch == STK_PROG_PAGE) {
|
||||
3eba: 80 e0 ldi r24, 0x00 ; 0
|
||||
3ebc: e6 cf rjmp .-52 ; 0x3e8a <main+0x8a>
|
||||
// PROGRAM PAGE - we support flash programming only, not EEPROM
|
||||
uint8_t desttype;
|
||||
uint8_t *bufPtr;
|
||||
pagelen_t savelength;
|
||||
|
||||
GETLENGTH(length);
|
||||
3ebe: 84 36 cpi r24, 0x64 ; 100
|
||||
3ec0: 09 f0 breq .+2 ; 0x3ec4 <main+0xc4>
|
||||
3ec2: 2e c0 rjmp .+92 ; 0x3f20 <main+0x120>
|
||||
3ec4: 55 d0 rcall .+170 ; 0x3f70 <getch>
|
||||
savelength = length;
|
||||
desttype = getch();
|
||||
3ec6: 54 d0 rcall .+168 ; 0x3f70 <getch>
|
||||
3ec8: f8 2e mov r15, r24
|
||||
3eca: 52 d0 rcall .+164 ; 0x3f70 <getch>
|
||||
3ecc: b8 2e mov r11, r24
|
||||
3ece: 00 e0 ldi r16, 0x00 ; 0
|
||||
|
||||
// read a page worth of contents
|
||||
bufPtr = buff.bptr;
|
||||
do *bufPtr++ = getch();
|
||||
3ed0: 11 e0 ldi r17, 0x01 ; 1
|
||||
3ed2: 4e d0 rcall .+156 ; 0x3f70 <getch>
|
||||
3ed4: f8 01 movw r30, r16
|
||||
3ed6: 81 93 st Z+, r24
|
||||
3ed8: 8f 01 movw r16, r30
|
||||
while (--length);
|
||||
3eda: fe 12 cpse r15, r30
|
||||
3edc: fa cf rjmp .-12 ; 0x3ed2 <main+0xd2>
|
||||
|
||||
// Read command terminator, start reply
|
||||
verifySpace();
|
||||
3ede: 5a d0 rcall .+180 ; 0x3f94 <verifySpace>
|
||||
3ee0: f5 e4 ldi r31, 0x45 ; 69
|
||||
* void writebuffer(memtype, buffer, address, length)
|
||||
*/
|
||||
static inline void writebuffer(int8_t memtype, addr16_t mybuff,
|
||||
addr16_t address, pagelen_t len)
|
||||
{
|
||||
switch (memtype) {
|
||||
3ee2: bf 12 cpse r11, r31
|
||||
3ee4: 01 c0 rjmp .+2 ; 0x3ee8 <main+0xe8>
|
||||
3ee6: ff cf rjmp .-2 ; 0x3ee6 <main+0xe6>
|
||||
3ee8: 83 e0 ldi r24, 0x03 ; 3
|
||||
* Start the page erase and wait for it to finish. There
|
||||
* used to be code to do this while receiving the data over
|
||||
* the serial link, but the performance improvement was slight,
|
||||
* and we needed the space back.
|
||||
*/
|
||||
__boot_page_erase_short(address.word);
|
||||
3eea: fe 01 movw r30, r28
|
||||
3eec: 87 bf out 0x37, r24 ; 55
|
||||
3eee: e8 95 spm
|
||||
3ef0: 07 b6 in r0, 0x37 ; 55
|
||||
boot_spm_busy_wait();
|
||||
3ef2: 00 fc sbrc r0, 0
|
||||
3ef4: fd cf rjmp .-6 ; 0x3ef0 <main+0xf0>
|
||||
3ef6: a0 e0 ldi r26, 0x00 ; 0
|
||||
3ef8: b1 e0 ldi r27, 0x01 ; 1
|
||||
3efa: fe 01 movw r30, r28
|
||||
3efc: 8d 91 ld r24, X+
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
3efe: 9d 91 ld r25, X+
|
||||
3f00: 0c 01 movw r0, r24
|
||||
3f02: e7 be out 0x37, r14 ; 55
|
||||
3f04: e8 95 spm
|
||||
3f06: 11 24 eor r1, r1
|
||||
3f08: 32 96 adiw r30, 0x02 ; 2
|
||||
addrPtr += 2;
|
||||
} while (len -= 2);
|
||||
3f0a: fa 12 cpse r15, r26
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
3f0c: f7 cf rjmp .-18 ; 0x3efc <main+0xfc>
|
||||
3f0e: fe 01 movw r30, r28
|
||||
boot_spm_busy_wait();
|
||||
3f10: d7 be out 0x37, r13 ; 55
|
||||
3f12: e8 95 spm
|
||||
#if defined(RWWSRE)
|
||||
// Reenable read access to flash
|
||||
__boot_rww_enable_short();
|
||||
3f14: 07 b6 in r0, 0x37 ; 55
|
||||
3f16: 00 fc sbrc r0, 0
|
||||
3f18: fd cf rjmp .-6 ; 0x3f14 <main+0x114>
|
||||
writebuffer(desttype, buff, address, savelength);
|
||||
|
||||
|
||||
}
|
||||
/* Read memory block mode, length is big endian. */
|
||||
else if(ch == STK_READ_PAGE) {
|
||||
3f1a: c7 be out 0x37, r12 ; 55
|
||||
3f1c: e8 95 spm
|
||||
uint8_t desttype;
|
||||
GETLENGTH(length);
|
||||
3f1e: 1e c0 rjmp .+60 ; 0x3f5c <main+0x15c>
|
||||
3f20: 84 37 cpi r24, 0x74 ; 116
|
||||
3f22: 71 f4 brne .+28 ; 0x3f40 <main+0x140>
|
||||
|
||||
desttype = getch();
|
||||
3f24: 25 d0 rcall .+74 ; 0x3f70 <getch>
|
||||
|
||||
verifySpace();
|
||||
3f26: 24 d0 rcall .+72 ; 0x3f70 <getch>
|
||||
3f28: f8 2e mov r15, r24
|
||||
3f2a: 22 d0 rcall .+68 ; 0x3f70 <getch>
|
||||
// while (--length);
|
||||
// read a Flash and increment the address (may increment RAMPZ)
|
||||
__asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
#else
|
||||
// read a Flash byte and increment the address
|
||||
__asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
3f2c: 33 d0 rcall .+102 ; 0x3f94 <verifySpace>
|
||||
3f2e: 8e 01 movw r16, r28
|
||||
#endif
|
||||
putch(ch);
|
||||
3f30: f8 01 movw r30, r16
|
||||
} while (--length);
|
||||
3f32: 85 91 lpm r24, Z+
|
||||
3f34: 8f 01 movw r16, r30
|
||||
3f36: 15 d0 rcall .+42 ; 0x3f62 <putch>
|
||||
3f38: fa 94 dec r15
|
||||
|
||||
read_mem(desttype, address, length);
|
||||
}
|
||||
|
||||
/* Get device signature bytes */
|
||||
else if(ch == STK_READ_SIGN) {
|
||||
3f3a: f1 10 cpse r15, r1
|
||||
3f3c: f9 cf rjmp .-14 ; 0x3f30 <main+0x130>
|
||||
// READ SIGN - return what Avrdude wants to hear
|
||||
verifySpace();
|
||||
3f3e: 0e c0 rjmp .+28 ; 0x3f5c <main+0x15c>
|
||||
3f40: 85 37 cpi r24, 0x75 ; 117
|
||||
putch(SIGNATURE_0);
|
||||
3f42: 39 f4 brne .+14 ; 0x3f52 <main+0x152>
|
||||
3f44: 27 d0 rcall .+78 ; 0x3f94 <verifySpace>
|
||||
3f46: 8e e1 ldi r24, 0x1E ; 30
|
||||
putch(SIGNATURE_1);
|
||||
3f48: 0c d0 rcall .+24 ; 0x3f62 <putch>
|
||||
3f4a: 84 e9 ldi r24, 0x94 ; 148
|
||||
3f4c: 0a d0 rcall .+20 ; 0x3f62 <putch>
|
||||
putch(SIGNATURE_2);
|
||||
3f4e: 86 e0 ldi r24, 0x06 ; 6
|
||||
3f50: 9c cf rjmp .-200 ; 0x3e8a <main+0x8a>
|
||||
}
|
||||
else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */
|
||||
3f52: 81 35 cpi r24, 0x51 ; 81
|
||||
3f54: 11 f4 brne .+4 ; 0x3f5a <main+0x15a>
|
||||
// Adaboot no-wait mod
|
||||
watchdogConfig(WATCHDOG_16MS);
|
||||
3f56: 88 e0 ldi r24, 0x08 ; 8
|
||||
3f58: 17 d0 rcall .+46 ; 0x3f88 <watchdogConfig>
|
||||
3f5a: 1c d0 rcall .+56 ; 0x3f94 <verifySpace>
|
||||
verifySpace();
|
||||
}
|
||||
else {
|
||||
// This covers the response to commands like STK_ENTER_PROGMODE
|
||||
verifySpace();
|
||||
3f5c: 80 e1 ldi r24, 0x10 ; 16
|
||||
3f5e: 01 d0 rcall .+2 ; 0x3f62 <putch>
|
||||
}
|
||||
putch(STK_OK);
|
||||
3f60: 87 cf rjmp .-242 ; 0x3e70 <main+0x70>
|
||||
|
||||
00003f62 <putch>:
|
||||
3f62: 90 91 c0 00 lds r25, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
}
|
||||
3f66: 95 ff sbrs r25, 5
|
||||
}
|
||||
|
||||
void putch(char ch) {
|
||||
#ifndef SOFT_UART
|
||||
while (!(UART_SRA & _BV(UDRE0)));
|
||||
3f68: fc cf rjmp .-8 ; 0x3f62 <putch>
|
||||
UART_UDR = ch;
|
||||
3f6a: 80 93 c6 00 sts 0x00C6, r24 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7e00c6>
|
||||
3f6e: 08 95 ret
|
||||
|
||||
00003f70 <getch>:
|
||||
[uartBit] "I" (UART_RX_BIT)
|
||||
:
|
||||
"r25"
|
||||
);
|
||||
#else
|
||||
while(!(UART_SRA & _BV(RXC0)))
|
||||
3f70: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
3f74: 87 ff sbrs r24, 7
|
||||
3f76: fc cf rjmp .-8 ; 0x3f70 <getch>
|
||||
;
|
||||
if (!(UART_SRA & _BV(FE0))) {
|
||||
3f78: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
3f7c: 84 fd sbrc r24, 4
|
||||
3f7e: 01 c0 rjmp .+2 ; 0x3f82 <getch+0x12>
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
3f80: a8 95 wdr
|
||||
* don't care that an invalid char is returned...)
|
||||
*/
|
||||
watchdogReset();
|
||||
}
|
||||
|
||||
ch = UART_UDR;
|
||||
3f82: 80 91 c6 00 lds r24, 0x00C6 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7e00c6>
|
||||
LED_PIN |= _BV(LED);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ch;
|
||||
}
|
||||
3f86: 08 95 ret
|
||||
|
||||
00003f88 <watchdogConfig>:
|
||||
"wdr\n"
|
||||
);
|
||||
}
|
||||
|
||||
void watchdogConfig(uint8_t x) {
|
||||
WDTCSR = _BV(WDCE) | _BV(WDE);
|
||||
3f88: e0 e6 ldi r30, 0x60 ; 96
|
||||
3f8a: f0 e0 ldi r31, 0x00 ; 0
|
||||
3f8c: 98 e1 ldi r25, 0x18 ; 24
|
||||
3f8e: 90 83 st Z, r25
|
||||
WDTCSR = x;
|
||||
3f90: 80 83 st Z, r24
|
||||
3f92: 08 95 ret
|
||||
|
||||
00003f94 <verifySpace>:
|
||||
do getch(); while (--count);
|
||||
verifySpace();
|
||||
}
|
||||
|
||||
void verifySpace() {
|
||||
if (getch() != CRC_EOP) {
|
||||
3f94: ed df rcall .-38 ; 0x3f70 <getch>
|
||||
3f96: 80 32 cpi r24, 0x20 ; 32
|
||||
3f98: 19 f0 breq .+6 ; 0x3fa0 <verifySpace+0xc>
|
||||
watchdogConfig(WATCHDOG_16MS); // shorten WD timeout
|
||||
3f9a: 88 e0 ldi r24, 0x08 ; 8
|
||||
3f9c: f5 df rcall .-22 ; 0x3f88 <watchdogConfig>
|
||||
3f9e: ff cf rjmp .-2 ; 0x3f9e <verifySpace+0xa>
|
||||
while (1) // and busy-loop so that WD causes
|
||||
; // a reset and app start.
|
||||
}
|
||||
putch(STK_INSYNC);
|
||||
3fa0: 84 e1 ldi r24, 0x14 ; 20
|
||||
3fa2: df cf rjmp .-66 ; 0x3f62 <putch>
|
||||
|
||||
00003fa4 <getNch>:
|
||||
::[count] "M" (UART_B_VALUE)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
void getNch(uint8_t count) {
|
||||
3fa4: cf 93 push r28
|
||||
3fa6: c8 2f mov r28, r24
|
||||
do getch(); while (--count);
|
||||
3fa8: e3 df rcall .-58 ; 0x3f70 <getch>
|
||||
3faa: c1 50 subi r28, 0x01 ; 1
|
||||
3fac: e9 f7 brne .-6 ; 0x3fa8 <getNch+0x4>
|
||||
verifySpace();
|
||||
3fae: cf 91 pop r28
|
||||
3fb0: f1 cf rjmp .-30 ; 0x3f94 <verifySpace>
|
||||
|
||||
00003fb2 <appStart>:
|
||||
|
||||
void appStart(uint8_t rstFlags) {
|
||||
// save the reset flags in the designated register
|
||||
// This can be saved in a main program by putting code in .init0 (which
|
||||
// executes before normal c init code) to save R2 to a global variable.
|
||||
__asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags));
|
||||
3fb2: 28 2e mov r2, r24
|
||||
|
||||
watchdogConfig(WATCHDOG_OFF);
|
||||
3fb4: 80 e0 ldi r24, 0x00 ; 0
|
||||
3fb6: e8 df rcall .-48 ; 0x3f88 <watchdogConfig>
|
||||
3fb8: e0 e0 ldi r30, 0x00 ; 0
|
||||
// Note that appstart_vec is defined so that this works with either
|
||||
// real or virtual boot partitions.
|
||||
__asm__ __volatile__ (
|
||||
3fba: ff 27 eor r31, r31
|
||||
3fbc: 09 94 ijmp
|
@ -0,0 +1,31 @@
|
||||
:103E0000112484B7882349F0982F9A70923029F0B2
|
||||
:103E100081FF02C097EF94BFCCD085E080938100F2
|
||||
:103E200082E08093C00088E18093C10086E08093A7
|
||||
:103E3000C20088E08093C4008EE0A6D0259A86E078
|
||||
:103E400028E13EEF91E0309385002093840096BBFB
|
||||
:103E5000B09BFECF1D9AA8954091C00047FD02C0BF
|
||||
:103E6000815089F7EE24E39495E0D92E21E1C22E0A
|
||||
:103E70007FD0813461F47CD0182F8CD01238E9F0D7
|
||||
:103E8000113811F487E001C083E06BD067C0823441
|
||||
:103E900011F484E103C0853419F485E083D05EC059
|
||||
:103EA000853539F465D0C82F63D0D82FCC0FDD1FEE
|
||||
:103EB00054C0863521F484E075D080E0E6CF8436A6
|
||||
:103EC00009F02EC055D054D0F82E52D0B82E00E0B4
|
||||
:103ED00011E04ED0F80181938F01FE12FACF5AD033
|
||||
:103EE000F5E4BF1201C0FFCF83E0FE0187BFE89574
|
||||
:103EF00007B600FCFDCFA0E0B1E0FE018D919D91E1
|
||||
:103F00000C01E7BEE89511243296FA12F7CFFE01B4
|
||||
:103F1000D7BEE89507B600FCFDCFC7BEE8951EC02A
|
||||
:103F2000843771F425D024D0F82E22D033D08E01DE
|
||||
:103F3000F80185918F0115D0FA94F110F9CF0EC0D8
|
||||
:103F4000853739F427D08EE10CD084E90AD086E099
|
||||
:103F50009CCF813511F488E017D01CD080E101D0CE
|
||||
:103F600087CF9091C00095FFFCCF8093C600089545
|
||||
:103F70008091C00087FFFCCF8091C00084FD01C00C
|
||||
:103F8000A8958091C6000895E0E6F0E098E190835E
|
||||
:103F900080830895EDDF803219F088E0F5DFFFCFF0
|
||||
:103FA00084E1DFCFCF93C82FE3DFC150E9F7CF9192
|
||||
:0E3FB000F1CF282E80E0E8DFE0E0FF27099443
|
||||
:023FFE000007BA
|
||||
:0400000300003E00BB
|
||||
:00000001FF
|
@ -0,0 +1,584 @@
|
||||
|
||||
optiboot_atmega168.elf: file format elf32-avr
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .data 00000000 00800100 00003fbe 00000252 2**0
|
||||
CONTENTS, ALLOC, LOAD, DATA
|
||||
1 .text 000001be 00003e00 00003e00 00000094 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
2 .version 00000002 00003ffe 00003ffe 00000252 2**0
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
3 .comment 0000002f 00000000 00000000 00000254 2**0
|
||||
CONTENTS, READONLY
|
||||
4 .debug_aranges 00000028 00000000 00000000 00000283 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
5 .debug_info 000005c8 00000000 00000000 000002ab 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
6 .debug_abbrev 00000282 00000000 00000000 00000873 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
7 .debug_line 000002f9 00000000 00000000 00000af5 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
8 .debug_frame 0000008c 00000000 00000000 00000df0 2**2
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
9 .debug_str 000001fa 00000000 00000000 00000e7c 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
10 .debug_loc 00000331 00000000 00000000 00001076 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
11 .debug_ranges 00000060 00000000 00000000 000013a7 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
00003e00 <main>:
|
||||
// SP points to RAMEND
|
||||
// r1 contains zero
|
||||
//
|
||||
// If not, uncomment the following instructions:
|
||||
// cli();
|
||||
asm volatile ("clr __zero_reg__");
|
||||
3e00: 11 24 eor r1, r1
|
||||
*
|
||||
* Code by MarkG55
|
||||
* see discusion in https://github.com/Optiboot/optiboot/issues/97
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
ch = MCUSR;
|
||||
3e02: 84 b7 in r24, 0x34 ; 52
|
||||
#else
|
||||
ch = MCUCSR;
|
||||
#endif
|
||||
// Skip all logic and run bootloader if MCUSR is cleared (application request)
|
||||
if (ch != 0) {
|
||||
3e04: 88 23 and r24, r24
|
||||
3e06: 49 f0 breq .+18 ; 0x3e1a <main+0x1a>
|
||||
* 2. we clear WDRF if it's set with EXTRF to avoid loops
|
||||
* One problematic scenario: broken application code sets watchdog timer
|
||||
* without clearing MCUSR before and triggers it quickly. But it's
|
||||
* recoverable by power-on with pushed reset button.
|
||||
*/
|
||||
if ((ch & (_BV(WDRF) | _BV(EXTRF))) != _BV(EXTRF)) {
|
||||
3e08: 98 2f mov r25, r24
|
||||
3e0a: 9a 70 andi r25, 0x0A ; 10
|
||||
3e0c: 92 30 cpi r25, 0x02 ; 2
|
||||
3e0e: 29 f0 breq .+10 ; 0x3e1a <main+0x1a>
|
||||
if (ch & _BV(EXTRF)) {
|
||||
3e10: 81 ff sbrs r24, 1
|
||||
3e12: 02 c0 rjmp .+4 ; 0x3e18 <main+0x18>
|
||||
* prevent entering bootloader.
|
||||
* '&' operation is skipped to spare few bytes as bits in MCUSR
|
||||
* can only be cleared.
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
MCUSR = ~(_BV(WDRF));
|
||||
3e14: 97 ef ldi r25, 0xF7 ; 247
|
||||
3e16: 94 bf out 0x34, r25 ; 52
|
||||
#else
|
||||
MCUCSR = ~(_BV(WDRF));
|
||||
#endif
|
||||
}
|
||||
appStart(ch);
|
||||
3e18: cc d0 rcall .+408 ; 0x3fb2 <appStart>
|
||||
}
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
// Set up Timer 1 for timeout counter
|
||||
TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
|
||||
3e1a: 85 e0 ldi r24, 0x05 ; 5
|
||||
3e1c: 80 93 81 00 sts 0x0081, r24 ; 0x800081 <__TEXT_REGION_LENGTH__+0x7e0081>
|
||||
UCSRA = _BV(U2X); //Double speed mode USART
|
||||
UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx
|
||||
UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1
|
||||
UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
#else
|
||||
UART_SRA = _BV(U2X0); //Double speed mode USART0
|
||||
3e20: 82 e0 ldi r24, 0x02 ; 2
|
||||
3e22: 80 93 c0 00 sts 0x00C0, r24 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
UART_SRB = _BV(RXEN0) | _BV(TXEN0);
|
||||
3e26: 88 e1 ldi r24, 0x18 ; 24
|
||||
3e28: 80 93 c1 00 sts 0x00C1, r24 ; 0x8000c1 <__TEXT_REGION_LENGTH__+0x7e00c1>
|
||||
UART_SRC = _BV(UCSZ00) | _BV(UCSZ01);
|
||||
3e2c: 86 e0 ldi r24, 0x06 ; 6
|
||||
3e2e: 80 93 c2 00 sts 0x00C2, r24 ; 0x8000c2 <__TEXT_REGION_LENGTH__+0x7e00c2>
|
||||
UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
3e32: 88 e0 ldi r24, 0x08 ; 8
|
||||
3e34: 80 93 c4 00 sts 0x00C4, r24 ; 0x8000c4 <__TEXT_REGION_LENGTH__+0x7e00c4>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set up watchdog to trigger after 1s
|
||||
watchdogConfig(WATCHDOG_1S);
|
||||
3e38: 8e e0 ldi r24, 0x0E ; 14
|
||||
3e3a: a6 d0 rcall .+332 ; 0x3f88 <watchdogConfig>
|
||||
|
||||
#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) || defined(LED_START_ON)
|
||||
/* Set LED pin as output */
|
||||
LED_DDR |= _BV(LED);
|
||||
3e3c: 25 9a sbi 0x04, 5 ; 4
|
||||
3e3e: 86 e0 ldi r24, 0x06 ; 6
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
void flash_led(uint8_t count) {
|
||||
do {
|
||||
TCNT1 = -(F_CPU/(1024*16));
|
||||
3e40: 28 e1 ldi r18, 0x18 ; 24
|
||||
3e42: 3e ef ldi r19, 0xFE ; 254
|
||||
TIFR1 = _BV(TOV1);
|
||||
3e44: 91 e0 ldi r25, 0x01 ; 1
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
void flash_led(uint8_t count) {
|
||||
do {
|
||||
TCNT1 = -(F_CPU/(1024*16));
|
||||
3e46: 30 93 85 00 sts 0x0085, r19 ; 0x800085 <__TEXT_REGION_LENGTH__+0x7e0085>
|
||||
3e4a: 20 93 84 00 sts 0x0084, r18 ; 0x800084 <__TEXT_REGION_LENGTH__+0x7e0084>
|
||||
TIFR1 = _BV(TOV1);
|
||||
3e4e: 96 bb out 0x16, r25 ; 22
|
||||
while(!(TIFR1 & _BV(TOV1)));
|
||||
3e50: b0 9b sbis 0x16, 0 ; 22
|
||||
3e52: fe cf rjmp .-4 ; 0x3e50 <main+0x50>
|
||||
#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) || defined (__AVR_ATmega16__)
|
||||
LED_PORT ^= _BV(LED);
|
||||
#else
|
||||
LED_PIN |= _BV(LED);
|
||||
3e54: 1d 9a sbi 0x03, 5 ; 3
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
3e56: a8 95 wdr
|
||||
* While in theory, the STK500 initial commands would be buffered
|
||||
* by the UART hardware, avrdude sends several attempts in rather
|
||||
* quick succession, some of which will be lost and cause us to
|
||||
* get out of sync. So if we see any data; stop blinking.
|
||||
*/
|
||||
if (UART_SRA & _BV(RXC0))
|
||||
3e58: 40 91 c0 00 lds r20, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
3e5c: 47 fd sbrc r20, 7
|
||||
3e5e: 02 c0 rjmp .+4 ; 0x3e64 <main+0x64>
|
||||
3e60: 81 50 subi r24, 0x01 ; 1
|
||||
#else
|
||||
// This doesn't seem to work?
|
||||
// if ((UART_PIN & (1<<UART_RX_BIT)) == 0)
|
||||
// break; // detect start bit on soft uart too.
|
||||
#endif
|
||||
} while (--count);
|
||||
3e62: 89 f7 brne .-30 ; 0x3e46 <main+0x46>
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
3e64: ee 24 eor r14, r14
|
||||
3e66: e3 94 inc r14
|
||||
} while (len -= 2);
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
3e68: 95 e0 ldi r25, 0x05 ; 5
|
||||
3e6a: d9 2e mov r13, r25
|
||||
boot_spm_busy_wait();
|
||||
#if defined(RWWSRE)
|
||||
// Reenable read access to flash
|
||||
__boot_rww_enable_short();
|
||||
3e6c: 21 e1 ldi r18, 0x11 ; 17
|
||||
#endif
|
||||
|
||||
/* Forever loop: exits by causing WDT reset */
|
||||
for (;;) {
|
||||
/* get character from UART */
|
||||
ch = getch();
|
||||
3e6e: c2 2e mov r12, r18
|
||||
|
||||
if(ch == STK_GET_PARAMETER) {
|
||||
3e70: 7f d0 rcall .+254 ; 0x3f70 <getch>
|
||||
unsigned char which = getch();
|
||||
3e72: 81 34 cpi r24, 0x41 ; 65
|
||||
3e74: 61 f4 brne .+24 ; 0x3e8e <main+0x8e>
|
||||
3e76: 7c d0 rcall .+248 ; 0x3f70 <getch>
|
||||
verifySpace();
|
||||
3e78: 18 2f mov r17, r24
|
||||
3e7a: 8c d0 rcall .+280 ; 0x3f94 <verifySpace>
|
||||
/*
|
||||
* Send optiboot version as "SW version"
|
||||
* Note that the references to memory are optimized away.
|
||||
*/
|
||||
if (which == STK_SW_MINOR) {
|
||||
3e7c: 12 38 cpi r17, 0x82 ; 130
|
||||
3e7e: e9 f0 breq .+58 ; 0x3eba <main+0xba>
|
||||
putch(optiboot_version & 0xFF);
|
||||
} else if (which == STK_SW_MAJOR) {
|
||||
3e80: 11 38 cpi r17, 0x81 ; 129
|
||||
putch(optiboot_version >> 8);
|
||||
3e82: 11 f4 brne .+4 ; 0x3e88 <main+0x88>
|
||||
3e84: 87 e0 ldi r24, 0x07 ; 7
|
||||
} else {
|
||||
/*
|
||||
* GET PARAMETER returns a generic 0x03 reply for
|
||||
* other parameters - enough to keep Avrdude happy
|
||||
*/
|
||||
putch(0x03);
|
||||
3e86: 01 c0 rjmp .+2 ; 0x3e8a <main+0x8a>
|
||||
3e88: 83 e0 ldi r24, 0x03 ; 3
|
||||
3e8a: 6b d0 rcall .+214 ; 0x3f62 <putch>
|
||||
3e8c: 67 c0 rjmp .+206 ; 0x3f5c <main+0x15c>
|
||||
}
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE) {
|
||||
3e8e: 82 34 cpi r24, 0x42 ; 66
|
||||
// SET DEVICE is ignored
|
||||
getNch(20);
|
||||
3e90: 11 f4 brne .+4 ; 0x3e96 <main+0x96>
|
||||
3e92: 84 e1 ldi r24, 0x14 ; 20
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE_EXT) {
|
||||
3e94: 03 c0 rjmp .+6 ; 0x3e9c <main+0x9c>
|
||||
// SET DEVICE EXT is ignored
|
||||
getNch(5);
|
||||
3e96: 85 34 cpi r24, 0x45 ; 69
|
||||
3e98: 19 f4 brne .+6 ; 0x3ea0 <main+0xa0>
|
||||
3e9a: 85 e0 ldi r24, 0x05 ; 5
|
||||
}
|
||||
else if(ch == STK_LOAD_ADDRESS) {
|
||||
3e9c: 83 d0 rcall .+262 ; 0x3fa4 <getNch>
|
||||
3e9e: 5e c0 rjmp .+188 ; 0x3f5c <main+0x15c>
|
||||
// LOAD ADDRESS
|
||||
address.bytes[0] = getch();
|
||||
3ea0: 85 35 cpi r24, 0x55 ; 85
|
||||
3ea2: 39 f4 brne .+14 ; 0x3eb2 <main+0xb2>
|
||||
3ea4: 65 d0 rcall .+202 ; 0x3f70 <getch>
|
||||
address.bytes[1] = getch();
|
||||
3ea6: c8 2f mov r28, r24
|
||||
3ea8: 63 d0 rcall .+198 ; 0x3f70 <getch>
|
||||
}
|
||||
else {
|
||||
RAMPZ &= 0xFE;
|
||||
}
|
||||
#endif
|
||||
address.word *= 2; // Convert from word address to byte address
|
||||
3eaa: d8 2f mov r29, r24
|
||||
3eac: cc 0f add r28, r28
|
||||
3eae: dd 1f adc r29, r29
|
||||
verifySpace();
|
||||
}
|
||||
else if(ch == STK_UNIVERSAL) {
|
||||
3eb0: 54 c0 rjmp .+168 ; 0x3f5a <main+0x15a>
|
||||
getNch(3);
|
||||
putch(0x00);
|
||||
}
|
||||
#else
|
||||
// UNIVERSAL command is ignored
|
||||
getNch(4);
|
||||
3eb2: 86 35 cpi r24, 0x56 ; 86
|
||||
3eb4: 21 f4 brne .+8 ; 0x3ebe <main+0xbe>
|
||||
putch(0x00);
|
||||
3eb6: 84 e0 ldi r24, 0x04 ; 4
|
||||
3eb8: 75 d0 rcall .+234 ; 0x3fa4 <getNch>
|
||||
#endif
|
||||
}
|
||||
/* Write memory, length is big endian and is in bytes */
|
||||
else if(ch == STK_PROG_PAGE) {
|
||||
3eba: 80 e0 ldi r24, 0x00 ; 0
|
||||
3ebc: e6 cf rjmp .-52 ; 0x3e8a <main+0x8a>
|
||||
// PROGRAM PAGE - we support flash programming only, not EEPROM
|
||||
uint8_t desttype;
|
||||
uint8_t *bufPtr;
|
||||
pagelen_t savelength;
|
||||
|
||||
GETLENGTH(length);
|
||||
3ebe: 84 36 cpi r24, 0x64 ; 100
|
||||
3ec0: 09 f0 breq .+2 ; 0x3ec4 <main+0xc4>
|
||||
3ec2: 2e c0 rjmp .+92 ; 0x3f20 <main+0x120>
|
||||
3ec4: 55 d0 rcall .+170 ; 0x3f70 <getch>
|
||||
savelength = length;
|
||||
desttype = getch();
|
||||
3ec6: 54 d0 rcall .+168 ; 0x3f70 <getch>
|
||||
3ec8: f8 2e mov r15, r24
|
||||
3eca: 52 d0 rcall .+164 ; 0x3f70 <getch>
|
||||
3ecc: b8 2e mov r11, r24
|
||||
3ece: 00 e0 ldi r16, 0x00 ; 0
|
||||
|
||||
// read a page worth of contents
|
||||
bufPtr = buff.bptr;
|
||||
do *bufPtr++ = getch();
|
||||
3ed0: 11 e0 ldi r17, 0x01 ; 1
|
||||
3ed2: 4e d0 rcall .+156 ; 0x3f70 <getch>
|
||||
3ed4: f8 01 movw r30, r16
|
||||
3ed6: 81 93 st Z+, r24
|
||||
3ed8: 8f 01 movw r16, r30
|
||||
while (--length);
|
||||
3eda: fe 12 cpse r15, r30
|
||||
3edc: fa cf rjmp .-12 ; 0x3ed2 <main+0xd2>
|
||||
|
||||
// Read command terminator, start reply
|
||||
verifySpace();
|
||||
3ede: 5a d0 rcall .+180 ; 0x3f94 <verifySpace>
|
||||
3ee0: f5 e4 ldi r31, 0x45 ; 69
|
||||
* void writebuffer(memtype, buffer, address, length)
|
||||
*/
|
||||
static inline void writebuffer(int8_t memtype, addr16_t mybuff,
|
||||
addr16_t address, pagelen_t len)
|
||||
{
|
||||
switch (memtype) {
|
||||
3ee2: bf 12 cpse r11, r31
|
||||
3ee4: 01 c0 rjmp .+2 ; 0x3ee8 <main+0xe8>
|
||||
3ee6: ff cf rjmp .-2 ; 0x3ee6 <main+0xe6>
|
||||
3ee8: 83 e0 ldi r24, 0x03 ; 3
|
||||
* Start the page erase and wait for it to finish. There
|
||||
* used to be code to do this while receiving the data over
|
||||
* the serial link, but the performance improvement was slight,
|
||||
* and we needed the space back.
|
||||
*/
|
||||
__boot_page_erase_short(address.word);
|
||||
3eea: fe 01 movw r30, r28
|
||||
3eec: 87 bf out 0x37, r24 ; 55
|
||||
3eee: e8 95 spm
|
||||
3ef0: 07 b6 in r0, 0x37 ; 55
|
||||
boot_spm_busy_wait();
|
||||
3ef2: 00 fc sbrc r0, 0
|
||||
3ef4: fd cf rjmp .-6 ; 0x3ef0 <main+0xf0>
|
||||
3ef6: a0 e0 ldi r26, 0x00 ; 0
|
||||
3ef8: b1 e0 ldi r27, 0x01 ; 1
|
||||
3efa: fe 01 movw r30, r28
|
||||
3efc: 8d 91 ld r24, X+
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
3efe: 9d 91 ld r25, X+
|
||||
3f00: 0c 01 movw r0, r24
|
||||
3f02: e7 be out 0x37, r14 ; 55
|
||||
3f04: e8 95 spm
|
||||
3f06: 11 24 eor r1, r1
|
||||
3f08: 32 96 adiw r30, 0x02 ; 2
|
||||
addrPtr += 2;
|
||||
} while (len -= 2);
|
||||
3f0a: fa 12 cpse r15, r26
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
3f0c: f7 cf rjmp .-18 ; 0x3efc <main+0xfc>
|
||||
3f0e: fe 01 movw r30, r28
|
||||
boot_spm_busy_wait();
|
||||
3f10: d7 be out 0x37, r13 ; 55
|
||||
3f12: e8 95 spm
|
||||
#if defined(RWWSRE)
|
||||
// Reenable read access to flash
|
||||
__boot_rww_enable_short();
|
||||
3f14: 07 b6 in r0, 0x37 ; 55
|
||||
3f16: 00 fc sbrc r0, 0
|
||||
3f18: fd cf rjmp .-6 ; 0x3f14 <main+0x114>
|
||||
writebuffer(desttype, buff, address, savelength);
|
||||
|
||||
|
||||
}
|
||||
/* Read memory block mode, length is big endian. */
|
||||
else if(ch == STK_READ_PAGE) {
|
||||
3f1a: c7 be out 0x37, r12 ; 55
|
||||
3f1c: e8 95 spm
|
||||
uint8_t desttype;
|
||||
GETLENGTH(length);
|
||||
3f1e: 1e c0 rjmp .+60 ; 0x3f5c <main+0x15c>
|
||||
3f20: 84 37 cpi r24, 0x74 ; 116
|
||||
3f22: 71 f4 brne .+28 ; 0x3f40 <main+0x140>
|
||||
|
||||
desttype = getch();
|
||||
3f24: 25 d0 rcall .+74 ; 0x3f70 <getch>
|
||||
|
||||
verifySpace();
|
||||
3f26: 24 d0 rcall .+72 ; 0x3f70 <getch>
|
||||
3f28: f8 2e mov r15, r24
|
||||
3f2a: 22 d0 rcall .+68 ; 0x3f70 <getch>
|
||||
// while (--length);
|
||||
// read a Flash and increment the address (may increment RAMPZ)
|
||||
__asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
#else
|
||||
// read a Flash byte and increment the address
|
||||
__asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
3f2c: 33 d0 rcall .+102 ; 0x3f94 <verifySpace>
|
||||
3f2e: 8e 01 movw r16, r28
|
||||
#endif
|
||||
putch(ch);
|
||||
3f30: f8 01 movw r30, r16
|
||||
} while (--length);
|
||||
3f32: 85 91 lpm r24, Z+
|
||||
3f34: 8f 01 movw r16, r30
|
||||
3f36: 15 d0 rcall .+42 ; 0x3f62 <putch>
|
||||
3f38: fa 94 dec r15
|
||||
|
||||
read_mem(desttype, address, length);
|
||||
}
|
||||
|
||||
/* Get device signature bytes */
|
||||
else if(ch == STK_READ_SIGN) {
|
||||
3f3a: f1 10 cpse r15, r1
|
||||
3f3c: f9 cf rjmp .-14 ; 0x3f30 <main+0x130>
|
||||
// READ SIGN - return what Avrdude wants to hear
|
||||
verifySpace();
|
||||
3f3e: 0e c0 rjmp .+28 ; 0x3f5c <main+0x15c>
|
||||
3f40: 85 37 cpi r24, 0x75 ; 117
|
||||
putch(SIGNATURE_0);
|
||||
3f42: 39 f4 brne .+14 ; 0x3f52 <main+0x152>
|
||||
3f44: 27 d0 rcall .+78 ; 0x3f94 <verifySpace>
|
||||
3f46: 8e e1 ldi r24, 0x1E ; 30
|
||||
putch(SIGNATURE_1);
|
||||
3f48: 0c d0 rcall .+24 ; 0x3f62 <putch>
|
||||
3f4a: 84 e9 ldi r24, 0x94 ; 148
|
||||
3f4c: 0a d0 rcall .+20 ; 0x3f62 <putch>
|
||||
putch(SIGNATURE_2);
|
||||
3f4e: 86 e0 ldi r24, 0x06 ; 6
|
||||
3f50: 9c cf rjmp .-200 ; 0x3e8a <main+0x8a>
|
||||
}
|
||||
else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */
|
||||
3f52: 81 35 cpi r24, 0x51 ; 81
|
||||
3f54: 11 f4 brne .+4 ; 0x3f5a <main+0x15a>
|
||||
// Adaboot no-wait mod
|
||||
watchdogConfig(WATCHDOG_16MS);
|
||||
3f56: 88 e0 ldi r24, 0x08 ; 8
|
||||
3f58: 17 d0 rcall .+46 ; 0x3f88 <watchdogConfig>
|
||||
3f5a: 1c d0 rcall .+56 ; 0x3f94 <verifySpace>
|
||||
verifySpace();
|
||||
}
|
||||
else {
|
||||
// This covers the response to commands like STK_ENTER_PROGMODE
|
||||
verifySpace();
|
||||
3f5c: 80 e1 ldi r24, 0x10 ; 16
|
||||
3f5e: 01 d0 rcall .+2 ; 0x3f62 <putch>
|
||||
}
|
||||
putch(STK_OK);
|
||||
3f60: 87 cf rjmp .-242 ; 0x3e70 <main+0x70>
|
||||
|
||||
00003f62 <putch>:
|
||||
3f62: 90 91 c0 00 lds r25, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
}
|
||||
3f66: 95 ff sbrs r25, 5
|
||||
}
|
||||
|
||||
void putch(char ch) {
|
||||
#ifndef SOFT_UART
|
||||
while (!(UART_SRA & _BV(UDRE0)));
|
||||
3f68: fc cf rjmp .-8 ; 0x3f62 <putch>
|
||||
UART_UDR = ch;
|
||||
3f6a: 80 93 c6 00 sts 0x00C6, r24 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7e00c6>
|
||||
3f6e: 08 95 ret
|
||||
|
||||
00003f70 <getch>:
|
||||
[uartBit] "I" (UART_RX_BIT)
|
||||
:
|
||||
"r25"
|
||||
);
|
||||
#else
|
||||
while(!(UART_SRA & _BV(RXC0)))
|
||||
3f70: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
3f74: 87 ff sbrs r24, 7
|
||||
3f76: fc cf rjmp .-8 ; 0x3f70 <getch>
|
||||
;
|
||||
if (!(UART_SRA & _BV(FE0))) {
|
||||
3f78: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7e00c0>
|
||||
3f7c: 84 fd sbrc r24, 4
|
||||
3f7e: 01 c0 rjmp .+2 ; 0x3f82 <getch+0x12>
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
3f80: a8 95 wdr
|
||||
* don't care that an invalid char is returned...)
|
||||
*/
|
||||
watchdogReset();
|
||||
}
|
||||
|
||||
ch = UART_UDR;
|
||||
3f82: 80 91 c6 00 lds r24, 0x00C6 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7e00c6>
|
||||
LED_PIN |= _BV(LED);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ch;
|
||||
}
|
||||
3f86: 08 95 ret
|
||||
|
||||
00003f88 <watchdogConfig>:
|
||||
"wdr\n"
|
||||
);
|
||||
}
|
||||
|
||||
void watchdogConfig(uint8_t x) {
|
||||
WDTCSR = _BV(WDCE) | _BV(WDE);
|
||||
3f88: e0 e6 ldi r30, 0x60 ; 96
|
||||
3f8a: f0 e0 ldi r31, 0x00 ; 0
|
||||
3f8c: 98 e1 ldi r25, 0x18 ; 24
|
||||
3f8e: 90 83 st Z, r25
|
||||
WDTCSR = x;
|
||||
3f90: 80 83 st Z, r24
|
||||
3f92: 08 95 ret
|
||||
|
||||
00003f94 <verifySpace>:
|
||||
do getch(); while (--count);
|
||||
verifySpace();
|
||||
}
|
||||
|
||||
void verifySpace() {
|
||||
if (getch() != CRC_EOP) {
|
||||
3f94: ed df rcall .-38 ; 0x3f70 <getch>
|
||||
3f96: 80 32 cpi r24, 0x20 ; 32
|
||||
3f98: 19 f0 breq .+6 ; 0x3fa0 <verifySpace+0xc>
|
||||
watchdogConfig(WATCHDOG_16MS); // shorten WD timeout
|
||||
3f9a: 88 e0 ldi r24, 0x08 ; 8
|
||||
3f9c: f5 df rcall .-22 ; 0x3f88 <watchdogConfig>
|
||||
3f9e: ff cf rjmp .-2 ; 0x3f9e <verifySpace+0xa>
|
||||
while (1) // and busy-loop so that WD causes
|
||||
; // a reset and app start.
|
||||
}
|
||||
putch(STK_INSYNC);
|
||||
3fa0: 84 e1 ldi r24, 0x14 ; 20
|
||||
3fa2: df cf rjmp .-66 ; 0x3f62 <putch>
|
||||
|
||||
00003fa4 <getNch>:
|
||||
::[count] "M" (UART_B_VALUE)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
void getNch(uint8_t count) {
|
||||
3fa4: cf 93 push r28
|
||||
3fa6: c8 2f mov r28, r24
|
||||
do getch(); while (--count);
|
||||
3fa8: e3 df rcall .-58 ; 0x3f70 <getch>
|
||||
3faa: c1 50 subi r28, 0x01 ; 1
|
||||
3fac: e9 f7 brne .-6 ; 0x3fa8 <getNch+0x4>
|
||||
verifySpace();
|
||||
3fae: cf 91 pop r28
|
||||
3fb0: f1 cf rjmp .-30 ; 0x3f94 <verifySpace>
|
||||
|
||||
00003fb2 <appStart>:
|
||||
|
||||
void appStart(uint8_t rstFlags) {
|
||||
// save the reset flags in the designated register
|
||||
// This can be saved in a main program by putting code in .init0 (which
|
||||
// executes before normal c init code) to save R2 to a global variable.
|
||||
__asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags));
|
||||
3fb2: 28 2e mov r2, r24
|
||||
|
||||
watchdogConfig(WATCHDOG_OFF);
|
||||
3fb4: 80 e0 ldi r24, 0x00 ; 0
|
||||
3fb6: e8 df rcall .-48 ; 0x3f88 <watchdogConfig>
|
||||
3fb8: e0 e0 ldi r30, 0x00 ; 0
|
||||
// Note that appstart_vec is defined so that this works with either
|
||||
// real or virtual boot partitions.
|
||||
__asm__ __volatile__ (
|
||||
3fba: ff 27 eor r31, r31
|
||||
3fbc: 09 94 ijmp
|
@ -0,0 +1,38 @@
|
||||
:101D0000112484B7882349F0982F9A70923029F0D3
|
||||
:101D100081FF02C097EF94BFFED08EE0E9D0D29A47
|
||||
:101D200023E0C22EBB24B39435E0A32ECDD0813462
|
||||
:101D300071F4CAD0F82EE0D082E8F816F1F0E1E8AC
|
||||
:101D4000FE1202C087E001C083E0AFD0ABC0823496
|
||||
:101D500011F484E103C0853419F485E0D5D0A2C024
|
||||
:101D6000853539F4B1D0C82FAFD0D82FCC0FDD1FB7
|
||||
:101D700098C0863521F484E0C7D080E0E6CF843671
|
||||
:101D800009F055C0A1D0A0D0F82E9ED0D82EEF2CAF
|
||||
:101D900080E6882E912C98D0F40181934F01EA942B
|
||||
:101DA000E110F9CFA9D0209719F590916000909398
|
||||
:101DB000E400809161008093E50020916800209309
|
||||
:101DC000E600209169002093E700092F182F0450A6
|
||||
:101DD000110900936800812F8F70806C80936900D7
|
||||
:101DE00000E81EE000936000812F806C809361000A
|
||||
:101DF000F5E4DF1201C0FFCFFE01C7BEE89507B6CC
|
||||
:101E000000FCFDCFA0E6B0E0FE018D919D910C019C
|
||||
:101E1000B7BEE8951124FA94FA943296F110F5CFF2
|
||||
:101E2000FE01A7BEE89507B600FCFDCF3BC0843796
|
||||
:101E300059F54AD049D0D82E47D05ED07E01E11462
|
||||
:101E4000F10419F48091E40017C0F1E0EF16F104F9
|
||||
:101E500019F48091E50010C088E0E816F10419F447
|
||||
:101E60008091E60009C0E9E0EE16F10419F48091D2
|
||||
:101E7000E70002C0F701849118D0DA94FFEFEF1A5F
|
||||
:101E8000FF0AD110DCCF0EC0853739F435D08EE192
|
||||
:101E90000CD083E90AD08CE058CF813511F488E06A
|
||||
:101EA00027D02AD080E101D041CF2AE030E08095D0
|
||||
:101EB000089410F4DA9802C0DA9A000015D014D011
|
||||
:101EC00086952A95B1F70895A89529E030E0CB9939
|
||||
:101ED000FECF0AD009D008D08894CB9908942A95CF
|
||||
:101EE00011F08795F7CF08959EE09A95F1F7089540
|
||||
:101EF00098E191BD81BD0895E7DF803219F088E057
|
||||
:101F0000F7DFFFCF84E1D1CFCF93C82FDDDFC15002
|
||||
:101F1000E9F7CF91F1CF282E80E0EADFE4E0FF2758
|
||||
:021F2000099422
|
||||
:021FFE000007DA
|
||||
:0400000300001D00DC
|
||||
:00000001FF
|
@ -0,0 +1,634 @@
|
||||
|
||||
optiboot_attiny84.elf: file format elf32-avr
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .text 00000222 00001d00 00001d00 00000074 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
1 .version 00000002 00001ffe 00001ffe 00000296 2**0
|
||||
CONTENTS, ALLOC, LOAD, READONLY, DATA
|
||||
2 .data 00000000 00800060 00800060 00000298 2**0
|
||||
CONTENTS, ALLOC, LOAD, DATA
|
||||
3 .comment 0000002f 00000000 00000000 00000298 2**0
|
||||
CONTENTS, READONLY
|
||||
4 .debug_aranges 00000028 00000000 00000000 000002c7 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
5 .debug_info 000005e9 00000000 00000000 000002ef 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
6 .debug_abbrev 0000029f 00000000 00000000 000008d8 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
7 .debug_line 00000307 00000000 00000000 00000b77 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
8 .debug_frame 0000009c 00000000 00000000 00000e80 2**2
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
9 .debug_str 00000212 00000000 00000000 00000f1c 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
10 .debug_loc 00000367 00000000 00000000 0000112e 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
11 .debug_ranges 00000060 00000000 00000000 00001495 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
00001d00 <main>:
|
||||
// SP points to RAMEND
|
||||
// r1 contains zero
|
||||
//
|
||||
// If not, uncomment the following instructions:
|
||||
// cli();
|
||||
asm volatile ("clr __zero_reg__");
|
||||
1d00: 11 24 eor r1, r1
|
||||
*
|
||||
* Code by MarkG55
|
||||
* see discusion in https://github.com/Optiboot/optiboot/issues/97
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
ch = MCUSR;
|
||||
1d02: 84 b7 in r24, 0x34 ; 52
|
||||
#else
|
||||
ch = MCUCSR;
|
||||
#endif
|
||||
// Skip all logic and run bootloader if MCUSR is cleared (application request)
|
||||
if (ch != 0) {
|
||||
1d04: 88 23 and r24, r24
|
||||
1d06: 49 f0 breq .+18 ; 0x1d1a <main+0x1a>
|
||||
* 2. we clear WDRF if it's set with EXTRF to avoid loops
|
||||
* One problematic scenario: broken application code sets watchdog timer
|
||||
* without clearing MCUSR before and triggers it quickly. But it's
|
||||
* recoverable by power-on with pushed reset button.
|
||||
*/
|
||||
if ((ch & (_BV(WDRF) | _BV(EXTRF))) != _BV(EXTRF)) {
|
||||
1d08: 98 2f mov r25, r24
|
||||
1d0a: 9a 70 andi r25, 0x0A ; 10
|
||||
1d0c: 92 30 cpi r25, 0x02 ; 2
|
||||
1d0e: 29 f0 breq .+10 ; 0x1d1a <main+0x1a>
|
||||
if (ch & _BV(EXTRF)) {
|
||||
1d10: 81 ff sbrs r24, 1
|
||||
1d12: 02 c0 rjmp .+4 ; 0x1d18 <main+0x18>
|
||||
* prevent entering bootloader.
|
||||
* '&' operation is skipped to spare few bytes as bits in MCUSR
|
||||
* can only be cleared.
|
||||
*/
|
||||
#if !defined(__AVR_ATmega16__)
|
||||
MCUSR = ~(_BV(WDRF));
|
||||
1d14: 97 ef ldi r25, 0xF7 ; 247
|
||||
1d16: 94 bf out 0x34, r25 ; 52
|
||||
#else
|
||||
MCUCSR = ~(_BV(WDRF));
|
||||
#endif
|
||||
}
|
||||
appStart(ch);
|
||||
1d18: fe d0 rcall .+508 ; 0x1f16 <appStart>
|
||||
UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set up watchdog to trigger after 1s
|
||||
watchdogConfig(WATCHDOG_1S);
|
||||
1d1a: 8e e0 ldi r24, 0x0E ; 14
|
||||
1d1c: e9 d0 rcall .+466 ; 0x1ef0 <watchdogConfig>
|
||||
LED_DDR |= _BV(LED);
|
||||
#endif
|
||||
|
||||
#ifdef SOFT_UART
|
||||
/* Set TX pin as output */
|
||||
UART_DDR |= _BV(UART_TX_BIT);
|
||||
1d1e: d2 9a sbi 0x1a, 2 ; 26
|
||||
* Start the page erase and wait for it to finish. There
|
||||
* used to be code to do this while receiving the data over
|
||||
* the serial link, but the performance improvement was slight,
|
||||
* and we needed the space back.
|
||||
*/
|
||||
__boot_page_erase_short(address.word);
|
||||
1d20: 23 e0 ldi r18, 0x03 ; 3
|
||||
1d22: c2 2e mov r12, r18
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
1d24: bb 24 eor r11, r11
|
||||
1d26: b3 94 inc r11
|
||||
} while (len -= 2);
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
1d28: 35 e0 ldi r19, 0x05 ; 5
|
||||
1d2a: a3 2e mov r10, r19
|
||||
#endif
|
||||
|
||||
/* Forever loop: exits by causing WDT reset */
|
||||
for (;;) {
|
||||
/* get character from UART */
|
||||
ch = getch();
|
||||
1d2c: cd d0 rcall .+410 ; 0x1ec8 <getch>
|
||||
|
||||
if(ch == STK_GET_PARAMETER) {
|
||||
1d2e: 81 34 cpi r24, 0x41 ; 65
|
||||
1d30: 71 f4 brne .+28 ; 0x1d4e <main+0x4e>
|
||||
unsigned char which = getch();
|
||||
1d32: ca d0 rcall .+404 ; 0x1ec8 <getch>
|
||||
1d34: f8 2e mov r15, r24
|
||||
verifySpace();
|
||||
1d36: e0 d0 rcall .+448 ; 0x1ef8 <verifySpace>
|
||||
/*
|
||||
* Send optiboot version as "SW version"
|
||||
* Note that the references to memory are optimized away.
|
||||
*/
|
||||
if (which == STK_SW_MINOR) {
|
||||
1d38: 82 e8 ldi r24, 0x82 ; 130
|
||||
1d3a: f8 16 cp r15, r24
|
||||
1d3c: f1 f0 breq .+60 ; 0x1d7a <main+0x7a>
|
||||
putch(optiboot_version & 0xFF);
|
||||
} else if (which == STK_SW_MAJOR) {
|
||||
1d3e: e1 e8 ldi r30, 0x81 ; 129
|
||||
1d40: fe 12 cpse r15, r30
|
||||
1d42: 02 c0 rjmp .+4 ; 0x1d48 <main+0x48>
|
||||
putch(optiboot_version >> 8);
|
||||
1d44: 87 e0 ldi r24, 0x07 ; 7
|
||||
1d46: 01 c0 rjmp .+2 ; 0x1d4a <main+0x4a>
|
||||
} else {
|
||||
/*
|
||||
* GET PARAMETER returns a generic 0x03 reply for
|
||||
* other parameters - enough to keep Avrdude happy
|
||||
*/
|
||||
putch(0x03);
|
||||
1d48: 83 e0 ldi r24, 0x03 ; 3
|
||||
1d4a: af d0 rcall .+350 ; 0x1eaa <putch>
|
||||
1d4c: ab c0 rjmp .+342 ; 0x1ea4 <main+0x1a4>
|
||||
}
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE) {
|
||||
1d4e: 82 34 cpi r24, 0x42 ; 66
|
||||
1d50: 11 f4 brne .+4 ; 0x1d56 <main+0x56>
|
||||
// SET DEVICE is ignored
|
||||
getNch(20);
|
||||
1d52: 84 e1 ldi r24, 0x14 ; 20
|
||||
1d54: 03 c0 rjmp .+6 ; 0x1d5c <main+0x5c>
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE_EXT) {
|
||||
1d56: 85 34 cpi r24, 0x45 ; 69
|
||||
1d58: 19 f4 brne .+6 ; 0x1d60 <main+0x60>
|
||||
// SET DEVICE EXT is ignored
|
||||
getNch(5);
|
||||
1d5a: 85 e0 ldi r24, 0x05 ; 5
|
||||
1d5c: d5 d0 rcall .+426 ; 0x1f08 <getNch>
|
||||
1d5e: a2 c0 rjmp .+324 ; 0x1ea4 <main+0x1a4>
|
||||
}
|
||||
else if(ch == STK_LOAD_ADDRESS) {
|
||||
1d60: 85 35 cpi r24, 0x55 ; 85
|
||||
1d62: 39 f4 brne .+14 ; 0x1d72 <main+0x72>
|
||||
// LOAD ADDRESS
|
||||
address.bytes[0] = getch();
|
||||
1d64: b1 d0 rcall .+354 ; 0x1ec8 <getch>
|
||||
1d66: c8 2f mov r28, r24
|
||||
address.bytes[1] = getch();
|
||||
1d68: af d0 rcall .+350 ; 0x1ec8 <getch>
|
||||
1d6a: d8 2f mov r29, r24
|
||||
}
|
||||
else {
|
||||
RAMPZ &= 0xFE;
|
||||
}
|
||||
#endif
|
||||
address.word *= 2; // Convert from word address to byte address
|
||||
1d6c: cc 0f add r28, r28
|
||||
1d6e: dd 1f adc r29, r29
|
||||
1d70: 98 c0 rjmp .+304 ; 0x1ea2 <main+0x1a2>
|
||||
verifySpace();
|
||||
}
|
||||
else if(ch == STK_UNIVERSAL) {
|
||||
1d72: 86 35 cpi r24, 0x56 ; 86
|
||||
1d74: 21 f4 brne .+8 ; 0x1d7e <main+0x7e>
|
||||
getNch(3);
|
||||
putch(0x00);
|
||||
}
|
||||
#else
|
||||
// UNIVERSAL command is ignored
|
||||
getNch(4);
|
||||
1d76: 84 e0 ldi r24, 0x04 ; 4
|
||||
1d78: c7 d0 rcall .+398 ; 0x1f08 <getNch>
|
||||
putch(0x00);
|
||||
1d7a: 80 e0 ldi r24, 0x00 ; 0
|
||||
1d7c: e6 cf rjmp .-52 ; 0x1d4a <main+0x4a>
|
||||
#endif
|
||||
}
|
||||
/* Write memory, length is big endian and is in bytes */
|
||||
else if(ch == STK_PROG_PAGE) {
|
||||
1d7e: 84 36 cpi r24, 0x64 ; 100
|
||||
1d80: 09 f0 breq .+2 ; 0x1d84 <main+0x84>
|
||||
1d82: 55 c0 rjmp .+170 ; 0x1e2e <main+0x12e>
|
||||
// PROGRAM PAGE - we support flash programming only, not EEPROM
|
||||
uint8_t desttype;
|
||||
uint8_t *bufPtr;
|
||||
pagelen_t savelength;
|
||||
|
||||
GETLENGTH(length);
|
||||
1d84: a1 d0 rcall .+322 ; 0x1ec8 <getch>
|
||||
1d86: a0 d0 rcall .+320 ; 0x1ec8 <getch>
|
||||
1d88: f8 2e mov r15, r24
|
||||
savelength = length;
|
||||
desttype = getch();
|
||||
1d8a: 9e d0 rcall .+316 ; 0x1ec8 <getch>
|
||||
1d8c: d8 2e mov r13, r24
|
||||
// PROGRAM PAGE - we support flash programming only, not EEPROM
|
||||
uint8_t desttype;
|
||||
uint8_t *bufPtr;
|
||||
pagelen_t savelength;
|
||||
|
||||
GETLENGTH(length);
|
||||
1d8e: ef 2c mov r14, r15
|
||||
savelength = length;
|
||||
desttype = getch();
|
||||
1d90: 80 e6 ldi r24, 0x60 ; 96
|
||||
1d92: 88 2e mov r8, r24
|
||||
1d94: 91 2c mov r9, r1
|
||||
|
||||
// read a page worth of contents
|
||||
bufPtr = buff.bptr;
|
||||
do *bufPtr++ = getch();
|
||||
1d96: 98 d0 rcall .+304 ; 0x1ec8 <getch>
|
||||
1d98: f4 01 movw r30, r8
|
||||
1d9a: 81 93 st Z+, r24
|
||||
1d9c: 4f 01 movw r8, r30
|
||||
while (--length);
|
||||
1d9e: ea 94 dec r14
|
||||
1da0: e1 10 cpse r14, r1
|
||||
1da2: f9 cf rjmp .-14 ; 0x1d96 <main+0x96>
|
||||
|
||||
// Read command terminator, start reply
|
||||
verifySpace();
|
||||
1da4: a9 d0 rcall .+338 ; 0x1ef8 <verifySpace>
|
||||
|
||||
#else
|
||||
/*
|
||||
* AVR with 2-byte ISR Vectors and rjmp
|
||||
*/
|
||||
if (address.word == rstVect0) {
|
||||
1da6: 20 97 sbiw r28, 0x00 ; 0
|
||||
1da8: 19 f5 brne .+70 ; 0x1df0 <main+0xf0>
|
||||
// This is the reset vector page. We need to live-patch
|
||||
// the code so the bootloader runs first.
|
||||
//
|
||||
// Move RESET vector to 'save' vector
|
||||
// Save jmp targets (for "Verify")
|
||||
rstVect0_sav = buff.bptr[rstVect0];
|
||||
1daa: 90 91 60 00 lds r25, 0x0060 ; 0x800060 <_edata>
|
||||
1dae: 90 93 e4 00 sts 0x00E4, r25 ; 0x8000e4 <_edata+0x84>
|
||||
rstVect1_sav = buff.bptr[rstVect1];
|
||||
1db2: 80 91 61 00 lds r24, 0x0061 ; 0x800061 <_edata+0x1>
|
||||
1db6: 80 93 e5 00 sts 0x00E5, r24 ; 0x8000e5 <_edata+0x85>
|
||||
saveVect0_sav = buff.bptr[saveVect0];
|
||||
1dba: 20 91 68 00 lds r18, 0x0068 ; 0x800068 <_edata+0x8>
|
||||
1dbe: 20 93 e6 00 sts 0x00E6, r18 ; 0x8000e6 <_edata+0x86>
|
||||
saveVect1_sav = buff.bptr[saveVect1];
|
||||
1dc2: 20 91 69 00 lds r18, 0x0069 ; 0x800069 <_edata+0x9>
|
||||
1dc6: 20 93 e7 00 sts 0x00E7, r18 ; 0x8000e7 <_edata+0x87>
|
||||
|
||||
// Instruction is a relative jump (rjmp), so recalculate.
|
||||
// an RJMP instruction is 0b1100xxxx xxxxxxxx, so we should be able to
|
||||
// do math on the offsets without masking it off first.
|
||||
addr16_t vect;
|
||||
vect.bytes[0] = rstVect0_sav;
|
||||
1dca: 09 2f mov r16, r25
|
||||
vect.bytes[1] = rstVect1_sav;
|
||||
1dcc: 18 2f mov r17, r24
|
||||
vect.word = (vect.word-save_vect_num); //substract 'save' interrupt position
|
||||
1dce: 04 50 subi r16, 0x04 ; 4
|
||||
1dd0: 11 09 sbc r17, r1
|
||||
// Move RESET jmp target to 'save' vector
|
||||
buff.bptr[saveVect0] = vect.bytes[0];
|
||||
1dd2: 00 93 68 00 sts 0x0068, r16 ; 0x800068 <_edata+0x8>
|
||||
buff.bptr[saveVect1] = (vect.bytes[1] & 0x0F)| 0xC0; // make an "rjmp"
|
||||
1dd6: 81 2f mov r24, r17
|
||||
1dd8: 8f 70 andi r24, 0x0F ; 15
|
||||
1dda: 80 6c ori r24, 0xC0 ; 192
|
||||
1ddc: 80 93 69 00 sts 0x0069, r24 ; 0x800069 <_edata+0x9>
|
||||
// Add rjump to bootloader at RESET vector
|
||||
vect.word = ((uint16_t)main); // (main) is always <= 0x0FFF; no masking needed.
|
||||
1de0: 00 e8 ldi r16, 0x80 ; 128
|
||||
1de2: 1e e0 ldi r17, 0x0E ; 14
|
||||
buff.bptr[0] = vect.bytes[0]; // rjmp 0x1c00 instruction
|
||||
1de4: 00 93 60 00 sts 0x0060, r16 ; 0x800060 <_edata>
|
||||
buff.bptr[1] = vect.bytes[1] | 0xC0; // make an "rjmp"
|
||||
1de8: 81 2f mov r24, r17
|
||||
1dea: 80 6c ori r24, 0xC0 ; 192
|
||||
1dec: 80 93 61 00 sts 0x0061, r24 ; 0x800061 <_edata+0x1>
|
||||
* void writebuffer(memtype, buffer, address, length)
|
||||
*/
|
||||
static inline void writebuffer(int8_t memtype, addr16_t mybuff,
|
||||
addr16_t address, pagelen_t len)
|
||||
{
|
||||
switch (memtype) {
|
||||
1df0: f5 e4 ldi r31, 0x45 ; 69
|
||||
1df2: df 12 cpse r13, r31
|
||||
1df4: 01 c0 rjmp .+2 ; 0x1df8 <main+0xf8>
|
||||
1df6: ff cf rjmp .-2 ; 0x1df6 <main+0xf6>
|
||||
* Start the page erase and wait for it to finish. There
|
||||
* used to be code to do this while receiving the data over
|
||||
* the serial link, but the performance improvement was slight,
|
||||
* and we needed the space back.
|
||||
*/
|
||||
__boot_page_erase_short(address.word);
|
||||
1df8: fe 01 movw r30, r28
|
||||
1dfa: c7 be out 0x37, r12 ; 55
|
||||
1dfc: e8 95 spm
|
||||
boot_spm_busy_wait();
|
||||
1dfe: 07 b6 in r0, 0x37 ; 55
|
||||
1e00: 00 fc sbrc r0, 0
|
||||
1e02: fd cf rjmp .-6 ; 0x1dfe <main+0xfe>
|
||||
1e04: a0 e6 ldi r26, 0x60 ; 96
|
||||
1e06: b0 e0 ldi r27, 0x00 ; 0
|
||||
1e08: fe 01 movw r30, r28
|
||||
|
||||
/*
|
||||
* Copy data from the buffer into the flash write buffer.
|
||||
*/
|
||||
do {
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr, *(mybuff.wptr++));
|
||||
1e0a: 8d 91 ld r24, X+
|
||||
1e0c: 9d 91 ld r25, X+
|
||||
1e0e: 0c 01 movw r0, r24
|
||||
1e10: b7 be out 0x37, r11 ; 55
|
||||
1e12: e8 95 spm
|
||||
1e14: 11 24 eor r1, r1
|
||||
addrPtr += 2;
|
||||
} while (len -= 2);
|
||||
1e16: fa 94 dec r15
|
||||
1e18: fa 94 dec r15
|
||||
1e1a: 32 96 adiw r30, 0x02 ; 2
|
||||
1e1c: f1 10 cpse r15, r1
|
||||
1e1e: f5 cf rjmp .-22 ; 0x1e0a <main+0x10a>
|
||||
|
||||
/*
|
||||
* Actually Write the buffer to flash (and wait for it to finish.)
|
||||
*/
|
||||
__boot_page_write_short(address.word);
|
||||
1e20: fe 01 movw r30, r28
|
||||
1e22: a7 be out 0x37, r10 ; 55
|
||||
1e24: e8 95 spm
|
||||
boot_spm_busy_wait();
|
||||
1e26: 07 b6 in r0, 0x37 ; 55
|
||||
1e28: 00 fc sbrc r0, 0
|
||||
1e2a: fd cf rjmp .-6 ; 0x1e26 <main+0x126>
|
||||
1e2c: 3b c0 rjmp .+118 ; 0x1ea4 <main+0x1a4>
|
||||
writebuffer(desttype, buff, address, savelength);
|
||||
|
||||
|
||||
}
|
||||
/* Read memory block mode, length is big endian. */
|
||||
else if(ch == STK_READ_PAGE) {
|
||||
1e2e: 84 37 cpi r24, 0x74 ; 116
|
||||
1e30: 59 f5 brne .+86 ; 0x1e88 <main+0x188>
|
||||
uint8_t desttype;
|
||||
GETLENGTH(length);
|
||||
1e32: 4a d0 rcall .+148 ; 0x1ec8 <getch>
|
||||
1e34: 49 d0 rcall .+146 ; 0x1ec8 <getch>
|
||||
1e36: d8 2e mov r13, r24
|
||||
|
||||
desttype = getch();
|
||||
1e38: 47 d0 rcall .+142 ; 0x1ec8 <getch>
|
||||
|
||||
verifySpace();
|
||||
1e3a: 5e d0 rcall .+188 ; 0x1ef8 <verifySpace>
|
||||
1e3c: 7e 01 movw r14, r28
|
||||
#endif
|
||||
default:
|
||||
do {
|
||||
#ifdef VIRTUAL_BOOT_PARTITION
|
||||
// Undo vector patch in bottom page so verify passes
|
||||
if (address.word == rstVect0) ch = rstVect0_sav;
|
||||
1e3e: e1 14 cp r14, r1
|
||||
1e40: f1 04 cpc r15, r1
|
||||
1e42: 19 f4 brne .+6 ; 0x1e4a <main+0x14a>
|
||||
1e44: 80 91 e4 00 lds r24, 0x00E4 ; 0x8000e4 <_edata+0x84>
|
||||
1e48: 17 c0 rjmp .+46 ; 0x1e78 <main+0x178>
|
||||
else if (address.word == rstVect1) ch = rstVect1_sav;
|
||||
1e4a: f1 e0 ldi r31, 0x01 ; 1
|
||||
1e4c: ef 16 cp r14, r31
|
||||
1e4e: f1 04 cpc r15, r1
|
||||
1e50: 19 f4 brne .+6 ; 0x1e58 <main+0x158>
|
||||
1e52: 80 91 e5 00 lds r24, 0x00E5 ; 0x8000e5 <_edata+0x85>
|
||||
1e56: 10 c0 rjmp .+32 ; 0x1e78 <main+0x178>
|
||||
else if (address.word == saveVect0) ch = saveVect0_sav;
|
||||
1e58: 88 e0 ldi r24, 0x08 ; 8
|
||||
1e5a: e8 16 cp r14, r24
|
||||
1e5c: f1 04 cpc r15, r1
|
||||
1e5e: 19 f4 brne .+6 ; 0x1e66 <main+0x166>
|
||||
1e60: 80 91 e6 00 lds r24, 0x00E6 ; 0x8000e6 <_edata+0x86>
|
||||
1e64: 09 c0 rjmp .+18 ; 0x1e78 <main+0x178>
|
||||
else if (address.word == saveVect1) ch = saveVect1_sav;
|
||||
1e66: e9 e0 ldi r30, 0x09 ; 9
|
||||
1e68: ee 16 cp r14, r30
|
||||
1e6a: f1 04 cpc r15, r1
|
||||
1e6c: 19 f4 brne .+6 ; 0x1e74 <main+0x174>
|
||||
1e6e: 80 91 e7 00 lds r24, 0x00E7 ; 0x8000e7 <_edata+0x87>
|
||||
1e72: 02 c0 rjmp .+4 ; 0x1e78 <main+0x178>
|
||||
else ch = pgm_read_byte_near(address.bptr);
|
||||
1e74: f7 01 movw r30, r14
|
||||
1e76: 84 91 lpm r24, Z
|
||||
__asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
#else
|
||||
// read a Flash byte and increment the address
|
||||
__asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address.bptr): "1" (address));
|
||||
#endif
|
||||
putch(ch);
|
||||
1e78: 18 d0 rcall .+48 ; 0x1eaa <putch>
|
||||
} while (--length);
|
||||
1e7a: da 94 dec r13
|
||||
1e7c: ff ef ldi r31, 0xFF ; 255
|
||||
1e7e: ef 1a sub r14, r31
|
||||
1e80: ff 0a sbc r15, r31
|
||||
1e82: d1 10 cpse r13, r1
|
||||
1e84: dc cf rjmp .-72 ; 0x1e3e <main+0x13e>
|
||||
1e86: 0e c0 rjmp .+28 ; 0x1ea4 <main+0x1a4>
|
||||
|
||||
read_mem(desttype, address, length);
|
||||
}
|
||||
|
||||
/* Get device signature bytes */
|
||||
else if(ch == STK_READ_SIGN) {
|
||||
1e88: 85 37 cpi r24, 0x75 ; 117
|
||||
1e8a: 39 f4 brne .+14 ; 0x1e9a <main+0x19a>
|
||||
// READ SIGN - return what Avrdude wants to hear
|
||||
verifySpace();
|
||||
1e8c: 35 d0 rcall .+106 ; 0x1ef8 <verifySpace>
|
||||
putch(SIGNATURE_0);
|
||||
1e8e: 8e e1 ldi r24, 0x1E ; 30
|
||||
1e90: 0c d0 rcall .+24 ; 0x1eaa <putch>
|
||||
putch(SIGNATURE_1);
|
||||
1e92: 83 e9 ldi r24, 0x93 ; 147
|
||||
1e94: 0a d0 rcall .+20 ; 0x1eaa <putch>
|
||||
putch(SIGNATURE_2);
|
||||
1e96: 8c e0 ldi r24, 0x0C ; 12
|
||||
1e98: 58 cf rjmp .-336 ; 0x1d4a <main+0x4a>
|
||||
}
|
||||
else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */
|
||||
1e9a: 81 35 cpi r24, 0x51 ; 81
|
||||
1e9c: 11 f4 brne .+4 ; 0x1ea2 <main+0x1a2>
|
||||
// Adaboot no-wait mod
|
||||
watchdogConfig(WATCHDOG_16MS);
|
||||
1e9e: 88 e0 ldi r24, 0x08 ; 8
|
||||
1ea0: 27 d0 rcall .+78 ; 0x1ef0 <watchdogConfig>
|
||||
verifySpace();
|
||||
}
|
||||
else {
|
||||
// This covers the response to commands like STK_ENTER_PROGMODE
|
||||
verifySpace();
|
||||
1ea2: 2a d0 rcall .+84 ; 0x1ef8 <verifySpace>
|
||||
}
|
||||
putch(STK_OK);
|
||||
1ea4: 80 e1 ldi r24, 0x10 ; 16
|
||||
1ea6: 01 d0 rcall .+2 ; 0x1eaa <putch>
|
||||
}
|
||||
1ea8: 41 cf rjmp .-382 ; 0x1d2c <main+0x2c>
|
||||
|
||||
00001eaa <putch>:
|
||||
void putch(char ch) {
|
||||
#ifndef SOFT_UART
|
||||
while (!(UART_SRA & _BV(UDRE0)));
|
||||
UART_UDR = ch;
|
||||
#else
|
||||
__asm__ __volatile__ (
|
||||
1eaa: 2a e0 ldi r18, 0x0A ; 10
|
||||
1eac: 30 e0 ldi r19, 0x00 ; 0
|
||||
1eae: 80 95 com r24
|
||||
1eb0: 08 94 sec
|
||||
1eb2: 10 f4 brcc .+4 ; 0x1eb8 <putch+0xe>
|
||||
1eb4: da 98 cbi 0x1b, 2 ; 27
|
||||
1eb6: 02 c0 rjmp .+4 ; 0x1ebc <putch+0x12>
|
||||
1eb8: da 9a sbi 0x1b, 2 ; 27
|
||||
1eba: 00 00 nop
|
||||
1ebc: 15 d0 rcall .+42 ; 0x1ee8 <uartDelay>
|
||||
1ebe: 14 d0 rcall .+40 ; 0x1ee8 <uartDelay>
|
||||
1ec0: 86 95 lsr r24
|
||||
1ec2: 2a 95 dec r18
|
||||
1ec4: b1 f7 brne .-20 ; 0x1eb2 <putch+0x8>
|
||||
1ec6: 08 95 ret
|
||||
|
||||
00001ec8 <getch>:
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
1ec8: a8 95 wdr
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SOFT_UART
|
||||
watchdogReset();
|
||||
__asm__ __volatile__ (
|
||||
1eca: 29 e0 ldi r18, 0x09 ; 9
|
||||
1ecc: 30 e0 ldi r19, 0x00 ; 0
|
||||
1ece: cb 99 sbic 0x19, 3 ; 25
|
||||
1ed0: fe cf rjmp .-4 ; 0x1ece <getch+0x6>
|
||||
1ed2: 0a d0 rcall .+20 ; 0x1ee8 <uartDelay>
|
||||
1ed4: 09 d0 rcall .+18 ; 0x1ee8 <uartDelay>
|
||||
1ed6: 08 d0 rcall .+16 ; 0x1ee8 <uartDelay>
|
||||
1ed8: 88 94 clc
|
||||
1eda: cb 99 sbic 0x19, 3 ; 25
|
||||
1edc: 08 94 sec
|
||||
1ede: 2a 95 dec r18
|
||||
1ee0: 11 f0 breq .+4 ; 0x1ee6 <getch+0x1e>
|
||||
1ee2: 87 95 ror r24
|
||||
1ee4: f7 cf rjmp .-18 ; 0x1ed4 <getch+0xc>
|
||||
LED_PIN |= _BV(LED);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ch;
|
||||
}
|
||||
1ee6: 08 95 ret
|
||||
|
||||
00001ee8 <uartDelay>:
|
||||
#if UART_B_VALUE > 255
|
||||
#error Baud rate too slow for soft UART
|
||||
#endif
|
||||
|
||||
void uartDelay() {
|
||||
__asm__ __volatile__ (
|
||||
1ee8: 9e e0 ldi r25, 0x0E ; 14
|
||||
1eea: 9a 95 dec r25
|
||||
1eec: f1 f7 brne .-4 ; 0x1eea <uartDelay+0x2>
|
||||
1eee: 08 95 ret
|
||||
|
||||
00001ef0 <watchdogConfig>:
|
||||
"wdr\n"
|
||||
);
|
||||
}
|
||||
|
||||
void watchdogConfig(uint8_t x) {
|
||||
WDTCSR = _BV(WDCE) | _BV(WDE);
|
||||
1ef0: 98 e1 ldi r25, 0x18 ; 24
|
||||
1ef2: 91 bd out 0x21, r25 ; 33
|
||||
WDTCSR = x;
|
||||
1ef4: 81 bd out 0x21, r24 ; 33
|
||||
1ef6: 08 95 ret
|
||||
|
||||
00001ef8 <verifySpace>:
|
||||
do getch(); while (--count);
|
||||
verifySpace();
|
||||
}
|
||||
|
||||
void verifySpace() {
|
||||
if (getch() != CRC_EOP) {
|
||||
1ef8: e7 df rcall .-50 ; 0x1ec8 <getch>
|
||||
1efa: 80 32 cpi r24, 0x20 ; 32
|
||||
1efc: 19 f0 breq .+6 ; 0x1f04 <verifySpace+0xc>
|
||||
watchdogConfig(WATCHDOG_16MS); // shorten WD timeout
|
||||
1efe: 88 e0 ldi r24, 0x08 ; 8
|
||||
1f00: f7 df rcall .-18 ; 0x1ef0 <watchdogConfig>
|
||||
1f02: ff cf rjmp .-2 ; 0x1f02 <verifySpace+0xa>
|
||||
while (1) // and busy-loop so that WD causes
|
||||
; // a reset and app start.
|
||||
}
|
||||
putch(STK_INSYNC);
|
||||
1f04: 84 e1 ldi r24, 0x14 ; 20
|
||||
1f06: d1 cf rjmp .-94 ; 0x1eaa <putch>
|
||||
|
||||
00001f08 <getNch>:
|
||||
::[count] "M" (UART_B_VALUE)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
void getNch(uint8_t count) {
|
||||
1f08: cf 93 push r28
|
||||
1f0a: c8 2f mov r28, r24
|
||||
do getch(); while (--count);
|
||||
1f0c: dd df rcall .-70 ; 0x1ec8 <getch>
|
||||
1f0e: c1 50 subi r28, 0x01 ; 1
|
||||
1f10: e9 f7 brne .-6 ; 0x1f0c <getNch+0x4>
|
||||
verifySpace();
|
||||
}
|
||||
1f12: cf 91 pop r28
|
||||
}
|
||||
#endif
|
||||
|
||||
void getNch(uint8_t count) {
|
||||
do getch(); while (--count);
|
||||
verifySpace();
|
||||
1f14: f1 cf rjmp .-30 ; 0x1ef8 <verifySpace>
|
||||
|
||||
00001f16 <appStart>:
|
||||
|
||||
void appStart(uint8_t rstFlags) {
|
||||
// save the reset flags in the designated register
|
||||
// This can be saved in a main program by putting code in .init0 (which
|
||||
// executes before normal c init code) to save R2 to a global variable.
|
||||
__asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags));
|
||||
1f16: 28 2e mov r2, r24
|
||||
|
||||
watchdogConfig(WATCHDOG_OFF);
|
||||
1f18: 80 e0 ldi r24, 0x00 ; 0
|
||||
1f1a: ea df rcall .-44 ; 0x1ef0 <watchdogConfig>
|
||||
// Note that appstart_vec is defined so that this works with either
|
||||
// real or virtual boot partitions.
|
||||
__asm__ __volatile__ (
|
||||
1f1c: e4 e0 ldi r30, 0x04 ; 4
|
||||
1f1e: ff 27 eor r31, r31
|
||||
1f20: 09 94 ijmp
|
891
ActualOptiboot/optiboot/bootloaders/optiboot/pin_defs.h
Normal file
891
ActualOptiboot/optiboot/bootloaders/optiboot/pin_defs.h
Normal file
@ -0,0 +1,891 @@
|
||||
/*
|
||||
* pin_defs.h
|
||||
* optiboot helper defining the default pin assignments (LED, SOFT_UART)
|
||||
* for the various chips that are supported. This also has some ugly macros
|
||||
* for selecting among various UARTs and LED possibilities using command-line
|
||||
* defines like "UART=2 LED=B5"
|
||||
*
|
||||
* Copyright 2013-2015 by Bill Westfield.
|
||||
* Copyright 2010 by Peter Knight.
|
||||
* This software is licensed under version 2 of the Gnu Public Licence.
|
||||
* See optiboot.c for details.
|
||||
*/
|
||||
|
||||
/*------------------------------------------------------------------------ */
|
||||
#if defined(__AVR_ATmega168__) \
|
||||
|| defined(__AVR_ATmega168P__) \
|
||||
|| defined(__AVR_ATmega328__) \
|
||||
|| defined(__AVR_ATmega328P__) \
|
||||
|| defined(__AVR_ATmega88) \
|
||||
|| defined(__AVR_ATmega8__) \
|
||||
|| defined(__AVR_ATmega88__)
|
||||
/*------------------------------------------------------------------------ */
|
||||
|
||||
/* Onboard LED is connected to pin PB5 in Arduino NG, Diecimila, and Duemilanove
|
||||
*/
|
||||
#if !defined(LED)
|
||||
#define LED B5
|
||||
#endif
|
||||
|
||||
/* Ports for soft UART */
|
||||
#ifdef SOFT_UART
|
||||
#define UART_PORT PORTD
|
||||
#define UART_PIN PIND
|
||||
#define UART_DDR DDRD
|
||||
#define UART_TX_BIT 1
|
||||
#define UART_RX_BIT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Handle devices with up to 4 uarts (eg m1280.) Rather inelegantly.
|
||||
* Note that mega8/m32 still needs special handling, because ubrr is handled
|
||||
* differently.
|
||||
*/
|
||||
#if UART == 0
|
||||
# define UART_SRA UCSR0A
|
||||
# define UART_SRB UCSR0B
|
||||
# define UART_SRC UCSR0C
|
||||
# define UART_SRL UBRR0L
|
||||
# define UART_UDR UDR0
|
||||
#elif UART == 1
|
||||
#if !defined(UDR1)
|
||||
#error UART == 1, but no UART1 on device
|
||||
#endif
|
||||
# define UART_SRA UCSR1A
|
||||
# define UART_SRB UCSR1B
|
||||
# define UART_SRC UCSR1C
|
||||
# define UART_SRL UBRR1L
|
||||
# define UART_UDR UDR1
|
||||
#elif UART == 2
|
||||
#if !defined(UDR2)
|
||||
#error UART == 2, but no UART2 on device
|
||||
#endif
|
||||
# define UART_SRA UCSR2A
|
||||
# define UART_SRB UCSR2B
|
||||
# define UART_SRC UCSR2C
|
||||
# define UART_SRL UBRR2L
|
||||
# define UART_UDR UDR2
|
||||
#elif UART == 3
|
||||
#if !defined(UDR3)
|
||||
#error UART == 3, but no UART3 on device
|
||||
#endif
|
||||
# define UART_SRA UCSR3A
|
||||
# define UART_SRB UCSR3B
|
||||
# define UART_SRC UCSR3C
|
||||
# define UART_SRL UBRR3L
|
||||
# define UART_UDR UDR3
|
||||
#endif
|
||||
|
||||
#if defined(__AVR_ATmega8__) \
|
||||
|| defined (__AVR_ATmega32__) \
|
||||
|| defined (__AVR_ATmega16__)
|
||||
//Name conversion R.Wiersma
|
||||
#define UCSR0A UCSRA
|
||||
#define UDR0 UDR
|
||||
#define UDRE0 UDRE
|
||||
#define RXC0 RXC
|
||||
#define FE0 FE
|
||||
#define TIFR1 TIFR
|
||||
#define WDTCSR WDTCR
|
||||
#endif
|
||||
|
||||
#if defined (__AVR_ATmega32__) \
|
||||
|| defined (__AVR_ATmega16__)
|
||||
#define WDCE WDTOE
|
||||
#endif
|
||||
|
||||
/* Luminet support */
|
||||
/*------------------------------------------------------------------------ */
|
||||
#if defined(__AVR_ATtiny84__)
|
||||
/*------------------------------------------------------------------------ */
|
||||
/* Red LED is connected to pin PA4 */
|
||||
#if !defined(LED)
|
||||
#define LED A4
|
||||
#endif
|
||||
|
||||
/* Ports for soft UART - left port only for now. TX/RX on PA2/PA3 */
|
||||
#ifdef SOFT_UART
|
||||
#define UART_PORT PORTA
|
||||
#define UART_PIN PINA
|
||||
#define UART_DDR DDRA
|
||||
#define UART_TX_BIT 2
|
||||
#define UART_RX_BIT 3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------ */
|
||||
/* Sanguino support (and other 40pin DIP cpus) */
|
||||
#if defined(__AVR_ATmega644P__) \
|
||||
|| defined(__AVR_ATmega1284P__) \
|
||||
|| defined(__AVR_ATmega32__) \
|
||||
|| defined (__AVR_ATmega16__)
|
||||
/*------------------------------------------------------------------------ */
|
||||
/* Onboard LED is connected to pin PB0 on Sanguino */
|
||||
#if !defined(LED)
|
||||
#define LED B0
|
||||
#endif
|
||||
|
||||
/* Ports for soft UART */
|
||||
#ifdef SOFT_UART
|
||||
#define UART_PORT PORTD
|
||||
#define UART_PIN PIND
|
||||
#define UART_DDR DDRD
|
||||
#define UART_TX_BIT 1
|
||||
#define UART_RX_BIT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------ */
|
||||
/* Mega support */
|
||||
#if defined(__AVR_ATmega1280__) \
|
||||
|| defined(__AVR_ATmega2560__)
|
||||
/*------------------------------------------------------------------------ */
|
||||
/* Onboard LED is connected to pin PB7 on Arduino Mega */
|
||||
#if !defined(LED)
|
||||
#define LED B7
|
||||
#endif
|
||||
|
||||
/* Ports for soft UART */
|
||||
#ifdef SOFT_UART
|
||||
#define UART_PORT PORTE
|
||||
#define UART_PIN PINE
|
||||
#define UART_DDR DDRE
|
||||
#define UART_TX_BIT 1
|
||||
#define UART_RX_BIT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ------------------------------------------------------------------------
|
||||
* A bunch of macros to enable the LED to be specifed as "B5" for bit 5
|
||||
* of port B, and similar.
|
||||
* We define symbols for all the legal combination of port/bit on a chip,
|
||||
* and do pre-processor tests to see if there's a match. This ends up
|
||||
* being very verbose, but it is pretty easy to generate semi-automatically.
|
||||
* (We wouldn't need this if the preprocessor could do string compares.)
|
||||
*/
|
||||
|
||||
// Symbols for each PortA bit.
|
||||
#define A0 0x100
|
||||
#define A1 0x101
|
||||
#define A2 0x102
|
||||
#define A3 0x103
|
||||
#define A4 0x104
|
||||
#define A5 0x105
|
||||
#define A6 0x106
|
||||
#define A7 0x107
|
||||
// If there is no PORTA on this chip, don't allow these to be used
|
||||
// (and indicate the error by redefining LED)
|
||||
#if !defined(PORTA)
|
||||
#if LED >= A0 && LED <= A7
|
||||
#undef LED
|
||||
#define LED -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define B0 0x200
|
||||
#define B1 0x201
|
||||
#define B2 0x202
|
||||
#define B3 0x203
|
||||
#define B4 0x204
|
||||
#define B5 0x205
|
||||
#define B6 0x206
|
||||
#define B7 0x207
|
||||
#if !defined(PORTB)
|
||||
#if LED >= B0 && LED <= B7
|
||||
#undef LED
|
||||
#define LED -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define C0 0x300
|
||||
#define C1 0x301
|
||||
#define C2 0x302
|
||||
#define C3 0x303
|
||||
#define C4 0x304
|
||||
#define C5 0x305
|
||||
#define C6 0x306
|
||||
#define C7 0x307
|
||||
#if !(defined(PORTC))
|
||||
#if LED >= C0 && LED <= C7
|
||||
#undef LED
|
||||
#define LED -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define D0 0x400
|
||||
#define D1 0x401
|
||||
#define D2 0x402
|
||||
#define D3 0x403
|
||||
#define D4 0x404
|
||||
#define D5 0x405
|
||||
#define D6 0x406
|
||||
#define D7 0x407
|
||||
#if !(defined(PORTD))
|
||||
#if LED >= D0 && LED <= D7
|
||||
#undef LED
|
||||
#define LED -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define E0 0x500
|
||||
#define E1 0x501
|
||||
#define E2 0x502
|
||||
#define E3 0x503
|
||||
#define E4 0x504
|
||||
#define E5 0x505
|
||||
#define E6 0x506
|
||||
#define E7 0x507
|
||||
#if !(defined(PORTE))
|
||||
#if LED >= E0 && LED <= E7
|
||||
#undef LED
|
||||
#define LED -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define F0 0x600
|
||||
#define F1 0x601
|
||||
#define F2 0x602
|
||||
#define F3 0x603
|
||||
#define F4 0x604
|
||||
#define F5 0x605
|
||||
#define F6 0x606
|
||||
#define F7 0x607
|
||||
#if !(defined(PORTF))
|
||||
#if LED >= F0 && LED <= F7
|
||||
#undef LED
|
||||
#define LED -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define G0 0x700
|
||||
#define G1 0x701
|
||||
#define G2 0x702
|
||||
#define G3 0x703
|
||||
#define G4 0x704
|
||||
#define G5 0x705
|
||||
#define G6 0x706
|
||||
#define G7 0x707
|
||||
#if !defined(PORTG)
|
||||
#if LED >= G0 && LED <= G7
|
||||
#undef LED
|
||||
#define LED -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define H0 0x800
|
||||
#define H1 0x801
|
||||
#define H2 0x802
|
||||
#define H3 0x803
|
||||
#define H4 0x804
|
||||
#define H5 0x805
|
||||
#define H6 0x806
|
||||
#define H7 0x807
|
||||
#if !(defined(PORTH))
|
||||
#if LED >= H0 && LED <= H7
|
||||
#undef LED
|
||||
#define LED -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define J0 0xA00
|
||||
#define J1 0xA01
|
||||
#define J2 0xA02
|
||||
#define J3 0xA03
|
||||
#define J4 0xA04
|
||||
#define J5 0xA05
|
||||
#define J6 0xA06
|
||||
#define J7 0xA07
|
||||
#if !(defined(PORTJ))
|
||||
#if LED >= J0 && LED <= J7
|
||||
#undef LED
|
||||
#define LED -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define K0 0xB00
|
||||
#define K1 0xB01
|
||||
#define K2 0xB02
|
||||
#define K3 0xB03
|
||||
#define K4 0xB04
|
||||
#define K5 0xB05
|
||||
#define K6 0xB06
|
||||
#define K7 0xB07
|
||||
#if !(defined(PORTK))
|
||||
#if LED >= K0 && LED <= K7
|
||||
#undef LED
|
||||
#define LED -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define L0 0xC00
|
||||
#define L1 0xC01
|
||||
#define L2 0xC02
|
||||
#define L3 0xC03
|
||||
#define L4 0xC04
|
||||
#define L5 0xC05
|
||||
#define L6 0xC06
|
||||
#define L7 0xC07
|
||||
#if !(defined(PORTL))
|
||||
#if LED >= L0 && LED <= L7
|
||||
#undef LED
|
||||
#define LED -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* A statement like "#if LED == B0" will evaluation (in the preprocessor)
|
||||
* to #if C0 == B0, and then to #if 0x301 == 0x201
|
||||
*/
|
||||
#if LED == B0
|
||||
#undef LED
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB0
|
||||
#elif LED == B1
|
||||
#undef LED
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB1
|
||||
#elif LED == B2
|
||||
#undef LED
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB2
|
||||
#elif LED == B3
|
||||
#undef LED
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB3
|
||||
#elif LED == B4
|
||||
#undef LED
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB4
|
||||
#elif LED == B5
|
||||
#undef LED
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB5
|
||||
#elif LED == B6
|
||||
#undef LED
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB6
|
||||
#elif LED == B7
|
||||
#undef LED
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB7
|
||||
|
||||
#elif LED == C0
|
||||
#undef LED
|
||||
#define LED_DDR DDRC
|
||||
#define LED_PORT PORTC
|
||||
#define LED_PIN PINC
|
||||
#define LED PINC0
|
||||
#elif LED == C1
|
||||
#undef LED
|
||||
#define LED_DDR DDRC
|
||||
#define LED_PORT PORTC
|
||||
#define LED_PIN PINC
|
||||
#define LED PINC1
|
||||
#elif LED == C2
|
||||
#undef LED
|
||||
#define LED_DDR DDRC
|
||||
#define LED_PORT PORTC
|
||||
#define LED_PIN PINC
|
||||
#define LED PINC2
|
||||
#elif LED == C3
|
||||
#undef LED
|
||||
#define LED_DDR DDRC
|
||||
#define LED_PORT PORTC
|
||||
#define LED_PIN PINC
|
||||
#define LED PINC3
|
||||
#elif LED == C4
|
||||
#undef LED
|
||||
#define LED_DDR DDRC
|
||||
#define LED_PORT PORTC
|
||||
#define LED_PIN PINC
|
||||
#define LED PINC4
|
||||
#elif LED == C5
|
||||
#undef LED
|
||||
#define LED_DDR DDRC
|
||||
#define LED_PORT PORTC
|
||||
#define LED_PIN PINC
|
||||
#define LED PINC5
|
||||
#elif LED == C6
|
||||
#undef LED
|
||||
#define LED_DDR DDRC
|
||||
#define LED_PORT PORTC
|
||||
#define LED_PIN PINC
|
||||
#define LED PINC6
|
||||
#elif LED == C7
|
||||
#undef LED
|
||||
#define LED_DDR DDRC
|
||||
#define LED_PORT PORTC
|
||||
#define LED_PIN PINC
|
||||
#define LED PINC7
|
||||
|
||||
#elif LED == D0
|
||||
#undef LED
|
||||
#define LED_DDR DDRD
|
||||
#define LED_PORT PORTD
|
||||
#define LED_PIN PIND
|
||||
#define LED PIND0
|
||||
#elif LED == D1
|
||||
#undef LED
|
||||
#define LED_DDR DDRD
|
||||
#define LED_PORT PORTD
|
||||
#define LED_PIN PIND
|
||||
#define LED PIND1
|
||||
#elif LED == D2
|
||||
#undef LED
|
||||
#define LED_DDR DDRD
|
||||
#define LED_PORT PORTD
|
||||
#define LED_PIN PIND
|
||||
#define LED PIND2
|
||||
#elif LED == D3
|
||||
#undef LED
|
||||
#define LED_DDR DDRD
|
||||
#define LED_PORT PORTD
|
||||
#define LED_PIN PIND
|
||||
#define LED PIND3
|
||||
#elif LED == D4
|
||||
#undef LED
|
||||
#define LED_DDR DDRD
|
||||
#define LED_PORT PORTD
|
||||
#define LED_PIN PIND
|
||||
#define LED PIND4
|
||||
#elif LED == D5
|
||||
#undef LED
|
||||
#define LED_DDR DDRD
|
||||
#define LED_PORT PORTD
|
||||
#define LED_PIN PIND
|
||||
#define LED PIND5
|
||||
#elif LED == D6
|
||||
#undef LED
|
||||
#define LED_DDR DDRD
|
||||
#define LED_PORT PORTD
|
||||
#define LED_PIN PIND
|
||||
#define LED PIND6
|
||||
#elif LED == D7
|
||||
#undef LED
|
||||
#define LED_DDR DDRD
|
||||
#define LED_PORT PORTD
|
||||
#define LED_PIN PIND
|
||||
#define LED PIND7
|
||||
|
||||
#elif LED == E0
|
||||
#undef LED
|
||||
#define LED_DDR DDRE
|
||||
#define LED_PORT PORTE
|
||||
#define LED_PIN PINE
|
||||
#define LED PINE0
|
||||
#elif LED == E1
|
||||
#undef LED
|
||||
#define LED_DDR DDRE
|
||||
#define LED_PORT PORTE
|
||||
#define LED_PIN PINE
|
||||
#define LED PINE1
|
||||
#elif LED == E2
|
||||
#undef LED
|
||||
#define LED_DDR DDRE
|
||||
#define LED_PORT PORTE
|
||||
#define LED_PIN PINE
|
||||
#define LED PINE2
|
||||
#elif LED == E3
|
||||
#undef LED
|
||||
#define LED_DDR DDRE
|
||||
#define LED_PORT PORTE
|
||||
#define LED_PIN PINE
|
||||
#define LED PINE3
|
||||
#elif LED == E4
|
||||
#undef LED
|
||||
#define LED_DDR DDRE
|
||||
#define LED_PORT PORTE
|
||||
#define LED_PIN PINE
|
||||
#define LED PINE4
|
||||
#elif LED == E5
|
||||
#undef LED
|
||||
#define LED_DDR DDRE
|
||||
#define LED_PORT PORTE
|
||||
#define LED_PIN PINE
|
||||
#define LED PINE5
|
||||
#elif LED == E6
|
||||
#undef LED
|
||||
#define LED_DDR DDRE
|
||||
#define LED_PORT PORTE
|
||||
#define LED_PIN PINE
|
||||
#define LED PINE6
|
||||
#elif LED == E7
|
||||
#undef LED
|
||||
#define LED_DDR DDRE
|
||||
#define LED_PORT PORTE
|
||||
#define LED_PIN PINE
|
||||
#define LED PINE7
|
||||
|
||||
#elif LED == F0
|
||||
#undef LED
|
||||
#define LED_DDR DDRF
|
||||
#define LED_PORT PORTF
|
||||
#define LED_PIN PINF
|
||||
#define LED PINF0
|
||||
#elif LED == F1
|
||||
#undef LED
|
||||
#define LED_DDR DDRF
|
||||
#define LED_PORT PORTF
|
||||
#define LED_PIN PINF
|
||||
#define LED PINF1
|
||||
#elif LED == F2
|
||||
#undef LED
|
||||
#define LED_DDR DDRF
|
||||
#define LED_PORT PORTF
|
||||
#define LED_PIN PINF
|
||||
#define LED PINF2
|
||||
#elif LED == F3
|
||||
#undef LED
|
||||
#define LED_DDR DDRF
|
||||
#define LED_PORT PORTF
|
||||
#define LED_PIN PINF
|
||||
#define LED PINF3
|
||||
#elif LED == F4
|
||||
#undef LED
|
||||
#define LED_DDR DDRF
|
||||
#define LED_PORT PORTF
|
||||
#define LED_PIN PINF
|
||||
#define LED PINF4
|
||||
#elif LED == F5
|
||||
#undef LED
|
||||
#define LED_DDR DDRF
|
||||
#define LED_PORT PORTF
|
||||
#define LED_PIN PINF
|
||||
#define LED PINF5
|
||||
#elif LED == F6
|
||||
#undef LED
|
||||
#define LED_DDR DDRF
|
||||
#define LED_PORT PORTF
|
||||
#define LED_PIN PINF
|
||||
#define LED PINF6
|
||||
#elif LED == F7
|
||||
#undef LED
|
||||
#define LED_DDR DDRF
|
||||
#define LED_PORT PORTF
|
||||
#define LED_PIN PINF
|
||||
#define LED PINF7
|
||||
|
||||
#elif LED == G0
|
||||
#undef LED
|
||||
#define LED_DDR DDRG
|
||||
#define LED_PORT PORTG
|
||||
#define LED_PIN PING
|
||||
#define LED PING0
|
||||
#elif LED == G1
|
||||
#undef LED
|
||||
#define LED_DDR DDRG
|
||||
#define LED_PORT PORTG
|
||||
#define LED_PIN PING
|
||||
#define LED PING1
|
||||
#elif LED == G2
|
||||
#undef LED
|
||||
#define LED_DDR DDRG
|
||||
#define LED_PORT PORTG
|
||||
#define LED_PIN PING
|
||||
#define LED PING2
|
||||
#elif LED == G3
|
||||
#undef LED
|
||||
#define LED_DDR DDRG
|
||||
#define LED_PORT PORTG
|
||||
#define LED_PIN PING
|
||||
#define LED PING3
|
||||
#elif LED == G4
|
||||
#undef LED
|
||||
#define LED_DDR DDRG
|
||||
#define LED_PORT PORTG
|
||||
#define LED_PIN PING
|
||||
#define LED PING4
|
||||
#elif LED == G5
|
||||
#undef LED
|
||||
#define LED_DDR DDRG
|
||||
#define LED_PORT PORTG
|
||||
#define LED_PIN PING
|
||||
#define LED PING5
|
||||
#elif LED == G6
|
||||
#undef LED
|
||||
#define LED_DDR DDRG
|
||||
#define LED_PORT PORTG
|
||||
#define LED_PIN PING
|
||||
#define LED PING6
|
||||
#elif LED == G7
|
||||
#undef LED
|
||||
#define LED_DDR DDRG
|
||||
#define LED_PORT PORTG
|
||||
#define LED_PIN PING
|
||||
#define LED PING7
|
||||
|
||||
#elif LED == H0
|
||||
#undef LED
|
||||
#define LED_DDR DDRH
|
||||
#define LED_PORT PORTH
|
||||
#define LED_PIN PINH
|
||||
#define LED PINH0
|
||||
#elif LED == H1
|
||||
#undef LED
|
||||
#define LED_DDR DDRH
|
||||
#define LED_PORT PORTH
|
||||
#define LED_PIN PINH
|
||||
#define LED PINH1
|
||||
#elif LED == H2
|
||||
#undef LED
|
||||
#define LED_DDR DDRH
|
||||
#define LED_PORT PORTH
|
||||
#define LED_PIN PINH
|
||||
#define LED PINH2
|
||||
#elif LED == H3
|
||||
#undef LED
|
||||
#define LED_DDR DDRH
|
||||
#define LED_PORT PORTH
|
||||
#define LED_PIN PINH
|
||||
#define LED PINH3
|
||||
#elif LED == H4
|
||||
#undef LED
|
||||
#define LED_DDR DDRH
|
||||
#define LED_PORT PORTH
|
||||
#define LED_PIN PINH
|
||||
#define LED PINH4
|
||||
#elif LED == H5
|
||||
#undef LED
|
||||
#define LED_DDR DDRH
|
||||
#define LED_PORT PORTH
|
||||
#define LED_PIN PINH
|
||||
#define LED PINH5
|
||||
#elif LED == H6
|
||||
#undef LED
|
||||
#define LED_DDR DDRH
|
||||
#define LED_PORT PORTH
|
||||
#define LED_PIN PINH
|
||||
#define LED PINH6
|
||||
#elif LED == H7
|
||||
#undef LED
|
||||
#define LED_DDR DDRH
|
||||
#define LED_PORT PORTH
|
||||
#define LED_PIN PINH
|
||||
#define LED PINH7
|
||||
|
||||
#elif LED == J0
|
||||
#undef LED
|
||||
#define LED_DDR DDRJ
|
||||
#define LED_PORT PORTJ
|
||||
#define LED_PIN PINJ
|
||||
#define LED PINJ0
|
||||
#elif LED == J1
|
||||
#undef LED
|
||||
#define LED_DDR DDRJ
|
||||
#define LED_PORT PORTJ
|
||||
#define LED_PIN PINJ
|
||||
#define LED PINJ1
|
||||
#elif LED == J2
|
||||
#undef LED
|
||||
#define LED_DDR DDRJ
|
||||
#define LED_PORT PORTJ
|
||||
#define LED_PIN PINJ
|
||||
#define LED PINJ2
|
||||
#elif LED == J3
|
||||
#undef LED
|
||||
#define LED_DDR DDRJ
|
||||
#define LED_PORT PORTJ
|
||||
#define LED_PIN PINJ
|
||||
#define LED PINJ3
|
||||
#elif LED == J4
|
||||
#undef LED
|
||||
#define LED_DDR DDRJ
|
||||
#define LED_PORT PORTJ
|
||||
#define LED_PIN PINJ
|
||||
#define LED PINJ4
|
||||
#elif LED == J5
|
||||
#undef LED
|
||||
#define LED_DDR DDRJ
|
||||
#define LED_PORT PORTJ
|
||||
#define LED_PIN PINJ
|
||||
#define LED PINJ5
|
||||
#elif LED == J6
|
||||
#undef LED
|
||||
#define LED_DDR DDRJ
|
||||
#define LED_PORT PORTJ
|
||||
#define LED_PIN PINJ
|
||||
#define LED PINJ6
|
||||
#elif LED == J7
|
||||
#undef LED
|
||||
#define LED_DDR DDRJ
|
||||
#define LED_PORT PORTJ
|
||||
#define LED_PIN PINJ
|
||||
#define LED PINJ7
|
||||
|
||||
#elif LED == K0
|
||||
#undef LED
|
||||
#define LED_DDR DDRK
|
||||
#define LED_PORT PORTK
|
||||
#define LED_PIN PINK
|
||||
#define LED PINK0
|
||||
#elif LED == K1
|
||||
#undef LED
|
||||
#define LED_DDR DDRK
|
||||
#define LED_PORT PORTK
|
||||
#define LED_PIN PINK
|
||||
#define LED PINK1
|
||||
#elif LED == K2
|
||||
#undef LED
|
||||
#define LED_DDR DDRK
|
||||
#define LED_PORT PORTK
|
||||
#define LED_PIN PINK
|
||||
#define LED PINK2
|
||||
#elif LED == K3
|
||||
#undef LED
|
||||
#define LED_DDR DDRK
|
||||
#define LED_PORT PORTK
|
||||
#define LED_PIN PINK
|
||||
#define LED PINK3
|
||||
#elif LED == K4
|
||||
#undef LED
|
||||
#define LED_DDR DDRK
|
||||
#define LED_PORT PORTK
|
||||
#define LED_PIN PINK
|
||||
#define LED PINK4
|
||||
#elif LED == K5
|
||||
#undef LED
|
||||
#define LED_DDR DDRK
|
||||
#define LED_PORT PORTK
|
||||
#define LED_PIN PINK
|
||||
#define LED PINK5
|
||||
#elif LED == K6
|
||||
#undef LED
|
||||
#define LED_DDR DDRK
|
||||
#define LED_PORT PORTK
|
||||
#define LED_PIN PINK
|
||||
#define LED PINK6
|
||||
#elif LED == K7
|
||||
#undef LED
|
||||
#define LED_DDR DDRK
|
||||
#define LED_PORT PORTK
|
||||
#define LED_PIN PINK
|
||||
#define LED PINK7
|
||||
|
||||
#elif LED == L0
|
||||
#undef LED
|
||||
#define LED_DDR DDRL
|
||||
#define LED_PORT PORTL
|
||||
#define LED_PIN PINL
|
||||
#define LED PINL0
|
||||
#elif LED == L1
|
||||
#undef LED
|
||||
#define LED_DDR DDRL
|
||||
#define LED_PORT PORTL
|
||||
#define LED_PIN PINL
|
||||
#define LED PINL1
|
||||
#elif LED == L2
|
||||
#undef LED
|
||||
#define LED_DDR DDRL
|
||||
#define LED_PORT PORTL
|
||||
#define LED_PIN PINL
|
||||
#define LED PINL2
|
||||
#elif LED == L3
|
||||
#undef LED
|
||||
#define LED_DDR DDRL
|
||||
#define LED_PORT PORTL
|
||||
#define LED_PIN PINL
|
||||
#define LED PINL3
|
||||
#elif LED == L4
|
||||
#undef LED
|
||||
#define LED_DDR DDRL
|
||||
#define LED_PORT PORTL
|
||||
#define LED_PIN PINL
|
||||
#define LED PINL4
|
||||
#elif LED == L5
|
||||
#undef LED
|
||||
#define LED_DDR DDRL
|
||||
#define LED_PORT PORTL
|
||||
#define LED_PIN PINL
|
||||
#define LED PINL5
|
||||
#elif LED == L6
|
||||
#undef LED
|
||||
#define LED_DDR DDRL
|
||||
#define LED_PORT PORTL
|
||||
#define LED_PIN PINL
|
||||
#define LED PINL6
|
||||
#elif LED == L7
|
||||
#undef LED
|
||||
#define LED_DDR DDRL
|
||||
#define LED_PORT PORTL
|
||||
#define LED_PIN PINL
|
||||
#define LED PINL7
|
||||
|
||||
#elif LED == A0
|
||||
#undef LED
|
||||
#define LED_DDR DDRA
|
||||
#define LED_PORT PORTA
|
||||
#define LED_PIN PINA
|
||||
#define LED PINA0
|
||||
#elif LED == A1
|
||||
#undef LED
|
||||
#define LED_DDR DDRA
|
||||
#define LED_PORT PORTA
|
||||
#define LED_PIN PINA
|
||||
#define LED PINA1
|
||||
#elif LED == A2
|
||||
#undef LED
|
||||
#define LED_DDR DDRA
|
||||
#define LED_PORT PORTA
|
||||
#define LED_PIN PINA
|
||||
#define LED PINA2
|
||||
#elif LED == A3
|
||||
#undef LED
|
||||
#define LED_DDR DDRA
|
||||
#define LED_PORT PORTA
|
||||
#define LED_PIN PINA
|
||||
#define LED PINA3
|
||||
#elif LED == A4
|
||||
#undef LED
|
||||
#define LED_DDR DDRA
|
||||
#define LED_PORT PORTA
|
||||
#define LED_PIN PINA
|
||||
#define LED PINA4
|
||||
#elif LED == A5
|
||||
#undef LED
|
||||
#define LED_DDR DDRA
|
||||
#define LED_PORT PORTA
|
||||
#define LED_PIN PINA
|
||||
#define LED PINA5
|
||||
#elif LED == A6
|
||||
#undef LED
|
||||
#define LED_DDR DDRA
|
||||
#define LED_PORT PORTA
|
||||
#define LED_PIN PINA
|
||||
#define LED PINA6
|
||||
#elif LED == A7
|
||||
#undef LED
|
||||
#define LED_DDR DDRA
|
||||
#define LED_PORT PORTA
|
||||
#define LED_PIN PINA
|
||||
#define LED PINA7
|
||||
|
||||
#else
|
||||
// Stop compilation right away, so we don't get more errors.
|
||||
#if LED == -1
|
||||
#error Unrecognized LED name. Should be like "B5"
|
||||
// Stop compilation right away, so we don't get more errors.
|
||||
#pragma GCC diagnostic warning "-Wfatal-errors"
|
||||
#error Nonexistent LED PORT. Check datasheet.
|
||||
#endif
|
||||
#pragma GCC diagnostic warning "-Wfatal-errors"
|
||||
#error Unrecognized LED name. Should be like "B5"
|
||||
#endif
|
49
ActualOptiboot/optiboot/bootloaders/optiboot/stk500.h
Normal file
49
ActualOptiboot/optiboot/bootloaders/optiboot/stk500.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* STK500 constants list, from AVRDUDE
|
||||
*
|
||||
* Trivial set of constants derived from Atmel App Note AVR061
|
||||
* Not copyrighted. Released to the public domain.
|
||||
*/
|
||||
|
||||
#define STK_OK 0x10
|
||||
#define STK_FAILED 0x11 // Not used
|
||||
#define STK_UNKNOWN 0x12 // Not used
|
||||
#define STK_NODEVICE 0x13 // Not used
|
||||
#define STK_INSYNC 0x14 // ' '
|
||||
#define STK_NOSYNC 0x15 // Not used
|
||||
#define ADC_CHANNEL_ERROR 0x16 // Not used
|
||||
#define ADC_MEASURE_OK 0x17 // Not used
|
||||
#define PWM_CHANNEL_ERROR 0x18 // Not used
|
||||
#define PWM_ADJUST_OK 0x19 // Not used
|
||||
#define CRC_EOP 0x20 // 'SPACE'
|
||||
#define STK_GET_SYNC 0x30 // '0'
|
||||
#define STK_GET_SIGN_ON 0x31 // '1'
|
||||
#define STK_SET_PARAMETER 0x40 // '@'
|
||||
#define STK_GET_PARAMETER 0x41 // 'A'
|
||||
#define STK_SET_DEVICE 0x42 // 'B'
|
||||
#define STK_SET_DEVICE_EXT 0x45 // 'E'
|
||||
#define STK_ENTER_PROGMODE 0x50 // 'P'
|
||||
#define STK_LEAVE_PROGMODE 0x51 // 'Q'
|
||||
#define STK_CHIP_ERASE 0x52 // 'R'
|
||||
#define STK_CHECK_AUTOINC 0x53 // 'S'
|
||||
#define STK_LOAD_ADDRESS 0x55 // 'U'
|
||||
#define STK_UNIVERSAL 0x56 // 'V'
|
||||
#define STK_PROG_FLASH 0x60 // '`'
|
||||
#define STK_PROG_DATA 0x61 // 'a'
|
||||
#define STK_PROG_FUSE 0x62 // 'b'
|
||||
#define STK_PROG_LOCK 0x63 // 'c'
|
||||
#define STK_PROG_PAGE 0x64 // 'd'
|
||||
#define STK_PROG_FUSE_EXT 0x65 // 'e'
|
||||
#define STK_READ_FLASH 0x70 // 'p'
|
||||
#define STK_READ_DATA 0x71 // 'q'
|
||||
#define STK_READ_FUSE 0x72 // 'r'
|
||||
#define STK_READ_LOCK 0x73 // 's'
|
||||
#define STK_READ_PAGE 0x74 // 't'
|
||||
#define STK_READ_SIGN 0x75 // 'u'
|
||||
#define STK_READ_OSCCAL 0x76 // 'v'
|
||||
#define STK_READ_FUSE_EXT 0x77 // 'w'
|
||||
#define STK_READ_OSCCAL_EXT 0x78 // 'x'
|
||||
#define STK_SW_MAJOR 0x81 // ' '
|
||||
#define STK_SW_MINOR 0x82 // ' '
|
||||
|
||||
/* AVR raw commands sent via STK_UNIVERSAL */
|
||||
#define AVR_OP_LOAD_EXT_ADDR 0x4d
|
2355
ActualOptiboot/optiboot/examples/chaucer112k/chaucer112k.ino
Normal file
2355
ActualOptiboot/optiboot/examples/chaucer112k/chaucer112k.ino
Normal file
File diff suppressed because it is too large
Load Diff
306
ActualOptiboot/optiboot/examples/chaucer16k/chaucer16k.ino
Normal file
306
ActualOptiboot/optiboot/examples/chaucer16k/chaucer16k.ino
Normal file
@ -0,0 +1,306 @@
|
||||
// Text is an extract from The Canterbury Tales
|
||||
// Full text at http://www.gutenberg.org/dirs/etext00/cbtls12.txt
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
const char knightsTale[] PROGMEM= {
|
||||
" THE KNIGHT'S TALE <1>\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"WHILOM*, as olde stories tellen us, *formerly\n"
|
||||
"There was a duke that highte* Theseus. *was called <2>\n"
|
||||
"Of Athens he was lord and governor,\n"
|
||||
"And in his time such a conqueror\n"
|
||||
"That greater was there none under the sun.\n"
|
||||
"Full many a riche country had he won.\n"
|
||||
"What with his wisdom and his chivalry,\n"
|
||||
"He conquer'd all the regne of Feminie,<3>\n"
|
||||
"That whilom was y-cleped Scythia;\n"
|
||||
"And weddede the Queen Hippolyta\n"
|
||||
"And brought her home with him to his country\n"
|
||||
"With muchel* glory and great solemnity, *great\n"
|
||||
"And eke her younge sister Emily,\n"
|
||||
"And thus with vict'ry and with melody\n"
|
||||
"Let I this worthy Duke to Athens ride,\n"
|
||||
"And all his host, in armes him beside.\n"
|
||||
"\n"
|
||||
"And certes, if it n'ere* too long to hear, *were not\n"
|
||||
"I would have told you fully the mannere,\n"
|
||||
"How wonnen* was the regne of Feminie, <4> *won\n"
|
||||
"By Theseus, and by his chivalry;\n"
|
||||
"And of the greate battle for the nonce\n"
|
||||
"Betwixt Athenes and the Amazons;\n"
|
||||
"And how assieged was Hippolyta,\n"
|
||||
"The faire hardy queen of Scythia;\n"
|
||||
"And of the feast that was at her wedding\n"
|
||||
"And of the tempest at her homecoming.\n"
|
||||
"But all these things I must as now forbear.\n"
|
||||
"I have, God wot, a large field to ear* *plough<5>;\n"
|
||||
"And weake be the oxen in my plough;\n"
|
||||
"The remnant of my tale is long enow.\n"
|
||||
"I will not *letten eke none of this rout*. *hinder any of\n"
|
||||
"Let every fellow tell his tale about, this company*\n"
|
||||
"And let see now who shall the supper win.\n"
|
||||
"There *as I left*, I will again begin. *where I left off*\n"
|
||||
"\n"
|
||||
"This Duke, of whom I make mentioun,\n"
|
||||
"When he was come almost unto the town,\n"
|
||||
"In all his weal, and in his moste pride,\n"
|
||||
"He was ware, as he cast his eye aside,\n"
|
||||
"Where that there kneeled in the highe way\n"
|
||||
"A company of ladies, tway and tway,\n"
|
||||
"Each after other, clad in clothes black:\n"
|
||||
"But such a cry and such a woe they make,\n"
|
||||
"That in this world n'is creature living,\n"
|
||||
"That hearde such another waimenting* *lamenting <6>\n"
|
||||
"And of this crying would they never stenten*, *desist\n"
|
||||
"Till they the reines of his bridle henten*. *seize\n"
|
||||
"\"What folk be ye that at mine homecoming\n"
|
||||
"Perturben so my feaste with crying?\"\n"
|
||||
"Quoth Theseus; \"Have ye so great envy\n"
|
||||
"Of mine honour, that thus complain and cry?\n"
|
||||
"Or who hath you misboden*, or offended? *wronged\n"
|
||||
"Do telle me, if it may be amended;\n"
|
||||
"And why that ye be clad thus all in black?\"\n"
|
||||
"\n"
|
||||
"The oldest lady of them all then spake,\n"
|
||||
"When she had swooned, with a deadly cheer*, *countenance\n"
|
||||
"That it was ruthe* for to see or hear. *pity\n"
|
||||
"She saide; \"Lord, to whom fortune hath given\n"
|
||||
"Vict'ry, and as a conqueror to liven,\n"
|
||||
"Nought grieveth us your glory and your honour;\n"
|
||||
"But we beseechen mercy and succour.\n"
|
||||
"Have mercy on our woe and our distress;\n"
|
||||
"Some drop of pity, through thy gentleness,\n"
|
||||
"Upon us wretched women let now fall.\n"
|
||||
"For certes, lord, there is none of us all\n"
|
||||
"That hath not been a duchess or a queen;\n"
|
||||
"Now be we caitives*, as it is well seen: *captives\n"
|
||||
"Thanked be Fortune, and her false wheel,\n"
|
||||
"That *none estate ensureth to be wele*. *assures no continuance of\n"
|
||||
"And certes, lord, t'abiden your presence prosperous estate*\n"
|
||||
"Here in this temple of the goddess Clemence\n"
|
||||
"We have been waiting all this fortenight:\n"
|
||||
"Now help us, lord, since it lies in thy might.\n"
|
||||
"\n"
|
||||
"\"I, wretched wight, that weep and waile thus,\n"
|
||||
"Was whilom wife to king Capaneus,\n"
|
||||
"That starf* at Thebes, cursed be that day: *died <7>\n"
|
||||
"And alle we that be in this array,\n"
|
||||
"And maken all this lamentatioun,\n"
|
||||
"We losten all our husbands at that town,\n"
|
||||
"While that the siege thereabouten lay.\n"
|
||||
"And yet the olde Creon, wellaway!\n"
|
||||
"That lord is now of Thebes the city,\n"
|
||||
"Fulfilled of ire and of iniquity,\n"
|
||||
"He for despite, and for his tyranny,\n"
|
||||
"To do the deade bodies villainy*, *insult\n"
|
||||
"Of all our lorde's, which that been y-slaw, *slain\n"
|
||||
"Hath all the bodies on an heap y-draw,\n"
|
||||
"And will not suffer them by none assent\n"
|
||||
"Neither to be y-buried, nor y-brent*, *burnt\n"
|
||||
"But maketh houndes eat them in despite.\"\n"
|
||||
"And with that word, withoute more respite\n"
|
||||
"They fallen groff,* and cryden piteously; *grovelling\n"
|
||||
"\"Have on us wretched women some mercy,\n"
|
||||
"And let our sorrow sinken in thine heart.\"\n"
|
||||
"\n"
|
||||
"This gentle Duke down from his courser start\n"
|
||||
"With hearte piteous, when he heard them speak.\n"
|
||||
"Him thoughte that his heart would all to-break,\n"
|
||||
"When he saw them so piteous and so mate* *abased\n"
|
||||
"That whilom weren of so great estate.\n"
|
||||
"And in his armes he them all up hent*, *raised, took\n"
|
||||
"And them comforted in full good intent,\n"
|
||||
"And swore his oath, as he was true knight,\n"
|
||||
"He woulde do *so farforthly his might* *as far as his power went*\n"
|
||||
"Upon the tyrant Creon them to wreak*, *avenge\n"
|
||||
"That all the people of Greece shoulde speak,\n"
|
||||
"How Creon was of Theseus y-served,\n"
|
||||
"As he that had his death full well deserved.\n"
|
||||
"And right anon withoute more abode* *delay\n"
|
||||
"His banner he display'd, and forth he rode\n"
|
||||
"To Thebes-ward, and all his, host beside:\n"
|
||||
"No ner* Athenes would he go nor ride, *nearer\n"
|
||||
"Nor take his ease fully half a day,\n"
|
||||
"But onward on his way that night he lay:\n"
|
||||
"And sent anon Hippolyta the queen,\n"
|
||||
"And Emily her younge sister sheen* *bright, lovely\n"
|
||||
"Unto the town of Athens for to dwell:\n"
|
||||
"And forth he rit*; there is no more to tell. *rode\n"
|
||||
"\n"
|
||||
"The red statue of Mars with spear and targe* *shield\n"
|
||||
"So shineth in his white banner large\n"
|
||||
"That all the fieldes glitter up and down:\n"
|
||||
"And by his banner borne is his pennon\n"
|
||||
"Of gold full rich, in which there was y-beat* *stamped\n"
|
||||
"The Minotaur<8> which that he slew in Crete\n"
|
||||
"Thus rit this Duke, thus rit this conqueror\n"
|
||||
"And in his host of chivalry the flower,\n"
|
||||
"Till that he came to Thebes, and alight\n"
|
||||
"Fair in a field, there as he thought to fight.\n"
|
||||
"But shortly for to speaken of this thing,\n"
|
||||
"With Creon, which that was of Thebes king,\n"
|
||||
"He fought, and slew him manly as a knight\n"
|
||||
"In plain bataille, and put his folk to flight:\n"
|
||||
"And by assault he won the city after,\n"
|
||||
"And rent adown both wall, and spar, and rafter;\n"
|
||||
"And to the ladies he restored again\n"
|
||||
"The bodies of their husbands that were slain,\n"
|
||||
"To do obsequies, as was then the guise*. *custom\n"
|
||||
"\n"
|
||||
"But it were all too long for to devise* *describe\n"
|
||||
"The greate clamour, and the waimenting*, *lamenting\n"
|
||||
"Which that the ladies made at the brenning* *burning\n"
|
||||
"Of the bodies, and the great honour\n"
|
||||
"That Theseus the noble conqueror\n"
|
||||
"Did to the ladies, when they from him went:\n"
|
||||
"But shortly for to tell is mine intent.\n"
|
||||
"When that this worthy Duke, this Theseus,\n"
|
||||
"Had Creon slain, and wonnen Thebes thus,\n"
|
||||
"Still in the field he took all night his rest,\n"
|
||||
"And did with all the country as him lest*. *pleased\n"
|
||||
"To ransack in the tas* of bodies dead, *heap\n"
|
||||
"Them for to strip of *harness and of **weed, *armour **clothes\n"
|
||||
"The pillers* did their business and cure, *pillagers <9>\n"
|
||||
"After the battle and discomfiture.\n"
|
||||
"And so befell, that in the tas they found,\n"
|
||||
"Through girt with many a grievous bloody wound,\n"
|
||||
"Two younge knightes *ligging by and by* *lying side by side*\n"
|
||||
"Both in *one armes*, wrought full richely: *the same armour*\n"
|
||||
"Of whiche two, Arcita hight that one,\n"
|
||||
"And he that other highte Palamon.\n"
|
||||
"Not fully quick*, nor fully dead they were, *alive\n"
|
||||
"But by their coat-armour, and by their gear,\n"
|
||||
"The heralds knew them well in special,\n"
|
||||
"As those that weren of the blood royal\n"
|
||||
"Of Thebes, and *of sistren two y-born*. *born of two sisters*\n"
|
||||
"Out of the tas the pillers have them torn,\n"
|
||||
"And have them carried soft unto the tent\n"
|
||||
"Of Theseus, and he full soon them sent\n"
|
||||
"To Athens, for to dwellen in prison\n"
|
||||
"Perpetually, he *n'olde no ranson*. *would take no ransom*\n"
|
||||
"And when this worthy Duke had thus y-done,\n"
|
||||
"He took his host, and home he rit anon\n"
|
||||
"With laurel crowned as a conquerour;\n"
|
||||
"And there he lived in joy and in honour\n"
|
||||
"Term of his life; what needeth wordes mo'?\n"
|
||||
"And in a tower, in anguish and in woe,\n"
|
||||
"Dwellen this Palamon, and eke Arcite,\n"
|
||||
"For evermore, there may no gold them quite* *set free\n"
|
||||
"\n"
|
||||
"Thus passed year by year, and day by day,\n"
|
||||
"Till it fell ones in a morn of May\n"
|
||||
"That Emily, that fairer was to seen\n"
|
||||
"Than is the lily upon his stalke green,\n"
|
||||
"And fresher than the May with flowers new\n"
|
||||
"(For with the rose colour strove her hue;\n"
|
||||
"I n'ot* which was the finer of them two), *know not\n"
|
||||
"Ere it was day, as she was wont to do,\n"
|
||||
"She was arisen, and all ready dight*, *dressed\n"
|
||||
"For May will have no sluggardy a-night;\n"
|
||||
"The season pricketh every gentle heart,\n"
|
||||
"And maketh him out of his sleep to start,\n"
|
||||
"And saith, \"Arise, and do thine observance.\"\n"
|
||||
"\n"
|
||||
"This maketh Emily have remembrance\n"
|
||||
"To do honour to May, and for to rise.\n"
|
||||
"Y-clothed was she fresh for to devise;\n"
|
||||
"Her yellow hair was braided in a tress,\n"
|
||||
"Behind her back, a yarde long I guess.\n"
|
||||
"And in the garden at *the sun uprist* *sunrise\n"
|
||||
"She walketh up and down where as her list.\n"
|
||||
"She gathereth flowers, party* white and red, *mingled\n"
|
||||
"To make a sotel* garland for her head, *subtle, well-arranged\n"
|
||||
"And as an angel heavenly she sung.\n"
|
||||
"The greate tower, that was so thick and strong,\n"
|
||||
"Which of the castle was the chief dungeon<10>\n"
|
||||
"(Where as these knightes weren in prison,\n"
|
||||
"Of which I tolde you, and telle shall),\n"
|
||||
"Was even joinant* to the garden wall, *adjoining\n"
|
||||
"There as this Emily had her playing.\n"
|
||||
"\n"
|
||||
"Bright was the sun, and clear that morrowning,\n"
|
||||
"And Palamon, this woful prisoner,\n"
|
||||
"As was his wont, by leave of his gaoler,\n"
|
||||
"Was ris'n, and roamed in a chamber on high,\n"
|
||||
"In which he all the noble city sigh*, *saw\n"
|
||||
"And eke the garden, full of branches green,\n"
|
||||
"There as this fresh Emelia the sheen\n"
|
||||
"Was in her walk, and roamed up and down.\n"
|
||||
"This sorrowful prisoner, this Palamon\n"
|
||||
"Went in his chamber roaming to and fro,\n"
|
||||
"And to himself complaining of his woe:\n"
|
||||
"That he was born, full oft he said, Alas!\n"
|
||||
"And so befell, by aventure or cas*, *chance\n"
|
||||
"That through a window thick of many a bar\n"
|
||||
"Of iron great, and square as any spar,\n"
|
||||
"He cast his eyes upon Emelia,\n"
|
||||
"And therewithal he blent* and cried, Ah! *started aside\n"
|
||||
"As though he stungen were unto the heart.\n"
|
||||
"And with that cry Arcite anon up start,\n"
|
||||
"And saide, \"Cousin mine, what aileth thee,\n"
|
||||
"That art so pale and deadly for to see?\n"
|
||||
"Why cried'st thou? who hath thee done offence?\n"
|
||||
"For Godde's love, take all in patience\n"
|
||||
"Our prison*, for it may none other be. *imprisonment\n"
|
||||
"Fortune hath giv'n us this adversity'.\n"
|
||||
"Some wick'* aspect or disposition *wicked\n"
|
||||
"Of Saturn<11>, by some constellation,\n"
|
||||
"Hath giv'n us this, although we had it sworn,\n"
|
||||
"So stood the heaven when that we were born,\n"
|
||||
"We must endure; this is the short and plain.\n"
|
||||
"\n"
|
||||
"This Palamon answer'd, and said again:\n"
|
||||
"\"Cousin, forsooth of this opinion\n"
|
||||
"Thou hast a vain imagination.\n"
|
||||
"This prison caused me not for to cry;\n"
|
||||
"But I was hurt right now thorough mine eye\n"
|
||||
"Into mine heart; that will my bane* be. *destruction\n"
|
||||
"The fairness of the lady that I see\n"
|
||||
"Yond in the garden roaming to and fro,\n"
|
||||
"Is cause of all my crying and my woe.\n"
|
||||
"I *n'ot wher* she be woman or goddess, *know not whether*\n"
|
||||
"But Venus is it, soothly* as I guess, *truly\n"
|
||||
"And therewithal on knees adown he fill,\n"
|
||||
"And saide: \"Venus, if it be your will\n"
|
||||
"You in this garden thus to transfigure\n"
|
||||
"Before me sorrowful wretched creature,\n"
|
||||
"Out of this prison help that we may scape.\n"
|
||||
"And if so be our destiny be shape\n"
|
||||
"By etern word to dien in prison,\n"
|
||||
"Of our lineage have some compassion,\n"
|
||||
"That is so low y-brought by tyranny.\"\n"
|
||||
"\n"
|
||||
"And with that word Arcita *gan espy* *began to look forth*\n"
|
||||
"Where as this lady roamed to and fro\n"
|
||||
"And with that sight her beauty hurt him so,\n"
|
||||
"That if that Palamon was wounded sore,\n"
|
||||
"Arcite is hurt as much as he, or more.\n"
|
||||
"And with a sigh he saide piteously:\n"
|
||||
"\"The freshe beauty slay'th me suddenly\n"
|
||||
"Of her that roameth yonder in the place.\n"
|
||||
"And but* I have her mercy and her grace, *unless\n"
|
||||
"That I may see her at the leaste way,\n"
|
||||
"I am but dead; there is no more to say.\"\n"
|
||||
"This Palamon, when he these wordes heard,\n"
|
||||
"Dispiteously* he looked, and answer'd: *angrily\n"
|
||||
"\"Whether say'st thou this in earnest or in play?\"\n"
|
||||
"\"Nay,\" quoth Arcite, \"in earnest, by my fay*. *faith\n"
|
||||
"God help me so, *me lust full ill to play*.\" *I am in no humour\n"
|
||||
"This Palamon gan knit his browes tway. for jesting*\n"
|
||||
"\"It were,\" quoth he, \"to thee no great honour\n"
|
||||
"For to be false, nor for to be traitour\n"
|
||||
};
|
||||
|
||||
void setup() {
|
||||
int i=0;
|
||||
uint8_t c;
|
||||
Serial.begin(115200);
|
||||
do {
|
||||
c = pgm_read_byte(knightsTale+i);
|
||||
if (c) Serial.write(c);
|
||||
i++;
|
||||
} while (c);
|
||||
}
|
||||
void loop() {
|
||||
}
|
3778
ActualOptiboot/optiboot/examples/chaucer256k/chaucer256k.ino
Normal file
3778
ActualOptiboot/optiboot/examples/chaucer256k/chaucer256k.ino
Normal file
File diff suppressed because it is too large
Load Diff
679
ActualOptiboot/optiboot/examples/chaucer32k/chaucer32k.ino
Normal file
679
ActualOptiboot/optiboot/examples/chaucer32k/chaucer32k.ino
Normal file
@ -0,0 +1,679 @@
|
||||
// Text is an extract from The Canterbury Tales
|
||||
// Full text at http://www.gutenberg.org/dirs/etext00/cbtls12.txt
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
const char knightsTale[] PROGMEM= {
|
||||
" THE KNIGHT'S TALE <1>\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"WHILOM*, as olde stories tellen us, *formerly\n"
|
||||
"There was a duke that highte* Theseus. *was called <2>\n"
|
||||
"Of Athens he was lord and governor,\n"
|
||||
"And in his time such a conqueror\n"
|
||||
"That greater was there none under the sun.\n"
|
||||
"Full many a riche country had he won.\n"
|
||||
"What with his wisdom and his chivalry,\n"
|
||||
"He conquer'd all the regne of Feminie,<3>\n"
|
||||
"That whilom was y-cleped Scythia;\n"
|
||||
"And weddede the Queen Hippolyta\n"
|
||||
"And brought her home with him to his country\n"
|
||||
"With muchel* glory and great solemnity, *great\n"
|
||||
"And eke her younge sister Emily,\n"
|
||||
"And thus with vict'ry and with melody\n"
|
||||
"Let I this worthy Duke to Athens ride,\n"
|
||||
"And all his host, in armes him beside.\n"
|
||||
"\n"
|
||||
"And certes, if it n'ere* too long to hear, *were not\n"
|
||||
"I would have told you fully the mannere,\n"
|
||||
"How wonnen* was the regne of Feminie, <4> *won\n"
|
||||
"By Theseus, and by his chivalry;\n"
|
||||
"And of the greate battle for the nonce\n"
|
||||
"Betwixt Athenes and the Amazons;\n"
|
||||
"And how assieged was Hippolyta,\n"
|
||||
"The faire hardy queen of Scythia;\n"
|
||||
"And of the feast that was at her wedding\n"
|
||||
"And of the tempest at her homecoming.\n"
|
||||
"But all these things I must as now forbear.\n"
|
||||
"I have, God wot, a large field to ear* *plough<5>;\n"
|
||||
"And weake be the oxen in my plough;\n"
|
||||
"The remnant of my tale is long enow.\n"
|
||||
"I will not *letten eke none of this rout*. *hinder any of\n"
|
||||
"Let every fellow tell his tale about, this company*\n"
|
||||
"And let see now who shall the supper win.\n"
|
||||
"There *as I left*, I will again begin. *where I left off*\n"
|
||||
"\n"
|
||||
"This Duke, of whom I make mentioun,\n"
|
||||
"When he was come almost unto the town,\n"
|
||||
"In all his weal, and in his moste pride,\n"
|
||||
"He was ware, as he cast his eye aside,\n"
|
||||
"Where that there kneeled in the highe way\n"
|
||||
"A company of ladies, tway and tway,\n"
|
||||
"Each after other, clad in clothes black:\n"
|
||||
"But such a cry and such a woe they make,\n"
|
||||
"That in this world n'is creature living,\n"
|
||||
"That hearde such another waimenting* *lamenting <6>\n"
|
||||
"And of this crying would they never stenten*, *desist\n"
|
||||
"Till they the reines of his bridle henten*. *seize\n"
|
||||
"\"What folk be ye that at mine homecoming\n"
|
||||
"Perturben so my feaste with crying?\"\n"
|
||||
"Quoth Theseus; \"Have ye so great envy\n"
|
||||
"Of mine honour, that thus complain and cry?\n"
|
||||
"Or who hath you misboden*, or offended? *wronged\n"
|
||||
"Do telle me, if it may be amended;\n"
|
||||
"And why that ye be clad thus all in black?\"\n"
|
||||
"\n"
|
||||
"The oldest lady of them all then spake,\n"
|
||||
"When she had swooned, with a deadly cheer*, *countenance\n"
|
||||
"That it was ruthe* for to see or hear. *pity\n"
|
||||
"She saide; \"Lord, to whom fortune hath given\n"
|
||||
"Vict'ry, and as a conqueror to liven,\n"
|
||||
"Nought grieveth us your glory and your honour;\n"
|
||||
"But we beseechen mercy and succour.\n"
|
||||
"Have mercy on our woe and our distress;\n"
|
||||
"Some drop of pity, through thy gentleness,\n"
|
||||
"Upon us wretched women let now fall.\n"
|
||||
"For certes, lord, there is none of us all\n"
|
||||
"That hath not been a duchess or a queen;\n"
|
||||
"Now be we caitives*, as it is well seen: *captives\n"
|
||||
"Thanked be Fortune, and her false wheel,\n"
|
||||
"That *none estate ensureth to be wele*. *assures no continuance of\n"
|
||||
"And certes, lord, t'abiden your presence prosperous estate*\n"
|
||||
"Here in this temple of the goddess Clemence\n"
|
||||
"We have been waiting all this fortenight:\n"
|
||||
"Now help us, lord, since it lies in thy might.\n"
|
||||
"\n"
|
||||
"\"I, wretched wight, that weep and waile thus,\n"
|
||||
"Was whilom wife to king Capaneus,\n"
|
||||
"That starf* at Thebes, cursed be that day: *died <7>\n"
|
||||
"And alle we that be in this array,\n"
|
||||
"And maken all this lamentatioun,\n"
|
||||
"We losten all our husbands at that town,\n"
|
||||
"While that the siege thereabouten lay.\n"
|
||||
"And yet the olde Creon, wellaway!\n"
|
||||
"That lord is now of Thebes the city,\n"
|
||||
"Fulfilled of ire and of iniquity,\n"
|
||||
"He for despite, and for his tyranny,\n"
|
||||
"To do the deade bodies villainy*, *insult\n"
|
||||
"Of all our lorde's, which that been y-slaw, *slain\n"
|
||||
"Hath all the bodies on an heap y-draw,\n"
|
||||
"And will not suffer them by none assent\n"
|
||||
"Neither to be y-buried, nor y-brent*, *burnt\n"
|
||||
"But maketh houndes eat them in despite.\"\n"
|
||||
"And with that word, withoute more respite\n"
|
||||
"They fallen groff,* and cryden piteously; *grovelling\n"
|
||||
"\"Have on us wretched women some mercy,\n"
|
||||
"And let our sorrow sinken in thine heart.\"\n"
|
||||
"\n"
|
||||
"This gentle Duke down from his courser start\n"
|
||||
"With hearte piteous, when he heard them speak.\n"
|
||||
"Him thoughte that his heart would all to-break,\n"
|
||||
"When he saw them so piteous and so mate* *abased\n"
|
||||
"That whilom weren of so great estate.\n"
|
||||
"And in his armes he them all up hent*, *raised, took\n"
|
||||
"And them comforted in full good intent,\n"
|
||||
"And swore his oath, as he was true knight,\n"
|
||||
"He woulde do *so farforthly his might* *as far as his power went*\n"
|
||||
"Upon the tyrant Creon them to wreak*, *avenge\n"
|
||||
"That all the people of Greece shoulde speak,\n"
|
||||
"How Creon was of Theseus y-served,\n"
|
||||
"As he that had his death full well deserved.\n"
|
||||
"And right anon withoute more abode* *delay\n"
|
||||
"His banner he display'd, and forth he rode\n"
|
||||
"To Thebes-ward, and all his, host beside:\n"
|
||||
"No ner* Athenes would he go nor ride, *nearer\n"
|
||||
"Nor take his ease fully half a day,\n"
|
||||
"But onward on his way that night he lay:\n"
|
||||
"And sent anon Hippolyta the queen,\n"
|
||||
"And Emily her younge sister sheen* *bright, lovely\n"
|
||||
"Unto the town of Athens for to dwell:\n"
|
||||
"And forth he rit*; there is no more to tell. *rode\n"
|
||||
"\n"
|
||||
"The red statue of Mars with spear and targe* *shield\n"
|
||||
"So shineth in his white banner large\n"
|
||||
"That all the fieldes glitter up and down:\n"
|
||||
"And by his banner borne is his pennon\n"
|
||||
"Of gold full rich, in which there was y-beat* *stamped\n"
|
||||
"The Minotaur<8> which that he slew in Crete\n"
|
||||
"Thus rit this Duke, thus rit this conqueror\n"
|
||||
"And in his host of chivalry the flower,\n"
|
||||
"Till that he came to Thebes, and alight\n"
|
||||
"Fair in a field, there as he thought to fight.\n"
|
||||
"But shortly for to speaken of this thing,\n"
|
||||
"With Creon, which that was of Thebes king,\n"
|
||||
"He fought, and slew him manly as a knight\n"
|
||||
"In plain bataille, and put his folk to flight:\n"
|
||||
"And by assault he won the city after,\n"
|
||||
"And rent adown both wall, and spar, and rafter;\n"
|
||||
"And to the ladies he restored again\n"
|
||||
"The bodies of their husbands that were slain,\n"
|
||||
"To do obsequies, as was then the guise*. *custom\n"
|
||||
"\n"
|
||||
"But it were all too long for to devise* *describe\n"
|
||||
"The greate clamour, and the waimenting*, *lamenting\n"
|
||||
"Which that the ladies made at the brenning* *burning\n"
|
||||
"Of the bodies, and the great honour\n"
|
||||
"That Theseus the noble conqueror\n"
|
||||
"Did to the ladies, when they from him went:\n"
|
||||
"But shortly for to tell is mine intent.\n"
|
||||
"When that this worthy Duke, this Theseus,\n"
|
||||
"Had Creon slain, and wonnen Thebes thus,\n"
|
||||
"Still in the field he took all night his rest,\n"
|
||||
"And did with all the country as him lest*. *pleased\n"
|
||||
"To ransack in the tas* of bodies dead, *heap\n"
|
||||
"Them for to strip of *harness and of **weed, *armour **clothes\n"
|
||||
"The pillers* did their business and cure, *pillagers <9>\n"
|
||||
"After the battle and discomfiture.\n"
|
||||
"And so befell, that in the tas they found,\n"
|
||||
"Through girt with many a grievous bloody wound,\n"
|
||||
"Two younge knightes *ligging by and by* *lying side by side*\n"
|
||||
"Both in *one armes*, wrought full richely: *the same armour*\n"
|
||||
"Of whiche two, Arcita hight that one,\n"
|
||||
"And he that other highte Palamon.\n"
|
||||
"Not fully quick*, nor fully dead they were, *alive\n"
|
||||
"But by their coat-armour, and by their gear,\n"
|
||||
"The heralds knew them well in special,\n"
|
||||
"As those that weren of the blood royal\n"
|
||||
"Of Thebes, and *of sistren two y-born*. *born of two sisters*\n"
|
||||
"Out of the tas the pillers have them torn,\n"
|
||||
"And have them carried soft unto the tent\n"
|
||||
"Of Theseus, and he full soon them sent\n"
|
||||
"To Athens, for to dwellen in prison\n"
|
||||
"Perpetually, he *n'olde no ranson*. *would take no ransom*\n"
|
||||
"And when this worthy Duke had thus y-done,\n"
|
||||
"He took his host, and home he rit anon\n"
|
||||
"With laurel crowned as a conquerour;\n"
|
||||
"And there he lived in joy and in honour\n"
|
||||
"Term of his life; what needeth wordes mo'?\n"
|
||||
"And in a tower, in anguish and in woe,\n"
|
||||
"Dwellen this Palamon, and eke Arcite,\n"
|
||||
"For evermore, there may no gold them quite* *set free\n"
|
||||
"\n"
|
||||
"Thus passed year by year, and day by day,\n"
|
||||
"Till it fell ones in a morn of May\n"
|
||||
"That Emily, that fairer was to seen\n"
|
||||
"Than is the lily upon his stalke green,\n"
|
||||
"And fresher than the May with flowers new\n"
|
||||
"(For with the rose colour strove her hue;\n"
|
||||
"I n'ot* which was the finer of them two), *know not\n"
|
||||
"Ere it was day, as she was wont to do,\n"
|
||||
"She was arisen, and all ready dight*, *dressed\n"
|
||||
"For May will have no sluggardy a-night;\n"
|
||||
"The season pricketh every gentle heart,\n"
|
||||
"And maketh him out of his sleep to start,\n"
|
||||
"And saith, \"Arise, and do thine observance.\"\n"
|
||||
"\n"
|
||||
"This maketh Emily have remembrance\n"
|
||||
"To do honour to May, and for to rise.\n"
|
||||
"Y-clothed was she fresh for to devise;\n"
|
||||
"Her yellow hair was braided in a tress,\n"
|
||||
"Behind her back, a yarde long I guess.\n"
|
||||
"And in the garden at *the sun uprist* *sunrise\n"
|
||||
"She walketh up and down where as her list.\n"
|
||||
"She gathereth flowers, party* white and red, *mingled\n"
|
||||
"To make a sotel* garland for her head, *subtle, well-arranged\n"
|
||||
"And as an angel heavenly she sung.\n"
|
||||
"The greate tower, that was so thick and strong,\n"
|
||||
"Which of the castle was the chief dungeon<10>\n"
|
||||
"(Where as these knightes weren in prison,\n"
|
||||
"Of which I tolde you, and telle shall),\n"
|
||||
"Was even joinant* to the garden wall, *adjoining\n"
|
||||
"There as this Emily had her playing.\n"
|
||||
"\n"
|
||||
"Bright was the sun, and clear that morrowning,\n"
|
||||
"And Palamon, this woful prisoner,\n"
|
||||
"As was his wont, by leave of his gaoler,\n"
|
||||
"Was ris'n, and roamed in a chamber on high,\n"
|
||||
"In which he all the noble city sigh*, *saw\n"
|
||||
"And eke the garden, full of branches green,\n"
|
||||
"There as this fresh Emelia the sheen\n"
|
||||
"Was in her walk, and roamed up and down.\n"
|
||||
"This sorrowful prisoner, this Palamon\n"
|
||||
"Went in his chamber roaming to and fro,\n"
|
||||
"And to himself complaining of his woe:\n"
|
||||
"That he was born, full oft he said, Alas!\n"
|
||||
"And so befell, by aventure or cas*, *chance\n"
|
||||
"That through a window thick of many a bar\n"
|
||||
"Of iron great, and square as any spar,\n"
|
||||
"He cast his eyes upon Emelia,\n"
|
||||
"And therewithal he blent* and cried, Ah! *started aside\n"
|
||||
"As though he stungen were unto the heart.\n"
|
||||
"And with that cry Arcite anon up start,\n"
|
||||
"And saide, \"Cousin mine, what aileth thee,\n"
|
||||
"That art so pale and deadly for to see?\n"
|
||||
"Why cried'st thou? who hath thee done offence?\n"
|
||||
"For Godde's love, take all in patience\n"
|
||||
"Our prison*, for it may none other be. *imprisonment\n"
|
||||
"Fortune hath giv'n us this adversity'.\n"
|
||||
"Some wick'* aspect or disposition *wicked\n"
|
||||
"Of Saturn<11>, by some constellation,\n"
|
||||
"Hath giv'n us this, although we had it sworn,\n"
|
||||
"So stood the heaven when that we were born,\n"
|
||||
"We must endure; this is the short and plain.\n"
|
||||
"\n"
|
||||
"This Palamon answer'd, and said again:\n"
|
||||
"\"Cousin, forsooth of this opinion\n"
|
||||
"Thou hast a vain imagination.\n"
|
||||
"This prison caused me not for to cry;\n"
|
||||
"But I was hurt right now thorough mine eye\n"
|
||||
"Into mine heart; that will my bane* be. *destruction\n"
|
||||
"The fairness of the lady that I see\n"
|
||||
"Yond in the garden roaming to and fro,\n"
|
||||
"Is cause of all my crying and my woe.\n"
|
||||
"I *n'ot wher* she be woman or goddess, *know not whether*\n"
|
||||
"But Venus is it, soothly* as I guess, *truly\n"
|
||||
"And therewithal on knees adown he fill,\n"
|
||||
"And saide: \"Venus, if it be your will\n"
|
||||
"You in this garden thus to transfigure\n"
|
||||
"Before me sorrowful wretched creature,\n"
|
||||
"Out of this prison help that we may scape.\n"
|
||||
"And if so be our destiny be shape\n"
|
||||
"By etern word to dien in prison,\n"
|
||||
"Of our lineage have some compassion,\n"
|
||||
"That is so low y-brought by tyranny.\"\n"
|
||||
"\n"
|
||||
"And with that word Arcita *gan espy* *began to look forth*\n"
|
||||
"Where as this lady roamed to and fro\n"
|
||||
"And with that sight her beauty hurt him so,\n"
|
||||
"That if that Palamon was wounded sore,\n"
|
||||
"Arcite is hurt as much as he, or more.\n"
|
||||
"And with a sigh he saide piteously:\n"
|
||||
"\"The freshe beauty slay'th me suddenly\n"
|
||||
"Of her that roameth yonder in the place.\n"
|
||||
"And but* I have her mercy and her grace, *unless\n"
|
||||
"That I may see her at the leaste way,\n"
|
||||
"I am but dead; there is no more to say.\"\n"
|
||||
"This Palamon, when he these wordes heard,\n"
|
||||
"Dispiteously* he looked, and answer'd: *angrily\n"
|
||||
"\"Whether say'st thou this in earnest or in play?\"\n"
|
||||
"\"Nay,\" quoth Arcite, \"in earnest, by my fay*. *faith\n"
|
||||
"God help me so, *me lust full ill to play*.\" *I am in no humour\n"
|
||||
"This Palamon gan knit his browes tway. for jesting*\n"
|
||||
"\"It were,\" quoth he, \"to thee no great honour\n"
|
||||
"For to be false, nor for to be traitour\n"
|
||||
"To me, that am thy cousin and thy brother\n"
|
||||
"Y-sworn full deep, and each of us to other,\n"
|
||||
"That never for to dien in the pain <12>,\n"
|
||||
"Till that the death departen shall us twain,\n"
|
||||
"Neither of us in love to hinder other,\n"
|
||||
"Nor in none other case, my leve* brother; *dear\n"
|
||||
"But that thou shouldest truly farther me\n"
|
||||
"In every case, as I should farther thee.\n"
|
||||
"This was thine oath, and mine also certain;\n"
|
||||
"I wot it well, thou dar'st it not withsayn*, *deny\n"
|
||||
"Thus art thou of my counsel out of doubt,\n"
|
||||
"And now thou wouldest falsely be about\n"
|
||||
"To love my lady, whom I love and serve,\n"
|
||||
"And ever shall, until mine hearte sterve* *die\n"
|
||||
"Now certes, false Arcite, thou shalt not so\n"
|
||||
"I lov'd her first, and tolde thee my woe\n"
|
||||
"As to my counsel, and my brother sworn\n"
|
||||
"To farther me, as I have told beforn.\n"
|
||||
"For which thou art y-bounden as a knight\n"
|
||||
"To helpe me, if it lie in thy might,\n"
|
||||
"Or elles art thou false, I dare well sayn,\"\n"
|
||||
"\n"
|
||||
"This Arcita full proudly spake again:\n"
|
||||
"\"Thou shalt,\" quoth he, \"be rather* false than I, *sooner\n"
|
||||
"And thou art false, I tell thee utterly;\n"
|
||||
"For par amour I lov'd her first ere thou.\n"
|
||||
"What wilt thou say? *thou wist it not right now* *even now thou\n"
|
||||
"Whether she be a woman or goddess. knowest not*\n"
|
||||
"Thine is affection of holiness,\n"
|
||||
"And mine is love, as to a creature:\n"
|
||||
"For which I tolde thee mine aventure\n"
|
||||
"As to my cousin, and my brother sworn\n"
|
||||
"I pose*, that thou loved'st her beforn: *suppose\n"
|
||||
"Wost* thou not well the olde clerke's saw<13>, *know'st\n"
|
||||
"That who shall give a lover any law?\n"
|
||||
"Love is a greater lawe, by my pan,\n"
|
||||
"Than may be giv'n to any earthly man:\n"
|
||||
"Therefore positive law, and such decree,\n"
|
||||
"Is broke alway for love in each degree\n"
|
||||
"A man must needes love, maugre his head.\n"
|
||||
"He may not flee it, though he should be dead,\n"
|
||||
"*All be she* maid, or widow, or else wife. *whether she be*\n"
|
||||
"And eke it is not likely all thy life\n"
|
||||
"To standen in her grace, no more than I\n"
|
||||
"For well thou wost thyselfe verily,\n"
|
||||
"That thou and I be damned to prison\n"
|
||||
"Perpetual, us gaineth no ranson.\n"
|
||||
"We strive, as did the houndes for the bone;\n"
|
||||
"They fought all day, and yet their part was none.\n"
|
||||
"There came a kite, while that they were so wroth,\n"
|
||||
"And bare away the bone betwixt them both.\n"
|
||||
"And therefore at the kinge's court, my brother,\n"
|
||||
"Each man for himselfe, there is no other.\n"
|
||||
"Love if thee list; for I love and aye shall\n"
|
||||
"And soothly, leve brother, this is all.\n"
|
||||
"Here in this prison musten we endure,\n"
|
||||
"And each of us take his Aventure.\"\n"
|
||||
"\n"
|
||||
"Great was the strife and long between these tway,\n"
|
||||
"If that I hadde leisure for to say;\n"
|
||||
"But to the effect: it happen'd on a day\n"
|
||||
"(To tell it you as shortly as I may),\n"
|
||||
"A worthy duke that hight Perithous<14>\n"
|
||||
"That fellow was to the Duke Theseus\n"
|
||||
"Since thilke* day that they were children lite** *that **little\n"
|
||||
"Was come to Athens, his fellow to visite,\n"
|
||||
"And for to play, as he was wont to do;\n"
|
||||
"For in this world he loved no man so;\n"
|
||||
"And he lov'd him as tenderly again.\n"
|
||||
"So well they lov'd, as olde bookes sayn,\n"
|
||||
"That when that one was dead, soothly to sayn,\n"
|
||||
"His fellow went and sought him down in hell:\n"
|
||||
"But of that story list me not to write.\n"
|
||||
"Duke Perithous loved well Arcite,\n"
|
||||
"And had him known at Thebes year by year:\n"
|
||||
"And finally at request and prayere\n"
|
||||
"Of Perithous, withoute ranson\n"
|
||||
"Duke Theseus him let out of prison,\n"
|
||||
"Freely to go, where him list over all,\n"
|
||||
"In such a guise, as I you tellen shall\n"
|
||||
"This was the forword*, plainly to indite, *promise\n"
|
||||
"Betwixte Theseus and him Arcite:\n"
|
||||
"That if so were, that Arcite were y-found\n"
|
||||
"Ever in his life, by day or night, one stound* *moment<15>\n"
|
||||
"In any country of this Theseus,\n"
|
||||
"And he were caught, it was accorded thus,\n"
|
||||
"That with a sword he shoulde lose his head;\n"
|
||||
"There was none other remedy nor rede*. *counsel\n"
|
||||
"But took his leave, and homeward he him sped;\n"
|
||||
"Let him beware, his necke lieth *to wed*. *in pledge*\n"
|
||||
"\n"
|
||||
"How great a sorrow suff'reth now Arcite!\n"
|
||||
"The death he feeleth through his hearte smite;\n"
|
||||
"He weepeth, waileth, crieth piteously;\n"
|
||||
"To slay himself he waiteth privily.\n"
|
||||
"He said; \"Alas the day that I was born!\n"
|
||||
"Now is my prison worse than beforn:\n"
|
||||
"*Now is me shape* eternally to dwell *it is fixed for me*\n"
|
||||
"Not in purgatory, but right in hell.\n"
|
||||
"Alas! that ever I knew Perithous.\n"
|
||||
"For elles had I dwelt with Theseus\n"
|
||||
"Y-fettered in his prison evermo'.\n"
|
||||
"Then had I been in bliss, and not in woe.\n"
|
||||
"Only the sight of her, whom that I serve,\n"
|
||||
"Though that I never may her grace deserve,\n"
|
||||
"Would have sufficed right enough for me.\n"
|
||||
"O deare cousin Palamon,\" quoth he,\n"
|
||||
"\"Thine is the vict'ry of this aventure,\n"
|
||||
"Full blissfully in prison to endure:\n"
|
||||
"In prison? nay certes, in paradise.\n"
|
||||
"Well hath fortune y-turned thee the dice,\n"
|
||||
"That hast the sight of her, and I th' absence.\n"
|
||||
"For possible is, since thou hast her presence,\n"
|
||||
"And art a knight, a worthy and an able,\n"
|
||||
"That by some cas*, since fortune is changeable, *chance\n"
|
||||
"Thou may'st to thy desire sometime attain.\n"
|
||||
"But I that am exiled, and barren\n"
|
||||
"Of alle grace, and in so great despair,\n"
|
||||
"That there n'is earthe, water, fire, nor air,\n"
|
||||
"Nor creature, that of them maked is,\n"
|
||||
"That may me helpe nor comfort in this,\n"
|
||||
"Well ought I *sterve in wanhope* and distress. *die in despair*\n"
|
||||
"Farewell my life, my lust*, and my gladness. *pleasure\n"
|
||||
"Alas, *why plainen men so in commune *why do men so often complain\n"
|
||||
"Of purveyance of God*, or of Fortune, of God's providence?*\n"
|
||||
"That giveth them full oft in many a guise\n"
|
||||
"Well better than they can themselves devise?\n"
|
||||
"Some man desireth for to have richess,\n"
|
||||
"That cause is of his murder or great sickness.\n"
|
||||
"And some man would out of his prison fain,\n"
|
||||
"That in his house is of his meinie* slain. *servants <16>\n"
|
||||
"Infinite harmes be in this mattere.\n"
|
||||
"We wot never what thing we pray for here.\n"
|
||||
"We fare as he that drunk is as a mouse.\n"
|
||||
"A drunken man wot well he hath an house,\n"
|
||||
"But he wot not which is the right way thither,\n"
|
||||
"And to a drunken man the way is slither*. *slippery\n"
|
||||
"And certes in this world so fare we.\n"
|
||||
"We seeke fast after felicity,\n"
|
||||
"But we go wrong full often truely.\n"
|
||||
"Thus we may sayen all, and namely* I, *especially\n"
|
||||
"That ween'd*, and had a great opinion, *thought\n"
|
||||
"That if I might escape from prison\n"
|
||||
"Then had I been in joy and perfect heal,\n"
|
||||
"Where now I am exiled from my weal.\n"
|
||||
"Since that I may not see you, Emily,\n"
|
||||
"I am but dead; there is no remedy.\"\n"
|
||||
"\n"
|
||||
"Upon that other side, Palamon,\n"
|
||||
"When that he wist Arcita was agone,\n"
|
||||
"Much sorrow maketh, that the greate tower\n"
|
||||
"Resounded of his yelling and clamour\n"
|
||||
"The pure* fetters on his shinnes great *very <17>\n"
|
||||
"Were of his bitter salte teares wet.\n"
|
||||
"\n"
|
||||
"\"Alas!\" quoth he, \"Arcita, cousin mine,\n"
|
||||
"Of all our strife, God wot, the fruit is thine.\n"
|
||||
"Thou walkest now in Thebes at thy large,\n"
|
||||
"And of my woe thou *givest little charge*. *takest little heed*\n"
|
||||
"Thou mayst, since thou hast wisdom and manhead*, *manhood, courage\n"
|
||||
"Assemble all the folk of our kindred,\n"
|
||||
"And make a war so sharp on this country\n"
|
||||
"That by some aventure, or some treaty,\n"
|
||||
"Thou mayst have her to lady and to wife,\n"
|
||||
"For whom that I must needes lose my life.\n"
|
||||
"For as by way of possibility,\n"
|
||||
"Since thou art at thy large, of prison free,\n"
|
||||
"And art a lord, great is thine avantage,\n"
|
||||
"More than is mine, that sterve here in a cage.\n"
|
||||
"For I must weep and wail, while that I live,\n"
|
||||
"With all the woe that prison may me give,\n"
|
||||
"And eke with pain that love me gives also,\n"
|
||||
"That doubles all my torment and my woe.\"\n"
|
||||
"\n"
|
||||
"Therewith the fire of jealousy upstart\n"
|
||||
"Within his breast, and hent* him by the heart *seized\n"
|
||||
"So woodly*, that he like was to behold *madly\n"
|
||||
"The box-tree, or the ashes dead and cold.\n"
|
||||
"Then said; \"O cruel goddess, that govern\n"
|
||||
"This world with binding of your word etern* *eternal\n"
|
||||
"And writen in the table of adamant\n"
|
||||
"Your parlement* and your eternal grant, *consultation\n"
|
||||
"What is mankind more *unto you y-hold* *by you esteemed\n"
|
||||
"Than is the sheep, that rouketh* in the fold! *lie huddled together\n"
|
||||
"For slain is man, right as another beast;\n"
|
||||
"And dwelleth eke in prison and arrest,\n"
|
||||
"And hath sickness, and great adversity,\n"
|
||||
"And oftentimes guilteless, pardie* *by God\n"
|
||||
"What governance is in your prescience,\n"
|
||||
"That guilteless tormenteth innocence?\n"
|
||||
"And yet increaseth this all my penance,\n"
|
||||
"That man is bounden to his observance\n"
|
||||
"For Godde's sake to *letten of his will*, *restrain his desire*\n"
|
||||
"Whereas a beast may all his lust fulfil.\n"
|
||||
"And when a beast is dead, he hath no pain;\n"
|
||||
"But man after his death must weep and plain,\n"
|
||||
"Though in this worlde he have care and woe:\n"
|
||||
"Withoute doubt it maye standen so.\n"
|
||||
"\"The answer of this leave I to divines,\n"
|
||||
"But well I wot, that in this world great pine* is; *pain, trouble\n"
|
||||
"Alas! I see a serpent or a thief\n"
|
||||
"That many a true man hath done mischief,\n"
|
||||
"Go at his large, and where him list may turn.\n"
|
||||
"But I must be in prison through Saturn,\n"
|
||||
"And eke through Juno, jealous and eke wood*, *mad\n"
|
||||
"That hath well nigh destroyed all the blood\n"
|
||||
"Of Thebes, with his waste walles wide.\n"
|
||||
"And Venus slay'th me on that other side\n"
|
||||
"For jealousy, and fear of him, Arcite.\"\n"
|
||||
"\n"
|
||||
"Now will I stent* of Palamon a lite**, *pause **little\n"
|
||||
"And let him in his prison stille dwell,\n"
|
||||
"And of Arcita forth I will you tell.\n"
|
||||
"The summer passeth, and the nightes long\n"
|
||||
"Increase double-wise the paines strong\n"
|
||||
"Both of the lover and the prisonere.\n"
|
||||
"I n'ot* which hath the wofuller mistere**. *know not **condition\n"
|
||||
"For, shortly for to say, this Palamon\n"
|
||||
"Perpetually is damned to prison,\n"
|
||||
"In chaines and in fetters to be dead;\n"
|
||||
"And Arcite is exiled *on his head* *on peril of his head*\n"
|
||||
"For evermore as out of that country,\n"
|
||||
"Nor never more he shall his lady see.\n"
|
||||
"You lovers ask I now this question,<18>\n"
|
||||
"Who lieth the worse, Arcite or Palamon?\n"
|
||||
"The one may see his lady day by day,\n"
|
||||
"But in prison he dwelle must alway.\n"
|
||||
"The other where him list may ride or go,\n"
|
||||
"But see his lady shall he never mo'.\n"
|
||||
"Now deem all as you liste, ye that can,\n"
|
||||
"For I will tell you forth as I began.\n"
|
||||
"\n"
|
||||
"When that Arcite to Thebes comen was,\n"
|
||||
"Full oft a day he swelt*, and said, \"Alas!\" *fainted\n"
|
||||
"For see this lady he shall never mo'.\n"
|
||||
"And shortly to concluden all his woe,\n"
|
||||
"So much sorrow had never creature\n"
|
||||
"That is or shall be while the world may dure.\n"
|
||||
"His sleep, his meat, his drink is *him byraft*, *taken away from him*\n"
|
||||
"That lean he wex*, and dry as any shaft. *became\n"
|
||||
"His eyen hollow, grisly to behold,\n"
|
||||
"His hue sallow, and pale as ashes cold,\n"
|
||||
"And solitary he was, ever alone,\n"
|
||||
"And wailing all the night, making his moan.\n"
|
||||
"And if he hearde song or instrument,\n"
|
||||
"Then would he weepen, he might not be stent*. *stopped\n"
|
||||
"So feeble were his spirits, and so low,\n"
|
||||
"And changed so, that no man coulde know\n"
|
||||
"His speech, neither his voice, though men it heard.\n"
|
||||
"And in his gear* for all the world he far'd *behaviour <19>\n"
|
||||
"Not only like the lovers' malady\n"
|
||||
"Of Eros, but rather y-like manie* *madness\n"
|
||||
"Engender'd of humours melancholic,\n"
|
||||
"Before his head in his cell fantastic.<20>\n"
|
||||
"And shortly turned was all upside down,\n"
|
||||
"Both habit and eke dispositioun,\n"
|
||||
"Of him, this woful lover Dan* Arcite. *Lord <21>\n"
|
||||
"Why should I all day of his woe indite?\n"
|
||||
"When he endured had a year or two\n"
|
||||
"This cruel torment, and this pain and woe,\n"
|
||||
"At Thebes, in his country, as I said,\n"
|
||||
"Upon a night in sleep as he him laid,\n"
|
||||
"Him thought how that the winged god Mercury\n"
|
||||
"Before him stood, and bade him to be merry.\n"
|
||||
"His sleepy yard* in hand he bare upright; *rod <22>\n"
|
||||
"A hat he wore upon his haires bright.\n"
|
||||
"Arrayed was this god (as he took keep*) *notice\n"
|
||||
"As he was when that Argus<23> took his sleep;\n"
|
||||
"And said him thus: \"To Athens shalt thou wend*; *go\n"
|
||||
"There is thee shapen* of thy woe an end.\" *fixed, prepared\n"
|
||||
"And with that word Arcite woke and start.\n"
|
||||
"\"Now truely how sore that e'er me smart,\"\n"
|
||||
"Quoth he, \"to Athens right now will I fare.\n"
|
||||
"Nor for no dread of death shall I not spare\n"
|
||||
"To see my lady that I love and serve;\n"
|
||||
"In her presence *I recke not to sterve.*\" *do not care if I die*\n"
|
||||
"And with that word he caught a great mirror,\n"
|
||||
"And saw that changed was all his colour,\n"
|
||||
"And saw his visage all in other kind.\n"
|
||||
"And right anon it ran him ill his mind,\n"
|
||||
"That since his face was so disfigur'd\n"
|
||||
"Of malady the which he had endur'd,\n"
|
||||
"He mighte well, if that he *bare him low,* *lived in lowly fashion*\n"
|
||||
"Live in Athenes evermore unknow,\n"
|
||||
"And see his lady wellnigh day by day.\n"
|
||||
"And right anon he changed his array,\n"
|
||||
"And clad him as a poore labourer.\n"
|
||||
"And all alone, save only a squier,\n"
|
||||
"That knew his privity* and all his cas**, *secrets **fortune\n"
|
||||
"Which was disguised poorly as he was,\n"
|
||||
"To Athens is he gone the nexte* way. *nearest <24>\n"
|
||||
"And to the court he went upon a day,\n"
|
||||
"And at the gate he proffer'd his service,\n"
|
||||
"To drudge and draw, what so men would devise*. *order\n"
|
||||
"And, shortly of this matter for to sayn,\n"
|
||||
"He fell in office with a chamberlain,\n"
|
||||
"The which that dwelling was with Emily.\n"
|
||||
"For he was wise, and coulde soon espy\n"
|
||||
"Of every servant which that served her.\n"
|
||||
"Well could he hewe wood, and water bear,\n"
|
||||
"For he was young and mighty for the nones*, *occasion\n"
|
||||
"And thereto he was strong and big of bones\n"
|
||||
"To do that any wight can him devise.\n"
|
||||
"\n"
|
||||
"A year or two he was in this service,\n"
|
||||
"Page of the chamber of Emily the bright;\n"
|
||||
"And Philostrate he saide that he hight.\n"
|
||||
"But half so well belov'd a man as he\n"
|
||||
"Ne was there never in court of his degree.\n"
|
||||
"He was so gentle of conditioun,\n"
|
||||
"That throughout all the court was his renown.\n"
|
||||
"They saide that it were a charity\n"
|
||||
"That Theseus would *enhance his degree*, *elevate him in rank*\n"
|
||||
"And put him in some worshipful service,\n"
|
||||
"There as he might his virtue exercise.\n"
|
||||
"And thus within a while his name sprung\n"
|
||||
"Both of his deedes, and of his good tongue,\n"
|
||||
"That Theseus hath taken him so near,\n"
|
||||
"That of his chamber he hath made him squire,\n"
|
||||
"And gave him gold to maintain his degree;\n"
|
||||
"And eke men brought him out of his country\n"
|
||||
"From year to year full privily his rent.\n"
|
||||
"But honestly and slyly* he it spent, *discreetly, prudently\n"
|
||||
"That no man wonder'd how that he it had.\n"
|
||||
"And three year in this wise his life be lad*, *led\n"
|
||||
"And bare him so in peace and eke in werre*, *war\n"
|
||||
"There was no man that Theseus had so derre*. *dear\n"
|
||||
"And in this blisse leave I now Arcite,\n"
|
||||
"And speak I will of Palamon a lite*. *little\n"
|
||||
"\n"
|
||||
"In darkness horrible, and strong prison,\n"
|
||||
"This seven year hath sitten Palamon,\n"
|
||||
"Forpined*, what for love, and for distress. *pined, wasted away\n"
|
||||
"Who feeleth double sorrow and heaviness\n"
|
||||
"But Palamon? that love distraineth* so, *afflicts\n"
|
||||
"That wood* out of his wits he went for woe, *mad\n"
|
||||
"And eke thereto he is a prisonere\n"
|
||||
"Perpetual, not only for a year.\n"
|
||||
"Who coulde rhyme in English properly\n"
|
||||
"His martyrdom? forsooth*, it is not I; *truly\n"
|
||||
"Therefore I pass as lightly as I may.\n"
|
||||
"It fell that in the seventh year, in May\n"
|
||||
"The thirde night (as olde bookes sayn,\n"
|
||||
"That all this story tellen more plain),\n"
|
||||
"Were it by a venture or destiny\n"
|
||||
"(As when a thing is shapen* it shall be), *settled, decreed\n"
|
||||
"That soon after the midnight, Palamon\n"
|
||||
"By helping of a friend brake his prison,\n"
|
||||
"And fled the city fast as he might go,\n"
|
||||
"For he had given drink his gaoler so\n"
|
||||
"Of a clary <25>, made of a certain wine,\n"
|
||||
"With *narcotise and opie* of Thebes fine, *narcotics and opium*\n"
|
||||
"That all the night, though that men would him shake,\n"
|
||||
"The gaoler slept, he mighte not awake:\n"
|
||||
"And thus he fled as fast as ever he may.\n"
|
||||
"The night was short, and *faste by the day *close at hand was\n"
|
||||
"That needes cast he must himself to hide*. the day during which\n"
|
||||
"And to a grove faste there beside he must cast about, or contrive,\n"
|
||||
"With dreadful foot then stalked Palamon. to conceal himself.*\n"
|
||||
"For shortly this was his opinion,\n"
|
||||
"That in the grove he would him hide all day,\n"
|
||||
"And in the night then would he take his way\n"
|
||||
"To Thebes-ward, his friendes for to pray\n"
|
||||
"On Theseus to help him to warray*. *make war <26>\n"
|
||||
"And shortly either he would lose his life,\n"
|
||||
"Or winnen Emily unto his wife.\n"
|
||||
"This is th' effect, and his intention plain.\n"
|
||||
"\n"
|
||||
"Now will I turn to Arcita again,\n"
|
||||
"That little wist how nighe was his care,\n"
|
||||
"Till that Fortune had brought him in the snare.\n"
|
||||
"The busy lark, the messenger of day,\n"
|
||||
"Saluteth in her song the morning gray;\n"
|
||||
};
|
||||
|
||||
void setup() {
|
||||
int i=0;
|
||||
uint8_t c;
|
||||
Serial.begin(115200);
|
||||
do {
|
||||
c = pgm_read_byte(knightsTale+i);
|
||||
if (c) Serial.write(c);
|
||||
i++;
|
||||
} while (c);
|
||||
}
|
||||
void loop() {
|
||||
}
|
1335
ActualOptiboot/optiboot/examples/chaucer64k/chaucer64k.ino
Normal file
1335
ActualOptiboot/optiboot/examples/chaucer64k/chaucer64k.ino
Normal file
File diff suppressed because it is too large
Load Diff
26
ActualOptiboot/optiboot/examples/eeprom_data.c
Normal file
26
ActualOptiboot/optiboot/examples/eeprom_data.c
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* This short C progam creates a .elf file with EEPROM contents that
|
||||
* can be extracted to form a .hex file for testing EEPROM upload/downloads
|
||||
* via the bootloader.
|
||||
*
|
||||
* Compile with:
|
||||
* avr-gcc -mmcu=atmega328p eeprom_data.c -o eeprom_data.elf
|
||||
* avr-objcopy -j .eeprom --change-section-lma .eeprom=0 -O ihex eeprom_data.elf eeprom_data.hex
|
||||
* Upload with:
|
||||
* avrdude ... -U eeprom:w:eeprom_data.hex
|
||||
*/
|
||||
#include <avr/io.h>
|
||||
#include <avr/eeprom.h>
|
||||
|
||||
#define zero16 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0
|
||||
#define zero32 zero16, zero16
|
||||
|
||||
const EEMEM unsigned long longs[32] = {0x12345678, 0x9abcdef0, 0x11223344, 0, 0xdeadbeef, zero16, 0xdecade, 0x78563412};
|
||||
const EEMEM unsigned int integers[64] = {0x1234, 0x5678, 0x9ABC, 0, 0, 0, 1, 2 , zero32, 0xAB90, 0x3412};
|
||||
const EEMEM char characters[128] = "test 1 2 3 4 5 6 7 8 9 0" " "
|
||||
"more testing abcdefghijklmnop";
|
||||
|
||||
|
||||
int main() {}
|
||||
|
||||
|
173
ActualOptiboot/optiboot/examples/hex-with-FFs.hex
Normal file
173
ActualOptiboot/optiboot/examples/hex-with-FFs.hex
Normal file
@ -0,0 +1,173 @@
|
||||
:100000000C9474000C949C000C949C000C949C0028
|
||||
:100010000C949C000C949C000C949C000C949C00F0
|
||||
:100020000C949C000C949C000C949C000C949C00E0
|
||||
:100030000C949C000C949C000C949C000C949C00D0
|
||||
:100040000C94E7020C949C000C9457030C9431031D
|
||||
:100050000C949C000C949C000C949C000C949C00B0
|
||||
:100060000C949C000C949C000000000024002700CD
|
||||
:100070002A0000000000250028002B0004040404CE
|
||||
:100080000404040402020202020203030303030342
|
||||
:10009000010204081020408001020408102001021F
|
||||
:1000A00004081020746869732069732061207465E6
|
||||
:1000B0007374206F66206D616B696E672073757253
|
||||
:1000C000652064617461206D616B657320697420C3
|
||||
:1000D000696E746F20746865207465787420736528
|
||||
:1000E000676D656E7400F60311241FBECFEFD8E074
|
||||
:1000F000DEBFCDBF11E0A0E0B1E0E8EBFAE002C066
|
||||
:1001000005900D92A231B107D9F721E0A2E1B1E04B
|
||||
:1001100001C01D92A83BB207E1F710E0C4E7D0E0B0
|
||||
:1001200004C02197FE010E942304C337D107C9F7F9
|
||||
:100130000E9489030C942E040C940000FFFFFFFF23
|
||||
:10014000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBF
|
||||
:10015000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAF
|
||||
:10016000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9F
|
||||
:10017000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8F
|
||||
:10018000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7F
|
||||
:10019000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6F
|
||||
:1001A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5F
|
||||
:1001B000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4F
|
||||
:1001C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F
|
||||
:1001D000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2F
|
||||
:1001E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1F
|
||||
:1001F000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0F
|
||||
:10020000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
|
||||
:10021000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEE
|
||||
:10022000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDE
|
||||
:10023000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCE
|
||||
:10024000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBE
|
||||
:10025000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAE
|
||||
:10026000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9E
|
||||
:10027000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8E
|
||||
:10028000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7E
|
||||
:10029000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6E
|
||||
:1002A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5E
|
||||
:1002B000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4E
|
||||
:1002C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3E
|
||||
:1002D000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2E
|
||||
:1002E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1E
|
||||
:1002F000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0E
|
||||
:10030000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD
|
||||
:10031000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFED
|
||||
:10032000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDD
|
||||
:10033000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCD
|
||||
:10034000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBD
|
||||
:10035000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAD
|
||||
:10036000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9D
|
||||
:10037000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8D
|
||||
:10038000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7D
|
||||
:10039000FFFFFFFFFC01538D448D252F30E0842F9C
|
||||
:1003A00090E0821B930B541710F0CF96089501979D
|
||||
:1003B0000895FC01918D828D981761F0828DDF0187
|
||||
:1003C000A80FB11D5D968C91928D9F5F9F73928F48
|
||||
:1003D00090E008958FEF9FEF0895FC01918D828D3D
|
||||
:1003E000981731F0828DE80FF11D858D90E008950A
|
||||
:1003F0008FEF9FEF0895FC01918D228D892F90E062
|
||||
:10040000805C9F4F821B91098F7399270895FC018F
|
||||
:10041000848DDF01A80FB11DA35ABF4F2C91848D8D
|
||||
:1004200090E001968F739927848FA689B7892C93C2
|
||||
:10043000A089B1898C9180648C93938D848D98135D
|
||||
:1004400006C00288F389E02D80818F7D8083089526
|
||||
:10045000EF92FF920F931F93CF93DF93EC0181E014
|
||||
:10046000888F9B8D8C8D981305C0E889F9898081D0
|
||||
:1004700085FD24C0F62E0B8D10E00F5F1F4F0F730C
|
||||
:100480001127E02E8C8DE8120CC00FB607FCFACFB6
|
||||
:10049000E889F989808185FFF5CFCE010E940702A6
|
||||
:1004A000F1CF8B8DFE01E80FF11DE35AFF4FF08273
|
||||
:1004B0000B8FEA89FB898081806207C0EE89FF8902
|
||||
:1004C0006083E889F98980818064808381E090E09D
|
||||
:1004D000DF91CF911F910F91FF90EF900895CF93EF
|
||||
:1004E000DF93EC01888D8823C9F0EA89FB8980813C
|
||||
:1004F00085FD05C0A889B9898C9186FD0FC00FB60E
|
||||
:1005000007FCF5CF808185FFF2CFA889B9898C914E
|
||||
:1005100085FFEDCFCE010E940702E7CFDF91CF919B
|
||||
:1005200008958BE191E00E94FB0121E0892B09F401
|
||||
:1005300020E0822F089580E090E0892B29F00E942E
|
||||
:10054000910281110C9400000895CF92DF92EF92F6
|
||||
:10055000FF920F931F93CF93DF936C017A018B016E
|
||||
:10056000C0E0D0E0CE15DF0581F0D8016D918D019E
|
||||
:10057000D601ED91FC910190F081E02DC601099525
|
||||
:10058000892B11F02196EECF7E01C701DF91CF912B
|
||||
:100590001F910F91FF90EF90DF90CF9008950895F5
|
||||
:1005A00080E090E00895009769F0FC010190002040
|
||||
:1005B000E9F73197AF01481B590BBC018BE191E082
|
||||
:1005C0000C94A50280E090E008950E9429041F92F7
|
||||
:1005D0000F920FB60F9211242F933F938F939F93F7
|
||||
:1005E000AF93BF938091170190911801A0911901C9
|
||||
:1005F000B0911A013091160123E0230F2D3720F41A
|
||||
:100600000196A11DB11D05C026E8230F0296A11D6C
|
||||
:10061000B11D209316018093170190931801A093A8
|
||||
:100620001901B0931A018091120190911301A091C8
|
||||
:100630001401B09115010196A11DB11D8093120105
|
||||
:1006400090931301A0931401B0931501BF91AF9142
|
||||
:100650009F918F913F912F910F900FBE0F901F9000
|
||||
:1006600018951F920F920FB60F9211242F933F935C
|
||||
:100670004F935F936F937F938F939F93AF93BF93AA
|
||||
:10068000EF93FF938BE191E00E940702FF91EF91BE
|
||||
:10069000BF91AF919F918F917F916F915F914F919A
|
||||
:1006A0003F912F910F900FBE0F901F9018951F92A2
|
||||
:1006B0000F920FB60F9211242F938F939F93EF9366
|
||||
:1006C000FF93E0912B01F0912C018081E0913101A9
|
||||
:1006D000F091320182FD12C09081809134018F5FD0
|
||||
:1006E0008F7320913501821751F0E0913401F0E0D1
|
||||
:1006F000E55EFE4F958F8093340101C08081FF91AC
|
||||
:10070000EF919F918F912F910F900FBE0F901F909F
|
||||
:100710001895789484B5826084BD84B5816084BD69
|
||||
:1007200085B5826085BD85B5816085BD80916E008F
|
||||
:10073000816080936E0010928100809181008260C0
|
||||
:1007400080938100809181008160809381008091FD
|
||||
:1007500080008160809380008091B10084608093EC
|
||||
:10076000B1008091B00081608093B00080917A00E8
|
||||
:10077000846080937A0080917A00826080937A000E
|
||||
:1007800080917A00816080937A0080917A008068FD
|
||||
:1007900080937A001092C100EDE9F0E02491E9E83D
|
||||
:1007A000F0E08491882399F090E0880F991FFC0174
|
||||
:1007B000E859FF4FA591B491FC01EE58FF4F859188
|
||||
:1007C00094918FB7F894EC91E22BEC938FBF84EA6D
|
||||
:1007D00090E00E94D3028CE391E00E94D3028CE56A
|
||||
:1007E00098E00E94D3020E949B02FDCFEBE1F1E072
|
||||
:1007F0001382128288EE93E0A0E0B0E084839583B8
|
||||
:10080000A683B78384E091E09183808385EC90E0B8
|
||||
:100810009587848784EC90E09787868780EC90E0CA
|
||||
:10082000918B808B81EC90E0938B828B82EC90E0BB
|
||||
:10083000958B848B86EC90E0978B868B118E128E35
|
||||
:10084000138E148E0895EE0FFF1F0590F491E02D86
|
||||
:10085000099481E090E0F8940C942E04FFFFFFFFD0
|
||||
:10086000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF98
|
||||
:10087000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF88
|
||||
:10088000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF78
|
||||
:10089000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF68
|
||||
:1008A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF58
|
||||
:1008B000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF48
|
||||
:1008C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF38
|
||||
:1008D000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF28
|
||||
:1008E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF18
|
||||
:1008F000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF08
|
||||
:10090000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7
|
||||
:10091000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE7
|
||||
:10092000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD7
|
||||
:10093000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7
|
||||
:10094000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB7
|
||||
:10095000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA7
|
||||
:10096000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF97
|
||||
:10097000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF87
|
||||
:10098000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF77
|
||||
:10099000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF67
|
||||
:1009A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF57
|
||||
:1009B000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF47
|
||||
:1009C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF37
|
||||
:1009D000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF27
|
||||
:1009E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF17
|
||||
:1009F000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF07
|
||||
:100A0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6
|
||||
:100A1000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE6
|
||||
:100A2000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD6
|
||||
:100A3000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC6
|
||||
:100A4000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB6
|
||||
:100A5000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA6
|
||||
:100A6000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF96
|
||||
:100A7000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF86
|
||||
:100A8000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF76
|
||||
:100A9000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF66
|
||||
:100AA000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF56
|
||||
:020AC800ED013E
|
||||
:00000001FF
|
107
ActualOptiboot/optiboot/examples/test_eeprom/test_eeprom.ino
Normal file
107
ActualOptiboot/optiboot/examples/test_eeprom/test_eeprom.ino
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
EEPROM test program with more features.
|
||||
*/
|
||||
|
||||
#include <EEPROM.h>
|
||||
|
||||
void setup() {
|
||||
// initialize the LED pin as an output.
|
||||
pinMode(13, OUTPUT);
|
||||
Serial.begin(115200);
|
||||
Serial.println("EEPROM test program.\n"
|
||||
"Enter one of (C)lear, (E)rase, (I)incrementing, (U)p&Down, (0)check,\n"
|
||||
"(D)ump, (F)check, (T)inccheck");
|
||||
|
||||
}
|
||||
|
||||
void hex2(uint8_t n) {
|
||||
if (n <= 15)
|
||||
Serial.write('0');
|
||||
Serial.print(n, HEX);
|
||||
Serial.write(' ');
|
||||
}
|
||||
|
||||
void print16(uint8_t *buf) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
hex2(buf[i]);
|
||||
}
|
||||
Serial.print(" ");
|
||||
for (int i = 0; i < 16; i++) {
|
||||
uint8_t c = buf[i];
|
||||
if (c < 32 || c > 126)
|
||||
Serial.write('.');
|
||||
else
|
||||
Serial.write(c);
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
void dump16(uint16_t addr) {
|
||||
struct {
|
||||
uint8_t buf[16];
|
||||
} s;
|
||||
|
||||
EEPROM.get(addr, s);
|
||||
print16(s.buf);
|
||||
}
|
||||
|
||||
|
||||
int cmd = -1;
|
||||
void loop() {
|
||||
uint16_t i;
|
||||
do {
|
||||
cmd = Serial.read();
|
||||
} while (cmd < 0);
|
||||
|
||||
switch (cmd & ~('a' - 'A')) {
|
||||
case 'C':
|
||||
for (i = 0 ; i < EEPROM.length() ; i++) {
|
||||
EEPROM.write(i, 0);
|
||||
}
|
||||
break;
|
||||
case 'D':
|
||||
Serial.println("EEPROM Dump\n");
|
||||
for (i = 0; i < EEPROM.length(); i += 16) {
|
||||
Serial.print(i, HEX);
|
||||
Serial.print(": ");
|
||||
dump16(i);
|
||||
}
|
||||
Serial.println();
|
||||
break;
|
||||
case 'E':
|
||||
for (i = 0 ; i < EEPROM.length() ; i++) {
|
||||
EEPROM.write(i, 0xFF);
|
||||
}
|
||||
break;
|
||||
case 'I':
|
||||
for (i = 0 ; i < EEPROM.length() ; i++) {
|
||||
EEPROM.write(i, i & 0xFF);
|
||||
}
|
||||
break;
|
||||
case 'U':
|
||||
for (i = 0 ; i < EEPROM.length() ; i++) {
|
||||
if ((i & 0x100) == 0) {
|
||||
EEPROM.write(i, i & 0xFF);
|
||||
} else {
|
||||
EEPROM.write(i, 255 - (i & 0xFF));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
Serial.println("EEPROM test program.\n"
|
||||
"Enter one of (C)lear, (E)rase, (I)incrementing, (0)check,\n"
|
||||
"(D)ump, (F)check, (T)inccheck");
|
||||
// Fall through
|
||||
case '\n':
|
||||
case '\r':
|
||||
break;
|
||||
default:
|
||||
Serial.print("unrecognized command ");
|
||||
Serial.println(cmd);
|
||||
break;
|
||||
// turn the LED on when we're done
|
||||
digitalWrite(13, HIGH);
|
||||
}
|
||||
}
|
||||
|
||||
|
137
ActualOptiboot/optiboot/examples/test_reset/test_reset.ino
Normal file
137
ActualOptiboot/optiboot/examples/test_reset/test_reset.ino
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
test_reset
|
||||
May 2015 by Bill Westfield (WestfW)
|
||||
Released to the public domain.
|
||||
|
||||
This sketch demonstrates retrival of the Reset Cause register (MCUSR) of the AVR.
|
||||
Normally, MCUSR itself is destroyed by the use of a bootloader, but Optiboot v4.6
|
||||
and later save the contents in register r2, where it can be accessed by an
|
||||
application.
|
||||
*/
|
||||
#include <avr/wdt.h>
|
||||
#if defined (__AVR_ATmega328P__) || defined (__AVR_ATmega168__)
|
||||
#include <LowPower.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
First, we need a variable to hold the reset cause that can be written before
|
||||
early sketch initialization (that might change r2), and won't be reset by the
|
||||
various initialization code.
|
||||
avr-gcc provides for this via the ".noinit" section.
|
||||
*/
|
||||
uint8_t resetFlag __attribute__ ((section(".noinit")));
|
||||
|
||||
/*
|
||||
Next, we need to put some code to save reset cause from the bootload (in r2)
|
||||
to the variable. Again, avr-gcc provides special code sections for this.
|
||||
If compiled with link time optimization (-flto), as done by the Arduno
|
||||
IDE version 1.6 and higher, we need the "used" attribute to prevent this
|
||||
from being omitted.
|
||||
*/
|
||||
void resetFlagsInit(void) __attribute__ ((naked))
|
||||
__attribute__ ((used))
|
||||
__attribute__ ((section (".init0")));
|
||||
void resetFlagsInit(void)
|
||||
{
|
||||
/*
|
||||
save the reset flags passed from the bootloader
|
||||
This is a "simple" matter of storing (STS) r2 in the special variable
|
||||
that we have created. We use assembler to access the right variable.
|
||||
*/
|
||||
__asm__ __volatile__ ("sts %0, r2\n" : "=m" (resetFlag) :);
|
||||
}
|
||||
|
||||
void printReset(const char *label, uint8_t resetFlags)
|
||||
{
|
||||
Serial.print(label);
|
||||
Serial.print(resetFlags, HEX);
|
||||
/*
|
||||
check for the usual bits. Note that the symnbols defined in wdt.h are
|
||||
bit numbers, so they have to be shifted before comparison.
|
||||
*/
|
||||
if (resetFlags & (1 << WDRF))
|
||||
{
|
||||
Serial.print(F(" Watchdog"));
|
||||
resetFlags &= ~(1 << WDRF);
|
||||
}
|
||||
if (resetFlags & (1 << BORF))
|
||||
{
|
||||
Serial.print(F(" Brownout"));
|
||||
resetFlags &= ~(1 << BORF);
|
||||
}
|
||||
if (resetFlags & (1 << EXTRF))
|
||||
{
|
||||
Serial.print(F(" External"));
|
||||
resetFlags &= ~(1 << EXTRF);
|
||||
}
|
||||
if (resetFlags & (1 << PORF))
|
||||
{
|
||||
Serial.print(F(" PowerOn"));
|
||||
resetFlags &= ~(1 << PORF);
|
||||
}
|
||||
if (resetFlags != 0x00)
|
||||
{
|
||||
// It should never enter here
|
||||
Serial.print(" Unknown");
|
||||
}
|
||||
Serial.println("");
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600); // Initialize serial port
|
||||
|
||||
Serial.println(F("Reset flag test\n"));
|
||||
|
||||
printReset("Actual MCUSR content: 0x", MCUSR);
|
||||
printReset("Passed in R2: 0x", resetFlag);
|
||||
#ifdef GPIOR0
|
||||
printReset("Passed in GPIOR0: 0x", GPIOR0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void loop() {
|
||||
int ch;
|
||||
Serial.println(F("\nSend 0-9 to set MCUSR, (W)atchdog enable, (J)mp to bootload, (S)leep"));
|
||||
while ((ch = Serial.read()) < 0) ;
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
MCUSR = ch & 0xF;
|
||||
printReset("\nNew MCUSR content: 0x", MCUSR);
|
||||
} else
|
||||
switch (ch & ~('a' - 'A')) {
|
||||
|
||||
case 'W':
|
||||
wdt_enable(WDTO_15MS);
|
||||
while (1); // To prevent the loop to start again before WDT resets the board
|
||||
break;
|
||||
case 'S':
|
||||
#if defined (__AVR_ATmega328P__) || defined (__AVR_ATmega168__)
|
||||
// Enter power down state for 8 s with ADC and BOD module disabled
|
||||
Serial.println(F("Low Power Sleep Mode"));
|
||||
Serial.flush();
|
||||
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
|
||||
Serial.println(F("Sleep Wakeup"));
|
||||
Serial.flush();
|
||||
#else
|
||||
Serial.print(F("\nPower down not supported on this CPU\n"));
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
/* Figure out where the bootloader starts. */
|
||||
#if FLASHEND > 140000
|
||||
Serial.println(F("Jump to bootloader not supported on chips with >128k memory"));
|
||||
#else
|
||||
typedef void (*do_reboot_t)(void);
|
||||
const do_reboot_t do_reboot = (do_reboot_t)((FLASHEND - 511) >> 1);
|
||||
|
||||
Serial.print("bootstart = ");
|
||||
Serial.println((unsigned int)do_reboot, HEX);
|
||||
Serial.flush();
|
||||
cli(); TCCR0A = TCCR1A = TCCR2A = 0; // make sure interrupts are off and timers are reset.
|
||||
do_reboot();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,56 @@
|
||||
# Template file for generating the .json file that the Arduino IDE
|
||||
# "Boards Manager" wants to see. This file must be pre-processed
|
||||
# before it will be valid:
|
||||
# Strip comments.
|
||||
# Replace variables:
|
||||
# %VERSION% gets the Optiboot Version
|
||||
# %HASH% gets the SHA-256 has for the .zip file.
|
||||
# (generate with: openssl dgst -sha256 optiboot.zip | sed -e 's/.* //'
|
||||
# %SIZE% gets the size of the .zip file
|
||||
#
|
||||
{
|
||||
"packages": [
|
||||
{
|
||||
"name": "Optiboot",
|
||||
"maintainer": "westfw",
|
||||
"websiteURL": "https://github.com/Optiboot/optiboot",
|
||||
"email": "",
|
||||
"help": {
|
||||
"online": ""
|
||||
},
|
||||
"platforms": [
|
||||
{
|
||||
"name": "Optiboot %VERSION%",
|
||||
"architecture": "avr",
|
||||
"version": "0.%VERSION%",
|
||||
#
|
||||
# 3r party packages must use "Contributed"
|
||||
#
|
||||
"category": "Contributed",
|
||||
"help": {
|
||||
"online": "https://github.com/Optiboot/optiboot/wiki"
|
||||
},
|
||||
"url": "https://github.com/Optiboot/optiboot/releases/download/v%VERSION%/Optiboot%VERSION%.zip",
|
||||
"archiveFileName": "optiboot%VERSION%.zip",
|
||||
#
|
||||
# Package file verification data
|
||||
#
|
||||
"checksum": "SHA-256:%HASH%",
|
||||
"size": "%SIZE%",
|
||||
#
|
||||
"boards": [
|
||||
{"name": "New Optiboot"}
|
||||
],
|
||||
"toolsDependencies": [
|
||||
{
|
||||
"packager": "arduino",
|
||||
"name": "avrdude",
|
||||
"version": "6.0.1-arduino5"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tools": []
|
||||
}
|
||||
]
|
||||
}
|
75
ActualOptiboot/optiboot/release.sh
Normal file
75
ActualOptiboot/optiboot/release.sh
Normal file
@ -0,0 +1,75 @@
|
||||
#%/bin/bash
|
||||
#
|
||||
# Use like: "sh release.sh <versionno>"
|
||||
#
|
||||
# Build a "release" .zip file for Optiboot bootloader
|
||||
# Run from the build directory
|
||||
|
||||
# Uncomment if you want a clean builds of specific files
|
||||
# make clean
|
||||
# make atmega328
|
||||
# make atmega168
|
||||
# make atmega8
|
||||
|
||||
rm -Rf /tmp/optiboot-release
|
||||
|
||||
#
|
||||
# Create the 3rd-party hardware extension directory structure
|
||||
# Note that the structure under "packages" (handed by boards manager)
|
||||
# is different than the structure under "sketchbook/hardware" would be.
|
||||
|
||||
TOP=/tmp/optiboot-release/Optiboot$1/
|
||||
#
|
||||
# Bootloaders directory
|
||||
mkdir -p $TOP/bootloaders/optiboot
|
||||
# cores, variants, libraries
|
||||
# mkdir -p $TOP/variants/
|
||||
mkdir -p $TOP/libraries/
|
||||
# Less common: firmware, system.
|
||||
# mkdir -p $TOP/firmwares/
|
||||
# mkdir -p $TOP/system/
|
||||
|
||||
#
|
||||
# Copy files from whereever into the release directory
|
||||
cp ../../boards-1.6.txt $TOP/boards.txt
|
||||
#cp -R ../../examples $TOP/libraries/
|
||||
#cp -R ../../variants $TOP/
|
||||
#cp -R ../../system $TOP/
|
||||
|
||||
#
|
||||
# Create platform.txt, because it contains the "group" name for the boards menu
|
||||
echo name=Optiboot $1 > $TOP/platform.txt
|
||||
echo version=$1 >> $TOP/platform.txt
|
||||
|
||||
#
|
||||
# Create a README file.
|
||||
echo This is an Optiboot version $1 \"Binary\" Release. > $TOP/README.TXT
|
||||
echo >> $TOP/README.TXT
|
||||
echo For Source code see http://github.com/Optiboot/optiboot>> $TOP/README.TXT
|
||||
|
||||
#
|
||||
# Copy over our "binaries."
|
||||
cp *.hex $TOP/bootloaders/optiboot
|
||||
|
||||
#
|
||||
# Copy examples ? (examples for a boards.txt don't seem possible?)
|
||||
|
||||
|
||||
# files we'd specifical exclude, if we weren't doing only .hex files.
|
||||
#rm /tmp/optiboot-release/Optiboot/avr/bootloaders/optiboot/*.lst
|
||||
#rm /tmp/optiboot-release/Optiboot/avr/bootloaders/optiboot/*~
|
||||
#rm /tmp/optiboot-release/Optiboot/avr/bootloaders/optiboot/#*
|
||||
|
||||
#
|
||||
# zip everything up.
|
||||
pushd /tmp/optiboot-release
|
||||
zip -r Optiboot$1.zip Optiboot$1
|
||||
HASH=`openssl dgst -sha256 Optiboot$1.zip | sed -e 's/.* //'`
|
||||
SIZE=`stat -f %z Optiboot$1.zip`
|
||||
popd
|
||||
sed -e "s/#.*//" -e "s/%HASH%/$HASH/g" -e "s/%VERSION%/$1/g" -e "s/%SIZE%/$SIZE/g" ../../package_optiboot_optiboot-additional_index.json.TEMPLATE > /tmp/optiboot-release/package_optiboot_optiboot-additional_index.json
|
||||
|
||||
#
|
||||
# This leaves the .zip and the .json file in /tmp/optiboot-release
|
||||
# where it can be copied to a suitable network location.
|
||||
|
Reference in New Issue
Block a user