How to create AVR ELF components? [Solved]

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

Greetings -

 

Have been through the AS7 Help, multiple times, with no joy. I want to create an ELF file that includes the standard flash data plus EEPROM data, fuse data, and lockbit data. 

 

The Help file contains NO information that I can find about how to create anything but the flash data. The Help description for Device Programming > Memories hints that the EEPROM data might be a hex file, but there does not seem to be anywhere that tells how to create such a file. Cannot find any hints at all about  fuse or lockbit.

 

Can some kind soul point me toward an explanation or description of how to do this? In particular, I'd like to know if there is any way to preserve specific EEPROM locations that contain the product serial number. Thinking toward doing field upgrades using AlanK's handy little programmers.

 

Thanks

Jim

This topic has a solution.

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Fri. May 24, 2019 - 07:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Partial answer to my own question. Might help others looking for this information.

 

Found in the Help > Project Management > GCC Projects > GCC Project Options and Configuration > Creating ELF files with other memory types > Creating ELF files for tiny, mega, and XMEGA devices (Oh, why is XMEGA all caps while tiny and mega are lower case? Does this indicate some sort of importance level?)

 

Left in a bit of a quandary, however. I have a typedef'd struct that defines the EEPROM contents. The struct is given an initial value where it is actually defined. My lack of familiarity with the syntax that is shown leaves me puzzled about how to write the appropriate .eeprom statement.

 

<edit> Corrected help "path" </edit>

 

Thanks

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Fri. May 24, 2019 - 05:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Long shot?: S7 manual has section on "gcc loader options".  

The gcc option for specifying the loader script is -Wl,--script=/path/to/loader.script.

On my machine the loader scripts are in .../avr/lib/ldscripts.

Attached is the GNU loader manual.  Section 3 is about loader scripts.

Attachment(s): 

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

on memory sections: libc manual section on memory

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

Thanks, I'll look it over. I have no clue, however, what those words are about!

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

Hmmm, just thinking (dangerous proposition).

 

I vaguely recall comments about the  EEPROM being erased, no matter what, before doing chip programming. If so, then I don't need to mess with the .eeprom section as the code will find an "eeprom programmed" flag that has been cleared and the code will reload defaults into the eeprom.

 

The Help section referenced in msg #2 give enough, I think, to proceed with fuse and lockbit programming.

 

Thanks, Matt, on that pointer to the AVR_LibC documentation. Forgot to check there.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Fri. May 24, 2019 - 05:30 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Checkout <avr/fuse.h>, <avr/lock.h> etc

 

All in the standard avr-libc manual.

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

Comment -

 

For all practical purposes, fuse.h and lock.h are just the source for the doxygen text that appears in the avr-libc manual.

 

To find the names of the  fuse bits and the lock bit, you really need to look at the device files and that can be a daunting  task. There does not seem to be any accessible place where they are tabulated like the interrupt vector names are.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

What's wrong with the device header? As soon as you build successfully even once (can just be empty main()) then Dependencies has a direct link to io<whatever>.h

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

Nothing wrong with the device header files if you know what to look for. Why is there that big interrupt vector table in the AVR-LibC manual?

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

Because someone went to some considerable effort to to automate the Doxygen that generates it. While the person who wrote the code and Doxygen for fuse/lock could have done the same remember the entire project is voluntary work and they presumably thought that simply implementing the feature was more important than eye candy. I agree. I've never used that ISR table in the manual either but have done it by reading _VECTOR() s in the .h files so doing the same for fuse/lock would actually seem to be the most obvious to me anyway. I'm sure I can't be alone.

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

Sorry, the AVR-LibC documentation is the first place I always go for vector names. Never knew how to find it otherwise. So, I expected something similar for the fuse bits. Now, I know differently.

 

The ONE big problem with this that I have is that "before the first successful compile". Or, even after a compile failure. Then, there is nothing in the dependencies.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

When you create a project in AS7 it immediately creates a template with empty main() just click Build before you do anything else like editing, adding code, adding files etc. Then Dependencies is immediately populated. The default inclusion of < avr/io.h > means ioXXX.h will immediately be listed.
.
Else (as I do) know where it is in the toolchain directory tree anyway.

Last Edited: Sat. May 25, 2019 - 04:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net