NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Support Forum » [initialload.hex] Error 2
January 21, 2012 by ffogarty5 |
I can't seem to get past [initialload.hex] Error 2 when I hit run in the command window. The COM port setting in the program was changed to the port listed in the DM. (com4 in my case). Any Ideas ? Thanks, Chris |
---|---|
January 22, 2012 by hevans (NerdKits Staff) |
Hi ffogarty5, That doesn't give me enough info about the error you are getting to know which direction to go in. If you can post a screenshot of the full error you are getting it will give us more information and I'm sure we can get up and running in no time. Humberto |
March 13, 2012 by Guerrieri |
I am getting the same thing. I do not know how to compile the program. This is where I believe I am stuck. C:Documents and Settingsuser>cd my documents C:Documents and SettingsuserMy Documents>ls C:Documents and SettingsuserMy Documents>cd initialload C:Documents and SettingsuserMy Documentsinitialload>ls Makefile initialload.c C:Documents and SettingsuserMy Documentsinitialload>make make -C ../libnerdkits make: ../libnerdkits: No such file or directory. Stop. make: [initialload.hex] Error 2 |
March 13, 2012 by Rick_S |
You have to keep the folder structure intact. Your initial load folder should be inside the code folder with all the other project folders as well as a folder called libnerdkits. That is where the UART, LCD, and delay libraries are kept. Unzip your download again but this time keep the original structure, then edit your makefile per the guide. I think you'll find then that it will compile fine. Rick |
March 13, 2012 by pcbolt |
Hi Guerrieri - Looks like the "makefile" program cannot find the libnerdkits directory so either it isn't installed on your machine or it is in a place "makefile" isn't told to look for. The way it is written now it is searching in a directory that shares the same parent directory as the one listed at your command prompt. So it should look something like this:
If you are in command prompt mode it should look like:
Any other configuration and the "makefile" program will be looking in the wrong place. You can either re-configure your directory structure to match this - or - replace the relative path to the "libnerdkits" directory (../libnerdkits) with the absolute path to the "libnerdkits" directory (C:\Some_other_directories\NK_Stuff\libnerkits). |
March 13, 2012 by pcbolt |
Rick - You must type a little faster than I do...you beat me to the punch :-) |
March 13, 2012 by Ralphxyz |
Guerrieri, did you maintain the structure of the Nerdkits download? The initiaload folder has to be in the Code folder!! To show the path with \ just indent the line four spaces or use the "Indent Selection as Code Block" button on this page.
Or you can escape the \ with \\ (two \ instead of one). Ralph |
March 14, 2012 by Guerrieri |
The initialload folder was NOT in the code folder. I downloaded the code again, and saved it in my docs, but how do I open it with word pad or a text editor? I am missing something simple. Before, when I save just the initialload folder, I was prompted to open with a list of programs. Thanks for the quick response. Joe |
March 14, 2012 by pcbolt |
Joe - I think I need a little more info. I assume after you downloaded the .zip file, you were able to extract the whole "code.zip" file all at once. If so, everything should get placed in the right location. If you extract just a sub-directory you're going to have trouble putting all the pieces together. Looks like you're using a recent version of windows so you should be able to right-click on the "code.zip" file and a default decompression program should be on the context menu (right-click menu). Another way is to open WinZip or 7-Zip then navigate to your "Code.zip" file, the use the "extract all". Hopefully this is where you got stuck...if not please describe your steps further. |
March 15, 2012 by Ralphxyz |
Guerrieri said:
What are you "trying" to open with word pad or a text editor? You do not open a folder with a text editor. Instead of using My Documents you ought to copy/move/unzip the code folder to C:\Nerdkits. That will give you C:\Nerdkits\Code. Then you can open C:\Nerdkits\Code\Initialload\initialload.c in your text editor (never use NotePad). Actually My Documents works but getting there from the command line is harder then simple
Ralph |
March 15, 2012 by pcbolt |
Ralph - I just use a batch file kept in the default cmd prompt directory to do that. |
March 15, 2012 by Ralphxyz |
You have a batch file for all of your projects? That certainly would work, or is your batch file just to get to the Code folder and then you cd from there? Ralph |
March 15, 2012 by pcbolt |
It just gets me from "Documents and Settings\ETC" to "Nerdkits\Code". Then I can pick and choose from there. Works like a charm. |
March 30, 2012 by Jer |
My problem is, I keep getting an Exit Code 2. "Line 414=> Isim = log(temp2) * Ik;" BUT If I place a letral like: Isim = log(.7) * Ik;" It will Compile no problems. Here is the full source code: Thanks For your Help. // ZSenSim.c is based on tempsensor.c // for NerdKits with ATmega328 // mrobbins@mit.edu define F_CPU 14745600include <stdio.h>//#include <math.h> include "c:WinAVR-20090313avrincludemath.h"include <avr/io.h>include <avr/interrupt.h>include <avr/pgmspace.h>include <inttypes.h>include "../libnerdkits/delay.h"include "../libnerdkits/lcd.h"include "../libnerdkits/uart.h"include "../libnerdkits/io_328p.h"include "../libnerdkits/io_328p.h"//--------------------------------------------------------------------------------------------- void master_SPI_init() {
// TCCR0B |= (1<<CS02) | (1<<CS00); // TIMSK0 |= (1<<TOIE0); } //--------------------------------------------------------------------------------------------- uint16_t SPI_MasterReceive() { // Initz Return value. uint16_t data = 0;
} //--------------------------------------------------------------------------------------------- void SPI_Master_Outp(uint16_t OutWord) {
} //--------------------------------------------------------------------------------------------- void SET_VDAC(uint8_t Chnl, double Vout, double Vref) { uint16_t DAC_Word = 0;
} //--------------------------------------------------------------------------------------------- uint16_t Inp_Keypad() {
} //--------------------------------------------------------------------------------------------- void adc_init() { // set analog to digital converter // for external reference (5v), single ended input ADC0 ADMUX = 0;
} //--------------------------------------------------------------------------------------------- uint16_t Inp_ADC() { // read from ADC, waiting for conversion to finish // (assumes someone else asked for a conversion.) // wait for it to be cleared while(ADCSRA & (1<<ADSC)) { // do nothing... just hold your breath. } // bit is cleared, so we have a result.
} //---------------------------------------------------------------------------------------------
double sampleToFahrenheit(uint16_t sample)
{
// conversion ratio in DEGREES/STEP:
// (5000 mV / 1024 steps) * (1 degree / 10mV)
// ^^^ ^^
// from ADC from LM34
return sample * (5000.0 / 1024.0 / 10.0); //--------------------------------------------------------------------------------------------- double Calc_VZout(double Read_Sim, double Ik, double Vref_uut, double Zout) {
} //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ int main() {
} //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
March 30, 2012 by pcbolt |
Hi Jer - It looks like the compiler may be assuming "temp2" does not get changed after it is initialized to 0. Since log(0) is undefined, it does not want to compile.
Either way you might want to add code to test if temp2 is zero before using the log() function. |
March 31, 2012 by Jer |
Thanks for the help! I initialized temp2 to EQL 1 and changed -Os to -O0 neither change the out come. Jer |
March 31, 2012 by Jer |
I FOUND THE SOLUTION!!! THANKS to mrobbins and Ralphxyz!! Microcontroller Programming » Trouble with the log10 function June 02, 2010 by mrobbins (NerdKits Staff) Hi Rufus, Does your compiler error say something like "relocation truncated to fit"? If so, give this a try: 1) In the Makefile, remove "-lm" from the end of the LINKFLAGS line: 1 LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt View Original 2) In the Makefile, add "-lm" to the end of the LINKOBJECTS line: 1 LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o -lm View Original 3) Run "make". This simply rearranges the order in which the compiler/linker bundles the math code with your code, ensuring that the math code comes last. For reasons that are a little bit voodoo, this tends to make it work. (There's a bug report about this issue from a while ago, but not too much detail in explaining it clearly.) Please let me know if that works! And if not, please post the compiler's error message. Mike |
March 31, 2012 by Jer |
Also Thanks to Mike and pcbolt! |
Please log in to post a reply.
Did you know that many systems in nature can be described by a first order response? Learn more...
|