Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the EspFirmwareFlasher #8

Merged
merged 2 commits into from
May 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions EspFirmwareFlasher/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!-- ********************************** -->
<!-- ESP32 / ESP8266 tool configuration -->
<!-- ********************************** -->
<!-- default ESP chip type; ESP32 and ESP8266 are allowed -->
<!--<add key="DefaultEspChipType" value="ESP32"/>-->
<!-- default serial port if nothing is delivered via command line argument -->
<!--<add key="DefaultSerialPort" value="COM1"/>-->
<!-- default baudrate for the serial port if nothing is delivered via command line argument -->
<!--<add key="DefaultBaudRate" value="921600"/>-->
<!-- default flash mode if nothing is delivered via command line argument -->
<!-- See https://github.com/espressif/esptool#flash-modes for more details -->
<!--<add key="DefaultFlashMode" value="dio"/>-->
<!-- default flash frequency if nothing is delivered via command line argument -->
<!-- See https://github.com/espressif/esptool#flash-modes for more details -->
<!--<add key="DefaultFlashFrequency" value="40m"/>-->

<!-- ******************************* -->
<!-- Firmware download configuration -->
<!-- ******************************* -->
<!-- default firmware type -->
<!--<add key="DefaultFirmwareType" value="nanoClr"/>-->
<!-- default download location on bintray.com -->
<!--<add key="DefaultDownloadSource" value="https://bintray.com/nfbot/nanoframework-images-dev"/>-->
<!-- default board type for the firmware download -->
<!--<add key="DefaultBoardType" value="ESP32_DEVKITC"/>-->
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
44 changes: 44 additions & 0 deletions EspFirmwareFlasher/CreateEspToolZip.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Tast for creating the esptool.zip -->
<UsingTask
TaskName="CreateEspToolZip"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
<ParameterGroup />
<Task>
<Reference Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.IO.Compression.FileSystem.dll"/>
<Using Namespace="System.Diagnostics"/>
<Using Namespace="System.IO"/>
<Using Namespace="System.IO.Compression"/>
<Code Type="Fragment" Language="cs">
<![CDATA[
// don't recreate esptool.zip if it's allready there
if (File.Exists("esptool.zip"))
{
Log.LogMessage(MessageImportance.High, "The esptool.zip is already there and will not be recreated.");
return _Success;
}

// delete obj\esptool-python if it's already there
Log.LogMessage(MessageImportance.High, "Creating esptool.zip ...");
if (Directory.Exists(@"obj\esptool-python"))
{
Directory.Delete(@"obj\esptool-python", true);
}

// install esptool via pip into obj\esptool-python
Process process = Process.Start("pip", @"install --target=obj\esptool-python esptool");
process.WaitForExit();

// create a package that can run without python via PyInstaller
process = Process.Start("pyinstaller", @"--distpath obj\esptool-python\dist --workpath obj\esptool-python\build --specpath obj\esptool-python obj\esptool-python\esptool.py");
process.WaitForExit();

// create a zip file from the package
ZipFile.CreateFromDirectory(@"obj\esptool-python\dist\esptool", "esptool.zip");
return _Success;
]]>
</Code>
</Task>
</UsingTask>
</Project>
68 changes: 68 additions & 0 deletions EspFirmwareFlasher/EspFirmwareFlasher.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DCF24265-C979-4573-BF3B-05BE35429DD1}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>EspFirmwareFlasher</RootNamespace>
<AssemblyName>EspFirmwareFlasher</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="EspTool.cs" />
<Compile Include="NanoClrFirmware.cs" />
<Compile Include="WifiWaterLevelGaugeFirmware.cs" />
<Compile Include="Firmware.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="CreateEspToolZip.targets">
<SubType>Designer</SubType>
</None>
<None Include="esptool.zip">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="CreateEspToolZip.targets" />
<Target Name="BeforeBuild">
<CreateEspToolZip />
</Target>
</Project>
25 changes: 25 additions & 0 deletions EspFirmwareFlasher/EspFirmwareFlasher.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EspFirmwareFlasher", "EspFirmwareFlasher.csproj", "{DCF24265-C979-4573-BF3B-05BE35429DD1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DCF24265-C979-4573-BF3B-05BE35429DD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCF24265-C979-4573-BF3B-05BE35429DD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCF24265-C979-4573-BF3B-05BE35429DD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DCF24265-C979-4573-BF3B-05BE35429DD1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E2AD78E4-47FA-4E0B-9A60-3CCAEDAB0863}
EndGlobalSection
EndGlobal
Loading