Loading a binary file using AS6 (???)

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All

Older versions of AVR32 studio allowed loading a binary file by specifying an offset (0x80000000).

AS6 doesn't look to support binary anymore.

Problem is that I have binary files (these are a combination of other binary sources that are combined to one file) and these are changing all the time. Now there is no way to load them with AS6 (in this format) and so older tools have to be used.

To make things cleaner and more efficient I have tried using objcopy to convert the binary to a hex but it loses the 0x80000000 offset and so doesn't work (I have given up trying with objcopy after testing virtually all possible options to add an offset with no obvious effect...).

Does anyone have a suggestion (if not it looks like investing some time in writing a conversion utility to do this). Wondering why binary support was dropped from AS6 since it was rather useful.

Last remark. Using the command line to do this:
avr32program program -finternal@0x80000000 -cxtal -F bin -O 2147483648 -e -u -R -r image.bin

it works very well (takes about 20s or so to program) and would be my solution but the end users refuse to accept this.... they adsolutely want to do everything directly from one tool (AS6). I have however found that loading ELF file of the same size from AS6 takes *MUCH* longer (the same image that was taking about 20s was taking around 3 minues from within AS6). Is this normal?? The load was successful (after a coffee break) and the final users did say that they "are aware that AS6 loading is somewhat slower" but it does seem rather extreme(???).

Regards

Mark

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

but it loses the 0x80000000

The put it back by placing the obj in a named section and using a --section-start

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

I have only a binary as input and so don't think that I can control things with named sections (??). There are no problems with convertig from *.elf but I don't have such input...

Regards

mark

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

See recent thread about how to do this in AVR GCC forum, I assume it's the same for avr32-GCC?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry, I read through recent threads in the GCC forum but don't know which one is being referred to.

After another hour or so studing the objcopy user's manual I have concluded that it was designed for clairvoyants because it doesn't really help to understand what its options actually do.

In the end I wrote a utility to do it, which proved faster...;-)

Regards

Mark

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Apologies for not being clearer, I meant this thread:

https://www.avrfreaks.net/index.p...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks - yes I did read that one but didn't see the options that it may have been using - or maybe it is just a bit complicated to understand (?)

Anyhow I have verified my new utility that does the complete jobs that are needed. It can be obtained here - including full details of use: http://www.utasker.com/forum/ind...

It is mainly used for taking binary inputs (eg. a boot loader and an application, or a primary boot loader and a secondary boot loader), adding these together, then optionally providing SREC or iHEX outputs that may be needed for certain tools (in the case of AS6 it is the iHEX output since it doesn't understand SREC and lost the ability to use binary in comparison to the previous AVR32 studio).

Eg.
"file1.bin" is a primary boot loader which is linked to 0x80000000 and is 0x1750 bytes long
"file2.bin" is a secondary loader (or an application) which is linked to 0x80002000 (and is 50k long - but not important).

The utility is called with
"uTaskerCombine file1.bin file2.bin 0x2000 combined.bin combined.hex 0x80000000"

This will combine the two input binaries into a single binary called "combined.bin" (there will be some 0xff between 0x80001750 and 0x80002000 to fill the gap). This could be loaded with AVR32 Studio's Flash utility by specifying the offset 0x80000000 (which was lost in the binary).

The output file "combined.hex" has the 0x80000000 added again and can be loaded by AS6.
If SREC is required, the name of the output hex file simply need an extension of *.srec or ".out" and it will automatically be generated in SREC instead (for whatever tools only understand that format).

The other tools at the link can also be useful since they allow encrypting the images for firmware uploading (supported by the boot loaders in question) and for embedding files into c-code (eg. converting images to embedded c-file arrays or taking HTML files, stripping white space and embedding into project as c-file consts....)

Regards

Mark