On Mittwoch, 18. Juli 2007, [EMAIL PROTECTED] wrote: > I have a problem where i couldnt find a clear answer in the manual/list. > I want to initialize an 4x4 array like: > > char state_table[4][4]={{0,1,-1,0},{-1,0,0,1},{1,0,0,-1},{0,-1,1,0}}; > but this only works if i add the code keyword infront of it. If code is > omitted the array does not work. > Is this the intended behavior? or am i doing something wrong? > > sdcc -v: SDCC : pic16 2.6.4 #4631 (Feb 13 2007) (UNIX) > device: pic18f2550
Well, that pic should have enough ram for the array, but: if the Array is in RAM, the startup code has to initialize it by copying the values from Flash. That is usually done by the initialization code in crt0iz.o, which should be linked automatically. There are however also other versions of that init code available (crt0i.o, crt0.o) which skip the variable initialization in order to save code space. Check your makefiles if you're linking the right one. /Ernst ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user