From: Jon M. <ja...@we...> - 2002-06-17 17:31:23
|
Try declaring the xm routine to take a pointer, not an array: void xm(xdata byte* file); I believe the problem is that it tries to pass the entire array on the stack when you declare the function to take an array argument. -Jon On Mon, Jun 17, 2002 at 10:15:48AM -0700, George Farris wrote: > When I try the following code under linux (without the xdata) it works > fine but when I compile and run on the 8051 board putchar(file[0]) > prints nothing. > > Is passing an array to a function broken or different? > > > #include <8051.h> > #include <stdio.h> > > typedef unsigned char byte; > > // Function prototypes > void xm(xdata byte file[]); > > // Global vars > xdata byte abuf[10000]; > > void xm(xdata byte file[]) { > putchar(file[0]); > } > > int main(void) { > abuf[0] = 'G'; > xm(abuf); > } > > -- > George Farris - VE7FRG > Ge...@gm... > > > > _______________________________________________________________ > > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Sdcc-user mailing list > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user |