Re: [Sdcc-user] Memory allocation error when use two arrays

2012-01-21 Thread Gál Zsolt
I am confused little bit. If I use the static modifier I can read in the translated code that arrays are compiler-definied variables: ; ; compiler-defined variables ; UDL_test_0 uda

Re: [Sdcc-user] Memory allocation error when use two arrays

2012-01-21 Thread Borut Razem
Global variables are also put in a different section, so the trick is: #define ARRAY_1_LEN 60 unsigned char array1[ARRAY_1_LEN]; /* global (non-static) array */ #define ARRAY_2_LEN 60 static unsigned char array2[ARRAY_2_LEN]; /* local (static) array */ Borut O

Re: [Sdcc-user] Memory allocation error when use two arrays

2012-01-21 Thread Gál Zsolt
Hello Tamas, It is not an intelligent solution for this problem, but you can make arrays initialized. The compiler put them initialized data section separately so the linker can allocate memory for them independently. Example: #define ARRAY_1_LEN 60 static unsigned char array1[ARRAY_

Re: [Sdcc-user] Memory allocation error when use two arrays

2012-01-21 Thread Borut Ražem
Hi Tamas, problem is that sdcc puts all variables, including both arrays, in the same section. The linker tries to allocate a continuous memory block for the complete section, which is 125 bytes, and fails. Solution would be to put each variable in it's own section, the same as the code genera

[Sdcc-user] Memory allocation error when use two arrays

2012-01-13 Thread Butuza Tamas
Dear sdcc developers, I made a test with sdcc, using two arrays, each is 60 bytes long. The target MCU is PIC16F1938. It is a 14 bit enh. core device with enough memory for these arrays. The two array should be allocated into separate banks, because they are together larger than the free space i