--stack-loc option

Help
2007-01-25
2013-03-12
  • juleskim999
    juleskim999
    2007-01-25

    I want to place the stack pointer of my program to some place. So I compile the program with these opitions like \sdcc\bin\sdcc  --model-small --xram-loc 0xf70 --stack-loc 0x20 app02.c

    And then the memory mem is following.
    ----------------------------------------------------------------
    Internal RAM layout:
    Stack starts at: 0x09 (sp set to 0x08) with 247 bytes available.

    Other memory:
       Name             Start    End      Size     Max    
       ---------------- -------- -------- -------- --------
       PAGED EXT. RAM                         0      256  
       EXTERNAL RAM                           0    65536  
       ROM/EPROM/FLASH  0x0000   0x0091     146    65536  
    -----------------------------------------------------------------
    My program is very simple like
    -----------------------------------------------------------------
    #pragma codeseg ncode2
    unsigned char sum(unsigned char a, unsigned char b)
    {
        unsigned char ucReturn;
        ucReturn = a+b;
        return ucReturn;
    }
    void main(void)
    {
        unsigned char cTemp1, cTemp2, cTemp3;
        cTemp1=10;
        cTemp2=20;
        cTemp3 = sum(cTemp1, cTemp2);
       
        _asm       
        push     dpl       
        mov     dpl, #0x32
        mov    a, #_endsyscall
        push    acc;           
        mov    a, #(_endsyscall >> 8)   
        push    acc           
        mov     a, #0xFA;       
        push    acc           
        mov    a, #0x05;       
        push    acc           
        ret               
    _endsyscall:               
        pop     dpl
        _endasm;
    }
    in order to know how stack option works.
    --------------------------------------------------------
    However, the option seems not to work.
    How can I do for it?

    Thanks

     
    • Maarten Brock
      Maarten Brock
      2007-01-25

      For --stack-loc to work you also need --no-pack-iram.
      The default --pack-iram does a better job at using all data memory and reserves the largest free block it can find for the stack.

      Greets,
      Maarten

       
      • juleskim999
        juleskim999
        2007-01-25

        Thank you so much!!!