views:

65

answers:

3

Hi,

I use Xilinx Microblaze CPU core in Virtex4 FPGA. I would like to add a new code part to my current code, but then my code will exceed the size of the flash it is burnt to. Therefore I want to burn the added code to another flash.

My code is copied to RAM by a boot loader, which then jumps to RAM and starts regular execution. I intend to copy the new code from the second flash the same way, adjacently (in RAM) to the code copied from the already used flash.

For this, I actually need two separate elf executable files, one for each burnt flash, and an exact separation between them, defining which routines reside in each file. Routine calls across files should be enabled.

My question: How can I produce these separate elf files, with an exact specification of routines in each file? Is there a way to split one executable file into two separate files? Or is there another solution for producing separate executable / library files as the output of a single link in an embedded system?

Thanks, Ishai

A: 

If you can you use dynamic libraries, you might factor some code out of your executable into one, and simply place one file in each of the flash areas.

Michael Burr
+2  A: 

If you can recombine your binary in RAM, then it should be perfectly fine to link to a single binary and then split the resulting file. You must guarantee that the the boot-loader functions are contained in the primary half. The easiest method would be to create a stand-alone boot loader binary.

You could use a utility like split or dd to divide the binary before copying it to flash.

Casey
+2  A: 
  1. Assume that you already done the obvious and ran 'strip' to produce a copy of the binary without the debug symbols. The debug info is no use on the actual target.

  2. if your stripped binary is still bigger than your FLASH, you can use S-RECORD tools to split that binary. It has many more options in addition to splitting the file, like adding checksum, CRC, as well as supporting a lot of file formats.

If your RAM is big enough to hold all of your program, there's no particular need to make separate ELF file / DLL. Just build your program as one big monolith program to run in the RAM address space, and let your bootloader load parts of it from Flash to RAM.

fseto