> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > On Behalf Of Thomas Richter > Sent: Friday, March 09, 2007 8:04 AM > To: [EMAIL PROTECTED]; avr-chat > Subject: Re: [avr-chat] ATmega2561: bootloader can not write > in applicationsection > > Hi Eric, > > that means my bootloader application was inside the > application flash section (RWW Section)?
Sure. Let's do the math: You originally put your bootloader at address 0x1F000, which is 126976 decimal. Your ATmega2561 has 256K of flash which is equal to 262144. All of the bootloader areas in the AVR reside in the very top of Flash. One can see that 126976 is less than half of 262144, i.e. your bootloader would definitely be in the Application area. Table 145 of the datasheet says that the maximum size of the bootloader (for a mega256x device) is 4096 words. A word is 16 bits, therefore the maximum bootloader size is 8K bytes. Since the bootloader is always at the top of the flash, subtract the size of the bootloader area from the total amount of flash, 262144 - 8192 = 253952, and this gets you the starting address of your bootloader. It's also instructive to convert the calculation to hexadecimal: 0x40000 - 0x2000 = 0x3E000. Now, if you look in Table 145 of the datasheet, at the last column labeled "Boot Reset Address (Start of BootLoader Section)", we get a starting address of 0x1F000 for the maximum size bootloader! This is very different then our calculation of 0x3E000. What is the relationship? We find out that 0x1F000 * 2 = 0x3E000, therefore all of the bootloader address information in the datasheet is given as *ADDRESSES TO WORDS*, which means that you have to double the values that you see in the datasheet in order to actually use them in *byte-oriented* compiler toolchains. This is the source of much confusion to the end-user. > When I use > LDFLAGS += -Wl,--section-start=.text=0x3E000 > then I get a verification error: > > avrdude: verifying ... > avrdude: verification error, first mismatch at byte 0x1e000 > 0xff != 0x0d > avrdude: verification error; content mismatch > > avrdude done. Thank you. > I'm not sure about your programming problem here. Perhaps others on this list can comment more about avrdude. HTH, Eric Weddington _______________________________________________ AVR-chat mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-chat
