mercury2_prog

FLASH源码 2025-08-13

水星2程序员

mercury2_prog应用程序是一种命令行实用程序,用于通过板载FT2232H USB到串行适配器编程Mercury 2 FPGA板。目前,它可以与S25FL116K(16Mbit),S25FL132K(32Mbit)和S25FL164K(64Mbit)SPI闪光芯片进行通信。

该应用程序使用FT2232H的端口A用于配置。端口B免费用于用户应用程序。请参阅Mercury 2示意图,以了解如何将FT2232H连接到FPGA和SPI闪光灯。

用法

  • -h--help打印了描述这些选项的帮助消息
  • -l--list列出了所有可见的FTDI设备,并尝试找到Mercury 2板
  • -e--erase在水星上擦除了整个SPI闪光2
  • -r--read读取整个SPI闪光灯并将其保存到dump.bit
  • -w--write使用指定的文件将其写入SPI闪存。例如: ./ mercury2_prog -w test.bit 。 (请注意,此命令将在编写之前自动删除所需的块。)

建造

mercury2_prog应用程序是在Linux上使用make编辑的。使用GCC 7.4.0和MingW32-GCC-7.3在Ubuntu 18.04上进行了测试。该构建产生了两个二进制文件:

  • mercury2_prog本机X86-64 Linux应用程序
  • mercury2_prog .exe跨编译X86-64 Windows应用程序

请注意,您必须sudo apt-get install mingw-tools mingw-w64-tools以互编换窗户。

样本输出

mercury2_prog -w mercury2_blink.bit .----------------------------------. | MERCURY 2 PROGRAMMER | | (c) 2019 MicroNova LLC | | www.micro-nova.com | '----------------------------------' Reading bitstream file 'mercury2_blink.bit' Size is 231.8 kBytes = 237345 bytes = 1898760 bits 928 x 256B pages (927 whole pages + 33 byte remainder) 58 x 4kB sectors (57 whole sectors + 3873 byte remainder) 4 x 64kB blocks (3 whole blocks + 40740 byte remainder) Reading file... Checking for FTDI devices...3 FTDI devices found Device 0: - Description = 'Mercury FPGA' - Serial # = '77' - FTDI Chip = FT232R @ 12Mbps - Opened = No Device 1: - Description = 'Mercury 2 FPGA A' - Serial # = '100A' - FTDI Chip = FT2232H @ 480Mbps - Opened = No Device 2: - Description = 'Mercury 2 FPGA B' - Serial # = '100B' - FTDI Chip = FT2232H @ 480Mbps - Opened = No Found Mercury 2 FPGA board at FTDI device 1. FTDI device 1 opened successfully. Configuring FTDI for SPI communication...OK Found flash: S25FL132K 32Mbit ***** WRITING FLASH ***** Erasing block 3 / 3 = 100.0% Writing page 927 / 927 = 100.0% Programming time : 2.019 sec Effective speed : 114.413 kBytes/sec">
 $ ./ mercury2_prog -w mercury2_blink.bit
.----------------------------------.
|       MERCURY 2 PROGRAMMER       |
|      (c) 2019 MicroNova LLC      |
|        www.micro-nova.com        |
'----------------------------------'

Reading bitstream file 'mercury2_blink.bit'

Size is 231.8 kBytes = 237345 bytes = 1898760 bits
  928 x 256B pages   (927 whole pages + 33 byte remainder)
   58 x 4kB  sectors (57 whole sectors + 3873 byte remainder)
    4 x 64kB blocks  (3 whole blocks + 40740 byte remainder)

Reading file...
Checking for FTDI devices...3 FTDI devices found
Device 0:
  - Description = 'Mercury FPGA'
  - Serial #    = '77'
  - FTDI Chip   = FT232R @ 12Mbps
  - Opened      = No
Device 1:
  - Description = 'Mercury 2 FPGA A'
  - Serial #    = '100A'
  - FTDI Chip   = FT2232H @ 480Mbps
  - Opened      = No
Device 2:
  - Description = 'Mercury 2 FPGA B'
  - Serial #    = '100B'
  - FTDI Chip   = FT2232H @ 480Mbps
  - Opened      = No

Found Mercury 2 FPGA board at FTDI device 1.
FTDI device 1 opened successfully.
Configuring FTDI for SPI communication...OK
Found flash: S25FL132K 32Mbit

***** WRITING FLASH *****
Erasing block 3 / 3 = 100.0%
Writing page 927 / 927 = 100.0%
Programming time : 2.019 sec
Effective speed  : 114.413 kBytes/sec
下载源码

通过命令行克隆项目:

git clone https://github.com/micro-nova/mercury2_prog.git