creating a working srec bootloader sdk project for version 12

7
Creating a working SREC bootloader SDK project for version 12 AUTHOR: Billy Huang DATE: 2010-12-13 This project focuses on obtaining output on the UART. It assumes that the XPS UART used is of type uart16550. This is recommended as it is well supported on Linux, should you wish to run Linux (such as TokaLin) on your Microblaze. Assumes you have a working XPS setup. This should be the case if you used a reference design and in XPS you selected Export Hardware Design to SDK. In XPS In SDK Create a new Xilinx C project Choose the SREC bootloader project. Next we change the BSP settings to link up the UART, otherwise you won’t see anything.

Upload: mikiiie

Post on 24-Oct-2014

81 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Creating a Working SREC Bootloader SDK Project for Version 12

Creating a working SREC bootloader SDK project forversion 12

AUTHOR: Billy HuangDATE: 2010-12-13

This project focuses on obtaining output on the UART. Itassumes that the XPS UART used is of type uart16550.This is recommended as it is well supported on Linux,should you wish to run Linux (such as TokaLin) on yourMicroblaze.

Assumes you have a working XPS setup. This should be thecase if you used a reference design and in XPS youselected Export Hardware Design to SDK.

In XPS

In SDK

Create a new Xilinx C project

Choose the SREC bootloader project.

Next we change the BSP settings to link up the UART,otherwise you won’t see anything.

Page 2: Creating a Working SREC Bootloader SDK Project for Version 12

Click “standalone” and change the value in the dropdownto your UART.

Click OK.

Next you may need to modify the C code. Note SDKrecompiles every time you save. If you get “linker”errors don’t worry about these, see linker generation

Page 3: Creating a Working SREC Bootloader SDK Project for Version 12

below. If you get C code errors try and fix these. Beloware some fixes I’ve had to do.

Add to the top of “platform_config.h”

#define STDOUT_IS_16550

#define STDOUT_BASEADDR STDOUT_BASEADDRESS

Change “blconfig.h”

#define FLASH_IMAGE_BASEADDR 0x87120000

To your flash image base address, i.e. where your flashfile will be loaded. It should be at the flash base,plus some offset. The offset is important becausegenerally you will have a bitstream at offset zero. So myoffset is 0x00120000. This is 1179648 in decimal, so 1152Kilobytes, so about 1MB. This should be enough of anoffset to miss overwriting the end of my bitstream.

Change “platform.c” baud rate to what you desire(generally 9600 or 115200).

XUartNs550_SetBaud(STDOUT_BASEADDR, XPAR_XUARTNS550_CLOCK_HZ,115200);

Next we need to generate a linker script, our programwon’t fit in microblaze cache, it needs to go into theBRAM memory. bram_block and xps_bram_if_cntlr need to bein your XPS design to have access to this. Without thisyou will not be able to use your microblaze for much atall, I think all reference designs should include thisanyway. In the very unlikely event it your design doesnot, then download the SP601 reference design and compareyour microblaze with the SP601 to see how BRAM is added,or refer to the documentation.

If you don’t know what a linker script is, it essentiallydefines for a static executable (which ours is) where inmemory various parts of the code should be. This ofcourse is completely system dependant, so needs to beregenerated on different systems. Thankfully the SDKmakes this process very easy.

Page 4: Creating a Working SREC Bootloader SDK Project for Version 12

Put everything into the BRAM.

Page 5: Creating a Working SREC Bootloader SDK Project for Version 12

Then click generate.

That should then recompile the program okay.

Running the program on the Microblaze

There are a few ways to do this, I am going to explainthe way which initialises the bitstream BRAM with yoursrec bootloader elf, loads the updated bitstream onto theFPGA and runs it.

In SDK

Select your complied bootloader.elf.

Page 6: Creating a Working SREC Bootloader SDK Project for Version 12

And Program.

With any luck you should see output on the UART. If notcheck the stages in this document. Confirm that you havethe Correct baud rate (an example of my settings arebelow). Check that you have the UART NTS 16550 in yourXPS project.

A view of TokaLin (not the SREC bootloader!!) is shownbelow.

Page 7: Creating a Working SREC Bootloader SDK Project for Version 12