Flashing a sketch from SD card using 2boot bootloader

Howdy,

First off, thank you for the effort you've put into this. I'm following your instructions, and I want to check my work before I get too far along.

When I get to step 3, make, I get this error:

$ make 
avr-gcc -gdwarf-2 -Wall -Os -mcall-prologues -mmcu=atmega328p -DBOOT_ADR=0x7000 -DF_CPU=16000000   -c -o main.o main.c
main.c:58:19: warning: ‘mem_cmpP’ declared ‘static’ but never defined [-Wunused-function]
 static inline int mem_cmpP(const void* dst, const void* src, int cnt);
                   ^
main.c:65:16: warning: ‘pagecmp’ defined but not used [-Wunused-function]
 static uint8_t pagecmp(uint16_t addr, uint8_t *data)
                ^
avr-gcc -gdwarf-2 -Wall -Os -mcall-prologues -mmcu=atmega328p -DBOOT_ADR=0x7000 -DF_CPU=16000000   -c -o pff.o pff.c
pff.c: In function ‘get_fat’:
pff.c:384:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   return LD_WORD(buf);
   ^
pff.c:388:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   return LD_DWORD(buf) & 0x0FFFFFFF;
   ^
pff.c: In function ‘pf_mount’:
pff.c:757:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     bsect = LD_DWORD(&buf[8]); /* Partition offset in LBA */
     ^
avr-gcc -gdwarf-2 -Wall -Os -mcall-prologues -mmcu=atmega328p -DBOOT_ADR=0x7000 -DF_CPU=16000000   -c -o mmc.o mmc.c
avr-gcc -c -mmcu=atmega328p -I. -x assembler-with-cpp -Wa,-adhlns=asmfunc.lst,-gstabs -DBOOT_ADR=0x7000 -DF_CPU=16000000 asmfunc.S -o asmfunc.o
avr-gcc -gdwarf-2 -Wall -Os -mcall-prologues -mmcu=atmega328p -DBOOT_ADR=0x7000 -DF_CPU=16000000 -Wl,-Map,avr_boot.map -Wl,--section-start,.text=0x7000 -o avr_boot.elf main.o pff.o mmc.o asmfunc.o 
avr-objdump -h -S avr_boot.elf > avr_boot.lst
avr-objcopy -j .text -j .data -j .fuse -O ihex avr_boot.elf avr_boot.hex
avr-size -C --mcu=atmega328p avr_boot.elf
avr-size: invalid option -- C
Usage: avr-size [option(s)] [file(s)]
 Displays the sizes of sections inside binary files
 If no input file(s) are specified, a.out is assumed
 The options are:
  -A|-B     --format={sysv|berkeley}  Select output style (default is berkeley)
  -o|-d|-x  --radix={8|10|16}         Display numbers in octal, decimal or hex
  -t        --totals                  Display the total sizes (Berkeley only)
            --common                  Display total size for *COM* syms
            --target=<bfdname>        Set the binary file format
            @<file>                   Read options from <file>
  -h        --help                    Display this information
  -v        --version                 Display the program's version

avr-size: supported targets: elf32-avr elf32-little elf32-big srec symbolsrec verilog tekhex binary ihex
make: *** [size] Error 1

Seems to compile, but I don't know how critical the avr-size output is, and if this error keeps any further steps from occurring. Running it by hand looks like this:

$ avr-size avr_boot.elf
   text   data    bss    dec    hex filename
   3932     26    173   4131   1023 avr_boot.elf

There is a avr_boot.hex, but at 11,174 bytes, it seems too big to me.

Am I on track here, or did I hose something?

-Chris

garfield38:
Hi all,

just a short message to thanks everybody that contribute to release avr_boot.

After a long time and many tries, I find the right flow to be able to burn the new boot loader on an atmega328p dip28 and load the blink example project into the avr from a 512Mo SD card:

  • get the github from
    OpenSeaMapLogger/bootloader/avr_boot-master at master · willie68/OpenSeaMapLogger · GitHub

  • check your hardware SD <-> Arduino with avr_boot-master/asmfunc.S

  • make

  • burn fuse
    avrdude -p atmega328p -c usbasp -P usb -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xd8:m -Ulfuse:w:0xff:m

  • burn boot loader
    avrdude -p atmega328p -c usbasp -P usb -U flash:w:avr_boot-master/avr_boot.hex:i -Ulock:w:0x0F:m

  • compile blink project

  • find the compiled file
    find $TMPDIR -name Blink.cpp.elf

  • convert hex to binary
    avr-objcopy -O binary Blink.cpp.elf OSMFIRMW.BIN

  • plug the SD card and wait the reboot (it may take long time)