为包含配置位流和 Microblaze 软件的 Xilinx Spartan-6 创建可启动 SPI 闪存(PROM 文件)的设计流程
我想知道为串行 SPI 闪存创建 PROM 文件 (.MCS) 的正确过程,其中包括 FPGA 配置比特流和 Microblaze 处理器使用的软件。这是假设我的硬件和软件设计全部完成的情况。
我正在使用 Xilinx Spartan-6 评估板 SP605,它具有多个非易失性存储器件,我希望使用串行 SPI 闪存来存储 FPGA 比特流和需要加载到内存中的 Microblaze 软件。只有当 Microblaze 的代码驻留在内部 BRAM 中时,我才能实现这一点。如果我创建链接脚本,将代码或数据部分放置在外部 DDR3 RAM 中,则会失败。
- 编辑 -
好的,所以我尝试了一些不同的事情,我对我需要做什么有了更好的理解,但仍然没有成功(顺便说一句,感谢你的回复安迪)。所以,我尝试了两种不同的方法。对于这两个程序,我首先将系统比特流与引导加载程序合并,以生成一个运行良好的新 .bit (download.bit) 文件(当您点击 SDK 中的程序并选择引导加载程序来加载 BRAM 时,它会调用 data2mem 来生成新的 download.bit 文件)。
第一种方法 - BIN 文件
一旦我的主程序完成(使用针对 DDR RAM 等的链接器脚本),我调用 mb-objcopy 从 .elf 文件生成 bin 文件:
mb-objcopy -O binary program -R .vectors_reset -R .vectors.sw_exception -R vectors.interrupt -R .vectors.hw_exception dummy.elf dummy.b
然后我使用 iMPACT 使用 download 创建 MCS 文件.bit 和 dummy。我将 download.bit 放置在 SPI Flash 的起始地址,并将 dummy.b 放置在更下方(引导加载程序已经指向该地址)。然后,我将 MCS 刻录到串行 SPI 闪存,重新启动,引导加载程序运行,并据称将所有内容复制到 DDR RAM,但是,主程序不起作用。我在这里错过了什么吗?如果我尝试使用 iMPACT 而不将主程序从 .elf 更改为 BIN,PC 会挂起(有时我什至必须完全重置计算机),而我有一台非常快且配备内存的 PC。
我使用的引导加载程序与 Xilinx XAPP1146 文档中链接的引导加载程序相同。
第二种方法 - SREC 文件
步骤几乎相同,除了我使用相同的 mb-objcopy 命令来生成 SREC 而不是 BIN 文件(这次我不删除任何扇区,这是我需要做的对于BIN文件,否则会生成一个巨大的文件)。
我使用的bootloader是SDK软件自带的。
如果您已成功为 Microblaze 创建引导加载程序,请告诉我。
提前致谢, 埃里克
I would like to know the proper procedure to create a PROM file (.MCS) for a serial SPI Flash that include BOTH the FPGA configuration bitstream and the software to be used by the Microblaze processor. This is assuming my hardware and software design is all done.
I am using a Xilinx Spartan-6 evaluation board, the SP605, which has several non-volatile memory devices and I wish to use the serial SPI Flash to store BOTH the FPGA bitstream AND the Microblaze's software that needs to be loaded into memory. I am able to achieve this only if the Microblaze's code is to reside in the internal BRAMs. If I create my link script such that it places the code or data sections in the external DDR3 RAM, it fails.
-- EDIT --
OK, so I have tried a couple of different things and I have a better understanding of what I need to do, but still no success (which, btw, thanks for your reply Andy). So, I have tried 2 different things. For both of them I first merge the system bitstream with the bootloader program to generate a new .bit (download.bit) file that runs just fine (when you hit program in SDK and choose the bootloader to load the BRAM, it calls data2mem to generate the new download.bit file).
FIRST APPROACH - BIN FILE
Once my main program is done (with a linker script targeting the DDR RAM and all) I call mb-objcopy to generate a bin file from the .elf one:
mb-objcopy -O binary program -R .vectors_reset -R .vectors.sw_exception -R vectors.interrupt -R .vectors.hw_exception dummy.elf dummy.b
Then I use iMPACT to create and MCS file using download.bit and dummy.b. I place download.bit at the starting address of the SPI Flash and dummy.b further down (the bootloader already points to that address). Then I burn the MCS to the serial SPI FLash, restart and the bootloader runs and supposedly copies everything to DDR RAM, but, the main program doesn't work. Am I missing something here? If I try to use iMPACT without changing the main program from .elf to BIN, the PC hangs (sometimes I even have to completely reset the computer) and I have a very fast and memory-equipped PC.
The bootloader I used was the same one linked in the Xilinx XAPP1146 document.
SECOND APPROACH - SREC FILE
The steps are pretty much the same, except that I use the same mb-objcopy command to generate an SREC instead of a BIN file (this time I don't remove any of the sectors, which I needed to do for the BIN file otherwise it would generate an enormous file).
The bootloader I used is the one that the SDK software has.
Please anyone let me know if you have successfully created a bootloader for the Microblaze.
Thanks in advance,
Erick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经构建了引导加载程序,但与您的有两个不同之处:
如果它给你任何想法,这就是我所做的:
我有一个单独的 SPI 闪存设备,我从中读取 ELF 文件,然后动态解析该文件并将相关代码/初始化部分传输到 DRAM 中。不过,您的引导加载程序没有理由无法从与配置相同的闪存设备加载。
它不是一个完全灵活的 ELF 解析器,因为它假设节的顺序与节头表报告它们的顺序相同,但这就是 Microblaze 工具生成文件的方式,所以它工作正常。
(并且在将文件编程到闪存之前,不要忘记从文件中删除调试信息!)
I have built bootloaders, but with two differences from yours:
In case it gives you any ideas, here's what I do:
I have a separate SPI flash device from which I read an ELF file, which I then parse on the fly and transfer the relevant code/initialisation sections into the DRAM. There's no reason that your bootloader couldn't load from the same flash device as the config though.
It's not a completely flexible ELF parser as it assumes that the sections come in the same order as the section header table reports them, but that's how the Microblaze tools produce the files, so it works out OK.
(And don't forget to strip the debugging information from the file before programming it to flash!)
这比这一切要容易得多。
impact -batch make_bpi_up.impact
xmcsutil -accept_notice -18 pi outfile.hex -o bootloader.bin
(上面的最后一个命令创建一个可启动映像,带有您的 FPGA 位文件和引导加载程序)
然后使用 XSDK 在引导加载程序指定的偏移量处对您的应用程序进行编程
接下来,使用 XSDK 对引导加载程序 @ 0x0 进行编程
- 请注意,当您从 XSDK 中选择“Program Flash”时,您需要浏览到 bootloader.bin 并选择 *,而不是在文件中选择 .bin;.elf;*.srec浏览器窗口中的文件类型过滤器,以便您能够选择 bootloader.bin
如果您需要我澄清任何步骤,请告诉我。在下周将其添加到我的博客并带有屏幕截图的过程中。
make_bpi_up.impact 文件由以下
MacGyverQue组成
It's waaaay easier than all that.
impact -batch make_bpi_up.impact
xmcsutil -accept_notice -18 pi outfile.hex -o bootloader.bin
(The last command above creates a bootable image w/ your FPGA bit file and the bootloader)
Then program your application @ the offset specified by your bootloader using XSDK
Next, program the bootloader @ 0x0 using XSDK
- note, when you're selecting "Program Flash" from XSDK, you'll need to browse to the bootloader.bin and select * as opposed to .bin;.elf;*.srec in the file type filter in the browser window so you'll be able to select the bootloader.bin
Let me know if you need me to clarify any of the steps. In the process of adding this to my blog w/ screenshots over the next week.
The make_bpi_up.impact file consists of the following
MacGyverQue
右键单击 microblaze,单击关联 ELF 文件,添加您的 .elf 文件并配置模式。生成比特流。并将 .bit 转换为 .mcs 并下载文件..
.elf 和 .mcs 文件都存储在闪存中
right click on microblaze ,click on associate ELF file add your .elf file and configure mode .generate bitstream. and convert .bit to .mcs and download the file ..
the both the .elf and .mcs file is stored into flash