From: Maarten B. <sou...@ds...> - 2005-06-17 08:28:06
|
<?xml version="1.0" ?><html> <head> <title></title> </head> <body> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> # make main.rel</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> sdcc -mmcs51 --stack-auto --use-stdout  --code-size 32768 --iram-size 512 --xram-size 65536 -I/usr/share/sdcc/include -Iincludes  -D_DEBUG -DSDCC --model-large -I/usr/share/sdcc/include -Iincludes  -c main.c -o main.rel</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> main.c:513: warning 112: function 'rand' implicit declaration</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> main.c:513: warning 84: 'auto' variable 'rand' may be used before initialization</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> main.c:103: error 2: Initializer element is not constant</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> make: *** [main.rel] Error 1</span></font></div> <div align="left"><br/></div> <div align="left"><font face="Arial"><span style="font-size:10pt">First, I know of no mcs51 compatible device that has 512 bytes iram. The architecture allows only 256 maximum.</span></font></div> <div align="left"><br/></div> <div align="left"><font face="Arial"><span style="font-size:10pt">Where is this 'rand' variable the compiler is complaining about?</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> The code is:</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> unsigned int signaltime=0;</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> void timer0() interrupt 1 using 1 </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> {</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">>     TH0=0x4c;</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">>     TL0=0x23;</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">>     bgtime++;</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">>     signaltime++; // This line causes error</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">>     freqtime++;</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">>     querytime++;</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">>     scantime++;</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> }</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> The most strange is, SDCC reports error even I comment out this line or the whole function.</span></font></div> <div align="left"><br/></div> <div align="left"><font face="Arial"><span style="font-size:10pt">Then the problem probably lies before that function.</span></font></div> <div align="left"><br/></div> <div align="left"><br/> </div> <div align="left"><font face="Arial"><span style="font-size:10pt">Greets,</span></font></div> <div align="left"><font face="Arial"><span style="font-size:10pt">Maarten</span></font></div> </body> </html> |