7 Replies Latest reply on Jan 7, 2013 8:23 AM by user_14586677

    Stack Address Change

    user_14586677

      I am trying to force stack in a 256 byte part to start at a different address, eg. resize it.

         

       

         

      In Compiler/Linker manual I can find a command line way to do it, but would rather have

         

      this done by project settings.

         

       

         

      -dram_end:<address>    Define the end of the data area. The startup file uses this argument to ini-
                                              tialize the value of the hardware stack.

         

       

         

      How would I go about this ?

         

       

         

      Regards, Dana.

        • 1. Re: Stack Address Change
          user_1377889

          Dana, when you are using ImageCraft the stack begins at low address after the last global var and advances up to 0xff.

             

          So if you define a placeholder var (global, uninitialized) you will get the wanted effect.

             

           

             

          Bob

          • 2. Re: Stack Address Change
            user_14586677

            Actually I don't think thats true, my stack starts at 0x80 in a 256 byte part,

               

            and globals + API >> 128 bytes.

               

             

               

            There must be a way to set stack address......

               

             

               

            Regards, Dana.

            • 3. Re: Stack Address Change
              user_1377889

              I found this in Help -> Documentation -> Compiler and Programming Documents -> C Language Compiler User Guide.pdf

                 

               

                 

              Bob 

              • 4. Re: Stack Address Change
                msur

                Hello Dana,

                   

                 

                   

                I have a simple workaround to force stack start address to a particular RAM location - but I do not recommend it, just if you are desperate :) ..

                   

                 

                   

                Open 'boot.tpl' file in either designer or notepad. Most probably, Line 212 (or search for 'Set up the stack' - refer attached figure). You will find that stack pointer, SP being initialized there. It is all yours, just edit it to your need :)

                   

                 

                   

                For LMM devices, (with more than >256 bytes of RAM), you get an option in the compiler settings for moving the stack stack address in the last page of RAM - this also can be found and edited in boot.tpl.

                   

                 

                   

                Regards,

                   

                MSUR

                • 5. Re: Stack Address Change
                  user_14586677

                  I saw that in tpl as well, but did not use because it states it is a temporary stack start

                     

                  address. I wound up using script in custom.lkp file, and the command -dram_end:<address>

                     

                   

                     

                  Regards, Dana.

                  • 6. Re: Stack Address Change
                    msur

                    For large memory models, yes it is temporary. For a 256 byte device, it is where stack starts.

                       

                     

                       

                    Even for LMMs, if you do a CTRL+F and search 'stack' in the file, you will find all the stack related assignments. For LMMs, the extra stuffs, that are done are basically initialization of the various page pointers, IDX_PP, CUR_PP, STK_PP etc.

                    • 7. Re: Stack Address Change
                      user_14586677

                      Thanks MSUR for the clarification.

                         

                       

                         

                      Seems to me Imagecraft could spend a little more time on documenting their

                         

                      compiler/user manual and illustrated examples of linker mods and optimization

                         

                      techniques. Also would be nice if someone brings stackwalk up to date as well.

                         

                       

                         

                      Regards, Dana.