9.4.0 version

This commit is contained in:
Dmitry Panin
2024-02-05 22:11:34 +03:00
commit dd54efd2d9
595 changed files with 650873 additions and 0 deletions

Binary file not shown.

233
Stuff/file2rle/Program.cs Normal file
View File

@@ -0,0 +1,233 @@
using System;
using System.Text;
using System.IO;
using System.Collections.Generic;
namespace file2rle
{
class Program
{
static FileStream in_file;
static FileStream out_file;
static byte[] out_bytes;
static StringBuilder hex = new StringBuilder(2);
static UInt32 out_count = 0;
static UInt32 in_position = 0;
const bool debug = false;
static void Main(string[] args)
{
if(args.Length!=2)
{
Console.WriteLine("Set argument <in_file> <out_file>");
return;
}
string in_filename = args[0];
string out_filename = args[1];
if (!File.Exists(in_filename))
{
Console.WriteLine("Infile not exist");
return;
}
in_file = File.OpenRead(in_filename);
if (in_file.Length == 0)
{
Console.WriteLine("Infile has zero length");
return;
}
if (File.Exists(out_filename))
File.Delete(out_filename);
out_file = File.OpenWrite(out_filename);
out_filename = out_filename.Substring(out_filename.LastIndexOf("\\")+1).Replace(".", "_").ToUpper();
in_filename = in_filename.Substring(in_filename.LastIndexOf("\\")+1).Replace(".", "_").ToUpper();
out_bytes = Encoding.UTF8.GetBytes("#ifndef __" + out_filename + "_H\r\n");
out_file.Write(out_bytes, 0, out_bytes.Length);
out_bytes = Encoding.UTF8.GetBytes("#define __" + out_filename + "_H\r\n");
out_file.Write(out_bytes, 0, out_bytes.Length);
out_bytes = Encoding.UTF8.GetBytes("\r\n#include <stdint.h>\r\n");
out_file.Write(out_bytes, 0, out_bytes.Length);
out_bytes = Encoding.UTF8.GetBytes("\r\nstatic const uint8_t FILES_" + in_filename + "[] = {\r\n");
out_file.Write(out_bytes, 0, out_bytes.Length);
int prev = in_file.ReadByte();
int replay_count = 0;
List<sbyte> neg_bytes = new List<sbyte>();
long filesize = in_file.Length;
if (filesize > 0x1000FF)
filesize = 0x1000FF; //trim for 1mb flash
while (in_position < filesize)
{
int current = in_file.ReadByte();
if (prev == current) //повторы
{
if (replay_count < 0) //начались повторы, сохраняем накопленные неповторяющиеся
{
while (replay_count < -127)
{
if (debug)
appendByteN(-127);
else
appendByte((sbyte)-127);
int tcnt = 0;
foreach (byte point in neg_bytes)
{
appendByte((sbyte)point);
tcnt++;
if (tcnt == 127)
break;
}
neg_bytes.RemoveRange(0, 127);
replay_count += 127;
}
if (debug)
appendByteN(replay_count);
else
appendByte((sbyte)replay_count);
foreach (byte point in neg_bytes)
appendByte((sbyte)point);
neg_bytes.Clear();
replay_count = 0;
}
replay_count++;
}
else //нет повторов
{
if (replay_count > 0) //сохраняем накопленные повторы
{
replay_count++;
while (replay_count > 127)
{
if (debug)
appendByteP(127);
else
appendByte(127);
appendByte((sbyte)prev);
replay_count -= 127;
}
if (debug)
appendByteP(replay_count);
else
appendByte((sbyte)replay_count);
appendByte((sbyte)prev);
replay_count = 0;
}
else //иначе накапливаем неповторяющиеся
{
neg_bytes.Add((sbyte)prev);
replay_count--;
}
}
in_position++;
prev = current;
}
if (replay_count > 0) //сохраняем накопленные повторы
{
replay_count++;
while (replay_count > 127)
{
if (debug)
appendByteP(127);
else
appendByte(127);
appendByte((sbyte)prev);
replay_count -= 127;
}
if (debug)
appendByteP(replay_count);
else
appendByte((sbyte)replay_count);
appendByte((sbyte)prev);
replay_count = 0;
}
//сохраняем накопленные неповторяющиеся
while (replay_count < -127)
{
if (debug)
appendByteN(-127);
else
appendByte((sbyte)-127);
int tcnt = 0;
foreach (byte point in neg_bytes)
{
appendByte((sbyte)point);
tcnt++;
if (tcnt == 127)
break;
}
neg_bytes.RemoveRange(0, 127);
replay_count += 127;
}
if (debug)
appendByteN(replay_count);
else
appendByte((sbyte)replay_count);
foreach (byte point in neg_bytes)
appendByte((sbyte)point);
neg_bytes.Clear();
replay_count = 0;
out_bytes = Encoding.UTF8.GetBytes("\r\n};\r\n");
out_file.Write(out_bytes, 0, out_bytes.Length);
out_bytes = Encoding.UTF8.GetBytes("\r\n#endif\r\n");
out_file.Write(out_bytes, 0, out_bytes.Length);
in_file.Close();
out_file.Close();
Console.WriteLine("End.");
}
static void appendByteN(int data)
{
out_bytes = Encoding.UTF8.GetBytes("N" + data.ToString() + ", ");
out_file.Write(out_bytes, 0, out_bytes.Length);
out_count++;
if ((out_count % 32) == 0)
{
out_bytes = Encoding.UTF8.GetBytes("\r\n");
out_file.Write(out_bytes, 0, out_bytes.Length);
}
}
static void appendByteP(int data)
{
out_bytes = Encoding.UTF8.GetBytes("P" + data.ToString() + ", ");
out_file.Write(out_bytes, 0, out_bytes.Length);
out_count++;
if ((out_count % 32) == 0)
{
out_bytes = Encoding.UTF8.GetBytes("\r\n");
out_file.Write(out_bytes, 0, out_bytes.Length);
}
}
static void appendByte(sbyte data)
{
hex.Clear();
hex.AppendFormat("{0:x2}", data);
out_bytes = Encoding.UTF8.GetBytes("0x" + hex.ToString().ToUpper() + ", ");
out_file.Write(out_bytes, 0, out_bytes.Length);
out_count++;
if ((out_count % 32) == 0)
{
out_bytes = Encoding.UTF8.GetBytes("\r\n/*"+ in_position +"*/ ");
out_file.Write(out_bytes, 0, out_bytes.Length);
}
}
}
}

View File

@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.1",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.1": {
"file2rle/1.0.0": {
"runtime": {
"file2rle.dll": {}
}
}
}
},
"libraries": {
"file2rle/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\XGudr\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\XGudr\\.nuget\\packages",
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
]
}
}

View File

@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "3.1.0"
}
}
}

View File

@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30002.166
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "file2rle", "file2rle.csproj", "{028116C6-B10A-4FF1-96DC-A33D89A1AA6A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{028116C6-B10A-4FF1-96DC-A33D89A1AA6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{028116C6-B10A-4FF1-96DC-A33D89A1AA6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{028116C6-B10A-4FF1-96DC-A33D89A1AA6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{028116C6-B10A-4FF1-96DC-A33D89A1AA6A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {68C4AE40-4968-4882-8ED7-3D22CF2520E1}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("file2rle")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("file2rle")]
[assembly: System.Reflection.AssemblyTitleAttribute("file2rle")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Создано классом WriteCodeFragment MSBuild.

View File

@@ -0,0 +1 @@
d0addd6f2ec60a2de7932b0ab2fbf03ca08598b3

View File

@@ -0,0 +1 @@
4e290fadfe16d97e399a0bb4b7ed5e50b3293bbc

View File

@@ -0,0 +1,13 @@
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\bin\Release\netcoreapp3.1\file2rle.exe
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\bin\Release\netcoreapp3.1\file2rle.deps.json
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\bin\Release\netcoreapp3.1\file2rle.runtimeconfig.json
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\bin\Release\netcoreapp3.1\file2rle.runtimeconfig.dev.json
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\bin\Release\netcoreapp3.1\file2rle.dll
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\bin\Release\netcoreapp3.1\file2rle.pdb
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\obj\Release\netcoreapp3.1\file2rle.csproj.CoreCompileInputs.cache
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\obj\Release\netcoreapp3.1\file2rle.AssemblyInfoInputs.cache
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\obj\Release\netcoreapp3.1\file2rle.AssemblyInfo.cs
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\obj\Release\netcoreapp3.1\file2rle.dll
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\obj\Release\netcoreapp3.1\file2rle.pdb
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\obj\Release\netcoreapp3.1\file2rle.genruntimeconfig.cache
d:\Dropbox\Develop\Projects\WOLF\STM32\Stuff\file2rle\obj\Release\netcoreapp3.1\file2rle.csprojAssemblyReference.cache

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
86c8e15dd33445635927cfaf398408205fd11473

Binary file not shown.

View File

@@ -0,0 +1,63 @@
{
"format": 1,
"restore": {
"d:\\Dropbox\\Develop\\Projects\\WOLF\\STM32\\Stuff\\file2rle\\file2rle.csproj": {}
},
"projects": {
"d:\\Dropbox\\Develop\\Projects\\WOLF\\STM32\\Stuff\\file2rle\\file2rle.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "d:\\Dropbox\\Develop\\Projects\\WOLF\\STM32\\Stuff\\file2rle\\file2rle.csproj",
"projectName": "file2rle",
"projectPath": "d:\\Dropbox\\Develop\\Projects\\WOLF\\STM32\\Stuff\\file2rle\\file2rle.csproj",
"packagesPath": "C:\\Users\\XGudr\\.nuget\\packages\\",
"outputPath": "d:\\Dropbox\\Develop\\Projects\\WOLF\\STM32\\Stuff\\file2rle\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
],
"configFilePaths": [
"C:\\Users\\XGudr\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netcoreapp3.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp3.1": {
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp3.1": {
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\XGudr\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.5.0</NuGetToolVersion>
</PropertyGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,69 @@
{
"version": 3,
"targets": {
".NETCoreApp,Version=v3.1": {}
},
"libraries": {},
"projectFileDependencyGroups": {
".NETCoreApp,Version=v3.1": []
},
"packageFolders": {
"C:\\Users\\XGudr\\.nuget\\packages\\": {},
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "d:\\Dropbox\\Develop\\Projects\\WOLF\\STM32\\Stuff\\file2rle\\file2rle.csproj",
"projectName": "file2rle",
"projectPath": "d:\\Dropbox\\Develop\\Projects\\WOLF\\STM32\\Stuff\\file2rle\\file2rle.csproj",
"packagesPath": "C:\\Users\\XGudr\\.nuget\\packages\\",
"outputPath": "d:\\Dropbox\\Develop\\Projects\\WOLF\\STM32\\Stuff\\file2rle\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
],
"configFilePaths": [
"C:\\Users\\XGudr\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netcoreapp3.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp3.1": {
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp3.1": {
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.201\\RuntimeIdentifierGraph.json"
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "4VZnGxtKzY8R2EeUusHRoqzUBS1IJW7g/AdjUI8Vs30wENs8xsNJRywqv19X+ltO+6MmDZ2A6qz6pIspd+Bl4A==",
"success": true,
"projectFilePath": "d:\\Dropbox\\Develop\\Projects\\WOLF\\STM32\\Stuff\\file2rle\\file2rle.csproj",
"expectedPackageFiles": [],
"logs": []
}