Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save graphis/b9517762c7d8afc0fc7a6bc5286f2281 to your computer and use it in GitHub Desktop.
Save graphis/b9517762c7d8afc0fc7a6bc5286f2281 to your computer and use it in GitHub Desktop.
Installing 8bit AVR development kit from macOS HomeBrew and FreeBSD Ports with the optiboot environment

AVR 8bit Ports for FreeBSD

  • devel/avr-binutils
  • devel/avr-gcc
  • devel/avr-libc
  • devel/avrdude
#!/bin/sh
# write a hex file to optiboot-enabled arduino
avrdude -D -c arduino -p m168 -b 115200 -P /dev/cu.[target-device] -U flash:w:target-file.hex
#!/bin/sh
# this is an example of writing the optiboot image to atmega168
# for ATmega168 with AVR Dragon in HVPP (note *PP*) mode
# NOTE: the -P should be changed appropriately
# Check out the lock/efuse/hfuse/lfuse bits
# Note 2: hfuse set to preserve EEPROM through chip erase
avrdude -D -v -p m168 -c dragon_pp \
-P usb -e -u -U lock:w:0xff:m \
-U efuse:w:0xfc:m -U hfuse:w:0xD5:m -U lfuse:w:0xF7:m \
-U flash:w:optiboot_atmega168.hex \
-U lock:w:0xef:m
#!/bin/sh
# write a hex file to optiboot-enabled arduino
avrdude -D -c arduino -p m328p -b 115200 -P /dev/cu.[target-device] -U flash:w:target-file.hex
#!/bin/sh
# this is an example of writing the optiboot image to atmega328
# for ATmega328p with AVR Dragon in HVPP (note *PP*) mode
# NOTE: the -P should be changed appropriately
# Check out the lock/efuse/hfuse/lfuse bits
# Note 2: must add -F flag as an workaround for the Device ID issue
# (removed from this script)
# Note 3: hfuse set to preserve EEPROM through chip erase
avrdude -D -v -p m328p -c dragon_pp \
-P usb -e -u -U lock:w:0xff:m \
-U efuse:w:0xfd:m -U hfuse:w:0xd6:m -U lfuse:w:0xff:m \
-U flash:w:optiboot_atmega328p.hex \
-U lock:w:0xef:m
:103E00001F92CDB7DEB7112484B714BE982F9D70D2
:103E100009F0D6D085E08093810082E08093C000D5
:103E200088E18093C10086E08093C20080E18093A6
:103E3000C4008EE0B0D0259A86E020E33CEF91E00C
:103E4000309385002093840096BBB09BFECF1D9AD3
:103E5000A8958150A9F7812C912C13E001E025E071
:103E6000F22E31E1E32E8BD0813471F488D0898336
:103E700098D08981823811F482E004C0813809F435
:103E80006DC083E075D071C0823411F484E103C049
:103E9000853419F485E08DD068C0853549F46FD03C
:103EA000D82E6DD08D2C912C982A880C991C5CC032
:103EB000863521F484E07DD080E0E4CF843609F0BB
:103EC00036C05DD05CD0D82E5AD0C82EA12CBB24D1
:103ED000B39455D0F50181935F01DE12FACF61D022
:103EE000F5E4CF1201C0FFCFF40117BFE89507B684
:103EF00000FCFDCFA401A0E0B1E02C911296CD0111
:103F00000197FC01808130E0382BFA01090107BFDD
:103F1000E89511244E5F5F4FDA12EFCFF401F7BE40
:103F2000E89507B600FCFDCFE7BEE8951EC08437D4
:103F300071F425D024D0D82E22D033D05401F501ED
:103F400085915F0115D0DA94D110F9CF0EC0853775
:103F500039F427D08EE10CD084E90AD086E092CFE4
:103F6000813511F488E017D01CD080E101D07BCFDF
:103F70009091C00095FFFCCF8093C600089580917A
:103F8000C00087FFFCCF8091C00084FD01C0A895D0
:103F90008091C6000895E0E6F0E098E19083808388
:103FA0000895EDDF803219F088E0F5DFFFCF84E17E
:103FB000DFCFCF93C82FE3DFC150E9F7CF91F1CF27
:0C3FC000282E80E0E8DFE0E0FF270994F5
:023FFE000206B9
:0400000300003E00BB
:00000001FF
:107E00001F92CDB7DEB7112484B714BE982F9D7092
:107E100009F0D7D085E08093810082E08093C00094
:107E200088E18093C10086E08093C20080E1809366
:107E3000C4008EE0B1D0259A86E020E33CEF91E0CB
:107E4000309385002093840096BBB09BFECF1D9A93
:107E5000A8958150A9F7812C912C13E001E025E031
:107E6000F22E31E1E32E8CD0813479F489D08983EC
:107E700099D08981823811F482E005C0813811F4EB
:107E800086E001C083E075D071C0823411F484E1D2
:107E900003C0853419F485E08DD068C0853549F478
:107EA0006FD0D82E6DD08D2C912C982A880C991CCF
:107EB0005CC0863521F484E07DD080E0E4CF843658
:107EC00009F036C05DD05CD0D82E5AD0C82EA12C77
:107ED000BB24B39455D0F50181935F01DE12FACF34
:107EE00061D0F5E4CF1201C0FFCFF40117BFE895D0
:107EF00007B600FCFDCFA401A0E0B1E02C911296E2
:107F0000CD010197FC01808130E0382BFA01090195
:107F100007BFE89511244E5F5F4FDA12EFCFF401EF
:107F2000F7BEE89507B600FCFDCFE7BEE8951EC09A
:107F3000843771F425D024D0D82E22D033D05401E8
:107F4000F50185915F0115D0DA94D110F9CF0EC0FB
:107F5000853739F427D08EE10CD085E90AD08FE03F
:107F600092CF813511F488E017D01CD080E101D088
:107F70007ACF9091C00095FFFCCF8093C600089502
:107F80008091C00087FFFCCF8091C00084FD01C0BC
:107F9000A8958091C6000895E0E6F0E098E190830E
:107FA00080830895EDDF803219F088E0F5DFFFCFA0
:107FB00084E1DFCFCF93C82FE3DFC150E9F7CF9142
:0E7FC000F1CF282E80E0E8DFE0E0FF270994F3
:027FFE00020679
:0400000300007E007B
:00000001FF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment