View Single Post
Old 07-08-2010, 11:07 AM   #939 (permalink)
Magister
OBDuino coder
 
Magister's Avatar
 
Join Date: Jun 2008
Location: Montréal, QC
Posts: 212

Titine - '13 Hyundai Sonata Hybrid
Thanks: 3
Thanked 10 Times in 8 Posts
*warning* untested as I do not have an MPGuino

If you have installed WinAVR and it's in your PATH, then open a command prompt and copy/paste:

this should compile the .cpp file to a .elf, it's one line only so make sure the copy/paste works well!
Code:
avr-gcc -mmcu=atmega328p -I. -fno-tree-loop-optimize -morder1 -funsigned-char -funsigned-bitfields -fshort-enums -fpack-struct -ffunction-sections -fdata-sections -fno-split-wide-types -Wl,--relax,--gc-sections -fno-inline-small-functions -mcall-prologues -gstabs -DF_CPU=20000000 -Os -Wall -Wstrict-prototypes -std=gnu99 -Wa,-adhlns=mpguino.lst -o mpguino.elf mpguino.cpp -L.
this transform the .elf to a .hex
Code:
avr-objcopy -O ihex -R .eeprom mpguino.elf mpguino.hex
check the size of the executable against the chip specs (optional step)
Code:
avr-size -C --mcu=atmega328p mpguino.elf
burn fuses, change "usbasp" with your programmer. Also double check the fuse value but I think they are correct for a 328p
Code:
avrdude -p atmega328p -c usbasp -U lock:w:0x3f:m -U efuse:w:0xfc:m -U hfuse:w:0xd4:m -U lfuse:w:0xdf:m
burn the .hex to the chip
Code:
avrdude -p atmega328p -c usbasp -U flash:w:mpguino.hex
it's ready
__________________
2013 Hyundai Sonata Hybrid
  Reply With Quote
The Following User Says Thank You to Magister For This Useful Post:
JellyBeanDriver (07-09-2010)