GithubHelp home page GithubHelp logo

uf2gen's Introduction

uf2gen

Generate UF2 firmware file from bin or hex format.

A partial function porting of uf2conv.py.

Only support for converting bin or hex to uf2.

CLI usage

installation

npm install -g uf2gen

command example

uf2gen firmware.bin --family SAMD21 --base 0x2000 -o output.uf2

arguments

CLI arguments are similar to uf2conv.

flag description default
-f, --family MCU family blank family
-b, --base base address 0x00
-o, --output output file path <inputFilePath>.uf2

Families are specified in id (like 0x68ed2b88) or shortName (like SAMD21).

Available MCU Families are listed here.
uf2families.ts

The default value of the base address is 0x00, note that this is different from that of uf2conv (0x2000).

check version

uf2gen --version

Library usage

import { getUf2FamilyId, convertBinToUf2 } from "uf2gen";

const inputFilePath = "firmware.bin"
const outputFilePath = "firmware.uf2"
const baseAddress = 0x2000
const familyId = getUf2FamilyId("SAMD21");
const buffer = await fs.readFile(inputFilePath);
const binFileBytes = new Uint8Array(buffer);
const uf2FileBytes = convertBinToUf2(binFileBytes, baseAddress, familyId);
await fs.writeFile(outputFilePath, uf2FileBytes);

uf2gen's People

Contributors

yahiro07 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.