npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@alcz/espefuse-js

v2.0.6

Published

Complementary lib to [esptool-js](https://github.com/espressif/esptool-js).

Downloads

2

Readme

Javascript implementation of espefuses

Complementary lib to esptool-js.

Only the esp32s3 variant is partially supported.

No read/write file operation is implemented (burnKey input values, emulator output..).


argparse (parsing cmd line arguments) part of esptool is not implemented.

(Only burnEfuse operation is performing the ArgValue check - e.g. transform MAC address in string format to binary representation..)


usage

webpack example

import { ESPLoader, LoaderOptions, Transport } from "esptool-js";
import { getEfuses, getEspEmulator } from "@0m/espefuse-js";

// same as term in esptool-js
const espLoaderTerminal = {
   // xterm-js or any other output
   clean() {
      terminal.clear();
   },
   writeLine(data) {
      terminal.writeln(data);
   },
   write(data) {
      terminal.write(data);
   },
};

const main = async () => {
   // esptool
   const dev = await this.getDevice();
   const transp = new Transport(dev, true);

   const loaderOptions: LoaderOptions = {
            transport: transp,
            baudrate: 115200,
            terminal: espLoaderTerminal,
            enableTracing: false,
         };
   const espLoader = new ESPLoader(loaderOptions);
   // or use emulator
   // const espLoader = new (getEspEmulator())();

   // espefuses
   const efuseOptions = {
            esp: espLoader,
            skipConnect: false,
            debug: true,
            doNotConfirm: true,
            terminal: this.espLoaderTerminal
         };

   const [efuses, operations] = getEfuses(efuseOptions);
   await efuses.setup();

   // print efuses summary
   await operations.summary(espLoader, efuses, {format: "summary"});
}

main.then(() => {});

EspEfuses settings:

  • esp: esptool-js instance
  • skipConnect: boolean = false (assume esptool-js instance is connected if true)
  • debug: boolean = false
  • doNotConfirm: boolean = false (not-confirm burn op?)
  • terminal = null; same as in esptool-js
  • confirmFn = null; Confirmation function. Return true to confirm or raise Error to deny.

operations

List of implemented operations:

args used in all ops:
esp: ESPLoader insance
efuses: EspEfuses instance

  • summary async function summary(esp: any, efuses: any, args: any): Promise<void>

    args: {format: "summary"} for human readable format

  • burnBit async function burnBit(esp: any, efuses: any, args: any): Promise<void>

    args:
    block: blockName, - Efuse block to burn [string - BLOCK0,BLOCK1,BLOCK2,BLOCK3]
    bitNumber: bitNum - Bit number in the efuse block [0..BLK_LEN-1]
  • burnEfuse async function burnEfuse(esp: any, efuses: any, args: any): Promise<void>

    args:
    nameValuePairs: [{[efuseName]: efuseValue}, ...]
  • readEfuse async function readEfuse(esp: any, efuses: any, args: any)

    args:
    efuses: list of efuse names to read [efuseName, ..]

    returns dict {[efuseName]: value, ...}

  • writeProtectEfuse async function writeProtectEfuse(esp: any, efuses: any, args: any): Promise<void>

    args:
    efuseName: list of efuse names to write protect [efuseName, ...]
    
  • burnKey async function burnKey(esp: any, efuses: any, args: any, digest: any = null): Promise<void>

    args:
    keypurpose: list of key purpose [TODO?: support "XTS_AES_256_KEY"]
    block: block name list
    keyfile: list of files to read block data from. (not supported, TODO?)
    forceWriteAlways: [boolean]
    noWriteProtect: [boolean]
    
    digest: list of data keys to burn

    If keyfile is not set, digest is used instead as source for data to burn.

    Number of items in block, keypurpose, and keyfile / digest must be the same.

Operations can be emulated for debugging purposes.

License

This document and the attached source code are released as Free Software under GNU General Public License Version 2 or later. See the accompanying LICENSE file for a copy.