WestfW / OptiLoader

Arduino sketch for burning new bootloaders
198 stars 105 forks source link

Converting HEX's to the strings in the sketch #6

Open ghost opened 11 years ago

ghost commented 11 years ago

Really awesome project!

No longer using the ATMEGA8 and 168, so was hoping to repurpose the space used for those two, and instead add some of the other chips I regularly bootload (ATmega 1284p, 644p, etc)

Can you provide details of converting the hex to string (mentioned a Macro process?)

Peter

WestfW commented 11 years ago

No longer using the ATMEGA8 and 168, so was hoping to repurpose the space used for those two, and instead add some of the other chips I regularly bootload (ATmega 1284p, 644p, etc) Can you provide details of converting the hex to string (mentioned a Macro process?)

I use EMACS, which permits me to define a "keyboard macro" that puts a quote at the beginning of a line, goes to the end of the line and adds "\n" and another quote, and then goes to the beginning of the next line.   Repeat the keyboard macro 34 times or so, add some curly brackets and such, and it's all done.

WestfW commented 11 years ago

No longer using the ATMEGA8 and 168, so was hoping to repurpose the space used for those two, and instead add some of the other chips I regularly bootload (ATmega 1284p, 644p, etc) Can you provide details of converting the hex to string (mentioned a Macro process?)

Well, it's an EMACS keyboard macro that I repeat.  All it does it put a quote at the start and "\n" quote at the end of each line. Then I manually insert some braces.  It's not "trivial", but it's not been difficult enough to put more effort into, either.  This is from "M-X Edit-last-kbd-macro", which is likely to be pretty useless if you're not an EMACS person.  I assume that other editors have similar capabilities....

;; Keyboard Macro Editor.  Press C-c C-c to finish; press C-x k RET to cancel. ;; Original keys: " C-e \ n" C-n C-a

Command: last-kbd-macro Key: none

Macro:

"            ;; self-insert-command C-e            ;; move-end-of-line \            ;; self-insert-command n"            ;; self-insert-command * 2 C-n            ;; next-line C-a            ;; move-beginning-of-line

Note that Adafruit has enhanced optiLoader: https://github.com/adafruit/Standalone-Arduino-AVR-ISP-programmer And Nick Gammon has also done some work: http://www.gammon.com.au/forum/?id=11635

Enjoy WestfW

ghost commented 11 years ago

Thanks for the replies

Replaced the array in images_8 with the converted Gen7 1284_20 bootloader hex with "" and \n added as in the examples. Fixed fuse and signature as appropriate. But sketch failed to compile:

error: initializer-string for array of chars is too long

The Gen7 bootloader is a lot bigger than OptiBoot - so not sure what to do - hardware guy here (;

WestfW commented 11 years ago

The current optiloader loads the entire hex file into RAM before programming it into the target, and it assumes a 512byte bootloader. It would take major modifications to support a 2k bootloader, since that would exceed the amount of RAM present in the chips. I'd suggest that you look at the adafruit or gammon enhancements, since I think this is one of the things that they do.