.elf to .bin file for microblaze

  • Thread starter Frank van Eijkelenburg
  • Start date
F

Frank van Eijkelenburg

Guest
I have a stand alone application which I want to download into external
sdram at a microblaze system. In bram a kind of bootloader is running. I try
to download via xmodem a binairy application to sdram and then jump to it.
To convert the application from .elf to .bin I use mb-objcopy:

mb-objcopy -I elf32-microblaze -O binary appl.elf appl.bin

when I look at the binary file with an editor I see the following:

B8 00 00 18 80 00 00 00 B0 00 7F FF B8 08 FF FF
..
..

when I look at sdram (after downloading) I see the following (unsigned char
pointer used for reading out):

00 B8 18 00 00 80 00 00 00 B0 FF 7F 08 B8 FF FF
..
..

Is this correct of should it be exactly the same as the binairy file?? (I
read that the bram is big endian and if I read here, the contents is the
same as the binairy file of the bootloader, but how is it with sdram, what
is the microblaze expecting (big endian of coarse, I know), but is the
binairy file created with objcopy ready to copy it byte for byte to sdram or
do I have to reverse something?

Frank
 
Hello

B8 00 00 18 80 00 00 00 B0 00 7F FF B8 08 FF FF
.

when I look at sdram (after downloading) I see the following (unsigned char
pointer used for reading out):

00 B8 18 00 00 80 00 00 00 B0 FF 7F 08 B8 FF FF
.
I had the same problem, you have to swap each byte with the following:

Bytes in bin-File:

b1 b2 b3 b4 b5 b6 b7 b8 b9 b10...

Bytes to store in SDRAM / FLASH ..

b2 b1 b4 b3 b6 b5 b8 b7 b10 b9 ...

Here is a litte C-code fragment which does that:

for (i = 0; i < FRAME_DATA_SIZE/2; i++) {
data_frame.data[2*i+1] = *act_data++;
data_frame.data[2*i] = *act_data++;
}
act_data is a pointer to the bin file
data_frame.data[x] is the data to store in FLASH.

Greetings,
Reiner Abl

--
_____________________________________
www.rockmotion.de
 
"Reiner Abl" <diax_removethis_@gmx.de> wrote in message
news:eek:prz9omzsxzrls9e@news.online.de...
Hello

B8 00 00 18 80 00 00 00 B0 00 7F FF B8 08 FF FF
.

when I look at sdram (after downloading) I see the following (unsigned
char
pointer used for reading out):

00 B8 18 00 00 80 00 00 00 B0 FF 7F 08 B8 FF FF
.

I had the same problem, you have to swap each byte with the following:

Bytes in bin-File:

b1 b2 b3 b4 b5 b6 b7 b8 b9 b10...

Bytes to store in SDRAM / FLASH ..

b2 b1 b4 b3 b6 b5 b8 b7 b10 b9 ...

Here is a litte C-code fragment which does that:

for (i = 0; i < FRAME_DATA_SIZE/2; i++) {
data_frame.data[2*i+1] = *act_data++;
data_frame.data[2*i] = *act_data++;
}
act_data is a pointer to the bin file
data_frame.data[x] is the data to store in FLASH.

Greetings,
Reiner Abl

--
_____________________________________
www.rockmotion.de
In meanwhile I can run an application from sdram. There was an error in the
byte selects of my sdram (I got an example which contains this bug). Longs
and words were written okay only bytes were swapped. The binary file I
created with mb-objcopy could be placed directly into sdram.

Anyway, thanks for your help.
Frank
 

Welcome to EDABoard.com

Sponsor

Back
Top