Reading SPI Flash memory blocks

Discussion in 'Embedded Systems and Microcontrollers' started by satcom, Jul 18, 2018.

  1. satcom

    Thread Starter Member

    Apr 1, 2015
    62
    0
    I have device with embedded eCos RTOS and SPI Flash memory, 8MB NOR flash (MX25L6405D)

    Flash Device Information:

    CFI Compliant: no
    Command Set: Generic SPI Flash
    Device/Bus Width: x16
    Little Word Endian: no
    Fast Bulk Erase: no
    Multibyte Write: 256 bytes max
    Phys base address: 0xbadf1a5
    Uncached Virt addr: 0x1badf1a5
    Cached Virt addr: 0x2badf1a5
    Number of blocks: 129
    Total size: 8388608 bytes, 8 Mbytes
    Current mode: Read Array
    Device Size: 8388608, Write buffer: 256, Busy bit:

    Size Device Device Region
    Block kB Address Offset Offset Region Allocation
    ----- ---- ---------- ----------- --------- -----------------
    0 32 0x1badf1a5 0 0 Bootloader (32768 bytes)
    1 32 0x1bae71a5 32768 ??? {unassigned}
    2 64 0x1baef1a5 65536 0 Permanent NonVol (65536 bytes)
    3 64 0x1baff1a5 131072 0 Image1
    4 64 0x1bb0f1a5 196608 65536 Image1
    5 64 0x1bb1f1a5 262144 131072 Image1
    6 64 0x1bb2f1a5 327680 196608 Image1
    7 64 0x1bb3f1a5 393216 262144 Image1
    .. .. ........
    127 64 0x1c2bf1a5 8257536 4063232 Image2 (4128768 bytes)
    128 64 0x1c2cf1a5 8323072 0 Dynamic NonVol (65536 bytes)


    I want read (on terminal console) a particular regions of flash memory (Perm. nonvol, Dynamic nonvol, Bootloader) use dedicated 'readmem' command
    readmem -s 2 -n 16384 0x80001234 (-s format of output, -n bytes to read, 0x.. address to read)

    The base address of flash is 80000000.
    To obtain an absolute address of each individual block, I added an offset value to the base address.
    I.e. for Block #2 (Permanent Nonvol) offset value is 0x00010000 (decimal 65536 to hex). An absolute addresss is 00010000 + 80000000 = 0x80010000

    Similarly, for Block #1 an absolute address is 00008000 + 80000000 = 0x80008000.
    For Block #0 (bootloader) an absolute address is 0x80000000.

    So, to read the full Block #2 (Perm. nonvol) should I read forward 65536 bytes starting from Block #2 absolute address 0x80010000? Or read from previous Block #1 till address 0x80010000?

    Same question for block #128 (Dynamic nonvol) with absolute address 0x807F0000: should I read forward 65536 bytes starting from this address,
    or read from Block #127 till address 0x807F0000?
    Lastly, the same question for reading bootloader.
     
Loading...