NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Makefile foodloader
December 01, 2009 by Farmerjoecoledge |
I think i might have a computer ghost that's having fun making my life suspiciously, crazy. |
---|---|
December 01, 2009 by Rick_S |
Why are you trying to compile the bootloader? If for some reason you had to send the bootloader to a chip that didn't have one, AKA one NOT from NerdKits, the compiled hex file is already done and in the code/bootloader folder. All that would have to be done is sending it over to the chip with an ISP (NOT THE NERDKIT) programmer. Rick |
December 01, 2009 by pbfy0 |
here's the image: and that's also happened to me. I think you need to run this command:
not just this:
if you are going to upload on a NON ATmega168, you would change the MCU=atmega168 to whatever MCU you were compiling it for. If you want to compile it for a different cpu frequency, you change F_CPU=14745600 to F_CPU= whatever clock speed you want. |
December 01, 2009 by FWSquatch |
What the heck is a foodloader? |
December 01, 2009 by Farmerjoecoledge |
Hello there FWSquatch, i've been dieing to try your gvoice but a little too much juice on the cpu/programmer kinda set me back, 2mo's now. Foodloader is a Nerdkit bootloader. You'ld have to ask them why. Thanks pbfy0 for posting that image. Don't know what i did wrong there. Rick didn't i already say they are nerds chips, it's all nerds stuff. |
December 01, 2009 by Rick_S |
Sure, FJC you did say that. That's why I was wondering why you were trying to compile the bootloader because their chips would already have that on them. My main thought for you was the fact that you cannot install a bootloader onto a micro-controller through the serial port (the method used by NerdKits). That was the reason I was wondering if you got yourself an ISP programmer? If you did get an ISP programmer, you really don't even need the bootloader on the chip unless serial programming is just more convenient for you. I actually prefer the serial programming over the ISP even though I do have an ISP parallel programmer. FWSquatch - foodloader is the bootloader used by the NerdKit team on the ATmega168's and ATmega328p's they sell. The bootloader they install is included in your code download and if you have the right kind of programmer can be installed on micro-controllers purchased elsewhere. Rick |
December 01, 2009 by Farmerjoecoledge |
Rick, They just sent me their hack, it's a parallel port hack. That's the one that the pic is from. I do have an isp but i lost all my links for the pinout, linux is shit, read my linux sucks post. So i'm on it, this better work nothing else has. Didn't you just say in the make error post it was because there was no bootloader? |
December 01, 2009 by Rick_S |
No, At least if I did It wasn't what I meant. :) What I was trying to say was that the error is because AVRdude couldn't communicate with the chip. Which could be many things only one of which would be the bootloader. I've even gotten that error when I didn't flip the programming switch. I really would be surprised if the bootloader was the problem since you did state that the microcontroller came from nerdkits. I really do hope you get it all figured out though. And I apologize for any confusion I may have created. Rick |
December 01, 2009 by Farmerjoecoledge |
I looked up the wiring for the breadboard but seems it's not right, what's your wiring for your isp cable to load the bootloader? Error mesg: avrdude: AVR device not responding avrdude: initialization failed, rc=-1 Double check connections and try again, or use -F to override this check |
December 02, 2009 by mcai8sh4 |
FJC : I kept getting that message when I first tried my ISP, for me the problem was with pin1 - Using the nerdkits setup we connect that pin to VCC, if you use an ISP - remove that wire (or connect it to VCC via a ~100ohm resistor). So Pin1 should only be connected to to your ISP. Take care with the fuse settings though, if you just run make from the ../bootloader directory without altering anything, it should work ok. If you still get stuck, shout out. |
December 02, 2009 by Rick_S |
Good call mcai8sh4. I don't normally ISP program in the breadboard. But I don't have my reset line hard wired high either. I use a pullup resistor with a switch. So If I did want to ISP program on board I could. Keep in mind FJC, I started programming these chips over a year ago many months before I purchased my Nerdkit. I mainly bought the Nerdkit in an effort to learn 'C' programming of micro-controllers. Prior to that, I was buying chips on e-bay, and other web sites with an ISP programmer from a site in Thialand. I've used another software and language (BASCOM) for my programming up to this point. I've messed around with electronics since I was young (late 70's early 80's). The only formal electronic training I have had is attending 1 semester at DeVry University. Everything else is self taught through books, the web, and A LOT of trial and error. So when you ask "what's your wiring for your isp cable to load the bootloader? " my answer would be, I soldered up a cirucuit with a onboard regulated power supply, crystal, ISP header, and chip socket so all I had to do was drop the chip in, power up, plug in the ISP programmer, and go to town. Not a lot of help to you. An ISP programmer in a breadboard is a royal pain. The main reason being, you cannot plug it in without an adapter of some sort. Because the headers for the ISP are 2X3 or 2X5, the pins will not physically connect unless you either stick jumper wires in each pin or buy/make an adapter board. I'm at work now but when I get home, I'll take a couple of photo's of my stuff to show you what I do to program that way. Rick |
December 02, 2009 by Rick_S |
As promised earlier, Here are the home-made carriers I made to program my mega8's and tiny2313's. The mega8 one also works with 48,88,168, and 328p's. Here's the mega8 one. On it I can either plug into the socket (with the wired oscillator circuit) or the zif connector if the chip doesn't need the external oscillator. The one for the tiny2313. This is my parallel ISP programmer (purchased from futurlec.com) There is a 10 pin ribbon cable that goes between the two parts of the isp programmer you see there. This is the breadboard ISP programming adapter I made. Top view:
and bottom view: That's a hand etched board using the laser printer method. If I want to ISP program, I can either plug my adapter into the breadboard and wire from it to the appropriate pins on the chip. Or move the chip to one of my dedicated "carriers" which is nothing more than a power supply, oscillator circuit, and an ISP header wired to the appropriate pin locations and plug the ISP programmer into that. Now you have a little more insight into my world. I don't know if any of this will help at all but at least you'll know a bit more of my background and where I come from when I attempt to help. :) Rick |
December 02, 2009 by Farmerjoecoledge |
I just tried your fix mcai8sh4 and it's the "terminate in an unsual way, contact the vendor" one. This is on my xp and it's the same error for everything, two of their programmers and the isp with parallel or usb. I'm thinkin my windows machine is saying f**k you that's enough. I put this thing through hell with this stuff and it's saying no more. The biggest of those being the winavr itself. The make worked fine 2 mo's ago and now when i came back it didn't. Had to uninstall and reinstall to get it to work! So what, do you think it's my comp? Same error over and over doesn't matter what it is. |
December 03, 2009 by mcai8sh4 |
Rick : Nice work, I want to make my own boards, the day will come soon! FJC : As Rick mentioned it could be the contents of the Makefile for your ISP causing you some problems. I also have a USB based ISP (different to the one you have, but it may be basically the same thing). For My make file, the AVRDUDES line reads : AVRDUDEFLAGS=-c avrispmkII -P usb -p m168 I don't know much about these ISPs, but I have read somewhere that windows can have problems with AVRISPmkII - so it may be something called USBasp. I only program my chips in linux, so I'm afraid I haven't used the ISP in XP. Perhaps if you post your Makefile, we may see something that could cause you problems. Best of luck, -Steve |
December 03, 2009 by Farmerjoecoledge |
Hi mcai8sh4, It's not "my" makefile. It's "supplied" in the "bootloader" file from the cd. Don't be confusing things more than they are. If either one of those makefiles had a line like that i'd certainly change it. |
December 03, 2009 by Rick_S |
FJC, Where did you get this CD from?? I didn't get one with my kit. |
December 03, 2009 by Farmerjoecoledge |
Hi Rick, Yeah, it came with my kit, approx 8mo's ago. It appears there's nothing on the cd, except for maybe a couple of drivers, that you can't get from this site. |
December 04, 2009 by Farmerjoecoledge |
Rick, What isp c compiler did you use for your projects. There's a ton of them. And what about some projects like the nerds but for the isp occupying pins 17,18.19? |
December 04, 2009 by Rick_S |
Quote:
It depends on what is hooked up to those pins in a real circuit. Some components will interfere with the ISP communications while others won't. Sometimes the chip has to be removed or mechanically (via jumpers) disconnected from the circuit on the board to program it via ISP. Quote:
?? ISP (In-System Programmer) has Nothing to do with compile time or the compiler. It is simply a method of connection between the PC and the micro-controller. I have WinAVR installed on my Vista 32 Ultimate and my Vista 32 Business boxes. This (Bundle of programs) uses the gcc compiler to compile the code and AVRdude (AVR Downloader/Uploader) to program the chip. As I stated above in the post with the photo's, the ISP programmer I got was from a company in Thailand called futurlec.com at this LINK Their stuff takes a long time (several weeks to over a month) to get here but it's inexpensive. This is by no means an endorsement, Parallel programmers can be picky as well. The programmer you bought will most likely work just fine if you get everything ELSE straightened out 1st. Then determine what settings to use for AVRdude. Rick |
December 04, 2009 by Farmerjoecoledge |
Hi Rick, I'm feeling stupider and stupider. What does this mean now? This (Bundle of programs) uses the gcc compiler to compile the code and AVRdude (AVR Downloader/Uploader) to program the chip. My understanding of this process is the gcc is "make" and he's the compiler, and when you compile you program. I didn't think/know they were two diffrent processes, invisable at that. Now what's this about avrdude? I know he's a compiler too but only? for hex's i believe,?? Is that what you mean? |
December 05, 2009 by hevans (NerdKits Staff) |
Hi Farmerjoe, You are not getting stupider, you are just beginning to understand how vast and complicated (and fun) all this stuff really is. But the first step to learning is just how much there is to learn. WinAVR is a bundle of programs. 'make' is just sort of the glue that gets them to work all together. The main programs you are interested in are avr-gcc, avrdude, and avrobjcopy. avr-gcc is used to compile your C code into object files. avrobjcopy turns these object files into hex files that can be uploaded to your MCU. avrdude is the program that physically (in the loose sense of the word) communicates with your MCU and transfers the hex file onto your chip. If you open up the make file, you will see that it makes subsequent calls to all these programs and ultimately you end up with your program on the chip. It is possible to do all these steps separately by hand of the command line (and might even be a good exercise for someone who wants to learn what happens at each step). Hope that clears things up. Humberto |
December 05, 2009 by Farmerjoecoledge |
Humberto, Did you just say your going to tell us how to do this manually? You just introduced a new player, avrobjcopy. Now your going to have to fill in the blanks. So do i understand avrobjcopy is a compiler too? So we take each whatever the proper name is for avrdude/avrobjcopy/avr-gcc and compile just that part of the makefile? Ok, that sounds like fun, your turn. |
December 05, 2009 by FWSquatch |
I don't think he's planning on a tutorial on manually compiling a program. He was mentioning if you'd like to learn more about how a program is compiled, you can dig through the Makefile and run the commands manually. If you just open up the Makefile, you can see a bunch of lines that are pretty much nothing more than commands that you could type in yourself on the command line. This page has a good overview of the toolchain for you: Take a gander at that and maybe it will help clear some of these things up. |
December 05, 2009 by Farmerjoecoledge |
Hi FWSquatch, I'm just going to throw this in an we can go from there. |
December 07, 2009 by Farmerjoecoledge |
Somebody post this image please. |
December 07, 2009 by pbfy0 |
|
December 07, 2009 by Rick_S |
Farmerjoe, Is that the image you were trying to show us?? If what you are trying to show us is you typing the lines of the makefile in a command window and getting errors, there is a reason for that. The lines from the makefile you typed are for lack of a better word, "variables". For instance, in the initialload makefile you will see this:
The lines above the all: contain text that is substituted in the lines below. For instance you see the line
That means that wherever below you see
make will substitute
so the line in the make file that says;
will become the command line equivalent of
See how each of the 3 items ${GCCFLAGS}, ${LINKFLAGS}, and ${LINKOBJECTS} were substituted. Thats part of how make interprets the makefile. Keep in mind as well, this is a VERY basic makefile. If you look in the bootloader folder at the file makefile.fl you can see just how complicated they can get. Hope that helps some, I know we'd all really like to see you back up and running. Rick |
December 07, 2009 by Farmerjoecoledge |
Hi Rick, good to see your still hangin in. There's me reading between the lines again. From what FWSquatch said I assumed each avr-gcc/avrdude/linkflags could be run individually. That's a dam good explanation by the way. So that line is what Humberto gave me to run, and you know it's the same error. Grant, ps. I kinda liked hiding behind farmer he's kinda, suspisious, among other things, stinky? ;) |
December 08, 2009 by Farmerjoecoledge |
Hi Rick, Continuing on, you never answered my last q on this and i think i know why. (This (Bundle of programs) uses the gcc compiler to compile the code and AVRdude (AVR Downloader/Uploader) to program the chip.) Ok, Am I right to think the compiler is a programmer? No. Why? The serial/parallel or usb can not transfer compiled data. The compiler is just that, he compiles all the pieces. That's why the serial adapter is called the "programmer". That's the guy who converts the RS232 computer data to binary, right? It's about time. |
December 09, 2009 by hevans (NerdKits Staff) |
Farmerjoe, The compiler turns your C code into machine readable code, which is what you think of as binary data. After the compiler compiles your code what is left is just a stream of 1s and 0s that can be run directly on the MCU. That job is handled in our toolchain by avr-gcc. One the program is compiled and ready to be uploaded, avrdude (a different program) is used to do the actual communication with the bootloader on the MCU, transfer this compiled program over to the chip, and burn it to the flash. Does that make sense? Humberto |
December 10, 2009 by Rick_S |
I think the term Programmer has been used somewhat loosely in the industry. I think it would be more accurate to call it a Programming interface. Because, in most cases the device sold as a programmer is nothing more than a means to interconnect a PC to a micro-controller. Technically, the person writing the code is the programmer. Then, as Humberto said, the compiler software on the PC (avr-gcc/avr-objcopy) converts the code into something the micro-controller can understand - You could think of it as a translator of sorts from the Human language to Machine language. This Machine language program is then sent using the programming software on the PC through the programming interface to the micro-controller. On the micro-controller end, the boot loader receives the machine language program and burns it into the flash of the micro-controller. I don't know if I made it any better or worse :) Hopefully better... Rick |
December 10, 2009 by Farmerjoecoledge |
Ok Good, I'm getting that part of the picture, Now between the protocols involved, and why, even at this stage there's so dam many. Don't even know where to start really but let's start with the os, Protocol-1, the code, Protocol-2, the toolchain, Protocol-3, the serial port, Protocol-4, the usb port, Protocol-5, the usb/rs232, Protocol-6 the rs232/serial, Protocol-7, the cpu, protocol-8. So say I'm the word "data" i'm being typed in a writing program on a windows os, So data is part of a program. Let's say data is a tiny 4letter entity of the ledarray2.c (we should mention the ascii protocol, without it no text). This is where you come in, you can be one of the protocols inside the toolchain. The first guy data talks to is the gcc, who happens to know another guy who can help, he's objcopy. Together these guy's take data and turn him into 0110. With his new identity he meets avrdude. Dude knows where to send him but to get him there he's got to meet mr. currant first. This mr. currant is a big shot, data has to live by his rules or no happy running for 0110. The toolchain gang are done for the day but 0110 is going to a usb instead of a serial port. Panic sets in, but wait there's help, mr usb/rs232 is going to change you back to rs232 data, but hold it i'm 0110 now not rs232 so i quit. Sorry can't quit now mr. uart is expecting you. So data 0110 is confused, miss. ttl is mad, you didn't call her. So shut up data,0110,rs232 or whatever you are, take your juice and get running. I'm trying to draw a picture like the electronics guy's and the water pressure. If you can clear up the path from the toolchain to the usb to the rs232 to the serial to the chip, and when exactly does data get his juice, that would be good. I'm not going to lose any sleep over this, just curious. |
December 10, 2009 by Rick_S |
As far as a windows PC is concerned, a built in serial port VS a USB serial port are the same. Any software written to communicate via serial will use either without a hitch. I can't speak for linux, I haven't tried any programming from my linux box. I just use it as a basic garage pc to stream music and lookup things periodically on the internet. I'm mostly a Windows guy. A common thing that causes AVRdude to Panic is when it cannot find either the microcontroller or the programming interface and there can be a LOT of reasons for this. Good to hear from you Grant, seemed you were kinda quiet on the scene there for a bit. Trying to mull some of this over?? It sounds like it's getting real close to clicking for you. Rick |
December 27, 2009 by Farmerjoecoledge |
Continued...http://www.nerdkits.com/forum/thread/339/ |
Please log in to post a reply.
Did you know that one NerdKits customer discovered that his hamster ran several miles in a night using his kit and a Hall-effect sensor? Learn more...
|