Let's Make Robots!

Learning to use "make" files to compile a new Arduino bootloader

G'day everyone. I am not a professional programmer, I have not had any training in C language. Previously I had a lot of support from LMR and learned to write an Arduino Library. Now I am trying to compile a bootloader and need help again. I've installed WinAVR and AVR studio and have been trying to find out how to use them. It seems I need to learn to use a "make" file but I cannot find any good information on how to do this. Most information on the net assumes I am a programmer.

ATmel have stopped producing the older ATmega168 20-AU chip previously used for Arduino products. It has been replaced with a new ATmega168PA-AU chip with a lower power consumption and a different ID signature that plays havoc with avrdude when you try to write a bootloader using an Arduino as an ISP.

I admit the easiest solution is just to change over to the ATmega328P that is now the Arduino standard but where would be the fun in that? I'd learn nothing. Also the ATmega168 is still a little bit cheaper and has plenty of memory for most beginner robots. For some customers such as a school that wants to order a 100 controllers, saving a few dollars by not paying for memory the students are unlikely to use makes the ATmega168 a good choice.

The opti-boot bootloader has been available for some time now aand is the standard for the Arduino Uno. It allows the software to be downloaded much quicker and it gives back 1.5K of program space. I would like to use this with DAGU products.

So far I have managed to modify the avrdude.conf file to include a 168p processor with the different signiture ID. I have modified the boards.txt file to use an opti-boot bootloader for the Arduino pro mini 8MHz @ 3.3V and called it:
Micro Magician (3.3V, 8 MHz) w/ ATmega168PA

Check the attached files to see the modified files. Note: I had to add a .TXT extension to the avrdude.conf file so I could attach it on LMR. please re-name if you want to use/test it.

While the new board type I created worked fine for burning the bootloader using another Arduino as an ISP it will not work for uploading a sketch. To upload a sketch I must select the original Arduino "pro-mini board 8MHz @ 3.3V" otherwise I get the avrdude "invalid signiature ID" error.

I assume this is because I am using the original bootloader and that it is returning the wrong signature. Here are the signatures:

ID - ATmega168 20-AU:  1E 94 06
ID - ATmega168 PA-AU:  1E 94 0B

It would seem that I need to edit the "optiboot" bootloader to return the new signature ID (1E 94 0B). I have had a look at the code but I am not entirely sure how to edit it and then I still have not worked out how to use the make file. What program am I supposed to run?

I am hoping an experienced programmer can explain to me where the bootloader needs to be edited to return the correct ID and how exactly am I supposed to compile the optiboot.c file to get the correct HEX file. I have looked at both WinAVR and AVRstudio with no luck.


boards.txt11.12 KB
avrdude.conf_.txt414 KB
optiboot_v4_4.zip80.73 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Uh. . .being your biggest fanboy, I'm the last person to question your ideas, and you did write a very well reasoned and convincing explanation of why you're doing it this way.  (Not to mention--I can really empathize with the lack of beginner information on mundane programming concepts.)  But when it comes to sticking with 168 series Atmel micro processors--When I look at the specs of something like, say, a Wild Thumper Controller, I'll have to admit I'm suprised and somewhat put off by the fact that you're (still) using a 168.

Obviously, it's a touch of elitism on my part.  But I can't help wonder how many other people think the same way.  Also, in engineering-think--When a component becomes difficult to source, or maintain, isn't it time to look for something else, or move along with the more advanced, better supported devices?

Never mind.  I like Dagu's low prices.  I should keep my mouth shut.  Don't mind me.

You must remember that DAGU sells to all countries. Not just America. Some customers want the cheapest price. That said, the difference in price between the 328 & 168 is not as much as it was a few years ago. At this point I simply want to give customers the option to choose and learn more about the Arduino system.


Start > Programs > Accessories > command prompt is the "DOS shell"

living in a more linux world I already have make installed.

Ok. thanks. I thought the DOS prompt was no longer part of Windows since XP.

So, back to a question I asked at the top.

What program do you run these from? It looks like it uses a DOS shell but Windows XP no longer includes a DOS shell.

Do I need to boot up the computer to the command prompt only to compile these programs? Surely this cannot be.

A makefile is a batch file that tells the compiler what files to include when it compiles a program. I found a very simple page that explained how to write a makefile. http://mrbook.org/tutorials/make/

Your makefile is called from the make command or from your compiler. I was able to write the makefile I needed to compile a multipart program I wrote for one of my classes.