UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
602 Views
Registered: ‎10-27-2015

MicroBlaze: How to extract the BRAM Code out of an ELF file?

HI We have a MicroBlaze implemented within a Zync. We want to update the program for the MicroBlaze on the fly. The plan is to reload a program within the BRAM without an ELF file loader. Simplest way: Stop MicroBlaze - load new ByteCode into BRAM - Start MicroBlaze. --> How can we extract the ByteCode out of an elf file? Thank you for your help.
Tags (3)
0 Kudos
3 Replies
Moderator
Moderator
544 Views
Registered: ‎10-06-2016

Re: MicroBlaze: How to extract the BRAM Code out of an ELF file?

Hi musche@dataio.com

 

Not sure if I understood properly the complete use case but I would say you can use objcopy to generate the bin file from the ELF so you can load it.

 

Regards

Ibai


Ibai
Don’t forget to reply, kudo, and accept as solution.
0 Kudos
195 Views
Registered: ‎10-27-2015

Re: MicroBlaze: How to extract the BRAM Code out of an ELF file?

Hi Ibai, Can you point me to an example on how to extract the byte code by using object copy. The idea is to upload a new byte code into the MicroBlaze by the processor at run time.
0 Kudos
Moderator
Moderator
190 Views
Registered: ‎09-12-2007

Re: MicroBlaze: How to extract the BRAM Code out of an ELF file?

So, as Ibai said, you can use the mb-objcopy to convert the elf to binary:

mb-objcopy -O binary executable.elf executable.bin

You can use the -j to copy just certain sections in the ELF. For example, here I copy just the vector sections.

mb-objcopy -O binary -j .vectors.reset -j .vectors.sw_exception -j .vectors.interrupt -j .vectors.hw_exception user_application.elf vector_section.bin

In your application, you could use somew thing similar to the use case here:

https://mcuoneclipse.com/2016/11/01/getting-the-memory-range-of-sections-with-gnu-linker-files/

Then use mb-objcopy to copy just this section to a binary file.

0 Kudos