cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Observer
Observer
547 Views
Registered: ‎01-24-2019

Microblaze Firmware Bootloader over UART

Jump to solution

Is there a xilinx bootloader code that I can use to implement application update over UART? I have an embedded application built on a spartan 7 device with microblaze. I do have a flash part connected over SPI but the only accessible port in the field is UART. Neither JTAG nor SPI are accessible.

This is something very common and many vendors provide an open source code to implement this feature and I was wondering if xilinx provide one. For example I have used this one on nordic devices (https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/examples_bootloader.html). Thanks!

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Observer
Observer
359 Views
Registered: ‎01-24-2019

Re: Microblaze Firmware Bootloader over UART

Jump to solution

No. There is no existing xilinx c code to bootload the flash image file (.mcs) over UART

View solution in original post

0 Kudos
7 Replies
Highlighted
Xilinx Employee
Xilinx Employee
510 Views
Registered: ‎11-05-2019

Re: Microblaze Firmware Bootloader over UART

Jump to solution

Hello @mustafa.homsi 

 

As explained in the past article, you need to create a Microblaze program that receives MCS from UART and buffers it in DDR memory, and a design to write the MCS to Flash memory.

External UART for spartan 6 fpga to load the mcs file in flash through SPI interface with spartan 6

The following App Note may be helpful, but you need to understand the IP to access the Flash memory and the FPGA's Config I/F.

XAPP1280 UltraScale FPGA Post-Configuration Access of SPI Flash Memory using STARTUPE3 Application Note (v1.1)

 

Thank you
Ka2ki
Don't forget to reply, kudo, and accept as solution.

Highlighted
Observer
Observer
481 Views
Registered: ‎01-24-2019

Re: Microblaze Firmware Bootloader over UART

Jump to solution

Thank you Katsuki. Few things to clarify:

1- I don't have DDR ram on board. I use BRAMs only.

2- I already have the QUAD SPI IP setup in a way I can access the flash post configuration. I do this to emulate an EEPROM functionality to support variable non-volatile data.

3- My intention is only to update the microblaze application code and not the FPGA configuration bitstream. One reason is to reduce the chances of damaging the hardware and another due to a size limitation.

4- The whole operation needs to be power-fail safe. This means I need to copy the new firmware version without erasing the old one, validate the new copy after it is copied (ex: CRC check) and then swap a pointer address to boot the new version.

This UART power-safe bootloader is not a quick thing to do and therefore most vendors provide a code to use (see nordic for example). Does xilinx offer something similar or the only way to do this is, is for the customer to write their own bootloader code?

Thanks!

 

 

 

 

0 Kudos
Highlighted
Observer
Observer
442 Views
Registered: ‎01-24-2019

Re: Microblaze Firmware Bootloader over UART

Jump to solution

Any update on this?

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
423 Views
Registered: ‎11-05-2019

Re: Microblaze Firmware Bootloader over UART

Jump to solution

Hello @mustafa.homsi 

Although your use case is technically possible is quite complex.

It depends on your experience of FPGA and Embedded system development. It means that you understand the documents on last post.

Thank you
Ka2ki
Don't forget to reply, kudo, and accept as solution.

0 Kudos
Highlighted
Contributor
Contributor
394 Views
Registered: ‎10-13-2015

Re: Microblaze Firmware Bootloader over UART

Jump to solution

Hello @mustafa.homsi , @katsuki ,

I would tend to agree with @katsukithat it might be possible, but it is complex.

You will want to do the trade study but I suspect a simpler approach would be to make use of the fallback/multiboot capabilities. In this scenario, 2 (minimum) images are stored in flash 1) application+bitstream & 2) programmer+bitsream. The 2nd image is the 'golden image' and is loaded whenever you want to update the application image or if something goes wrong with the application image download. It is possible the FPGA bitstreams only differ by what Microblaze code is resident in BRAM but that is up to you. This approach also gets around the other constraint you have, scarcity of BRAM. The loader program and your application program are not resident at the same time therefore don't consume resources the other program needs.  

 https://www.xilinx.com/support/documentation/application_notes/xapp1247-multiboot-spi.pdf

Xilinx does offer a SREC bootloader as a template project in SDK/Vitis. I suspect the more important piece is really the FLASH programming piece. Xilinx does offer some basic examples. 

https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/spi/examples/xspi_winbond_flash_quad_example.c

For clarity, Xilinx does provide tools to program the SPI (indirectly) using Vivado or SDK/Vitis over the only hardware interface that exists before the FPGA is loaded (JTAG). All other communication interfaces (if any) are synthesized and vary widely based on customer use cases. There isn't another 'standard' method to get code to the FLASH using the FPGA (you could always bypass the FPGA to program FLASH as well). 

-Neil

 

 

 

Highlighted
Observer
Observer
360 Views
Registered: ‎01-24-2019

Re: Microblaze Firmware Bootloader over UART

Jump to solution

@nwillard thank you for sharing the info about Spartan 7 multiboot feature as I was not aware of it. This definitely takes care of the power-safe implemantation. I already have a way to update the new bitstream image using Xilinx QUAD SPI IP and xilinx SPI c code driver. The missing piece is the c code to receive the .mcs file over UART and convert it over to SPI packets so the flash can be updated. A companion desktop also need to be developed which loads the .mcs file and send it over UART packets. This definitely is going to take some efforts and I just wanted to make sure there is nothing out there that is already developed by xilinx. However, it sounds that we have to just develop it. 

Btw as I was reading more about multiboot I came across QuickBoot feature and this application note https://www.google.com/url?sa=t&source=web&rct=j&url=https://www.xilinx.com/support/documentation/application_notes/xapp1081-quickboot-remote-update.pdf&ved=2ahUKEwi_wrHC6s7oAhUQqJ4KHaSEDwwQFjAAegQIARAB&usg=AOvVaw35MGzRjdTgCRtgCEzNx0mV .

QuickBoot is slightly better than multiboot and figure 1 shows exactly what I am trying to achieve. 

0 Kudos
Highlighted
Observer
Observer
360 Views
Registered: ‎01-24-2019

Re: Microblaze Firmware Bootloader over UART

Jump to solution

No. There is no existing xilinx c code to bootload the flash image file (.mcs) over UART

View solution in original post

0 Kudos