Compile problem

Status
Not open for further replies.
I'm new to PJRC, and the use of the GCC compiler.
I downloaded blinky and unpacked it.
I have AVR studio installed and am using programmers notepad.
When I open the blinky make file using programmers notepad,and have pn make all, I get the following compile error.
I did not try the command line make.

Compiling C: example.c
avr-gcc -c -mmcu=atmega32u4 -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./example.lst -std=gnu99 -MMD -MP -MF .dep/example.o.d example.c -o example.o
example.c:69: fatal error: opening dependency file .dep/example.o.d: No such file or directory
compilation terminated.
make.exe: *** [example.o] Error 1

I would be great full for any help.
Doug McCallum
 
Hello dougmccallum, the blinky example works ok for me although the version of avr-gcc has changed since those samples were posted and I don't remember what but there's some basic changes you need to make in the code to get it to compile w/current versions on avr-gcc. My personal approach would be to open a terminal, first type "make clean", then "make" and see what happens. You may also want to post a direct link to the exact code you're trying to compile, your operating system version & your version of avr.gcc for better answers too. Hope this helps.
 
OK thank you.
I'm just getting started with AVR, and Teensy.
I have used Teensy with Arduino compiler, but I need more speed.
Thank you, I give it a try.
 
You're compiling example.c, which in the blinky example from here (https://www.pjrc.com/teensy/gcc.html) doesn't exist, but in that example (and many others in the tutorial series) you're going to get a lot of errors saying

Code:
usb_debug_only.c:113:24: error: variable ‘hid_report_descriptor’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
 static uint8_t PROGMEM hid_report_descriptor[] = {

And all you do is go in the source change whatever the type is to const by putting const before it, but it char, int, etc.

After that, a successful compile looks like

Code:
$ avr-gcc -v
Using built-in specs.
COLLECT_GCC=avr-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/avr/4.8.2/lto-wrapper
Target: avr
Configured with: ../src/configure -v --enable-languages=c,c++ --prefix=/usr/lib --infodir=/usr/share/info --mandir=/usr/share/man --bindir=/usr/bin --libexecdir=/usr/lib --libdir=/usr/lib --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-libssp --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=avr
Thread model: single
gcc version 4.8.2 (GCC) 
$ make

-------- begin --------
avr-gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling C: blinky.c
avr-gcc -c -mmcu=atmega32u4         -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./blinky.lst  -std=gnu99 -MMD -MP -MF .dep/blinky.o.d blinky.c -o blinky.o 
blinky.c: In function ‘main’:
blinky.c:53:16: warning: unused variable ‘i’ [-Wunused-variable]
  unsigned char i;
                ^

Compiling C: usb_debug_only.c
avr-gcc -c -mmcu=atmega32u4         -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./usb_debug_only.lst  -std=gnu99 -MMD -MP -MF .dep/usb_debug_only.o.d usb_debug_only.c -o usb_debug_only.o 

Compiling C: print.c
avr-gcc -c -mmcu=atmega32u4         -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./print.lst  -std=gnu99 -MMD -MP -MF .dep/print.o.d print.c -o print.o 

Linking: blinky.elf
avr-gcc -mmcu=atmega32u4         -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=blinky.o  -std=gnu99 -MMD -MP -MF .dep/blinky.elf.d blinky.o usb_debug_only.o print.o --output blinky.elf -Wl,-Map=blinky.map,--cref -Wl,--relax -Wl,--gc-sections     -lm

Creating load file for Flash: blinky.hex
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature blinky.elf blinky.hex

Creating load file for EEPROM: blinky.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
	--change-section-lma .eeprom=0 --no-change-warnings -O ihex blinky.elf blinky.eep || exit 0

Creating Extended Listing: blinky.lss
avr-objdump -h -S -z blinky.elf > blinky.lss

Creating Symbol Table: blinky.sym
avr-nm -n blinky.elf > blinky.sym

Size after:
   text	   data	    bss	    dec	    hex	filename
   1538	      0	      3	   1541	    605	blinky.elf

-------- end --------

Then you can flash it to the teensy. hope this helps.
 
Last edited:
I have used Teensy with Arduino compiler, but I need more speed.

It's the same avr-gcc compiler, whether you use Arduino or run it from a makefile. You can access all the AVR hardware registers from Arduino code.

If you simply do not like using Arduino, or Arduino with "external editor" in prefs, and you'd rather run everything manually the hard way, then fine. But if you're doing this only because some code ran too slowly, perhaps just ask for help with the speed issue. Don't forget to follow the Forum Rule, and take some time to explain what you're really trying to accomplish. Real humans who understand can help much more!
 
Paul
Thank you.
I thought the Arduino carried a lot of over head.
I do need speed, I'm attempting to track a quadrature single from an encoder.
I need as much speed as possible, due to the fact that the pulse rate can be as hi as 5MHZ.
My basic calculations hold out that your Teensy 3 will do the job.
I know there are ways to access ports fast using Arduino, but that's not my only concern.
Basically I will be tracking, and intercepting a hi speed encoder, calculating position, and adjusting the output pulse rate, and count to compensate for co axis movement.
The overview of the project is whats refereed to as a nutator control. The unit has five axes, three linear, and two rotating.
One rotating axis "C" supports the second rotating axis "B", and both of these are moved on an X,Y,Z plane, using the "X","Y", and "Z" axes.
The basic linear, and rotational movements are controlled using a CNC.
The basic concept is to keep the tool tip on the "B" axis pointing to the same point in space.
One way this is done is through the angle of the "B" axis in relationship to the "C" axis.
This works, but requires a very intensive mechanical alignment, and is very susceptible to misalignment, and crashes.
When this nutator is preformed in software, the "C" axis rotates about the "Z" axis, and "B" axis rotates perpendicular to the "C" axis.
One way I preform this nutator function is by intercepting all five encoder signals calculating the movement of the rotary axes, and adjusting the encoder signals of the
"X", "Y", and "Z" axes to keep the tool tip pointing to the same point in space.
Currently I use a PC with hi speed cards.
The basic calculations I have preformed show a Teensy 3 can preform the same function at the lower movement speeds, as at the higher speeds the nutator function is not required.
But I do need to pass the higher speed encoder signals when needed.
There are other chips that can preform, I just don't like using a sledge hammer to drive a finishing nail.

You asked for all the information.
 
On another note about this project.
Most of the math involved is all trig.
This is not the Arduinos forty as far as speed.
I like C when it comes to getting the most speed without going to assembly.
That's another reason I wanted to use GCC compiler, the ability to use inline assembly, if needed.

I'll dig through the make, that's a fairly good way to learn more about GCC.
 
On another note about this project.
Most of the math involved is all trig.
This is not the Arduinos forty as far as speed.
I like C when it comes to getting the most speed without going to assembly.
That's another reason I wanted to use GCC compiler, the ability to use inline assembly, if needed.
...

As Paul noted "It's the same avr-gcc compiler, whether you use Arduino or run it from a makefile" Arduino is just an editor pre-compile front end tool to GCC. The resultant code is from the same compiler. If it could be done faster than PJRC already optimizes for - I suspect Paul would account for that . . .
 
And note, you really want to benchmark your application to make sure if you are optimizing it, that you are optimizing the area where it is spending the most time. It is rather common for people to imagine one part is the critical region, and it turns out to be something else entirely.
 
Status
Not open for further replies.
Back
Top