Hello,
I want to report a problem resulting in access to a variable in the
wrong bank. Experienced with Version 2.6.0 #4309 (Jan 19 2007).
To showcase the bug I used a simple dummy.c:
/*---start---*/
unsigned char a;
unsigned char b;
unsigned char sum_a_b()
{
return a + b;
}
/*---end---*/
The sdcc compiler generates single banksel statement before accessing
several locally defined variables.
BANKSEL _b
MOVF _b,W
ADDWF _a,W
If _a is not in the same bank as _b there is an error.
I guess the assumption is that they all reside in a single/same udata
section/bank. However the compiler also generates separate udata section
for each variable which allows the linker to place the variables in
separate banks and in certain situations those sections end up in
different banks.
;--------------------------------------------------------
; udata
;--------------------------------------------------------
data_dummy udata
; .area DSEG (DATA)
udata_dummy_0 udata
_a res 1
udata_dummy_1 udata
_b res 1
As a simple solution I came up with a perl script which deletes the
"unwanted" additional udata sections (udata_dummy_[0-9]+). This fixes
the issue.
Do you think this is a bug or a feature? It probably would be nice to
have the bigger then 1 bank sections automatically split but separate
section for each variable is an overkill. And in addition it is obvious
the code generator assumes all local variables reside in the same bank
which can only be guaranteed if the variables are in the same udata section.
Regards,
Vladimir
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user