How to remove interrupt vector table / minimize code space

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

I'm trying to shrink a bootloader written in C, and was wondering if I can tell the compiler not to include the interrupt vector table, since I don't use interrupts.

Put another way, how do I minimize the compiled code size of a very small program?

Hoping the answer isn't "Switch to assembly!" :)

Thanks!

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

Recommended reading:

Smallest bootloader

While you'll see it's possible to discard the vectors and C preamble (though some parts you may need to reinstate by hand) the bottom line is that if you want a "tight" (256/512 word) bootloader then do it in assembler. This is one of the few occasions where the small margin asm buys over C probably IS justified.

Cliff

PS OTOH why reinvent the wheel? There's a load of great bootloaders out there - two particularly good ones in the project section here (search "danni" and "stevech")

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

Thanks, Cliff! That was an informative thread.

I think I found the answer here:

https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=166877

As to why write my own, partially to learn how, partially for my specific needs. I want to be able to have regular serial comms running with TeraTerm Pro, and on demand, enter the BL via serial command, and just drag the new .HEX file into the terminal program window to download new code. Perhaps existing BLs support this, I didn't know. I'm using this for code development on a bot with a wireless serial link. I notice some of these other BLs seem to be very fast, like 4X faster than mine, so perhaps I should go learn how they do that.