HI,
I have a problem with WinAVR-20060421.
I am writing a program ,using avr-gcc (GCC) 3.4.6 /atmega128£¬when I
compile it ,it occur errors!!
There are some codes in my program below:
---------------------------------------------------------------
#define ADC_PRE 0
#define ADC_RH 1
#define ADC_TEMP 2
#define ADC_OIL 3
......
unsigned int ADC_result;
signed int OIL_value;
signed int PRE_result;
signed int RH_result;
signed int TEMP_result;
unsigned int tt0,Xt,Xt0,XRH1,XRH2;
......
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=(0x40|adc_input);
ADCSRA|=(1<<ADSC);
loop_until_bit_is_set(ADCSRA,ADIF);
ADCSRA|=(1<<ADIF);
return ADC;
}
void get_AD(void)
{
float float_tmp;
ADC_result=read_adc(ADC_RH);
float_tmp=(long)ADC_result*Vref;
float_tmp=float_tmp/1024;
float_tmp=float_tmp*XRH1;
float_tmp=float_tmp*0.0032;
float_tmp=float_tmp-XRH2;
RH_result=(signed int)(float_tmp/10);/////////////// #A
if(RH_result>999) RH_result=999;
if(RH_result<0) RH_result=0;
ADC_result=read_adc(ADC_TEMP);
float_tmp=(long)ADC_result*Vref;
float_tmp=float_tmp/1024;
float_tmp=float_tmp*Xt0;
float_tmp=float_tmp/1000;
TEMP_result=(signed int)(float_tmp-2730);//////////// #B
if(TEMP_result>1250){TEMP_result=1250;}
if(TEMP_result<-250){TEMP_result=-250;}
ADC_result=read_adc(ADC_OIL);
float_tmp=(long)ADC_result*Vref;
float_tmp=float_tmp/1024;
if((float_tmp-tt0)>0) float_tmp=float_tmp*0.64;
else float_tmp=float_tmp*0.71;
float_tmp=float_tmp*Xt;
float_tmp=float_tmp/1000;
if(float_tmp> 1250) float_tmp=1250;
if(float_tmp< -250) float_tmp=-250;
OIL_value=(signed int)(TEMP_result+float_tmp);////// #C
ADC_result=read_adc(ADC_PRE);
float_tmp=(long)ADC_result*Vref;
PRE_result=(signed int)(float_tmp/1024);//////////// #D
}
.......
void disp_real_data(void)
{
.....
get_AD();
.....
}
.....
int main(void)
{
disp_real_data();
}
----------------------------------------------------------------------
when I compile it ,it occur errors!! messages is below:
£££££££££££££££££££££££££££££££££££
"make.exe" all
-------- begin --------
avr-gcc (GCC) 3.4.6
Copyright (C) 2006 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.
Size before:
main.elf :
section size addr
.data 1846 8388864
.text 94220 0
.bss 341 8390710
.noinit 0 8391051
.eeprom 0 8454144
.stab 1032 0
.stabstr 132 0
.debug_aranges 20 0
.debug_pubnames 4031 0
.debug_info 26575 0
.debug_abbrev 541 0
.debug_line 34723 0
.debug_str 3584 0
.debug_ranges 60 94220
Total 167105
Compiling: D:/AVR/MyProg/MyProg.c
avr-gcc -c -mmcu=atmega128 -I. -gdwarf-2 -DF_CPU=16000000UL -Os
-funsigned-char
-funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes
-Wa,-adhlns=D:/AVR/MyProg/MyProg.lst -std=gnu99 -MD -MP -MF .dep/MyProg.o.d
D:/AVR/MyProg/MyProg.c -o D:/AVR/MyProg/MyProg.o
..................
..................
..................
..................
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s: Assembler messages:
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96535: Error: value of 65706
too large for field of 2 bytes at 16
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:114827: Error: value of 65706
too large for field of 2 bytes at 23874
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96410: Error: value of 65538
too large for field of 2 bytes at 34638
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96416: Error: value of 65556
too large for field of 2 bytes at 34644
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96422: Error: value of 65568
too large for field of 2 bytes at 34650
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96428: Error: value of 65586
too large for field of 2 bytes at 34656
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96434: Error: value of 65598
too large for field of 2 bytes at 34662
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96440: Error: value of 65616
too large for field of 2 bytes at 34668
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96446: Error: value of 65618
too large for field of 2 bytes at 34674
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96452: Error: value of 65622
too large for field of 2 bytes at 34680
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96458: Error: value of 65626
too large for field of 2 bytes at 34686
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96464: Error: value of 65630
too large for field of 2 bytes at 34692
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96470: Error: value of 65634
too large for field of 2 bytes at 34698
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96476: Error: value of 65652
too large for field of 2 bytes at 34704
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96482: Error: value of 65656
too large for field of 2 bytes at 34710
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96488: Error: value of 65658
too large for field of 2 bytes at 34716
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96494: Error: value of 65664
too large for field of 2 bytes at 34722
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96500: Error: value of 65668
too large for field of 2 bytes at 34728
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96506: Error: value of 65672
too large for field of 2 bytes at 34734
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96512: Error: value of 65688
too large for field of 2 bytes at 34740
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:96518: Error: value of 65706
too large for field of 2 bytes at 34746
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/cceEaaaa.s:118148: Error: value of 65706
too large for field of 2 bytes at 14
make.exe: *** [D:/AVR/MyProg/MyProg.o] Error 1
Process Exit Code: 2
Time Taken: 00:17
£££££££££££££££££££££££££££££££££££
And then I do some modification respectively,it gets different result:
A) If I only delete the line marked with #A , and compile it again ,it
compile successfully.
B) If I only delete the line marked with #B , and compile it again ,it also
occur errors!
messages is below:
£££££££££££££££££££££££££££££££££££
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccMDaaaa.s: Assembler messages:
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccMDaaaa.s:96438: Error: value of 65562
too large for field of 2 bytes at 16
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccMDaaaa.s:114730: Error: value of 65562
too large for field of 2 bytes at 23874
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccMDaaaa.s:96415: Error: value of 65544
too large for field of 2 bytes at 34710
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccMDaaaa.s:96421: Error: value of 65562
too large for field of 2 bytes at 34716
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccMDaaaa.s:118051: Error: value of 65562
too large for field of 2 bytes at 14
£££££££££££££££££££££££££££££££££££
C) If I only delete the line marked with #C , and compile it again ,it
compile successfully.
D) If I only delete the line marked with #D , and compile it again ,it also
occur errors!
messages is below:
£££££££££££££££££££££££££££££££££££
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s: Assembler messages:
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96493: Error: value of 65638
too large for field of 2 bytes at 16
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:114785: Error: value of 65638
too large for field of 2 bytes at 23874
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96398: Error: value of 65548
too large for field of 2 bytes at 34656
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96404: Error: value of 65550
too large for field of 2 bytes at 34662
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96410: Error: value of 65554
too large for field of 2 bytes at 34668
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96416: Error: value of 65558
too large for field of 2 bytes at 34674
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96422: Error: value of 65562
too large for field of 2 bytes at 34680
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96428: Error: value of 65566
too large for field of 2 bytes at 34686
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96434: Error: value of 65584
too large for field of 2 bytes at 34692
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96440: Error: value of 65588
too large for field of 2 bytes at 34698
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96446: Error: value of 65590
too large for field of 2 bytes at 34704
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96452: Error: value of 65596
too large for field of 2 bytes at 34710
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96458: Error: value of 65600
too large for field of 2 bytes at 34716
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96464: Error: value of 65604
too large for field of 2 bytes at 34722
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96470: Error: value of 65620
too large for field of 2 bytes at 34728
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:96476: Error: value of 65638
too large for field of 2 bytes at 34734
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOEaaaa.s:118106: Error: value of 65638
too large for field of 2 bytes at 14
£££££££££££££££££££££££££££££££££££
E)If I only changes the line marked with #C to " float_tmp=OIL_value;" , and
compile it
again ,it compile successfully.
F)If I only changes the line marked with #C to " OIL_value=float_tmp;", and
compile it again
,it also occur errors! messages is below:
£££££££££££££££££££££££££££££££££££
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s: Assembler messages:
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96517: Error: value of 65662
too large for field of 2 bytes at 16
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:114809: Error: value of 65662
too large for field of 2 bytes at 23874
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96410: Error: value of 65542
too large for field of 2 bytes at 34656
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96416: Error: value of 65554
too large for field of 2 bytes at 34662
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96422: Error: value of 65572
too large for field of 2 bytes at 34668
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96428: Error: value of 65574
too large for field of 2 bytes at 34674
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96434: Error: value of 65578
too large for field of 2 bytes at 34680
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96440: Error: value of 65582
too large for field of 2 bytes at 34686
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96446: Error: value of 65586
too large for field of 2 bytes at 34692
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96452: Error: value of 65590
too large for field of 2 bytes at 34698
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96458: Error: value of 65608
too large for field of 2 bytes at 34704
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96464: Error: value of 65612
too large for field of 2 bytes at 34710
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96470: Error: value of 65614
too large for field of 2 bytes at 34716
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96476: Error: value of 65620
too large for field of 2 bytes at 34722
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96482: Error: value of 65624
too large for field of 2 bytes at 34728
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96488: Error: value of 65628
too large for field of 2 bytes at 34734
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96494: Error: value of 65644
too large for field of 2 bytes at 34740
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:96500: Error: value of 65662
too large for field of 2 bytes at 34746
C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:118130: Error: value of 65662
too large for field of 2 bytes at 14
£££££££££££££££££££££££££££££££££££
So, I have some questions:
a. float_tmp is "float" type variable,OIL_value,PRE_result,RH_result and
TEMP_result are "signed int" type variable,is there something wrong in my
codes about change of variable each other?
b. messages of compiler
"C:\DOCUME~1\Aminis~1\LOCALS~1\Temp/ccOCaaaa.s:XXXXX: Error: value of XXXXX
too large for field of 2 bytes at XXXXX",why the value of XXXXX are not the
same of A),B),C),D),E),F) above.
c. My codes are very big, but it is just about 70 of 128K!!
And I use a array with about 10000 Elements of char (1 Bytes) has 10000
kytes stored as const data in PROGMEM. I define these large arrays store in
FLASH,such as :
const unsigned char c16x16[] PROGMEM={
0x02,0x00,0x01,0x00,0x01,0x04,0xff,0xfe,0x00,0x10,0x1f,0xf8,0x10,0x10,0x10,0x10,
0x10,0x10,0x1f,0xf0,0x01,0x00,0x09,0x40,0x09,0x30,0x11,0x18,0x25,0x08,0x02,0x00,
......
......
0x02,0x10,0x22,0x18,0x24,0x16,0x44,0x12,0x08,0x10,0x10,0x10,0x20,0x50,0x40,0x20,
0x02,0x00,0x42,0x0c,0x32,0x70,0x12,0x40,0x8f,0xc0,0x62,0x44,0x22,0x7e,0x0a,0xc8};
//c16x16 total 10752 elements
If I want to access the progmem data which are located above the 64kByte,
is it limit? Is these make errors happened?
d. How to know what's at the lines the assembler is complaining about?
Waiting for your reply!
And Wish you,Merry Christmas!
Thanks,
JimStation
_________________________________________________________________
Your Hotmail address already works to sign into Windows Live Messenger! Get
it now
http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://get.live.com/messenger/overview