cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
745 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
Highlighted
Moderator
Moderator
333 Views
Registered: ‎09-12-2007

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

Jump to solution

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
Highlighted
Moderator
Moderator
687 Views
Registered: ‎10-06-2016

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

Jump to solution

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
Highlighted
338 Views
Registered: ‎10-27-2015

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

Jump to solution
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
Highlighted
Moderator
Moderator
334 Views
Registered: ‎09-12-2007

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

Jump to solution

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