Post-Build Scripts using AVR Studio + GCC

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

Dear all,

I am looking to run a post-build script on a hex file after it has been built.

Specifically, I want to run a CRC program (to be written) over the hex file, and fill the last four bytes of the hex file with said CRC value.

Is there a way that I can tell AVR studio to automatically run a program/script after a succeessful build? I'd rather keep this as an integrated process than write my own makefiles and build scripts.

Yes, I know I can always run the program myself afterwards, but programmers are lazy... aren't they? :D

-- Damien.

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

Studio always has the "use external makefile" option - that's the only way you are going to get close as far as I can see.

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

Since you are idle. Set up your project as normal with the Studio internal Makefile.

Then check the "external" makefile box, and browse to default/makefile. (this is the Studio on-the-fly makefile)

right click and rename it as makefile.ext
select makefile.ext as your "external makefile"

You now have a working external makefile.
Load it into the editor and add your "extra commands" to the "all" target.

All done.

David.

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

I had a bit of a mad thought (though I hate this idea). Just about the last thing that the Studio Makefile invokes is avr-size.exe, so replace that with a process that does the final CRC step.

(I tried this and the concept works but it has to be a .exe that replaces avr-size.exe)

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

clawson wrote:
I had a bit of a mad thought (though I hate this idea). Just about the last thing that the Studio Makefile invokes is avr-size.exe, so replace that with a process that does the final CRC step.

Elegant, yet so filthy dirty at the same time :D

Of course, at the end of the script, you could call the renamed avr-size.exe.

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

Cliff,

If your suggestion is that you just rename the real avr-size.exe to "real-avr-size.exe" and name your hack program "avr-size.exe" that does your particular stuff.

This stinks.

I suppose if the OP is really that idle, and you can find the template that Studio uses to build its on-the-fly makefile, then the OP could put his extra commands in this template.

And this would be very useful to everyone. But I have never found the Studio template.

David.

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

Quote:

But I have never found the Studio template.

Guess where it's hidden...

C:\Program Files\Atmel\AVR Tools>grep -r "General Flags" *
Binary file Compilers/AvrPluginavrgccplugin.dll matches

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

Yep. Found it. And I have even less desire to go editing a binary file.

I suppose it would not be in the correct spirit of Windows for it to have been an ascii text template.

David.