baerwolf / USBaspLoader

An (V)USB bootloader firmware for AVR-MCUs emulating the popular USBasp for programming itself
Other
178 stars 146 forks source link

Size exceed 2kB #14

Closed zaniar closed 8 years ago

zaniar commented 9 years ago

OS: Windows 7 64-bit Toolchain: avr-toolchain-installer-3.4.2.1573-win32.win32.x86.exe

I modified nothing. Just download, extract, and then make. The main.hex have size of 5.62kB.

Any clue?

baerwolf commented 9 years ago

Hi and thx for your mail.

Since hexfiles use human readable form, they translate every binary value to some hex-string. This overhead increases the filesize.

The real siye stored in flash is smaller. When you want to know the size requirements ahead, please use "avr-size" and/or covert hexfile into binary. (With the tool avr-objcopy or http://matrixstorm.com/avr/avrstick/#hextobin)

BR Stephan

On 09/09/15 22:47, Edwin Zaniar Putra wrote:

OS: Windows 7 64-bit Toolchain: avr-toolchain-installer-3.4.2.1573-win32.win32.x86.exe

I modified nothing. Just download, extract, and then make. The main.hex have size of 5.62kB.

Any clue?

— Reply to this email directly or view it on GitHub https://github.com/baerwolf/USBaspLoader/issues/14.

gloob commented 8 years ago

Hi,

Last time I checked, this is true for atmega328p.

oxytocin:USBaspLoader aleiva$ git diff
diff --git a/Makefile.inc b/Makefile.inc
index 537444f..bb28c13 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -6,7 +6,7 @@
 # License: GNU GPL v2 (see License.txt)

 F_CPU = 16000000
-DEVICE = atmega8
+DEVICE = atmega328p

 # where the updating firmware should be located (starting address)
 FLASHADDRESS = 0x0000
oxytocin:USBaspLoader aleiva$ avr-size firmware/main.hex 
   text    data     bss     dec     hex filename
      0    2200       0    2200     898 firmware/main.hex

It's 2200 bytes, tested in OS X and Windows. (atmega8 is 2004 bytes the final firmware)

@baerwolf do you know how to fix this?

Thanks!

baerwolf commented 8 years ago

Hi gloob.

@baerwolf do you know how to fix this?

Fix what? Please tell me more details about your problem.

2200 Byte for ATmega328p is okay, since its bootloader section is bigger (4k?). 2004 Byte for ATmega8 also is okay and should fit into BLS.

BR Stephan

gloob commented 8 years ago

Fix what? Please tell me more details about your problem.

2200 Byte for ATmega328p is okay, since its bootloader section is bigger (4k?). 2004 Byte for ATmega8 also is okay and should fit into BLS.

Ahh, I think you are right, I was confused reading the Atmel documentation that the bigger BLS (setting BOOTSZ = '00') is 2048 words and because is 16 bits/word I guess that it makes the 4Kb. I didn't check it physically but makes sense.

Sorry for bothering with this and thanks again!

baerwolf commented 8 years ago

No problem - I am glad I could help. Have a happy new Year!

BR Stephan