Hi List,

referring to my earlier post about suspected stack collision/memory
allocation etc:

after hours of pruning and trimming to make as simple as possible test
case I was down to:


static volatile char dummy[158];

void main() {
        OSCCON=0x70;

        TRISDbits.TRISD2 = 0;

        while (1) {
                volatile unsigned char inner_loop;
                volatile unsigned char outer_loop;
                PORTD ^= 0x04;
                outer_loop = 0;
                while (--outer_loop) {
                        inner_loop=0;
                        while (--inner_loop);
                        //for (inner_loop=0; inner_loop < 255;
inner_loop++)
                        //      ;
                }

        }

}


Depending on the size of the dummy[] variable this worked or not. With
the (out commmented)
for loop it failed if I increased the variable size to over 158. With
the refactored loop 
I noticed that changing the size of the dummy variable the speed of the
loops (as observed
on oscilloscope) changed! I had already observed that all this was
related to those variables
being allocated on the 1. or 3. memory page. At this point I checked
the datasheet for the
umpteent time and noticed that unimplemented memory locations return 0.
This would
explain the why the for loop did not work and why the speed of the
loops changed depending
if one or both of the loop variables returned 0. But 3. page is still
RAM on 4550. Just for
fun I checked with magnifying class (yeah, I'm over 40 so my eye sigth
is not what it was)
and indeed it was 4450 as it should be.....whaaaat? Wrong chip! Argh.

My appologies and thanks to all especially to Raphael who put their
effort into solving this
childish error. At this point I'm not sure if I've ordered the wrong
samples or if Microchip
bungled the order, difficult to know as it is more than a year ago when
I receive them.

But once again SDCC and the developers/community proved theri worth!

br Kusti







------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to