--stack-loc option

  • 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;
        cTemp3 = sum(cTemp1, cTemp2);
        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           
        pop     dpl
    in order to know how stack option works.
    However, the option seems not to work.
    How can I do for it?


    • 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.


      • juleskim999

        juleskim999 - 2007-01-25

        Thank you so much!!!


Log in to post a comment.