Big bootloader

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

Hi everyone,

I want to write a bootloader, but its code size is bigger than the boot section of the flash memory.

Is it possible to place flash write/read routines into the boot section, and the code that doesn't fit into this area to the application section?

Thanks,
Dave

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

Before you start hacking and outsource functions, check if you can reduce code size. The application node AVR035: Efficient C Coding for AVR should help in that matter even if you wrote your program in assembler.

Regards
Sebastian

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

Remember that the RWW will go invisible for code execution during the SPM process so you want to ensure that anything you must have access to is "above the line" but I'm intrigued - how on earth can you have written a bootloader that's so big it won't fit into the BLS? It's not working over Ethernet by any chance is it (about the only thing I can think of that might be complicated enough to bloat the code)

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

I'm designing a module to a complicated system. My module have to work "properly" (show that "it is living") when there is no valid application. But to communicate with this complicated system (with an ASIC), I have to use a driver, which size is 1.5k

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

It couldn't just flash an LED or something to show that it is "alive" ?

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

No :-)

It's the system's specification, it can't be modified.
We haven't used avr-s in other system components (silabs 8051), there wasn't such problem.

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

Well as long as you are careful it should be possible to position some of the boot code just below the BLS boundary then, when programming apps, either ensure they never get that far up or always include a copy of that fixed bit at the top of the app code being programmed.

What language and, if C, what compiler?

Cliff

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

Quote:
I have to use a driver, which size is 1.5k

Hmmm, the bootloader size in the datasheet is given in words. So a 1024 word bootloader section has a size of 2048 bytes.

Regards
Sebastian

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

Maybe put the bootloader code in as small a bootloader section as possible, put the 'driver' below it. Have the bootloader prevent any erase/write to any page at or above the beginning of the 'driver section'. Resets will get you to the bootloader, and your 'driver' will be protected by the bootloader code.

And if you forget about the 'driver' sitting up in app space (app gets too big), your bootloader will/should let you know when you try to load it.

I'm not sure if I'm forgetting something important here, seems like I am.

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

Just out of curiosity, which AVR are you using? Can you go to the next size bigger that would support a bootloader of the size you need?

Granted, I use the largest of the AVRs (ATmega2560), but largest boot section of the m640/m1280/m2560 series is 4K Words. I believe that the m128 has a similar boot section size.

Just FYI.

Stu

EDIT: PS: Also, you've turned on the optimizer, right? Make sure you're using -Os for the best optimization.

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

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

Stu,

Yup the biggest (and default) bootloader size on the mega128 is 4096 words, 8192 bytes.

Cliff

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

use a very small fast bootloader, optimized ASM to keep boot section small so your flash memory for application space is larger. 512 byte fast bootloader w/ PC side GUI program:

http://www.avrfreaks.net/index.p...

Supports > 64KB Flash (RAMPZ bit).

Freeware.