USB bootloader

Post Reply
olofk
Posts: 2
Joined: Fri Oct 16, 2020 6:42 am

Hi there,

I was wondering if it's possible to load the FPGA image over serial using the factory flash image to save me from getting an swd cable
olofk
Posts: 2
Joined: Fri Oct 16, 2020 6:42 am

Partly answering myself, I found this

viewtopic.php?f=4&t=29

After reading that I'm still not sure if using the tinyfpga programmer will overwrite the factory bootloader or store the m4/fpga image in another part of the flash. My experience from tinyfpga BX tells me it's the latter, but want to be sure before I kick out the factory image
Robert
Posts: 29
Joined: Fri May 15, 2020 8:27 am

The SPI Flash on the QuickFeather board has the following address map

QuickFeather Flash is 2MB. First 1MB is fixed
* for use with Bootloader, FPGA, FFE, APP images
*
* 0x0000’0000 0x0000’FFFF QuickFeather Boot Loader (raw flash)
* 0x0001’0000 0x0001’0007 {CRC,ByteCount} USB to serial flash FPGA image metadata
* 0x0001’1000 0x0001’1007 {CRC,ByteCount} Application FPGA image metadata
* 0x0001’2000 0x0001’2007 {CRC,ByteCount} Application FFE image metadata
* 0x0001’3000 0x0001’3007 {CRC,ByteCount} Application M4 image metadata
* 0x0001’4000 0x0001’FFFF Unused
* 0x0002’0000 0x0003’FFFF USB to serial flash FPGA image
* 0x0004’0000 0x0005’FFFF Application FPGA image
* 0x0006’0000 0x0007’FFFF Application FFE image
* 0x0008’0000 0x000F’FFFF Application M4 image
* 0x0010’0000 0x001F’FFFF Unused


This can be found at https://github.com/QuickLogic-Corp/qorc ... _defines.h Line 28

As long as you don't overwrite the boot loader and USB to Serial flash FPGA image you can use the TinyFPGA to program the Application M4, FPGA images using the USB cable
YouTube video is available at https://youtu.be/Q5GIZUsXb3I, which also includes information on how to recover from a bricked unit using the SWD interface

Example of using programming the m4app memory space of the SPI flash using the TinyFPGA
Navigate to m4app project build folder and run make

cd qorc-sdk/qf_apps/qf_project_name/GCC_Project
make
Reset QuickFeather board and press ‘user button’ while blue LED is flashing.
Should switch to mode where green LED is breathing.
If green LED not breathing, press reset again and ‘user button’ within 5 seconds of releasing reset (while blue LED is still flashing)

With green LED breathing, program m4app app into QuickFeather:

qfprog --port /dev/ttyXX --m4app output/bin/m4app.bin

replace /dev/ttyXX with the actual device path.

After programming is complete then reset the board to run.

Full details are available in the https://github.com/QuickLogic-Corp/qorc-sdk README.md Lesson #1a: M4 only – qf_helloworldsw

I will work on providing an example of unbricking the board using the https://github.com/blacksphere/blackmagic/wiki

Any issues please let me know
matt_mets
Posts: 4
Joined: Wed Nov 11, 2020 12:37 pm

Another way to un-brick a board is to use a separate device to program the boot image into the SPI flash directly.

Here's a python script that can be used to generate a suitable flash image:
https://github.com/Blinkinlabs/bl_apps/ ... h_image.py

Once you have the image, you can load it to the flash using something like a BusPirate or teensy (https://github.com/osresearch/spiflash).
Post Reply