How to rescue image from SD card, when my preprogrammed flash was erased

I accidentally erased SPI Flsh today. When power on, it reported Error 0x0100000000000002.
So, how to rescue image from SD card, when my preprogrammed flash was erased?
I need your help. thanks

  1. Download the firmware from https://www.sifive.com/products/hifive-unleashed/
  2. Copy the raw ‘gpt’ file to an SD card (dd if=firmware.gpt of=/dev/sdz)
  3. Orient the HiFive Unleashed so that the MSELx text is readable left-to-right
  4. Set the HiFive Unleashed to MSEL0=left, MSEL1=left, MSEL2=right, MSEL3=left
  5. Boot he HiFive Unleashed with the prepared SD card
  6. Copy the ‘gpt’ file to the HiFive Unleashed with scp
  7. On the HiFive Unleashed, run: flashcp -v foo.gpt /dev/mtd0
  8. Restore the mode select DIPs to all left.
2 Likes