How to include Fuse, Lock Bits and OSCCAL value in IAR C

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

Dear guys,

I am working with the IAR C Compiler, to produce the code.hex and eeprom.hex files. After this, in order to write the AVR I am following the steps:

(Using the AVR Studio and a programmer)
1. I am writing the code.hex in flash memory
2. I am writing the eeprom.hex in eeprom memory
3. I am writing the OSCCAL value in EEPROM 0x00 (if internal RC is used)
4. I am setting the Fuse Bits
5. I am setting the Lock Bits

I would like to ask you if there is any way to include all these functions in my 2 files (code.hex and eeprom.hex) and how?

Thank you.

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer

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

I do not think that you can do this directly in IAR.
But let's face it, you are only sending fuse hex values to "stk500.exe" or whichever command line programmer you use.

So I would simply write a batch file with the appropriate command line.

You could go through a fairly complicated procedure in Studio4 that effectively creates a single "production.elf" file. This is understood by "stk500.exe" or "jtagicemkii.exe" or "avrdragon.exe".

I think that you might find the "production.elf" takes some time to parse. All the same you may feel happier sending this to an assembly factory.

David.

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

Quote:

You could go through a fairly complicated procedure in Studio4 that effectively creates a single "production.elf" file.

That would seem to be the way to go. If you look at the "Program" dialog the fourth panel is "ELF Production File Format" and the dialog has a [Save] button allowing one to be created.

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

Thank you guys.

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer