Error building xboot with Atmel tool chain

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've downloaded the latest version of xboot. I'm using the Atmel tool chain as included with AVR studio 6 installed on a 64 bit windows 7 machine. I'm getting the following error:

c:\EGRET\Egret_FootBallS6\Egret_FootBallS6\Egret_FootBallS6\xboot>make

-------- begin --------

Compiling: xboot.c
c:Program Files (x86)/Atmel/Atmel Studio 6.0/extensions/Atmel/AVRGCC/3.4.0.65/AVRToolchain/bin/avr-gcc -c -mmcu=atxmega256a3u -I. -g
stabs   -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -fno-jump-tables -W
all -Wa,-adhlns=xboot.lst  -Wstrict-prototypes -std=gnu99 -MD -MP -MF .dep/xboot.o.d -DF_CPU=32000000L xboot.c -o xboot.o
/usr/bin/sh: -c: line 1: syntax error near unexpected token `(x'
/usr/bin/sh: -c: line 1: `c:Program Files (x86)/Atmel/Atmel Studio 6.0/extensions/Atmel/AVRGCC/3.4.0.65/AVRToolchain/bin/avr-gcc -c
-mmcu=atxmega256a3u -I. -gstabs   -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-se
ctions -fno-jump-tables -Wall -Wa,-adhlns=xboot.lst  -Wstrict-prototypes -std=gnu99 -MD -MP -MF .dep/xboot.o.d -DF_CPU=32000000L xbo
ot.c -o xboot.o'
make: *** [xboot.o] Error 258

I modified the makefile to point to the Atmel avr toolchain:

# Define directories, if needed.
DIRAVR = c:Program Files (x86)/Atmel/Atmel Studio 6.0/extensions/Atmel/AVRGCC/3.4.0.65/AVRToolchain
DIRAVRBIN = $(DIRAVR)/bin
DIRAVRUTILS = $(DIRAVR)/utils/bin
#DIRINC = .
DIRLIB = $(DIRAVR)/avr/lib


# Define programs and commands.
SHELL = $(DIRAVRUTILS)/sh
NM = $(DIRAVRBIN)/avr-nm
CC = $(DIRAVRBIN)/avr-gcc
CXX = $(DIRAVRBIN)/avr-g++
OBJCOPY = $(DIRAVRBIN)/avr-objcopy
OBJDUMP= $(DIRAVRBIN)/avr-objdump
SIZE = $(DIRAVRBIN)/avr-size
AVRDUDE = $(DIRAVRBIN)/avrdude.sh
#REMOVE = rm -f
#COPY = cp

# Define programs and commands.
#SHELL = sh
#CC = avr-gcc
#CXX = avr-g++
#OBJCOPY = avr-objcopy
#OBJDUMP = avr-objdump
#SIZE = avr-size
#NM = avr-nm
#AVRDUDE = avrdude
REMOVE = rm -f
COPY = cp
WINSHELL = cmd

Any ideas what this error means? Is it possible the shell can't understand the directory "program files (x86)/...."? (That would be a pain to fix.....)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In makefile , try to enclose the path in " "

DIRAVR = "C:\Program Files (x86)/Atmel/Atmel Studio 6.0/extensions/Atmel/AVRGCC/3.4.0.65/AVRToolchain"

Else switch to a real os :wink:

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bingo600 wrote:
In makefile , try to enclose the path in " "

DIRAVR = "C:\Program Files (x86)/Atmel/Atmel Studio 6.0/extensions/Atmel/AVRGCC/3.4.0.65/AVRToolchain"

Else switch to a real os :wink:

/Bingo


I don't think that will work because the way the make file is set up we end up with "c:\Program files (x86) .......\bin"\avr-gcc when we try to execute the thing.

I'm (we all are) stuck with the Balmer OS until Atmel supports debugging xmegas on Linux. (sigh :-( )

---EDIT---

I'll be dipped in $@%! It DID work with a little extra skulldugery:

# Define directories, if needed.
DIRAVR = "c:Program Files (x86)/Atmel/Atmel Studio 6.0/extensions/Atmel/AVRGCC/3.4.0.65/AVRToolchain
DIRAVRBIN = $(DIRAVR)/bin
DIRAVRUTILS = $(DIRAVR)/utils/bin
#DIRINC = .
DIRLIB = $(DIRAVR)/avr/lib"


# Define programs and commands.
SHELL = $(DIRAVRUTILS)/sh"
NM = $(DIRAVRBIN)/avr-nm"
CC = $(DIRAVRBIN)/avr-gcc"
CXX = $(DIRAVRBIN)/avr-g++"
OBJCOPY = $(DIRAVRBIN)/avr-objcopy"
OBJDUMP= $(DIRAVRBIN)/avr-objdump"
SIZE = $(DIRAVRBIN)/avr-size"
AVRDUDE = $(DIRAVRBIN)/avrdude.sh"
#REMOVE = rm -f
#COPY = cp

# Define programs and commands.
#SHELL = sh
#CC = avr-gcc
#CXX = avr-g++
#OBJCOPY = avr-objcopy
#OBJDUMP = avr-objdump
#SIZE = avr-size
#NM = avr-nm
#AVRDUDE = avrdude
REMOVE = rm -f
COPY = cp
WINSHELL = cmd
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kscharf wrote:
It DID work with a little extra skulldugery:
I would not use that weird quotes-splitting. Instead I would do this:

CC = "$(DIRAVRBIN)/avr-gcc" 

Stefan Ernst

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sternst wrote:
kscharf wrote:
It DID work with a little extra skulldugery:
I would not use that weird quotes-splitting. Instead I would do this:

CC = "$(DIRAVRBIN)/avr-gcc" 


Yes that IS cleaner. Good catch.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nice fix! I just updated the xboot makefile in the repository to match.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've just uploaded xboot built for the xmega256a3u onto a device and tried to use it with avrdude. I'm getting an error:

c:\EGRET\Egret_FootBallS6\Egret_FootBallS6\Egret_FootBallS6\Debug>avrdude -Pcom11 -cavr109 -b115200 -px256a3u -U flash:w:egret_footb
alls6.hex

Connecting to programmer: .
Found programmer: Id = "XBoot++"; type = S
    Software Version = 1.7; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=512 bytes.

Programmer supports the following devices:
    Device code: 0x7b

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9842
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: error: programmer did not respond to command: set addr
c:\EGRET\Egret_FootBallS6\Egret_FootBallS6\Egret_FootBallS6\Debug>avrdude -v

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"


avrdude: no programmer has been specified on the command line or the config file
         Specify a programmer using the -c option and try again


I had to add a section to avrdude.conf for the xmega256a3u. Since this cpu has the same signature as the xmega256a3 I just copied the section for that cpu and changed the name strings. Any ideas why I'm getting this error?

I've attached my modified xboot.h and makefile

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BTW the baud rate selection values for the xmega at 32mhz for 115200
#define UART_BSEL_VALUE 16
#define UART_BSCALE_VALUE 0
#define UART_CLK2X 0
Yield an error of 2.12%

A better selection would be:
#define UART_BSEL_VALUE 1047
#define UART_BSCALE_VALUE -6
#define UART_CLK2X 0

with an error of 0.01%

See attached spreadsheet.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

update:

I dug up the 2010529 version of xboot and modified it to build with the S6 tools for the atxmega256a3u. I also changed the 115200 baud constants to use the ones from my spreadsheet. The error went away. I think maybe the latest version of xboot won't play with the version of avrdude that I'm using (5.10)?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kscharf wrote:
update:

I dug up the 2010529 version of xboot and modified it to build with the S6 tools for the atxmega256a3u. I also changed the 115200 baud constants to use the ones from my spreadsheet. The error went away. I think maybe the latest version of xboot won't play with the version of avrdude that I'm using (5.10)?

I am having the exact same problem, the set addr error and I would be grateful if you could post the Studio-6 project that worked well for you.

Do you know what the resolution to the error is btw?

SG

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You must change code in function get_2bytes():
(from asm back to C)

unsigned int __attribute__ ((noinline)) get_2bytes()
{
         return (get_char() << 8) | get_char();
/*
        unsigned int result;
        asm volatile (
                "call get_char"    "\n\t"
                "mov  %B0,r24"     "\n\t"
                "call get_char"    "\n\t"
                "mov  %A0,r24"     "\n\t"
                : "=r" (result)
                :
        );
        return result;
		*/
}
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Both inplementations of get_2bytes() are wrong:

The C variant relies on undefined behavior, i.e. the extpression is evaluated left to right. If the prototype of get_char is as indicated then you need to compiler for a different ABI with unsigned char.

The asm construct is plain wrong and need to be rewritten.

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I am having the same problem on an atxmega64a3u, where avrdude spits out the 'programmer did not respond to command' error.

I worked around it by explicitly changing the get_2bytes() function in xboot.c to reflect my set-up:

char c = 0;
char d = 0;
while(~USARTE0.STATUS & (1<<7)){}
USARTE0.STATUS |= (1<<7);
c = USARTE0.DATA;
while(~USARTE0.STATUS & (1<<7)){}
USARTE0.STATUS |= (1<<7);
d = USARTE0.DATA;
return (c << 8) | d;
//return (get_char() << 8) | get_char();
/*unsigned int result;
asm volatile (
   "call get_char"    "\n\t"
   "mov  %B0,r24"     "\n\t"
   "call get_char"    "\n\t"
   "mov  %A0,r24"     "\n\t"
   : "=r" (result)
   :
);
return result;*/

This fixed my problem, but I was wondering whether anyone knows of a more permanent fix?

Cheers