Results 1 to 7 of 7

Thread: AVR Studio help - my first robot

  1. AVR Studio help - my first robot

    Hello, I am trying to program my first robot, a Pololu 3pi. I have downloaded and installed the AVR Studio and libraries. When i try to build the sample line following pid program I get several errors and I am not sure what I have done wrong. Any help will be greatly appriciated.
    Thank you

    the errors listed are

    Build started 27.2.2010 at 13:40:03
    avr-gcc -mmcu=atmega328p -Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT test.o -MF dep/test.o.d -c ../test.c
    ../test.c:15:24: error: pololu/3pi.h: No such file or directory
    ../test.c: In function 'load_custom_characters':
    ../test.c:58: warning: implicit declaration of function 'lcd_load_custom_character'
    ../test.c:65: warning: implicit declaration of function 'clear'
    ../test.c: In function 'display_readings':
    ../test.c:86: warning: implicit declaration of function 'print_character'
    ../test.c: In function 'initialize':
    ../test.c:100: warning: implicit declaration of function 'pololu_3pi_init'
    ../test.c:104: warning: implicit declaration of function 'print_from_program_space'
    ../test.c:105: warning: implicit declaration of function 'lcd_goto_xy'
    ../test.c:107: warning: implicit declaration of function 'play_from_program_space'
    ../test.c:108: warning: implicit declaration of function 'delay_ms'
    ../test.c:117: warning: implicit declaration of function 'button_is_pressed'
    ../test.c:117: error: 'BUTTON_B' undeclared (first use in this function)
    ../test.c:117: error: (Each undeclared identifier is reported only once
    ../test.c:117: error: for each function it appears in.)
    ../test.c:119: warning: implicit declaration of function 'read_battery_millivolts'
    ../test.c:122: warning: implicit declaration of function 'print_long'
    ../test.c:123: warning: implicit declaration of function 'print'
    ../test.c:132: warning: implicit declaration of function 'wait_for_button_release'
    ../test.c:140: warning: implicit declaration of function 'set_motors'
    ../test.c:149: warning: implicit declaration of function 'calibrate_line_sensors'
    ../test.c:149: error: 'IR_EMITTERS_ON' undeclared (first use in this function)
    ../test.c:161: warning: implicit declaration of function 'read_line'
    ../test.c:183: warning: implicit declaration of function 'is_playing'
    ../test.c: In function 'main':
    ../test.c:203: error: 'IR_EMITTERS_ON' undeclared (first use in this function)
    make: *** [test.o] Error 1
    Build failed with 6 errors and 17 warnings...

  2. #2
    Join Date
    Aug 2008
    Location
    Iowa City, IA
    Posts
    390
    Rep Power
    46

    Re: AVR Studio help - my first robot

    All/most of the errors are probably related to the first error..

    error: pololu/3pi.h: No such file or directory

    Make sure that the compiler can find that directory and that the file 3pi.h exists within it. The simplest quick fix is to put the absolute path directly into the #include. Once that is working you can take the directory out and put it into the compiler include path where it belongs.

  3. Re: AVR Studio help - my first robot

    thank u so very much, that helped alot. I have it down to 1 error and 1 warrning now. Im not sure if i am missing a command code or what. Any suggestions?

    c:\robot\lcd.h:31: warning: '__progmem__' attribute ignored - when clicked on goes to this line of code
    void lcd_load_custom_character(const PROGMEM char *picture, unsigned char number);

    c:\robot\OrangutanSerial.h:1:38: error: #include nested too deeply - when clicked on goes to this line of code
    #include <c:\robot\OrangutanSerial.h>

    The files are there were the path indicates, so am i missing a command or something simple. Please remember i am a noob to this and i do greatly appricate any and all help.
    thanx
    Grizzly

  4. only 1 error left

    I have it down to 1 error and 1 warrning now. Im not sure if i am missing a command code or what. Any suggestions?

    c:\robot\lcd.h:31: warning: '__progmem__' attribute ignored - when clicked on goes to this line of code
    void lcd_load_custom_character(const PROGMEM char *picture, unsigned char number);

    c:\robot\OrangutanSerial.h:1:38: error: #include nested too deeply - when clicked on goes to this line of code
    #include <c:\robot\OrangutanSerial.h>

    The files are there were the path indicates, so am i missing a command or something simple. Please remember i am a noob to this and i do greatly appricate any and all help.
    thanx
    Grizzly

  5. #5
    Join Date
    Aug 2008
    Location
    Iowa City, IA
    Posts
    390
    Rep Power
    46

    Re: only 1 error left

    I think you're going to need to post more for this one. My guess is that you have circular includes. One file including another file that eventual includes itself again. Do you have guards in your headers? Something like..

    #ifndef MYFILE_H
    #define MYFILE_H

    //-- header stuff goes here

    #endif

  6. Re: only 1 error left

    Actually, I can help with this:

    warning: '__progmem__' attribute ignored occurs because you are passing an argument to a function which you have designated as type const char*, but which exists on the micro-controller's flash memory (not the ram).

    I assume this is because "picture" is a BFO* array which lives in your flash memory until it's needed. However, the syntax you have used to in your declaration indicates that the pointer to the memory (ie, the const char *) lives in progmem.

    The program is unable to copy values from flash directly to the stack without using a special latch register. What you need to do to fix it is to remove the PROGMEM from the declaration, and then reference your array directly using the & operator:

    lcd_load_custom_character(&picture, sizeofpicture)

    However, within the function you will now need to copy the array from flash memory to RAM. I don't know what compiler you are using, but avrlibc uses pgm_read_byte(char* byte). This needs to be done one byte at a time. Then you can operate on the copy of the array normally.

    I actually wrote a short article about this ages ago.


    *I'll tell you when you're older
    http://www.buildtherobot.blogspot.com - for robot builders and enthusiasts

  7. #7
    Join Date
    Dec 2007
    Location
    Portland, OR
    Posts
    3,198
    Images
    952
    Rep Power
    141

    Re: AVR Studio help - my first robot

    Merged, these don't need to be separate threads.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Contest Entry RC truck robot conversion
    By Orac in forum Project Showcase
    Replies: 24
    Last Post: 11-13-2012, 11:50 PM
  2. Contest Entry The eyeRobot: Robot Blind Aid
    By Shrimpy in forum Project Showcase
    Replies: 16
    Last Post: 02-07-2011, 09:20 AM
  3. Question(s) Writing an educatonal book on robotics
    By darkback2 in forum Robotics General Discussion
    Replies: 107
    Last Post: 05-24-2010, 11:51 PM
  4. Project New Post For Fresh Start On Robot Butler
    By ROBOTMAN in forum Project Showcase
    Replies: 11
    Last Post: 10-31-2009, 12:50 PM
  5. Contest Entry Butler Robot
    By airman00 in forum Project Showcase
    Replies: 11
    Last Post: 07-31-2008, 09:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •