cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rdemara
Adventurer
Adventurer
596 Views
Registered: ‎05-29-2015

ARM running petalinux + microblaze running baremetal

Jump to solution

Is there a guide any where to get both the Zynq ARM core and a microblaze playing nicely? I've done this successfully in the past (Vivado 2016.4). I've recently upgraded Vivado & accompanying tools to a newer version (2019.2) and things have changed quite a bit. Petalinux is completely different and now there's Vitis, which I presume replaces the SDK.

I have a Vivado design that runs PetaLinux on the ARM cores. I have this design working fine. It's currently booting off of an SD card. I'd like to now add a Microblaze processor to our Vivado project to autonomously control some other, more complicated, timing sensitive external hardware. Basically treating the Microblaze as a fabric embedded microcontroller. Eventually it will spit some data out to the ARM over DMA, via AXI stream. My questions are:

1) How do I generate an elf file targeting just the Microblaze in the system. I presume I use Vitis and import the xsa file as step one.

2) How do I package up the Microblaze elf file, so when the FSBL loads the bit file it also programs the microblaze processor?

1 Solution

Accepted Solutions
rdemara
Adventurer
Adventurer
536 Views
Registered: ‎05-29-2015

I was able to get everything to work. The good news is that the flow is very similar to older builds, with the SDK/Vitis portion being different:

1) Create the project in Vivado. Generate the bitstream.

2) Export the hardware, including the bit file.

3) Launch Vitis. Create a new application project.

4) In the "platform" page select the create a new platform from XSA option. Click the "+" and select the generated XSA file.

5) On the "domain" page target your microblaze.

6) Select the code template, I selected the "peripheral test" as a starting point.

7) Build the application.

Go back into Vivado and click the Tools -> Associate ELF File. Select the recently compiled elf file. I then went a head and regenerated the implementation and bit file (not sure if you need to do this). It will generate a .mmi file for your microblaze BRAM in your implementation directory.

9) Do whatever you have to do to get to a point where you're ready to generate a petalinux image, right before actually generating the BOOT.BIN and image.ub. Use the updatemem tool to join the Vivado bitfile, the Vivado generated .mmi file, and your microblaze elf application:

 

In my Petalinux Makefile I added some variables:

XSA_DIR=../../xsa
MB_ELF_BIN=../../vitis/mb_proj/Debug/mb_proj.elf
MB_MMI_FILE=../../work/vivado_proj/vivado_proj.runs/impl_1/vivado_proj_wrapper.mmi
VIVADO_BIT_FILE=../../work/vivado_proj/vivado_proj.runs/impl_1/vivado_proj_wrapper.bit
BOOT_FSBL_IMAGE = images/linux/zynq_fsbl.elf
BOOT_BIT_IMAGE = images/linux/system.bit
BOOT_UBOOT_IMAGE = images/linux/u-boot.elf

And I added a new recipe:

combine_elf_gen_bootimage:
   updatemem -force -meminfo ${MB_MMI_FILE} -data ${MB_ELF_BIN} -bit ${VIVADO_BIT_FILE} -proc design_1/microblaze_0 -out ${XSA_DIR}/combined.bit
   petalinux-package --boot --force --fsbl ${BOOT_FSBL_IMAGE} --fpga ${XSA_DIR}/combined.bit --u-boot    ${BOOT_UBOOT_IMAGE}

 

View solution in original post

2 Replies
rdemara
Adventurer
Adventurer
537 Views
Registered: ‎05-29-2015

I was able to get everything to work. The good news is that the flow is very similar to older builds, with the SDK/Vitis portion being different:

1) Create the project in Vivado. Generate the bitstream.

2) Export the hardware, including the bit file.

3) Launch Vitis. Create a new application project.

4) In the "platform" page select the create a new platform from XSA option. Click the "+" and select the generated XSA file.

5) On the "domain" page target your microblaze.

6) Select the code template, I selected the "peripheral test" as a starting point.

7) Build the application.

Go back into Vivado and click the Tools -> Associate ELF File. Select the recently compiled elf file. I then went a head and regenerated the implementation and bit file (not sure if you need to do this). It will generate a .mmi file for your microblaze BRAM in your implementation directory.

9) Do whatever you have to do to get to a point where you're ready to generate a petalinux image, right before actually generating the BOOT.BIN and image.ub. Use the updatemem tool to join the Vivado bitfile, the Vivado generated .mmi file, and your microblaze elf application:

 

In my Petalinux Makefile I added some variables:

XSA_DIR=../../xsa
MB_ELF_BIN=../../vitis/mb_proj/Debug/mb_proj.elf
MB_MMI_FILE=../../work/vivado_proj/vivado_proj.runs/impl_1/vivado_proj_wrapper.mmi
VIVADO_BIT_FILE=../../work/vivado_proj/vivado_proj.runs/impl_1/vivado_proj_wrapper.bit
BOOT_FSBL_IMAGE = images/linux/zynq_fsbl.elf
BOOT_BIT_IMAGE = images/linux/system.bit
BOOT_UBOOT_IMAGE = images/linux/u-boot.elf

And I added a new recipe:

combine_elf_gen_bootimage:
   updatemem -force -meminfo ${MB_MMI_FILE} -data ${MB_ELF_BIN} -bit ${VIVADO_BIT_FILE} -proc design_1/microblaze_0 -out ${XSA_DIR}/combined.bit
   petalinux-package --boot --force --fsbl ${BOOT_FSBL_IMAGE} --fpga ${XSA_DIR}/combined.bit --u-boot    ${BOOT_UBOOT_IMAGE}

 

View solution in original post

blazin912
Observer
Observer
313 Views
Registered: ‎01-08-2021

I'm trying to do something very similar here to get started. 

When I boot my system U-Boot crashes.. do you have to rebuilt u-boot with any particular changes? My only difference is Zynq MP vs Zynq, but I assume process is similar

0 Kudos