looking for hints on building STK500v2 bootloader on windows

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

looking for hints on building STK500v2 bootloader on windows

Postby mxa » Wed Apr 25, 2012 9:25 pm

Has anyone built the stk500v2 bootloader for a mega2560 on a windows platform?

I've tried but I don't think it's working because when I run the following at the command prompt:
make clean
make mega2560

I get a "stk500boot_v2_mega2560.hex" file, but it does not match the original hex file.
I create a hexfile with 29,384 bytes, and the original hex file is 22,989 bytes.

The make process does output some warnings but I'm not sure where my problem is because I'm expecting that it should create the same hex file but they are not even close. My hex file is larger, and if you look at the hex file the first few lines of hex code don't match.

Anyone have any ideas? I haven't changed anything in the source files.

The following is the output from the make process:
Code: Select all
>make mega2560

-------- begin --------
avr-gcc (WinAVR 20081205) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or banned FOR A PARTICULAR PURPOSE.


Compiling: stk500boot.c
avr-gcc -c -mmcu=atmega2560 -I. -gdwarf-2 -DF_CPU=16000000UL  -Os -funsigned-cha
r -funsigned-bitfields -fpack-struct -fshort-enums -mno-tablejump  -Wall -Wstric
t-prototypes -Wa,-adhlns=stk500boot.lst  -std=gnu99 -D_MEGA_BOARD_ -MD -MP -MF .
dep/stk500boot.o.d stk500boot.c -o stk500boot.o
stk500boot.c: In function 'PrintFromPROGMEM':
stk500boot.c:1145: warning: cast from pointer to integer of different size
stk500boot.c: In function 'DumpHex':
stk500boot.c:1395: warning: cast to pointer from integer of different size
stk500boot.c: In function 'EEPROMtest':
stk500boot.c:1438: warning: cast from pointer to integer of different size
stk500boot.c:1459: warning: cast from pointer to integer of different size
In file included from stk500boot.c:1490:
avrinterruptnames.h: At top level:
avrinterruptnames.h:312: warning: ignoring #pragma mark __AVR_ATmega169__
avrinterruptnames.h:351: warning: ignoring #pragma mark __AVR_ATmega640__
stk500boot.c: In function 'VectorDisplay':
stk500boot.c:1599: warning: cast from pointer to integer of different size
stk500boot.c:1600: warning: cast to pointer from integer of different size

Linking: stk500boot.elf
avr-gcc -mmcu=atmega2560 -I. -gdwarf-2 -DF_CPU=16000000UL  -Os -funsigned-char -
funsigned-bitfields -fpack-struct -fshort-enums -mno-tablejump  -Wall -Wstrict-p
rototypes -Wa,-adhlns=stk500boot.o  -std=gnu99 -D_MEGA_BOARD_ -MD -MP -MF .dep/s
tk500boot.elf.d stk500boot.o --output stk500boot.elf -Wl,-Map=stk500boot.map,--c
ref    -lm -Wl,--section-start=.text=3E000

Creating load file for Flash: stk500boot.hex
avr-objcopy -O ihex -R .eeprom stk500boot.elf stk500boot.hex

Creating load file for EEPROM: stk500boot.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
        --change-section-lma .eeprom=0 -O ihex stk500boot.elf stk500boot.eep
e:\Arduino\arduino-1.0-windows\arduino-1.0\hardware\tools\avr\bin\avr-objcopy.ex
e: --change-section-lma .eeprom=0x00000000 never used

Creating Extended Listing: stk500boot.lss
avr-objdump -h -S stk500boot.elf > stk500boot.lss

Creating Symbol Table: stk500boot.sym
avr-nm -n stk500boot.elf > stk500boot.sym

Size after:
AVR Memory Usage
----------------
Device: atmega2560

Program:   10420 bytes (4.0% Full)
(.text + .data + .bootloader)

Data:         12 bytes (0.1% Full)
(.data + .bss + .noinit)



-------- end --------

mv stk500boot.hex stk500boot_v2_mega2560.hex
mxa
 
Posts: 9
Joined: Sun Mar 18, 2012 9:00 pm

Re: looking for hints on building STK500v2 bootloader on windows

Postby westfw » Thu Apr 26, 2012 2:42 am

User avatar
westfw
 
Posts: 1321
Joined: Fri Apr 27, 2007 12:01 pm
Location: SF Bay area

Re: looking for hints on building STK500v2 bootloader on windows

Postby mxa » Thu Apr 26, 2012 12:46 pm

Thanks westfw .... those are great links.

Would you know if the arduinoisp sketch can program a mega2560 which has a larger address space then an uno?
mxa
 
Posts: 9
Joined: Sun Mar 18, 2012 9:00 pm

Re: looking for hints on building STK500v2 bootloader on windows

Postby westfw » Thu Apr 26, 2012 3:57 pm

I don't think so. It depends on how clever avrdude is.
In theory, the protocol (stk500v1) is only capable of programming 128kb, but there's this 'trick' where you can send the programmer explicit SPI commands instead of data blocks, in which case it can do almost anything (though perhaps quite slowly.

USBTiny has similar issues with its protocol. Apparently it CAN program 256k using tricks like the above, but AVRDude has trouble with the "verify" step (where it wants to read all 256k back.)
User avatar
westfw
 
Posts: 1321
Joined: Fri Apr 27, 2007 12:01 pm
Location: SF Bay area

Re: looking for hints on building STK500v2 bootloader on windows

Postby mxa » Thu Apr 26, 2012 9:41 pm

According to the links you sent me, adding the option " -fno-inline-small-functions" produces smaller hex code, and it does by about ~3K but is it a valid bootfile? Have you tried one compiled with this option?

Thank you for the info on the arduinoisp, maybe I"ll just purchase a usb, ISP type programmer that supports stk500v2.
mxa
 
Posts: 9
Joined: Sun Mar 18, 2012 9:00 pm


Return to Arduino

Who is online

Users browsing this forum: No registered users and 7 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [108]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[31]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[34]
LCDs & Displays[48]
Components & Parts[70]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[111]
 
Wireless[14]
Cables[62]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]