From: SourceForge.net <no...@so...> - 2006-03-09 15:12:01
|
Bugs item #1195745, was opened at 2005-05-05 11:40 Message generated for change (Comment added) made by lisaa_yritysta You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1195745&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Lisaa_yritysta (lisaa_yritysta) Assigned to: Nobody/Anonymous (nobody) Summary: Some weird variable handling with re-entrant functions Initial Comment: Hello! Following code should store to the external memory following repeating data sequence: 06 00 01 02 03 04 05. Instead the memory is filled with garbage. Removing practically anything from the code seems to fix the sequence. I'm using the latest version of the SDCC and re-entrant functions. Compiling line is: sdcc --int-long-reent --use- stdout --stack-auto _Testi.c -+-+-+- #include <stdio.h> typedef unsigned char BYTE; typedef unsigned short WORD; typedef unsigned long LONG; xdata BYTE seuranta[256]; xdata BYTE seuranta_pos=0; xdata BYTE usrIntsRec; xdata BYTE antInterval=0; xdata BYTE antSend[2] = { 0x00, 0xff }; void uart0send(BYTE tavu) { seuranta[seuranta_pos]=tavu; if (seuranta_pos!=255) seuranta_pos++; } WORD uart1rec(BYTE n) { return(n); } void main(void) { union { WORD w; BYTE b; } tavu; BYTE maxInterval; BYTE maxAnt; BYTE ant; BYTE rec[2]; BYTE antBuf[2][6]; BYTE n; for (ant=0; ant<2; ant++) { if (antSend[ant]==0xff) break; } maxAnt=ant; maxInterval=5*(antInterval+1); usrIntsRec=0; for (;;) { uart0send(maxAnt*6); for (ant=0; ant<maxAnt; ant++) { for (n=0; n<6; n++) { tavu.w=uart1rec(n); if (tavu.w==0xffff) break; rec[n&1]=tavu.b; uart0send(tavu.b); if (n&1) { antBuf[ant][n-1]=rec[0]; antBuf[ant][n]=rec[1]; } } } if (usrIntsRec>=maxInterval) break; } } ---------------------------------------------------------------------- >Comment By: Lisaa_yritysta (lisaa_yritysta) Date: 2006-03-09 17:12 Message: Logged In: YES user_id=1272744 Now the problem seems to be gone, but another appears... This time it is the xram's variable presetting (the same program code): External RAM is emptied only from 00h to 100h and the global variables are not preset. ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2006-03-09 14:58 Message: Logged In: YES user_id=888171 Can you confirm this bug still exists in SDCC 2.5.4 #1222? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1195745&group_id=599 |