cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1,102 Views
Registered: ‎10-27-2015

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

Jump to solution
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
1 Solution

Accepted Solutions
stephenm
Moderator
Moderator
690 Views
Registered: ‎09-12-2007

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.

View solution in original post

0 Kudos
3 Replies
ibaie
Xilinx Employee
Xilinx Employee
1,044 Views
Registered: ‎10-06-2016

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
695 Views
Registered: ‎10-27-2015
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
stephenm
Moderator
Moderator
691 Views
Registered: ‎09-12-2007

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.

View solution in original post

0 Kudos