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 
generation for pic16 does.

Borut


On 13. 01. 2012 11:19, Butuza Tamas wrote:
> 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 in one ram bank.
>
> After trying to complie and link, I got the following error:
> no target memory available for section "UDL_test_0"
>
> The souce code:
> --------------------
> // Test: Using two arrays
> // Gives an error: no target memory available for section "UDL_test_0"
> #include "pic16f1938.h"
> // Configuration: 8MHz crystal, PLL (x4 = 32MHz), WDT disabled, Flash self 
> write disabled.
> unsigned short __at(_CONFIG1) config1Reg = (_FCMEN_OFF&  _IESO_OFF&  
> _BOREN_ON&  _CPD_ON&  _CP_ON&  _MCLRE_OFF&  _PWRTE_ON&  _WDTE_OFF&  _FOSC_HS);
> unsigned short __at(_CONFIG2) config2Reg = (_LVP_ON&  _BORV_HI&  _STVREN_ON&  
> _PLLEN_ON&  _WRT_ALL);
>
> #define ARRAY_1_LEN           60
> static unsigned char array1[ARRAY_1_LEN];
> #define ARRAY_2_LEN           60
> static unsigned char array2[ARRAY_2_LEN];
>
> // Entry point required by sdcc.
> void _sdcc_gsinit_startup(void) {
>    //__asm pagesel _main __endasm;
>    __asm goto _main __endasm;
> }
>
> void main (void) {
>       unsigned short i;
>       for (i = 0; i<  ARRAY_1_LEN; i++) {
>               array1[i] = i;
>       }
>       for (i = 0; i<  ARRAY_2_LEN; i++) {
>               array2[i] = i;
>       }
>       while (1) {
>       }
> }
>
>
> Compilation and linking:
> sdcc -S -mpic14 -p16f1938 -I. test.c
> sdcc -S -mpic14 -p16f1938 -I. pic16f1938.c
> gpasm -c test.asm
> gpasm -c pic16f1938.asm
> gpasm -c _gptrget1.S
> gplink -s 16f1938_g.lkr test.o pic16f1938.o _gptrget1.o
>
>
> Versions:
> gpasm-0.14.1 (Jan  1 2012)
> SDCC : mcs51/gbz80/z80/z180/r2k/ds390/pic16/pic14/TININative/ds400/hc08 3.1.1 
> #7
> 148 (Jan  3 2012) (MINGW32)
>
> Is this a bug or did I forgot something?
>
> Best regards,
> Tamas Butuza
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Mar 27 - Feb 2
> Save $400 by Jan. 27
> Register now!
> http://p.sf.net/sfu/rsa-sfdev2dev2
> _______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to