avr-gcc – architecture independent obj files

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

I have a lot of data files I'd like to include in my apps. So I changed the data into obj files using objcopy. That's fine, and I'm able to create a library which contains all my binary data. But here is the problem. The obj and lib files are architecture dependent. So if I create them for e.g. ATMega128 they cannot be used with XMEGA128. So every time I change the MCU type I have to recreate obj and thus lib files for used architecture. But my lib (or obj) contains only raw binary data, so it should not depend on architecture. Is there any general architecture specifier, like AVR8 which will satisfy linker no matter for which AVR8 I'm building the application?

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

I don't believe there is such a generic option.

But why store as binary? Surely the data is more easily maintained as source and the only "cost" is that the first time you build the project it takes a few seconds longer.

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

I have some reasons. First of all, the data is a huge binary. It doesn’t make any sense to convert it to c source file and then compile it to create an obj file. Besides of that, the source files are a couple of MB long, and compilation really takes some time. Another reason is my comfort – it is easier to add a lib into the project, then 10-20 source files. Let’s assume binary files containing fonts. I can prepare a lib file with a lot of different font sets, and finally only the fonts I used in project will be linked with it.
Another problem is that Atmel Studio lacks the support for adding binary files into the project. So to use for example bmp file I need to convert it into c array, and add to my project. I can’t understand why 700 MB program is not able to recognize binary file and compile it appropriately.

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

If you ask avr-ld nicely,
it will allow you to combine mismatched object files.
You will not a warning,
not even for mismatches for which you might want a warning.

Probably you do not need to combine the files.
Copy the program and the big data to the flash separately.

Moderation in all things. -- ancient proverb

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

Does gas' .incbin directive help? You could then wrise a small .S wrapper to .incbin your data and assign a symbol to it. This avoild the need to compile it, but I don't know whether it's much faster. Yust give it a try.

avrfreaks does not support Opera. Profile inactive.