| Author |
Message |
|
|
Posted: Nov 20, 2007 - 11:00 AM |
|

Joined: Sep 26, 2007
Posts: 12
|
|
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 |
|
|
| |
|
|
|
|
|
Posted: Nov 20, 2007 - 11:12 AM |
|


Joined: Aug 22, 2004
Posts: 1625
Location: Germany
|
|
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 |
|
|
| |
|
|
|
|
|
Posted: Nov 20, 2007 - 11:15 AM |
|


Joined: Jul 18, 2005
Posts: 33138
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
| 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) |
_________________
|
| |
|
|
|
|
|
Posted: Nov 20, 2007 - 11:28 AM |
|

Joined: Sep 26, 2007
Posts: 12
|
|
| 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 |
|
|
| |
|
|
|
|
|
Posted: Nov 20, 2007 - 11:31 AM |
|


Joined: Jul 18, 2005
Posts: 33138
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
| It couldn't just flash an LED or something to show that it is "alive" ? |
_________________
|
| |
|
|
|
|
|
Posted: Nov 20, 2007 - 11:33 AM |
|

Joined: Sep 26, 2007
Posts: 12
|
|
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. |
|
|
| |
|
|
|
|
|
Posted: Nov 20, 2007 - 11:38 AM |
|


Joined: Jul 18, 2005
Posts: 33138
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
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 |
_________________
|
| |
|
|
|
|
|
Posted: Nov 20, 2007 - 11:48 AM |
|


Joined: Aug 22, 2004
Posts: 1625
Location: Germany
|
|
|
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 |
|
|
| |
|
|
|
|
|
Posted: Nov 20, 2007 - 02:18 PM |
|

Joined: Sep 21, 2005
Posts: 2104
|
|
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. |
|
|
| |
|
|
|
|
|
Posted: Nov 20, 2007 - 05:08 PM |
|


Joined: Dec 30, 2005
Posts: 2041
Location: Longmont, CO USA
|
|
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.
(My boss always chooses Cheap. Twice.)
|
| |
|
|
|
|
|
Posted: Nov 20, 2007 - 05:31 PM |
|


Joined: Jul 18, 2005
Posts: 33138
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
Stu,
Yup the biggest (and default) bootloader size on the mega128 is 4096 words, 8192 bytes.
Cliff |
_________________
|
| |
|
|
|
|
|
Posted: Nov 21, 2007 - 04:54 AM |
|

Joined: Dec 18, 2001
Posts: 2939
|
|
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.php?modu ... tem_id=625
Supports > 64KB Flash (RAMPZ bit).
Freeware. |
|
|
| |
|
|
|
|
|