Is it possible to generate a binary output as well as ELF?

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

Hi All

I have a project which I build using GCC from a makefile. This generates an elf file output of about 130k size. In my make file I convert it to binary using objcopy. This I download to the board in AVR32 studio using the program command - the download takes a few seconds or so and the board then runs correctly.

I have tried a few times in the past to get the project to work with AVR32 studio but have always failed to get it to load and debug. Now I have upgraded to AVR32 - 2.5 and GCC 2.4.2 to see whether anything has changed.

Since I can't find a way of getting AVR32 studio to use my (known-good) make file I let it import the project and use a managed make. The project builds normally (all objects are generated and there are no errors) but the ELF file that is generated is about 6.5Meg bytes in size(?). Trying to load the ELF to the board results in it hanging at 61% each time after a couple of minutes of loading something and then having to kill the process.

If I try to generate a BIN from the ELF using avr32-objcopy the binary file that is created has a size of 0 bytes (no error messages though). AVR32 can however view the symbols in the ELF file, so it can't be just filled with rubbish.

Does anyone know whether it is possible to configure AVR32 to automatically generate the binary - maybe it has more success that way(?).

Any other tips to getting started? (eg. is it possible to find the make file that AVR32 studio has created and is using?)

Regards

Mark

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

Hi

This I already do but there is 0 byte output (the elf must have a problem). I was trying to find a setting to get the AVR32 to do this itself. The command could be added to the makefile but I can't find where it is located - possibly AVR32 generates a temporary make file each time it builds, but the solution would normally be to simply add the objcopy to that.

All other IDEs that I know have settings to generate various output formats but my searches through the AVR32 studio menus and help documents haven't identified anything. For the moment I am interpreting the answer as a confirmation that AVR32 Studio can't do this.

Regards

Mark

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

No idea how to do it in Studio (except having a post build action with the avr32-objcopy command line).
btw AVR32 Studio will use avr32-objcopy so if there is a problem in your elf, AVR32 Studio won't solve it.

-sma

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

Hi

Yes, a post build step would work. I found this in the Properties | C/C++ build | Settings.

Also this doesn't solve the base problem that the objcopy doesn't generate any binary content from the ELF that Studio generates.

This means that the base problem is that studio is generating a huge ELF file (6.5M in comparison to 130k when compiled outside of studio with a make file using the same GCC bins).

In fact when I do the following I get information that, although the ELF is huge it doesn't contain any code.
avr32-size output.elf
text data bss dec hex filename
0 0 0 0 0 output.elf

I will post again when more info.

Regards

Mark

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

Hi

By comparing the settings that studio was using with those in the reference make file I managed to get it to generate a small elf file which contained code. This could be converted to a binary that downloads and also runs. Downloading the ELF took longer but it didn't run. Debugging doesn't work since it can't establish a debugging connection - this will be the next problem to solve since it has never worked on any laptops up to now (just on old workstations).

This is what I did:

1) In properties | C/C++ Build | Settings | Tool Settings | AVR32/GNU C Compiler I deactivated all settings (apart from two define symbols _HW_AVR32 and _GNU and the directory include path). I set optimization none (this is overridden later)
In miscellaneous I set all settings:
-march=ucr2 -Wall -Wstrict-prototypes -g -c –Os

2) In AVR32/GNU C linker I disable everything and then paste the following in the miscellaneous setting:
-Wl,-Map=output.map -nostartfiles --no-gc-sections -T"${workspace_loc:/App/output}"\GNU_AVR32\linker_script.ld
(I think that this is also directory independent since it uses the $(workspace_loc:/))
This generates an ELF file and a map file. The ELF probably doesn’t contain debugging info since it is small.

3) In the setting “Build Steps” I add “avr32-objcopy -O binary output.elf output.bin” as a post build command.
This binary can be loaded to the target by using the erase and program commands. The download is fast (the ELF download takes longer and doesn’t run) and the project runs correctly.

Regards

Mark