<< Chapter < Page Chapter >> Page >

Compiling and linking

A working program can be produced by compiling the C code and linking assembly modules and the core module. The compilertranslates C code to a relocatable assembly form. The linker assigns physical addresses on the DSP to the relocatable dataand code segments, resolves .global references and links runtime libraries.

The procedure for compiling C code and linking assembly modules has been automated for you in the batch file v:\ece420\54x\dsptools\c_asm.bat . The name of the first file becomes the name of the executable. Once you havecompleted lab4main.c and c_fft_given.asm , type c_asm lab4main.c c_fft_given.asm to produce a lab4main.out file to be loaded onto the DSP. For the C FFT type c_asm lab4main.c lab4fft.c to produce lab4main.out . Load the output file onto the DSP as usual and confirm that validFFTs are calculated. Once valid output is obtained, measure how many clock cycles it takes to compute both the assembly and C FFT.

Quiz information

From your prelab experiments, you should be able to describe the effect of windowing and zero-padding on FFT spectralanalysis. In your DSP system, experiment with differentinputs, changing N and the type of window. Can you explain what happens as the input frequency is increased beyond the Nyquist rate? Does the X k 2 coincide with what you expect from Matlab? What is the relationship between the observed spectrum and the DTFT?What would happen if the FFT calculation takes longer than it takes to fill inputs with N samples? How long does it take to compute each FFT? What are the tradeoffs between writing code in C versus assembly?

Appendix a:

lab4main.c

1 /* v:/ece420/54x/dspclib/lab4main.c */ 2 /* dgs - 9/14/2001 */ 3 /* mdk - 2/10/2004 C FFT update */ 4 5 #include "v:/ece420/54x/dspclib/core.h" 6 7 /* comment the next line to use assembly fft */ 8 #define C_FFT 9 10 #ifdef C_FFT /* Use C FFT */ 11 12 #include "window.h" 13 #include "lab4.h" /* Number of C FFT points defined here */ 14 15 /* function defined in lab4fft.c */ 16 void fft(void); 17 18 /* FFT data buffers */ 19 int real[N]; /* Real part of data */ 20 int imag[N]; /* Imaginary part of data */ 21 22 #else /* Use assembly FFT */ 23 24 #define N 1024 /* Number of assembly FFT points */ 25 26 /* Function defined by c_fft_given.asm */ 27 void bit_rev_fft(void); 28 29 /* FFT data buffers (declared in c_fft_given.asm) */ 30 extern int bit_rev_data[N*2]; /* Data input for bit-reverse function */ 31 extern int fft_data[N*2]; /* In-place FFT & Output array */ 32 extern int window[N]; /* The Hamming window */ 33 34 #endif /* C_FFT */ 35 36 37 /* Our input/output buffers */ 38 int inputs[N]; 39 int outputs[N]; 40 41 volatile int input_full = 0; /* volatile means interrupt changes it */ 42 int count = 0; 43 44 45 interrupt void irq(void) 46 { 47 int *Xmitptr,*Rcvptr; /* pointers to Xmit & Rcv Bufs */ 48 int i; 49 50 static int in_irq = 0; /* Flag to prevent reentrance */ 51 52 /* Make sure we're not in the interrupt (should never happen) */ 53 if( in_irq ) 54 return; 55 56 /* Mark we're processing, and enable interrupts */ 57 in_irq = 1; 58 enable_irq(); 59 60 /* The following waitaudio call is guaranteed not to 61 actually wait; it will simply return the pointers. */ 62 WaitAudio(&Rcvptr,&Xmitptr); 63 64 /* input_full should never be true... */ 65 if( !input_full ) 66 { 67 for (i=0; i<BlockLen; i++) 68 { 69 /* Save input, and echo to channel 1 */ 70 inputs[count] = Xmitptr[6*i] = Rcvptr[4*i]; 71 72 /* Send FFT output to channel 2 */ 73 Xmitptr[6*i+1] = outputs[count]; 74 75 count++; 76 } 77 } 78 79 /* Have we collected enough data yet? */ 80 if( count >= N ) 81 input_full = 1; 82 83 /* We're not in the interrupt anymore... */ 84 disable_irq(); 85 in_irq = 0; 86 } 87 88 89 main() 90 { 91 /* Initialize IRQ stuff */ 92 count = 0; 93 input_full = 0; 94 SetAudioInterrupt(irq); /* Set up interrupts */ 95 96 while (1) 97 { 98 while( !input_full ); /* Wait for a data buffer to collect */ 99 100 /* From here until we clear input_full can only take * 101 * BlockLen sample times, so don't do too much here. */ 102 103 /* First, transfer inputs and outputs */ 104 105 #ifdef C_FFT /* Use C FFT */ 106 /* I n s e r t c o d e t o f i l l */ 107 /* C F F T b u f f e r s */ 108 109 #else /* Use assembly FFT */ 110 /* I n s e r t c o d e t o f i l l */ 111 /* a s s e m b l y F F T b u f f e r s */ 112 113 #endif /* C_FFT */ 114 115 /* Done with that... ready for new data collection */ 116 count = 0; /* Need to reset the count */ 117 input_full = 0; /* Mark we're ready to collect more data */ 118 119 /**********************************************************/ 120 /* Now that we've gotten the data moved, we can do the */ 121 /* more lengthy processing. */ 122 123 #ifdef C_FFT /* Use C FFT */ 124 125 /* Multiply the input signal by the Hamming window. */ 126 /* . . . i n s e r t C / a s m code . . . */ 127 128 /* Bit-reverse and compute FFT in C */ 129 fft(); 130 131 /* Now, take absolute value squared of FFT */ 132 /* . . . i n s e r t C / a s m code . . . */ 133 134 /* Last, set the DC coefficient to -1 for a trigger pulse */ 135 /* . . . i n s e r t C / a s m code . . . */ 136 137 /* done, wait for next time around! */ 138 139 140 #else /* Use assembly FFT */ 141 142 /* Multiply the input signal by the Hamming window. */ 143 /* . . . i n s e r t C / a s m code . . . */ 144 145 /* Bit-reverse and compute FFT in assembly */ 146 bit_rev_fft(); 147 148 /* Now, take absolute value squared of FFT */ 149 /* . . . i n s e r t C / a s m code . . . */ 150 151 /* Last, set the DC coefficient to -1 for a trigger pulse */ 152 /* . . . i n s e r t C / a s m code . . . */ 153 154 /* done, wait for next time around! */ 155 156 157 #endif /* C_FFT */ 158 159 } 160 }

Questions & Answers

find the 15th term of the geometric sequince whose first is 18 and last term of 387
Jerwin Reply
The given of f(x=x-2. then what is the value of this f(3) 5f(x+1)
virgelyn Reply
hmm well what is the answer
Abhi
how do they get the third part x = (32)5/4
kinnecy Reply
can someone help me with some logarithmic and exponential equations.
Jeffrey Reply
sure. what is your question?
ninjadapaul
20/(×-6^2)
Salomon
okay, so you have 6 raised to the power of 2. what is that part of your answer
ninjadapaul
I don't understand what the A with approx sign and the boxed x mean
ninjadapaul
it think it's written 20/(X-6)^2 so it's 20 divided by X-6 squared
Salomon
I'm not sure why it wrote it the other way
Salomon
I got X =-6
Salomon
ok. so take the square root of both sides, now you have plus or minus the square root of 20= x-6
ninjadapaul
oops. ignore that.
ninjadapaul
so you not have an equal sign anywhere in the original equation?
ninjadapaul
hmm
Abhi
is it a question of log
Abhi
🤔.
Abhi
Commplementary angles
Idrissa Reply
hello
Sherica
im all ears I need to learn
Sherica
right! what he said ⤴⤴⤴
Tamia
hii
Uday
what is a good calculator for all algebra; would a Casio fx 260 work with all algebra equations? please name the cheapest, thanks.
Kevin Reply
a perfect square v²+2v+_
Dearan Reply
kkk nice
Abdirahman Reply
algebra 2 Inequalities:If equation 2 = 0 it is an open set?
Kim Reply
or infinite solutions?
Kim
The answer is neither. The function, 2 = 0 cannot exist. Hence, the function is undefined.
Al
y=10×
Embra Reply
if |A| not equal to 0 and order of A is n prove that adj (adj A = |A|
Nancy Reply
rolling four fair dice and getting an even number an all four dice
ramon Reply
Kristine 2*2*2=8
Bridget Reply
Differences Between Laspeyres and Paasche Indices
Emedobi Reply
No. 7x -4y is simplified from 4x + (3y + 3x) -7y
Mary Reply
how do you translate this in Algebraic Expressions
linda Reply
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
Crystal Reply
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
Chris Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
China
Cied
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
AMJAD
preparation of nanomaterial
Victor Reply
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
Himanshu Reply
good afternoon madam
AMJAD
what is system testing
AMJAD
what is the application of nanotechnology?
Stotaw
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
Azam
anybody can imagine what will be happen after 100 years from now in nano tech world
Prasenjit
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
Azam
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
Prasenjit
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
Damian
silver nanoparticles could handle the job?
Damian
not now but maybe in future only AgNP maybe any other nanomaterials
Azam
Hello
Uday
I'm interested in Nanotube
Uday
this technology will not going on for the long time , so I'm thinking about femtotechnology 10^-15
Prasenjit
can nanotechnology change the direction of the face of the world
Prasenjit Reply
At high concentrations (>0.01 M), the relation between absorptivity coefficient and absorbance is no longer linear. This is due to the electrostatic interactions between the quantum dots in close proximity. If the concentration of the solution is high, another effect that is seen is the scattering of light from the large number of quantum dots. This assumption only works at low concentrations of the analyte. Presence of stray light.
Ali Reply
the Beer law works very well for dilute solutions but fails for very high concentrations. why?
bamidele Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!
QuizOver.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Ece 320 spring 2004. OpenStax CNX. Aug 24, 2004 Download for free at http://cnx.org/content/col10225/1.12
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ece 320 spring 2004' conversation and receive update notifications?

Ask