Author Topic: microblaze building .mcs flash image for bootloader  (Read 6717 times)

mlefevre

  • Active Member
  • *
  • Posts: 21
microblaze building .mcs flash image for bootloader
« on: February 14, 2012, 04:42:37 PM »
Hi,

I have a good .elf software (let's call it soft.elf) for a microblaze running a Gibagee board. I want to store this software in the SPI W25Q64BV flash at offset 0x400000, and develop my own bootloder to load this software from SPI Flash into DDR3 at each start up of the board.
I have take a look at all the scripts given in the TE-Reference design, but i am bit lost....
What is the command to generate soft.mcs from soft.lef at offset 0x400000 with the same boot data header that the one provided in the reference design :
Code: [Select]
typedef struct tagBOOTDATAHEADER {
unsigned int size;
unsigned int boot_jump;
unsigned short crc16;
unsigned char vectors[40];
} BOOTDATAHEADER;

Thanks for helping.
« Last Edit: February 14, 2012, 04:44:40 PM by mlefevre »

Ales Gorkic

  • Jr. Member
  • **
  • Posts: 80
    • Optomotive Cameras
Re: microblaze building .mcs flash image for bootloader
« Reply #1 on: February 15, 2012, 11:28:06 PM »
Hi,

This is the system:
copy your bitstream with the bootloader in the BRAM to
PREPARE_FWU/download.bit
and executable to
PREPARE_FWU/demo.elf

Then run the (0x400000 is the boot address):
build_boot download.bit demo.elf 0x400000

It will generate file firmware.fwu which is a ZIP file containing fpga.bin which is a flash image.

If you need mcs file edit the build_boot.bat and comment the line:
 del _combined.hex

The only thing which is important is the offset from which the ELF is stored in the flash (0x100000 in the following line):
    bin\xmcsutil -accept_notice -16 -i _fpga_bootloader.mcs _bootdata.mcs -o _combined.mcs -segaddr 0x00 0x100000 -usedataaddr -padff
This address should match flash sector specified bootloader program.

I hope you can manage to make it work.

Best regards,

Ales
Assumption is a mother of all fuck-ups.

mlefevre

  • Active Member
  • *
  • Posts: 21
Re: microblaze building .mcs flash image for bootloader
« Reply #2 on: February 16, 2012, 08:19:57 AM »
OK, thanks

I am still working on it. I'll poste the .bat when it 'll be done. And some explanation on the bootloader.

mlefevre

  • Active Member
  • *
  • Posts: 21
Re: microblaze building .mcs flash image for bootloader
« Reply #3 on: February 28, 2012, 08:34:54 AM »
Hi,

I'am done with the bootloader...It works but it gave me hard time.
I have re-use the all script procedure provided in the reference design (thank you for providing it!!)
I am stunt by the fact that Xilinx do not provide some code and script to write a simple bootloader.
On Altera/Nios2 it took me a single day to do the very same work, just 2 commands objcopy and elf2flash.
On Xilinx you have a dosen  of script commands and to write your own C++ application to organise your mcs file!!!!

I can help if anyone is stuck on bootlloader.