Download User Manual ST10F272
Transcript
UM0381 System programming The effect of the address transformation is that the physical stack addresses wrap around from the end of the defined area to its beginning. When flushing and filling the internal stack, this circular stack mechanism only requires to move that portion of stack data which is really to be re-used (the upper part of the defined stack area) instead of the whole stack area. Stack data that remain in the lower part of the internal stack need not be moved by the distance of the space being flushed or filled, as the stack pointer automatically wraps around to the beginning of the freed part of the stack area. Note: This circular stack technique is applicable for stack sizes of 32 to 512 words (STKSZ = ‘000b’ to ‘100b’), it does not work with option STKSZ = ‘111b’, which uses the complete IRAM for system stack. In the latter case the address transformation mechanism is deactivated. When a boundary is reached, the stack underflow or overflow trap is entered, where the user moves a predetermined portion of the internal stack to or from the external stack. The amount of data transferred is determined by the average stack space required by routines and the frequency of calls, traps, interrupts and returns. In most cases this will be approximately one quarter to one tenth the size of the internal stack. Once the transfer is complete, the boundary pointers are updated to reflect the newly allocated space on the internal stack. Thus, the user is free to write code without concern for the internal stack limits. Only the execution time required by the trap routines affects user programs. The following procedure initializes the controller for usage of the circular stack mechanism: ● Specify the size of the physical system stack area within the IRAM (bit-field STKSZ in register SYSCON). ● Define two pointers, which specify the upper and lower boundary of the external stack. These values are then tested in the stack underflow and overflow trap routines when moving data. ● Set the stack overflow pointer (STKOV) to the limit of the defined internal stack area plus six words (for the reserved space to store two interrupt entries). The internal stack will now fill until the overflow pointer is reached. After entry into the overflow trap procedure, the top of the stack will be copied to the external memory. The internal pointers will then be modified to reflect the newly allocated space. After exiting from the trap procedure, the internal stack will wrap around to the top of the internal stack, and continue to grow until the new value of the stack overflow pointer is reached. When the underflow pointer is reached while the stack is emptied the bottom of stack is reloaded from the external memory and the internal pointers are adjusted accordingly. Linear stack The ST10F272 also offers a linear stack option (STKSZ = ‘111b’), where the system stack may use the complete IRAM area. This provides a large system stack without requiring procedures to handle data transfers for a circular stack. However, this method also leaves less RAM space for variables or code. The RAM area that may effectively be consumed by the system stack is defined via the STKUN and STKOV pointers. The underflow and overflow traps in this case serve for fatal error detection only. For the linear stack option all modifiable bit of register SP are used to access the physical stack. Although the stack pointer may cover addresses from 00’F000h up to 00’FFFEh the (physical) system stack must be located within the IRAM and therefore may only use the address range 00’F600h to 00’FDFEh. It is the user’s responsibility to restrict the system stack to the IRAM range. 523/537
Related documents
ST10F276
ST10 UART recommendations
“TOYUG”
TI Submission - TI E2E Community
Tektronix BERTScope Bit Error Ratio Analyzer & Pattern Generator
STMicroelectronics L4998 Datasheet
Blast-e manuals part1
User Manual - The Bodgery Wiki
UNIX
ST10F269 User's manual
Network Computing Devices, Inc. NCBridge Installation Manual for
The Other YN-622C User Guide