Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Daddo
PostPosted: Mar 16, 2011 - 10:16 PM
Wannabe


Joined: Mar 16, 2006
Posts: 55
Location: Urbana, Illinois

In trying to convert an AS4 project (which compiles and runs w/WinAVR-20100110) (Xmega128A1), I enounter the following code:

FUSES = {
.byte[5] = FUSE_EESAVE,
};

Can someone tell me what is meant here (help ref would be fine), and how to do it in AS5?

JimT

(forgot to add: Error text is:
Error 37 unknown field 'byte' specified in initializer
)
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Mar 16, 2011 - 11:20 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62952
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

Can someone tell me what is meant here

http://www.nongnu.org/avr-libc/user-man ... _fuse.html

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Daddo
PostPosted: Mar 17, 2011 - 01:15 PM
Wannabe


Joined: Mar 16, 2006
Posts: 55
Location: Urbana, Illinois

Perfect reference; Thank you. Is there equivalent functionality in AS5?
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Mar 17, 2011 - 01:43 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62952
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

Is there equivalent functionality in AS5?

Yes. AS5 contains a copy of avr-gcc/AVR-LibC. For all intents and purposes it works just like the previous AS4+WinAVR combination though, in fact, the avr-gcc and AVR-LibC in AS5 are actually later versions (which is rather a bone of contention with Linux users but that's another matter Wink)

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Daddo
PostPosted: Mar 17, 2011 - 03:02 PM
Wannabe


Joined: Mar 16, 2006
Posts: 55
Location: Urbana, Illinois

Given the fact that the compiler in AS5('bone of contention' aside, for the moment) generates the error, it seems it doesn't work *exactly* the same. The reference you provided seems to support 'FUSES' or 'FUSEMEM', as does the AS5 (through <avr/io.h> -> iox128a1.h + fuse.h), yet still the error occures. It *looks* to me like the variable FUSES is defined (pretty much the same as WinAVR-20100110). On the other hand, FUSE_EESAVE *is* defined.
Hhhmmmm.
JimT
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Mar 17, 2011 - 03:28 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62952
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

it seems it doesn't work *exactly* the same

It should. The fuse.h in WinAVR20100110 has:
Code:
#if FUSE_MEMORY_SIZE > 3

typedef struct
{
    unsigned char byte[FUSE_MEMORY_SIZE];
} __fuse_t;

and there's also:
Code:
C:\WinAVR-20100110\avr\include\avr>grep FUSE_MEMORY_SIZE iox*.h
iox128a1.h:#define FUSE_MEMORY_SIZE 6
iox128a3.h:#define FUSE_MEMORY_SIZE 6
iox128d3.h:#define FUSE_MEMORY_SIZE 6
iox16a4.h:#define FUSE_MEMORY_SIZE 6
iox16d4.h:#define FUSE_MEMORY_SIZE 6
iox192a3.h:#define FUSE_MEMORY_SIZE 6
iox192d3.h:#define FUSE_MEMORY_SIZE 6
iox256a3.h:#define FUSE_MEMORY_SIZE 6
iox256a3b.h:#define FUSE_MEMORY_SIZE 6
iox256d3.h:#define FUSE_MEMORY_SIZE 6
iox32a4.h:#define FUSE_MEMORY_SIZE 6
iox32d4.h:#define FUSE_MEMORY_SIZE 6
iox64a1.h:#define FUSE_MEMORY_SIZE 6
iox64a3.h:#define FUSE_MEMORY_SIZE 6
iox64d3.h:#define FUSE_MEMORY_SIZE 6

So for the "X" devices it is the struct with a byte[6] array that will be used. Therefore the error "unknown field 'byte' specified in initializer" would not be expected.

If you then move to AS5 and AVR-Libc 1.7.1 it contains it also has:
Code:
#if FUSE_MEMORY_SIZE > 3

typedef struct
{
    unsigned char byte[FUSE_MEMORY_SIZE];
} __fuse_t;

and:
Code:
D:\Program Files\Atmel\AVR Studio 5.0\extensions\Application\AVR Toolchain\avr\include\avr>grep FUSE_MEMORY_SIZE iox*.h
iox128a1.h:#define FUSE_MEMORY_SIZE 6
iox128a1u.h:#define FUSE_MEMORY_SIZE 0
iox128a3.h:#define FUSE_MEMORY_SIZE 6
iox128d3.h:#define FUSE_MEMORY_SIZE 6
iox16a4.h:#define FUSE_MEMORY_SIZE 6
iox16d4.h:#define FUSE_MEMORY_SIZE 6
iox192a3.h:#define FUSE_MEMORY_SIZE 6
iox192d3.h:#define FUSE_MEMORY_SIZE 6
iox256a3.h:#define FUSE_MEMORY_SIZE 6
iox256a3b.h:#define FUSE_MEMORY_SIZE 6
iox256d3.h:#define FUSE_MEMORY_SIZE 6
iox32a4.h:#define FUSE_MEMORY_SIZE 6
iox32d4.h:#define FUSE_MEMORY_SIZE 6
iox32x1.h:#define FUSE_MEMORY_SIZE 6
iox64a1.h:#define FUSE_MEMORY_SIZE 6
iox64a1u.h:#define FUSE_MEMORY_SIZE 0
iox64a3.h:#define FUSE_MEMORY_SIZE 6
iox64d3.h:#define FUSE_MEMORY_SIZE 6

Now I haven't a clue what a 128a1u is but it's not possible you have specified that rather than the plain 128a1 by any chance is there?

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Daddo
PostPosted: Mar 17, 2011 - 06:25 PM
Wannabe


Joined: Mar 16, 2006
Posts: 55
Location: Urbana, Illinois

Well, I agree, it should work. In answer to your last question (WRT 128a1u), I certainly selected the right chip, (Device section of the project) (it was a converted, SA4 project, and I checked it right after conversion). In addition, I planted this code:

#if FUSE_MEMORY_SIZE > 3

typedef struct
{
unsigned char byte[FUSE_MEMORY_SIZE];
} __fuse_t;

#endif

to see if it would try to redefine FUSE_MEMORY_SIZE, and it *did*! I got "conflicting types for '__fuse_t'", just as I expected I would. So, FUSE_MEMORY_SIZE is *not* zero, as it might be defined for 128a1u.

Further testing shows that, at that point, FUSES *is* defined, but *not* with byte[5].

On the other hand, I am told by the code originator that I can comment it out, and continue on. As a result, I'll have to re-visit when I have more time.

Thank you for your help, in any case!

JimT
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits