NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » Make File to compile assembler functions

February 26, 2012
by gnkarn
gnkarn's Avatar

I have bee trying to include 3 functions to calculate FFT on my code using AVR studio4 with no success . After hours of trying and studying different potential causes, i think that something is wrong in the make file . As i suspect that the problem is not being able to compile the assembler routines, i would like to compile them separated and manually , and then include the objets using the avrstudio.

this is the error i receive after compiling

Build started 26.2.2012 at 18:31:55 make -C libnerdkits make[1]: Entering directory Z:/para_virtual_box/electronica-docs/3dcubo1/libnerdkits' make[1]: Nothing to be done forall'. make[1]: Leaving directory Z:/para_virtual_box/electronica-docs/3dcubo1/libnerdkits' avr-gcc -g -Os -Wall -mmcu=atmega328p -std=c99 -Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm -o 3dcubo1.elf 3dcubo1.c libnerdkits\delay.o C:\DOCUME~1\GUS\CONFIG~1\Temp/ccHVxDSN.o: In functionfft_mode':

Z:para_virtual_boxelectronica-docs3dcubo1/3dcubo1.c:981: undefined reference to `fft_input'

Z:para_virtual_boxelectronica-docs3dcubo1/3dcubo1.c:982: undefined reference to `fft_execute'

Z:para_virtual_boxelectronica-docs3dcubo1/3dcubo1.c:983: undefined reference to `fft_output'

make: *** [3dcubo1.hex] Error 1 Build failed with 3 errors and 0 warnings...

if i try a different make setup , the error is

<command-line>: warning: this is the location of the previous definition avr-gcc -I"Z:PARA_VIRTUAL_BOXELECTRONICA-DOCS3dcubo1libnerdkits" -I"Z:PARA_VIRTUAL_BOXELECTRONICA-DOCS3dcubo1..nerdskitCode" -I"Z:PARA_VIRTUAL_BOXELECTRONICA-DOCS3dcubo1..nerdskitCodelibnerdkits" -I"Z:PARA_VIRTUAL_BOXELECTRONICA-DOCS3dc ubo1." -mmcu=atmega328p -mmcu=atmega328p -Wall -gdwarf-2 -std=gnu99

                                                                                                                                  -DF_CPU=14745600UL -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT ffft.o -MF dep/ffft.o.

d -x assembler-with-cpp -Wa,-gdwarf2 -c ../avrfft/ffft.S

avr-gcc -mmcu=atmega328p -Wl,-Map=3dcubo1.map 3dcubo1.o ffft.o "Z:para_virtual_boxelectronica-docs3dcubo1libnerdkitsdelay.o" -L"C:Archivos de programaAVRlib" -L"Z:PARA_VIRTUAL_BOXELECTRONICA-DOCS3dcubo1libnerdkits" -L"Z:PARA_VIRTUAL_BOXELECT RONICA-DOCS3dcubo1avrfft" -lm -lZ:para_virtual_boxelectronica-docs3dcubo1avrfftffft -o 3dcubo1.elf

c:/winavr-20090313/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: cannot find -lZ:para_virtual_boxelectronica-docs3dcubo1avrfftffft

make: *** [3dcubo1.elf] Error 1 Build failed with 1 errors and 2 warnings...

The ffft.S file is ok, and the ffft.h file is also , ok,

any help please

rgds

February 26, 2012
by gnkarn
gnkarn's Avatar

additional information from my previuous post,

This is the include file i have on my C program ,

#include "avrfftffft.h"

and this is the make file i,m using

GCCFLAGS=-g -Os -Wall -mmcu=atmega328p -std=c99

LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm

AVRDUDEFLAGS=-c avr109 -p m328p -b 115200 -P com3

LINKOBJECTS=libnerdkitsdelay.o

all: 3dcubo1-upload

3dcubo1.hex: 3dcubo1.c

make -C libnerdkits
avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o 3dcubo1.elf 3dcubo1.c ${LINKOBJECTS}
avr-objcopy -j .text -O ihex Z:\para_virtual_box\electronica-docs\3dcubo1\3dcubo1.elf 3dcubo1.hex

3dcubo1.ass: 3dcubo1.hex

avr-objdump -S -d 3dcubo1.elf > 3dcubo1.ass

3dcubo1-upload: 3dcubo1.hex

avrdude ${AVRDUDEFLAGS} -U flash:w:3dcubo1.hex:a
February 26, 2012
by Ralphxyz
Ralphxyz's Avatar

gnkarn, try reposting all of your makefiles errors and code using the "Indent Selection as Code Block" so that we can make better sense of what you are posting.

Or as you can see from your post, you can precede each line with four spaces.

Ralph

February 26, 2012
by gnkarn
gnkarn's Avatar

Ralph , The important part of the first post is this error, And the make file is on the second,

I'm trying to understand what I need to add to the make file , for the avrgcc to find the functions that where properly defined and needs to be compiled , and linked with the rest.

Z:para_virtual_boxelectronica-docs3dcubo1/3dcubo1.c:981: undefined reference to `fft_input'

Z:para_virtual_boxelectronica-docs3dcubo1/3dcubo1.c:982: undefined reference to `fft_execute'

Z:para_virtual_boxelectronica-docs3dcubo1/3dcubo1.c:983: undefined reference to `fft_output'

make: *** [3dcubo1.hex] Error 1 Build failed with 3 errors and 0 warnings...

regards , Gustavo

February 27, 2012
by gnkarn
gnkarn's Avatar

This is the original post with the compiler output organized as code for better reading . The three functions no recognized are in separate .S file and a separate .h file ; just to summarize : I have failed to modify the make file , to take into account this new functions.

Build started 27.2.2012 at 08:36:37
make -C libnerdkits
make[1]: Entering directory `Z:/para_virtual_box/electronica-docs/3dcubo1/libnerdkits'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `Z:/para_virtual_box/electronica-docs/3dcubo1/libnerdkits'
avr-gcc -g -Os -Wall -mmcu=atmega328p -std=c99 -Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm -o 3dcubo1.elf 3dcubo1.c libnerdkits\delay.o  
C:\DOCUME~1\GUS\CONFIG~1\Temp/ccE3FqmE.o: In function `fft_mode':

Z:\para_virtual_box\electronica-docs\3dcubo1/3dcubo1.c:981: undefined reference to `fft_input'
Z:\para_virtual_box\electronica-docs\3dcubo1/3dcubo1.c:982: undefined reference to `fft_execute'
Z:\para_virtual_box\electronica-docs\3dcubo1/3dcubo1.c:983: undefined reference to `fft_output'
make: *** [3dcubo1.hex] Error 1
Build failed with 3 errors and 0 warnings...

Thanls to anyone taking a look at this , Gustavo

February 27, 2012
by Ralphxyz
Ralphxyz's Avatar

Lets see your includes in relation to Z:para_virtual_boxelectronica-docs3dcubo1/3dcubo1.c.

This looks like a pat problem.

Ralph

February 28, 2012
by gnkarn
gnkarn's Avatar

RAlph,

this how it looks

// ************************************************************
//                          INCLUDE
// ************************************************************

#define F_CPU 14745600

#include "libnerdkits/io_328p.h"
#include "libnerdkits/delay.h"
#include <stdlib.h>// incluido por la funcion random
#include <avr\pgmspace.h> // incluido para poner datos en memoria de programa

#include <math.h> // habilitado por el calculo del Seno() y log10

// #include "libnerdkits/lcd.h"
//#include "libnerdkits/uart.h"//sacado para hacer lugar

#define  NUM_TLCS  3
#define  NUM_ROWS  1 //numero de leds multiplexados en cada pin.

#include "Tlc5940Mux.h"
#include "tlc_fades.h"
//#include "tlcMux_shifts.h"
#include "avrfft\ffft.h"  // libreria de elm chan para fft

I am able to run the code now, by forcing the manual compiling of the FFT routines, and including the objet file manually , this enables me to move on, but i know I do have a problem , most probably as you say some kind of path problem, that need to find..

February 28, 2012
by gnkarn
gnkarn's Avatar

What follows is the main make file, something is missing here, to make the compilation of the new assembler routines possible, what is it ??

GCCFLAGS=-g -O0 -Wall -mmcu=atmega328p -std=c99
LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm
AVRDUDEFLAGS=-c avr109 -p m328p -b 115200 -P com3
LINKOBJECTS=libnerdkits\delay.o avrfft\ffft.o  
all:    3dcubo1-upload

3dcubo1.hex:    3dcubo1.c
    make -C libnerdkits
    avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o 3dcubo1.elf 3dcubo1.c ${LINKOBJECTS}
    avr-objcopy -j .text -O ihex Z:\para_virtual_box\electronica-docs\3dcubo1\3dcubo1.elf 3dcubo1.hex

3dcubo1.ass:    3dcubo1.hex
    avr-objdump -S -d 3dcubo1.elf > 3dcubo1.ass

3dcubo1-upload: 3dcubo1.hex
    avrdude ${AVRDUDEFLAGS} -U flash:w:3dcubo1.hex:a
March 03, 2012
by gnkarn
gnkarn's Avatar

Anyone have an idea where to look in order to have a clear understanding on how to set paths , so the make file can properly find all the files during compiling and linking ?, i have one file that is not properly linked , i compiled it manually, and I'm not sure that thte linked object is occupying the right place in memory . thanks

March 03, 2012
by Ralphxyz
Ralphxyz's Avatar

Sometimes I have been know to copy all of my .h files to the libNerdkits folder and use that syntax.

include "../libnerdkits/delay.h"

The "paths" have been documented and discussed a lot here in the forum, so try searching.

Ralph

March 03, 2012
by gnkarn
gnkarn's Avatar

Thanks Ralph, by copying the .h file and .o file on the same library folder , it is now compiling with no errors .

Now it seams that the previous generated ffft.o file , is by some reason not compatible with the rest of the program, it is not using memory right, so the program behavior change when i enable the new functions .

Do you know what needs to be added on the make file in order to be able to trace the Assembler routines on avr4?,

March 03, 2012
by Ralphxyz
Ralphxyz's Avatar

Short answer no!! There has been a lot of discussions here in the forums about the MakeFile syntax. Start out by just searching the forum for "MakeFile Assembler" or somethinglike that.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that negative numbers are represented in two's complement notation in binary? Learn more...