Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. i'm working on a SPI NAND Flash applet for #GlasgowInterfaceExplorer.

i'm working on a SPI NAND Flash applet for #GlasgowInterfaceExplorer.

Scheduled Pinned Locked Moved Uncategorized
glasgowinterfac
8 Posts 4 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • whitequark@social.treehouse.systemsW This user is from outside of this forum
    whitequark@social.treehouse.systemsW This user is from outside of this forum
    whitequark@social.treehouse.systems
    wrote last edited by
    #1

    i'm working on a SPI NAND Flash applet for #GlasgowInterfaceExplorer. i would like to add the ability to read (and write) data dumps... however, unlike with SPI NOR flashes where the data is located in an flat address space, SPI NAND devices are structured as pages (each consisting of data + spare + ECC)

    how should i format these dumps? is there a standard format? is "use msgpack with a simple custom schema" good enough, considering msgspec promises fast (de)serialization for Python and other languages?

    snowfox@tech.lgbtS whitequark@social.treehouse.systemsW 2 Replies Last reply
    0
    • whitequark@social.treehouse.systemsW This user is from outside of this forum
      whitequark@social.treehouse.systemsW This user is from outside of this forum
      whitequark@social.treehouse.systems
      wrote last edited by
      #2

      @r I would consider this to be a "dogshit experience", correct

      f4grx@chaos.socialF R 2 Replies Last reply
      0
      • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

        @r I would consider this to be a "dogshit experience", correct

        f4grx@chaos.socialF This user is from outside of this forum
        f4grx@chaos.socialF This user is from outside of this forum
        f4grx@chaos.social
        wrote last edited by
        #3

        @whitequark @r encode everything in ASN1 sequences. You get free indications of blocks sizes.

        More seriously, why not have a look at floppy formats from hxc? They probably have a format to archive hard drive blocks.

        1 Reply Last reply
        0
        • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

          i'm working on a SPI NAND Flash applet for #GlasgowInterfaceExplorer. i would like to add the ability to read (and write) data dumps... however, unlike with SPI NOR flashes where the data is located in an flat address space, SPI NAND devices are structured as pages (each consisting of data + spare + ECC)

          how should i format these dumps? is there a standard format? is "use msgpack with a simple custom schema" good enough, considering msgspec promises fast (de)serialization for Python and other languages?

          snowfox@tech.lgbtS This user is from outside of this forum
          snowfox@tech.lgbtS This user is from outside of this forum
          snowfox@tech.lgbt
          wrote last edited by
          #4

          @whitequark My preference/bias is against adding dependencies, so JSON-wrapped hexdumps ({"data":..., "spare":..., "ecc":...}, maybe with the address as well) would be fine, with a slight preference for hex over base64 for legibility and ease of decoding, if the size difference isn't an issue. A handy side-effect is that you can (in practice) encode/decode it as a hexdump delmited by fixed strings, so a JSON library isn't strictly necessary (assuming the encoder doesn't change field order/spacing/etc).

          Alternatively, you could do something like bin/cue and put the format in another file assuming it's the same for all sectors (though perhaps as JSON instead of a custom text format).

          There's also the various disk image formats, some of which might handle sectors of unusual size (I've heard that 512+ecc(?) was a thing), though I don't know if any support annotating the spare/ecc/etc bytes in a sector.

          whitequark@social.treehouse.systemsW 1 Reply Last reply
          0
          • snowfox@tech.lgbtS snowfox@tech.lgbt

            @whitequark My preference/bias is against adding dependencies, so JSON-wrapped hexdumps ({"data":..., "spare":..., "ecc":...}, maybe with the address as well) would be fine, with a slight preference for hex over base64 for legibility and ease of decoding, if the size difference isn't an issue. A handy side-effect is that you can (in practice) encode/decode it as a hexdump delmited by fixed strings, so a JSON library isn't strictly necessary (assuming the encoder doesn't change field order/spacing/etc).

            Alternatively, you could do something like bin/cue and put the format in another file assuming it's the same for all sectors (though perhaps as JSON instead of a custom text format).

            There's also the various disk image formats, some of which might handle sectors of unusual size (I've heard that 512+ecc(?) was a thing), though I don't know if any support annotating the spare/ecc/etc bytes in a sector.

            whitequark@social.treehouse.systemsW This user is from outside of this forum
            whitequark@social.treehouse.systemsW This user is from outside of this forum
            whitequark@social.treehouse.systems
            wrote last edited by
            #5

            @snowfox do you really want to store 1 GB of data as base64-encoded JSON?

            1 Reply Last reply
            0
            • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

              @r I would consider this to be a "dogshit experience", correct

              R This user is from outside of this forum
              R This user is from outside of this forum
              rogandawes@infosec.exchange
              wrote last edited by
              #6

              @whitequark @r my understanding is that the OS is free to use the extra bytes as they will, so the ostensible 2k+64bytes may actually be used as 4*(512b+16b) or whatever they want. Which means that separating them doesn’t actually give you anything meaningful. Besides which, the OOB data may have important ECC data required to properly interpret the data bytes anyway.
              And finally, most tooling expects to receive it in that format (nandwrite, xgecu’s software, etc).

              1 Reply Last reply
              0
              • R This user is from outside of this forum
                R This user is from outside of this forum
                rogandawes@infosec.exchange
                wrote last edited by
                #7

                @r @whitequark *one* of the problems 😅

                1 Reply Last reply
                0
                • whitequark@social.treehouse.systemsW whitequark@social.treehouse.systems

                  i'm working on a SPI NAND Flash applet for #GlasgowInterfaceExplorer. i would like to add the ability to read (and write) data dumps... however, unlike with SPI NOR flashes where the data is located in an flat address space, SPI NAND devices are structured as pages (each consisting of data + spare + ECC)

                  how should i format these dumps? is there a standard format? is "use msgpack with a simple custom schema" good enough, considering msgspec promises fast (de)serialization for Python and other languages?

                  whitequark@social.treehouse.systemsW This user is from outside of this forum
                  whitequark@social.treehouse.systemsW This user is from outside of this forum
                  whitequark@social.treehouse.systems
                  wrote last edited by
                  #8

                  i have settled on "linear image of data+spare bytes, exactly as it came out of the page buffer"

                  reasoning:

                  • while data/spare is a well known distinction, it is somewhat arbitrary (spare bytes aren't any different than data bytes with ECC disabled, except for bad block markers)
                  • moreover, wth ECC enabled, there is more internal structure to the page than just data/spare
                  • and we can't represent this internal structure because we don't know and the vendor doesn't describe it except free-form in the datasheet
                  • this is exactly how bytes come out of the device when you ask it
                  • this is compatible with existing tooling
                  1 Reply Last reply
                  1
                  0
                  • R relay@relay.infosec.exchange shared this topic
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups