some info for stack memory models
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3632
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2005-01-11 Vangelis Rokas <vrokas AT otenet.gr>
+
+ * doc/sdccman.lyx: update documentation about stack pragma, added
+ some info for stack memory models
+
2005-01-08 Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
* src/pic16/gen.c (DEBUGpc): MSVC 6 does not support macro variable arguments
2005-01-08 Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
* src/pic16/gen.c (DEBUGpc): MSVC 6 does not support macro variable arguments
stack pragma stack forces the code generator to initialize the stack & frame
pointers at a specific address.
stack pragma stack forces the code generator to initialize the stack & frame
pointers at a specific address.
- This is an adhoc solution since gplink does not support yet stack.
- When the gplink issue is resolved the pragma will be deprecated
-\begin_inset Foot
-collapsed true
+ This is an adhoc solution for cases where no STACK directive is available
+ in the linker script or gplink is not instructed to create a stack section.
+\newline
+The stack pragma should be used only once in a project.
+ Multiple pragmas may result in indeterminate behaviour of the program.
+\newline
+The format is as follows:
+\layout LyX-Code
+#pragma stack bottom_address [stack_size]
\layout Standard
\emph on
\layout Standard
\emph on
-It is important to initialize the stack, otherwise strange things can happen.
- Stack is not initialized by default because there are some sources that
- do not require it.
- (like library sources)
-\end_inset
-
-.
-\newline
-The stack pragma should be used only once in a project.
- Multiple pragmas may result in indeterminate behaviour of the program.
+bottom_address
+\emph default
+ is the lower bound of the stack section.
+ The stack pointer initially will point at address (bottom_address+stack_size-1).
\layout LyX-Code
Example:
\layout LyX-Code
Example:
-/* initializes stack at RAM address 0x5ff */
+/* initializes stack of 100 bytes at RAM address 0x200 */
\layout List
\labelwidthstring 00.00.0000
\layout List
\labelwidthstring 00.00.0000
The following stack models are supported by the PIC16 port
\layout Itemize
The following stack models are supported by the PIC16 port
\layout Itemize
+
+\noun on
+small
+\noun default
+ model
+
+\noun on
+large
+\noun default
+ model
-\series bold
-Currently stack and frame pointers should be initialized explicit by the
- user at the desired Data RAM position (see
-\begin_inset LatexCommand \ref{sub:PIC16_Pragmas}
+\noun on
+Large
+\noun default
+stack model is currently not working properly throughout the code generator.
+ So its use is not advised.
+ Also there are some other points that need special care:
+\layout Enumerate
+Do not create stack sections with size more than one physical bank (that
+ is 256 bytes)
+\layout Enumerate
+
+Stack sections should no cross physical bank limits (i.e.
+ #pragma stack 0x50 0x100)
+\layout Standard
- Pragma stack).
- Uninitialized stack and frame pointers can result in unexpected behavior
- of the resulting binary.
+These limitations are caused by the fact that only FSRxL is modified when
+ using SMALL stack model, so no more than 256 bytes of stack can be used.
+ This problem will disappear after LARGE model is fully implemented.
\layout Subsection
Function return values
\layout Subsection
Function return values