>>
>
>
> how are your initialized globals actually being initialized?  are
> you sure they _are_ being initialized?  if your linker or runtime
> startup code aren't set up correctly, then it's quite easy for
> static initializations to not happen, leaving the contents of
> those locations undefined.
>
> it's also possible that uninitialized data (which, according to C
> language rules, should be 0 on startup) may work correctly:  i.e.,
> if you never set a value in "count" at all, your code might work.
> again, it depends on the C startup code.

Well, I'm not doing anything other than the default xinit startup code  
that is generated by sdcc.

with a global:
xdata BYTE buf[0x64];
xdata WORD count=0;

I get this assembly (snipped):

<snip>
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
     .area XISEG   (XDATA)
G$count$0$0==.
_count::
     .ds 2
     .area HOME    (CODE)
<snip>
Fmem$__xinit_count$0$0 == .
__xinit__count:
     .byte #0x00,#0x00
     .area CABS    (ABS,CODE)


When I change the buffer in front of the count variable (or use xram- 
loc) the output assembly is exactly the same in regards to count.  The  
only difference between the two assembly outputs is the size of the  
buffer:

Diff:
  G$buf$0$0==.
  _buf::
-       .ds 100
+       .ds 102


The only difference between the two firmwares is that when the count  
variable is located at 0x64 (or the other locations I pointed out and  
probably many more), the firmware doesn't run.

I'm not sure why the location of the variable matters in the slightest  
but that seems to me to be the case.

-Dennis


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to