How to determine the System memory addresses of SPI Flash used in device running eCos operating system? For example, show flash command returns the following info:

 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)

But these addresses seems is not an actual addresses of memory locations. Because when I try readmem command, it always returns errors. For example, there is an example of readmem command:

readmem -s 4 -n 64 0x80001234 -- Reads 64 bytes as 32-bit values.

When I tried readmem -s 4 -n 16384 0x1baef1a5 it always returns error: ERROR - Address(for any addresses from above table). So I assume these addresses is not an actual Flash Memory addresses. I tnink is this because processor’s memory controller maps the flash address space to the system address space. And flash word-size differs from system word-size. How to find the System memory address to read SPI Flash?

  • what commands are available in the bootloader? is there anything like memory map? – Igor Skochinsky Jul 3 '18 at 10:50
  • I will re-check the output of serial console I have, but I remember that only small generic info was displayed on boot, the last lines was "output/input to console is disabled in NonVol". – minto Jul 3 '18 at 11:59
  • this document lists show memory, does it work for you? – Igor Skochinsky Jul 4 '18 at 21:25
  • show memory command available, but it show sort of general stats info, no memory map addresses. Many commands from listed in doc are not available in this F/W, only a limited number. Serial console output. – minto Jul 5 '18 at 9:48

I'm not too familiar with eCos, but my guess is that device address is not a memory address but the address of the hardware device used to access the SPI chip by the OS and bootloader, i.e. something similar to the PCI address like B0:D31:F0 (bus 0, device 31, function 0) on the PC. You should try to find where the flash is mapped into memory and read the chunks using the Offset column.

  • Based on serial output from other similar BCM33XX based devices, it looks like the f/w image Load Address is 80004000. A built-in telnet command read_memory allow read max 16384 bytes at a time, so to read the full image I need manually perform 248 read cycles (4063232/16384), this doesn't appear to be feasible. – minto Jul 10 '18 at 20:24
  • just automate it with some scripts. in any case that’s a different issue, feel free to add a new question about it. I believe I addressed the original question. – Igor Skochinsky Jul 10 '18 at 20:24

Your Answer

