Options
All
  • Public
  • Public/Protected
  • All
Menu

Module micropython-fs-builder

Functions

addIntelHexFiles

  • addIntelHexFiles(intelHex: string | MemoryMap, files: object, returnBytes?: boolean): string | Uint8Array
  • Adds a hash table of filenames and byte arrays as files to the MicroPython filesystem.

    throws

    {Error} When the an invalid file name is given.

    throws

    {Error} When a file doesn't have any data.

    throws

    {Error} When there are issues calculating the file system boundaries.

    throws

    {Error} When there is no space left for a file.

    Parameters

    • intelHex: string | MemoryMap

      MicroPython Intel Hex string or MemoryMap.

    • files: object

      Hash table with filenames as the key and byte arrays as the value.

      • [filename: string]: Uint8Array
    • Default value returnBytes: boolean = false

    Returns string | Uint8Array

    MicroPython Intel Hex string with the files in the filesystem.

calculateFileSize

  • calculateFileSize(filename: string, data: Uint8Array): number
  • Parameters

    • filename: string
    • data: Uint8Array

    Returns number

    Size, in bytes, of how much space the file would take in the MicroPython filesystem.

createMpFsBuilderCache

  • To speed up the Intel Hex string generation with MicroPython and the filesystem we can cache some of the Intel Hex records and the parsed Memory Map. This function creates an object with cached data that can then be sent to other functions from this module.

    Parameters

    • originalIntelHex: string

      Intel Hex string with MicroPython to cache.

    Returns MpFsBuilderCache

    Cached MpFsBuilderCache object.

generateHexWithFiles

  • Generates an Intel Hex string with MicroPython and files in the filesystem.

    Uses pre-cached MicroPython memory map and Intel Hex string of record to speed up the Intel Hex generation compared to addIntelHexFiles().

    Parameters

    • cache: MpFsBuilderCache

      Object with cached data from createMpFsBuilderCache().

    • files: object

      Hash table with filenames as the key and byte arrays as the value.

      • [filename: string]: Uint8Array

    Returns string

    MicroPython Intel Hex string with the files in the filesystem.

getIntelHexFiles

  • getIntelHexFiles(intelHex: string | MemoryMap): object
  • Reads the filesystem included in a MicroPython Intel Hex string or Map.

    throws

    {Error} When multiple files with the same name encountered.

    throws

    {Error} When a file chunk points to an unused chunk.

    throws

    {Error} When a file chunk marker does not point to previous chunk.

    throws

    {Error} When following through the chunks linked list iterates through more chunks and used chunks (sign of an infinite loop).

    Parameters

    • intelHex: string | MemoryMap

      The MicroPython Intel Hex string or MemoryMap to read from.

    Returns object

    Dictionary with the filename as key and byte array as values.

    • [filename: string]: Uint8Array

getMemMapFsSize

  • getMemMapFsSize(intelHexMap: MemoryMap): number
  • Calculate the MicroPython filesystem size.

    Parameters

    • intelHexMap: MemoryMap

      The MicroPython Intel Hex Memory Map.

    Returns number

    Size of the filesystem in bytes.

Generated using TypeDoc