Why is BOOTSZ 2048 in a virgin ATmega328?

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

I don't understand why the BOOTSZ is set to 2048 and the BOOTRST fuse unchecked in a virgin ATmega328.  I would think I would want the BOOTSZ to be as small as possible to maximize space for code if I am not using the bootloader.  Am I going to get into trouble if I change the BOOTSZ to the smallest value if I am not using the bootloader? 

 

The datasheet seems to say the BOOTSZ is set to 2048 if BOOTRST is unprogrammed.  The sentence in the data sheet seems ungrammatical to me:

 

When the BOOTRST Fuse is unprogrammed, the Boot section size set to 2Kbytes and the IVSEL bit in the

MCUCR Register is set before any interrupts are enabled

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

What is the problem?   2048 is the biggest size possible.

 

If BOOTRST is not programmed,   you have the whole 32kB of Flash for your application.

It allows you to put SPM anywhere in this 2048 byte area (if your application requires it)

 

If you do want to use BOOTRST,  you are going to choose the most appropriate BOOTSZ at the same time.

 

David.

 

 

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

MarkThomas wrote:
Why is BOOTSZ 2048 in a virgin ATmega328?

Well, they all claim to be virgins, you should know better…

ɴᴇᴛɪᴢᴇᴎ

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

I should know better.  My ignorance astonishes me sometimes.  Thanks all.

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

MarkThomas wrote:
I should know better.

;)  No problem here.  In AVR8 there is only a designated bootloader section if you choose to use it as such.  I have Mega8/88 apps at 90+% and no bootloader used.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

I seem to remember someone telling me that if my application is longer than the application space allocated it will write over into the bootloader space, so if I don't use the bootloader it doesn't really matter how much space I allocate to the bootloader.  I found this table in the data sheet.

 

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

MarkThomas wrote:
I seem to remember someone telling me that if my application is longer than the application space allocated it will write over into the bootloader space, so if I don't use the bootloader it doesn't really matter how much space I allocate to the bootloader.

That is correct.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

I guess that's what David meant by saying I had the whole 32kB of flash for my application.

 

I wish I had learned assembly language when I was a student, instead of only doing algorithms in FORTRAN and C, and later in C++, with no knowledge of what was going on underneath it all.  It is really frustrating and depressing some times.  O well, I guess I have been able to struggle through everything I have really needed so far, but I am totally in awe of what people take for granted on this site.  I don't know where I would be without you all.  Thanks so much!

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

American and European data sheets are rarely ungrammatical.  However they always have terse, drill-bit precise, language constructions.

 

It's the Chinese data sheets, especially for TFT controllers, where the English language grammar gets seriously stretched and creative.