Jcd.SRecord 1.0.29

Prefix Reserved
dotnet add package Jcd.SRecord --version 1.0.29                
NuGet\Install-Package Jcd.SRecord -Version 1.0.29                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Jcd.SRecord" Version="1.0.29" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Jcd.SRecord --version 1.0.29                
#r "nuget: Jcd.SRecord, 1.0.29"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Jcd.SRecord as a Cake Addin
#addin nuget:?package=Jcd.SRecord&version=1.0.29

// Install Jcd.SRecord as a Cake Tool
#tool nuget:?package=Jcd.SRecord&version=1.0.29                

Jcd.SRecord

This library will load, parse and validate a motorola sRecord file according to the Ubuntu srec manpage and the Wikipedia SREC (file format) article.

Some inspiration was taken from reading the code by Vanya A. Sergeev and Jerry G. Scherer However, you'll note mine is significantly different.

Examples

    // read all of the data, tracking the parse result for each line.
    var document = SRecordDocument.CreateFromFile("FakeFirmware.s37");

    // compute some statistics.
    var parsingStats = document.CalculateParseStatistics();
    var dataStats = document.CalculateDataStatistics();

    // Report on what's in the file.
    Console.WriteLine($"Record type counts:");
    Console.WriteLine($"S0 {dataStats.S0Count}; S1 {dataStats.S1Count}; S2 {dataStats.S2Count}; S3 {dataStats.S3Count}; S4 {dataStats.S4Count}; S5 {dataStats.S5Count}; S6 {dataStats.S6Count}; S7 {dataStats.S7Count}; S8 {dataStats.S8Count}; S9: {dataStats.S9Count}");
    Console.WriteLine();
    Console.WriteLine($"Parsing stats:");
    Console.WriteLine($"Total number of blank lines: {parsingStats.BlankElementCount}");
    Console.WriteLine($"Total number of lines with parsing errors: {parsingStats.ErrorElementCount}");
    Console.WriteLine($"Total number of stand alone comment lines: {parsingStats.StandAloneCommentCount}");
    Console.WriteLine($"Total number of lines with comments: {parsingStats.ElementsWithCommentsCount}");
    Console.WriteLine($"Total number of lines with s-record entries: {parsingStats.ElementsWithSRecordDataCount}");
    Console.WriteLine($"Total number of lines with comments and s-record entries: {parsingStats.SRecordDataWithCommentCount}");
    Console.WriteLine($"Total line count: {parsingStats.TotalElementsCount}");
    /* The above gives the following output:
    Record type counts:
    S0 1; S1 3; S2 0; S3 0; S4 0; S5 1; S6 0; S7 0; S8 0; S9: 1

    Parsing stats:
    Total number of blank lines: 0
    Total number of lines with parsing errors: 0
    Total number of stand alone comment lines: 3
    Total number of lines with comments: 3
    Total number of lines with s-record entries: 6
    Total number of lines with comments and s-record entries: 0
    Total line count: 9
    */

    // now access the data and upload the firmware to a device.
    foreach (var record in document.SRecords)
    {
        // get a byte array if it's S1, S2, S3 and send firmware to the device.
        if (record.Type.Key == "S1" || record.Type.Key == "S2" || record.Type.Key == "S3")
            UploadToFirmware(record.Address, record.Type.AddressLengthInBytes, record.Data.ToArray());
        // set the execution address if S7, S8, or S9
        else if (record.Type.Key == "S7" || record.Type.Key == "S8" || record.Type.Key == "S9")
            SetExecutionAddress(record.Address,record.Type.AddressLengthInBytes);
    }

GitHub Build status CodeFactor Grade

MyGet Nuget

API Docs

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.29 202 3/14/2024
1.0.15 553 7/30/2022
1.0.14 427 7/30/2022
1.0.12 447 7/29/2022

updated nuget dependencies and updated language version in use.