nanoFramework.Tools.FirmwareFlasher 2.5.99

Prefix Reserved
dotnet add package nanoFramework.Tools.FirmwareFlasher --version 2.5.99                
NuGet\Install-Package nanoFramework.Tools.FirmwareFlasher -Version 2.5.99                
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="nanoFramework.Tools.FirmwareFlasher" Version="2.5.99" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add nanoFramework.Tools.FirmwareFlasher --version 2.5.99                
#r "nuget: nanoFramework.Tools.FirmwareFlasher, 2.5.99"                
#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 nanoFramework.Tools.FirmwareFlasher as a Cake Addin
#addin nuget:?package=nanoFramework.Tools.FirmwareFlasher&version=2.5.99

// Install nanoFramework.Tools.FirmwareFlasher as a Cake Tool
#tool nuget:?package=nanoFramework.Tools.FirmwareFlasher&version=2.5.99                

#yourfirstpr Build Status NuGet Discord

nanoFramework logo


Document Language: English | 中文简体

Welcome to the .NET nanoFramework firmware flasher tool repository

This repo contains the nano firmware flasher tool. It's a .NET Core Tool that allows flashing a .NET nanoFramework target with a firmware image (nanoBooter and nanoCLR), the application deployment (all assemblies required to run a .NET application) and restore previously saved deployment images. Is part of .NET nanoFramework toolbox, along with other various tools that are required in .NET nanoFramework development, usage or repository management.

It makes use of several 3rd party tools:

  • Espressif esptool You can find the esptool and licensing information on the repository here.
  • STM32 Cube Programmer You can find the source, licensing information and documentation here.
  • Texas Instruments Uniflash You can find the Uniflash tool and licensing information here.
  • SEGGER J-Link You can find the J-Link, licensing information and documentation here.

We are also distributing this tool as a .NET library so it can be integrated in 3rd party applications. Please check the README in the Samples folder for more details along with sample applications.

Install .NET nanoFramework Firmware Flasher

Perform a one-time install of the .NET nanoFramework Firmware Flasher tool using the following .NET Core CLI command:

dotnet tool install -g nanoff

After a successful installation a message is displayed showing the command that's to be used to call the tool along with the version installed. Similar to the following example:

You can invoke the tool using the following command: nanoff
Tool 'nanoff' (version '9.9.9') was successfully installed.

nanoff install flash

Install path issues

⚠️ That are know issues running commands for STM32 devices when nanoff is installed in a path that contains diacritic characters. This is caused by a known bug in STM32 Cube Programmer. If that's the case with your user path, for example, you have to install it in a location that does have those. To accomplish that, use the following .NET Core CLI command on which the path where the tool will be installed is specified:

dotnet tool install nanoff --tool-path c:\a-plain-simple-path-to-install-the-tool

Note that if you're not using nanoff with STM32 devices, this limitation does not apply.

MacOS users

You'll need to add nanoff to your path as well, once installed run:

export PATH=$PATH:~/.dotnet/tools

Update .NET nanoFramework Firmware Flasher

To update .NET nanoFramework Firmware Flasher tool use the following .NET Core CLI command:

dotnet tool update -g nanoff

If the tool was installed at a specific path, use the following .NET Core CLI command instead:

dotnet tool update nanoff --tool-path c:\path-where-the-tool-was-installed

Usage

Once the tool is installed, you can call it by using its command nanoff, which is a short version of the name to ease typing.

nanoff [command] [args]

The tool includes help for all available commands. You can see a list of all available ones by entering:

nanoff --help

List of usage examples per platform and common options:

Note that it's possible to combine multiple options if those operations are supported by the platforms, e.g. update the CLR and deploy a managed application in the same execution.

ESP32 usage examples

There are multiple ESP32 images available, some are build specifically for a target. Please check out the list. You will need as well to know the COM port used by your device. Find how to do this here. Alternatively, you can as well list the available COM ports. If you list them first without the device to flash and then plugging the device, the additional port which will show up is the one for the device to flash. This method works for all OS:

nanoff --listports

The ESP32_PSRAM_REV0 image will just work for any variant of the ESP32 series, with or without PSRAM, and for all silicon revisions. You can read more about the differences between the various images here.

The FEATHER_S2 image will just work for pretty much all variants of the ESP32-S2 series that expose the embedded USB CDC pins. You can read more about the differences between the various images here.

When using nanoff you can add --target MY_TARGET_NAME_HERE to use a specific image. If, instead, you just specify the platform with --platform esp32 nanoff will choose the most appropriate image depending on the features of the device that's connected. Output similar to this one will show to advise what's the image about to be used:

No target name was provided! Using 'ESP32_REV0' based on the device characteristics.

Note: Please note that for ESP32-S2 targets is not possible to safely determine what's the best image to use. For this reason it's mandatory providing the appropriate target name with --target MY_TARGET_NAME_HERE.

Some ESP32 boards have issues entering bootloader mode. This can be usually overcome by holding down the BOOT/FLASH button in the board. In case nanoff detects this situation the following warning is shown:

*** Hold down the BOOT/FLASH button in ESP32 board ***

⚠️ To update FeatherS2, TinyS2 and some S3 modules, the board needs to be put in download mode by holding [BOOT], clicking [RESET] and then releasing [BOOT].

Update the firmware of an ESP32 target

To update the firmware of an ESP32 target connected to COM31, to the latest available development version.

nanoff --update --target ESP32_PSRAM_REV0 --serialport COM31

Update the firmware of an ESP32-S2 KALUGA 1 with a local CLR file

To update the firmware of an ESP32-S2 KALUGA 1 target connected to COM31 with a local CLR file (for example from a build). This file has to be a binary file with a valid CLR from a build. No other checks or validations are performed on the file content.

nanoff --update --target KALUGA_1 --serialport COM31 --clrfile "C:\nf-interpreter\build\nanoCLR.bin" 

You can adjust the name of the core image you want to use. Refer to the previous section to get the full list.

Show details of the connected ESP32 device

To show the details of the ESP32 device connected to COM31.

nanoff --platform esp32 --serialport COM31 --devicedetails 

Optionally an extra parameter --checkpsram can be passed, which forces the detection of PSRAM availability.

Deploy a managed application to an ESP32 target

To deploy a managed application to an ESP32_PSRAM_REV0 target connected to COM31.

Note: The binary file with the deployment image can be found on the Release or Debug folder of a Visual Studio project after a successful build. This file contains everything that's required to deploy a managed application to a target (meaning application executable and all referenced libraries and assemblies).

nanoff --target ESP32_PSRAM_REV0 --serialport COM12 --deploy --image "E:\GitHub\nf-Samples\samples\Blinky\Blinky\bin\Debug\Blinky.bin"

Update the firmware of an ESP32 target along with a managed application

To deploy an application on an ESP32 target connected to COM31, with your application, you have to specify the path to the managed application. Optionally you can provide an address which will override the default deployment address. This example uses the binary format file that you can find when you are building an application. Note, as only application can run, when you are building a library, a bin file is not created automatically. Only for applications.

nanoff --target ESP32_PSRAM_REV0 --update --serialport COM31 --deploy --image "c:\eps32-backups\my_awesome_app.bin" --address 0x1B000

STM32 usage examples

Update the firmware of a specific STM32 target

To update the firmware of the ST_STM32F769I_DISCOVERY target to the latest available stable version using the JTAG connection.

nanoff --update --target ST_STM32F769I_DISCOVERY --jtag

Deploy a managed application to a ST_STM32F769I_DISCOVERY target

To deploy a managed application to a ST_STM32F769I_DISCOVERY target, which has the deployment region at 0x08080000 flash address and reset the MCU after flashing it.

Note: The binary file with the deployment image can be found on the Release or Debug folder of a Visual Studio project after a successful build. This file contains everything that's required to deploy a managed application to a target (meaning application executable and all referenced libraries and assemblies).

nanoff --target ST_STM32F769I_DISCOVERY --deploy --image "E:\GitHub\nf-Samples\samples\Blinky\Blinky\bin\Debug\Blinky.bin" --address 0x08040000 --reset

Update the firmware of a ST_STM32F769I_DISCOVERY along with a managed application

To update the firmware of the ST_STM32F769I_DISCOVERY target to the latest available version, using a JTAG connection, along with a managed application. You have to specify the path to the managed application. This example uses the binary format file that is generated by Visual Studio when building any nanoFramework C# application. Because it's a binary file you have to specify too the flash address of the deployment region (here 0x08000000, mind the hexadecimal format).

nanoff --update --target ST_STM32F769I_DISCOVERY --jtag --binfile "c:\dev\my awesome app\bin\debug\my_awesome_app.bin" --address 0x08000000

List all STM32 devices available with JTAG connection

This useful to list all STM32 devices that are connected through JTAG.

nanoff --listjtag

List all STM32 devices available with DFU connection

This useful to list all STM32 devices that are connected through DFU.

nanoff --listdfu

Install STM32 JTAG drivers

To install the drivers for STM32 JTAG connected targets.

nanoff --installjtagdrivers

Install STM32 DFU drivers

To install the drivers for STM32 DFU connected targets.

nanoff --installdfudrivers

TI CC13x2 usage examples

Update the firmware of a specific TI CC13x2 target

To update the firmware of the TI_CC1352R1_LAUNCHXL target to the latest version.

nanoff --update --target TI_CC1352R1_LAUNCHXL

Install the XDS110 USB drivers required by TI LaunchPad targets

To install the XDS110 USB drivers.

nanoff --installxdsdrivers

Silabs Giant Gecko usage examples

Update the firmware of a specific Silabs target

To update the firmware of the SL_STK3701A target to the latest version.

nanoff --update --target SL_STK3701A

Update the firmware of a Silabs target from a local file

To update the firmware of a Silabs target with a local firmware file (for example from a build). This file has to be a binary file with a valid Booter and CLR from a build. No checks or validations are performed on the file(s) content.

nanoff --update --platform gg11 --binfile "C:\nf-interpreter\build\nanobooter-nanoclr.bin" --address 0x0

Deploy a managed application to a SL_STK3701A target

To deploy a managed application to a SL_STK3701A target, which has the deployment region at 0x000EE000 flash address and reset the MCU after flashing it.

Note: The binary file with the deployment image can be found on the Release or Debug folder of a Visual Studio project after a successful build. This file contains everything that's required to deploy a managed application to a target (meaning application executable and all referenced libraries and assemblies).

nanoff --target SL_STK3701A --deploy --image "E:\GitHub\nf-Samples\samples\Blinky\Blinky\bin\Debug\Blinky.bin" --address 0x000EE000

Update the firmware of a SL_STK3701A along with a managed application

To update the firmware of the SL_STK3701A target to the latest available version, using a J-Link connection, along with a managed application. You have to specify the path to the managed application. This example uses the binary format file that is generated by Visual Studio when building any nanoFramework C# application. Because it's a binary file you have to specify too the flash address of the deployment region (here 0x000EE000, mind the hexadecimal format).

nanoff --update --target SL_STK3701A --binfile "c:\dev\my awesome app\bin\debug\my_awesome_app.bin" --address 0x000EE000

This useful to list all Silabs devices that are connected through J-Link.

nanoff --listjlink

Plain connection usage examples

It's possible to update a nano device using the same connection that is used for Visual Studio connection, meaning that no specialized connection is required (like JTAG, or JLink). This is only possible if the device has previously been flashed with a working nanoFramework firmware.

Update the CLR of a nano device

To update the CLR of a nano device connected to a serial port to the latest available version. This will find the latest available firmware for the connected device and will update the CLR.

nanoff --nanodevice --update --serialport COM9

Deploy a managed application

To deploy (or update) a managed application, the path to the managed application has to be provided. This example uses the binary format file that is generated by Visual Studio when building any nanoFramework C# application. Because it's possible to retrieve all the required details from the connected device no other configuration is required.

nanoff --nanodevice --deploy --serialport COM9 --image "c:\dev\my awesome app\bin\debug\my_awesome_app.bin"

Update the CLR of a nano device from a local file

To update the firmware of a nano device with a local firmware file (for example from a build). This file has to be a binary file with a valid nanoCLR from a build. No checks or validations are performed on the file content.

nanoff --nanodevice --update --serialport COM9 --clrfile "C:\nf-interpreter\build\nanoclr.bin"

Get details from a nano device

To get the details of a nano device connected to a serial port.

nanoff --nanodevice --devicedetails --serialport COM9

Common options

Pre-check if target fits connected device

The tool tries to make a best effort sanity check on whether the requested target fits the connected target. Sometimes that's not possible because of the differences and variations on the target names, or lack of details provided by the connected device or even (like with DFU connected devices) because it's not possible to determine exactly what device is connected at all. This doesn't necessarily mean that the firmware wont' work, so take this as an advice only.

To disable this validation add --nofitcheck option to the command line.

Tool output verbosity

The tool output verbosity can be set through the v|verbosity option.

This is convenient, for example, if this tool is being used in a automated process where the minimum output is desired to ease processing the return result of the execution. It can be set to:

  • q[uiet]
  • m[inimal]
  • n[ormal]
  • d[etailed]
  • diag[nostic]
nanoff -v q

List connected nano devices

To get a list of connected nano devices. If more details are required add verbose option with setting above normal.

nanoff --listdevices [ -v d ]

Output example:

-- Connected .NET nanoFramework devices --
SKY_EEVB_Debug @ COM7

------------------------------------------

Output example with verbose details:

-- Connected .NET nanoFramework devices --
SKY_EEVB_Debug @ COM7
  Target:      SKY_EEVB_Debug
  Platform:    GGECKO_S1
  Date:        May 31 2023
  Type:        MinSizeRel build with Azure RTOS v6.2.0
  CLR Version: 1.8.1.124

------------------------------------------

Finding the device COM port on Windows

You need to know the COM Port attached to your device. Search for Computer Management, select Device Manager then expand Ports (COM & LPT), you will find the COM port of the connected device.

IMPORTANT: you may have to install drivers. Refer to the vendor website or use Windows Update to install the latest version of the drivers.

Finding COM Port

Finding the device COM port using nanoff

You can use the --listports command with nanoff to list the available COM ports. This method works on all OS. If you run the command first without your device plugged, you'll get a first list. Then plug your device and run the command again. The new COM port showing up is the one from your device!

nanoff --listports

Example of outcomes when there is no device plugged in:

No available COM port

And when you then plug the device and run the command again:

Available COM ports:
  COM12

List targets

You can list the supported targets, and their version using the --platform parameter.

List packages available for ESP32 targets:

nanoff --listtargets --platform esp32

List packages available for STM32 targets:

nanoff --listtargets --platform stm32

If you use the --listtargets switch in conjunction with --preview, you'll get the list of available firmware packages that are available with experimental or major feature changes.

Deploy file to device storage

Some devices like ESP32, Orgpal and few others have storage available. Files can be deployed in this storage. You have to use the filedeployment parameter pointing on a JSON file to deploy files while flashing the device:

nanoff --target XIAO_ESP32C3 --update --masserase --serialport COM21  --filedeployment C:\path\deploy.json

The JSON an optional SerialPort in case the port to upload the files must be different than the one to flash the device or not specified in the main command line and a mandatory list of Files entries. Each entry must contains DestinationFilePath, the destination full path file name and SourceFilePath to deploy content, otherwise to delete the file, the full path with file name of the source file to be deployed:

{
   "serialport":"COM42",
   "files": [
      {         
         "DestinationFilePath": "I:\\TestFile.txt",
         "SourceFilePath": "C:\\tmp\\NFApp3\\NFApp3\\TestFile.txt"
      },
      {
         "DestinationFilePath": "I:\\NoneFile.txt"
      },
      {
         "DestinationFilePath": "I:\\wilnotexist.txt",
         "SourceFilePath": "C:\\WRONGPATH\\TestFile.txt"
      }
   ]
}

In the case you just want to deploy the files without any other operation, you can just specify:

nanoff --filedeployment C:\path\deploy.json

In that case, the SerialPort must be present in the JSON file.

[!Note] If a file already exists in the storage, it will be replaced by the new one.

If a file does not exist and is requested to be deleted, nothing will happen, a warning will be displayed.

If a file can't be uploaded because of a problem, the deployment of the other files will continue and an error will be displayed.

Clear cache location

If needed one can clear the local cache from the firmware packages that are stored there. As an additional information the cache location is the directory -nanoFramework\fw_cache in the user folder.

When this option is included in the command no other options are processed.

nanoff --clearcache

Firmware archive

By default, nanoff uses the online repository to look for firmware packages. It is also possible to use a local directory as the source of firmware. The firmware archive can be populated via the --updatefwarchive option:

nanoff --updatefwarchive --target ESP32_S3_ALL --fwarchivepath c:\...\firmware 
nanoff --updatefwarchive --platform esp32 --fwarchivepath c:\...\firmware

For a list of archived firmware:

nanoff --listtargets --fromfwarchive --fwarchivepath c:\...\firmware

To install firmware on a device, use the same command line arguments as usual, but add --fromfwarchive and --fwarchivepath:

nanoff --nanodevice --update --serialport COM9 --fromfwarchive --fwarchivepath c:\...\firmware

Bypass version check

By default nanoff checks whether a new version of the tool has been published. If that is not necessary, the option --suppressnanoffversioncheck can be added to suppress the check.

Exit codes

The exit codes can be checked in this source file.

Telemetry

This tool is using anonymous telemetry to help us improve the usage. You can opt out by setting up an environment variable NANOFRAMEWORK_TELEMETRY_OPTOUT to 1.

The telemetry information is mainly related to the command line arguments, the firmware versions installed and any issue that can occurs during the code execution.

Feedback and documentation

To provide feedback, report issues and finding out how to contribute please refer to the Home repo.

Join our Discord community here.

Credits

The list of contributors to this project can be found at CONTRIBUTORS.

License

The nanoFramework firmware flasher tool is licensed under the MIT license.

Code of Conduct

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behaviour in our community. For more information see the .NET Foundation Code of Conduct.

.NET Foundation

This project is supported by the .NET Foundation.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 Framework net472 is compatible.  net48 was computed.  net481 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
2.5.99 375 10/10/2024
2.5.98 386 10/9/2024
2.5.97 309 10/9/2024
2.5.96 412 9/30/2024
2.5.95 427 9/26/2024
2.5.94 352 9/25/2024
2.5.90 572 6/26/2024
2.5.89 428 6/24/2024
2.5.86 489 6/18/2024
2.5.83 313 6/14/2024
2.5.78 422 6/4/2024
2.5.77 253 5/31/2024
2.5.74 377 5/29/2024
2.5.73 278 5/28/2024
2.5.67 418 4/28/2024
2.5.66 351 4/26/2024
2.5.61 765 4/1/2024
2.5.60 761 3/25/2024
2.5.59 718 3/21/2024
2.5.58 1,166 1/31/2024
2.5.56 1,776 1/4/2024
2.5.54 1,697 1/2/2024
2.5.52 1,912 12/22/2023
2.5.49 1,744 12/21/2023
2.5.46 2,962 10/27/2023
2.5.45 2,108 10/24/2023
2.5.44 1,834 10/19/2023
2.5.43 2,181 10/19/2023
2.5.38 2,690 10/9/2023
2.5.36 3,209 8/23/2023
2.5.34 3,484 7/14/2023
2.5.33 3,251 7/14/2023
2.5.32 3,216 7/14/2023
2.5.28 3,252 6/28/2023
2.5.25 3,604 6/27/2023
2.5.24 3,150 6/19/2023
2.5.21 3,516 6/14/2023
2.5.10 3,254 5/31/2023
2.5.3 2,935 5/29/2023
2.5.2 3,533 5/12/2023
2.5.1 3,322 4/27/2023
2.4.36 3,676 4/27/2023
2.4.35 3,637 4/27/2023
2.4.34 3,387 4/26/2023
2.4.33 3,505 4/17/2023
2.4.31 3,444 3/15/2023
2.4.30 3,859 2/22/2023
2.4.28 3,637 2/17/2023
2.4.24 3,535 12/19/2022
2.4.22 3,434 12/17/2022
2.4.19 3,660 12/16/2022
2.4.14 3,584 12/13/2022
2.4.2 3,301 11/16/2022
2.4.1 3,602 11/16/2022
2.3.12 3,635 11/9/2022
2.3.9 4,063 9/7/2022
2.3.7 3,822 9/5/2022
2.3.4 3,913 8/25/2022
2.3.1 3,852 8/24/2022
2.2.5 3,934 8/22/2022
2.2.2 5,041 8/22/2022
2.2.1 3,577 8/22/2022
2.1.16 3,653 8/19/2022
2.1.15 3,709 8/19/2022
2.1.14 3,588 8/19/2022
2.1.11 3,648 8/18/2022
2.1.7 936 7/14/2022
2.1.6 939 7/14/2022
2.1.5 920 7/13/2022
2.1.2 893 7/6/2022
2.0.67 898 6/14/2022
2.0.66 923 6/9/2022
2.0.65 933 6/1/2022
2.0.62 924 5/19/2022
2.0.60 991 5/17/2022
2.0.58 912 4/27/2022
2.0.57 962 4/21/2022
2.0.56 978 4/20/2022
2.0.55 925 4/18/2022
2.0.51 962 4/18/2022
2.0.47 963 4/18/2022
2.0.44 996 4/14/2022
2.0.41 955 3/31/2022
2.0.39 962 3/31/2022
2.0.34 937 3/8/2022
2.0.30 932 2/23/2022
2.0.28 962 2/18/2022
2.0.26 945 2/18/2022
2.0.25 925 2/18/2022
2.0.15 3,662 2/10/2022
2.0.9 3,274 12/27/2021
2.0.7 3,454 12/23/2021
2.0.6 2,890 12/22/2021
2.0.5 3,009 12/17/2021
2.0.3 3,035 12/16/2021
1.29.8 2,944 11/29/2021
1.29.5 4,608 11/26/2021
1.29.1 2,982 11/17/2021
1.28.2 3,192 11/4/2021
1.28.1 3,294 10/28/2021
1.27.1 3,174 10/15/2021
1.26.5 3,267 10/14/2021
1.26.4 3,165 10/7/2021
1.26.3 3,126 10/6/2021
1.26.2 3,433 10/6/2021
1.26.1 3,940 10/5/2021
1.25.4 2,974 10/5/2021
1.25.3 4,250 10/4/2021
1.25.1 2,760 8/25/2021
1.24.7 2,762 8/25/2021
1.24.6 2,645 8/25/2021
1.24.2 2,667 8/24/2021
1.24.1 2,623 8/17/2021
1.23.3 2,527 8/16/2021
1.23.1 2,649 8/16/2021
1.22.9 2,582 8/9/2021
1.22.7 2,490 7/21/2021
1.22.6 2,503 7/17/2021
1.22.5 2,564 6/29/2021
1.22.4 2,414 6/25/2021
1.22.2 2,355 6/24/2021
1.22.1 2,690 6/23/2021
1.22.0 2,706 6/23/2021
1.20.1 1,493 6/22/2021
1.20.0-preview.13 220 6/18/2021
1.20.0-preview.12 203 6/17/2021
1.20.0-preview.8 215 5/10/2021
1.19.0 1,543 3/31/2021
1.19.0-preview.1 246 3/24/2021
1.17.0-preview.6 212 3/19/2021
1.16.2 1,608 3/15/2021
1.16.1-preview.1 313 12/3/2020
1.16.0-preview.3 352 7/13/2020
1.15.0 1,802 7/13/2020
1.14.0 1,715 7/2/2020
1.14.0-preview.9 396 7/2/2020
1.13.0 1,753 5/28/2020
1.12.1 1,699 4/29/2020
1.11.0 1,867 3/5/2020
1.11.0-preview.3 411 3/5/2020
1.2.0 1,323 11/11/2019
1.0.6 1,317 9/24/2019
1.0.6-preview.12 376 9/24/2019
1.0.6-preview.5 394 7/24/2019
1.0.5-preview.3 384 7/5/2019
1.0.5-preview.1 367 7/4/2019
1.0.4-preview.1 375 7/4/2019
1.0.1-preview.1 399 7/4/2019