CE007_stack_error_trap

所属分类:单片机开发
开发工具:C/C++
文件大小:13KB
下载次数:25
上传日期:2007-10-26 20:37:54
上 传 者joncy
说明:  dsPIC30F Code ——学习PIC单片机(16位)的好资料
(dsPIC30F Code- learning PIC Singlechip (16) a good information)

文件列表:
CE007_stack_error_trap (0, 2007-03-28)
CE007_stack_error_trap\CodeExample.mcp (861, 2007-03-13)
CE007_stack_error_trap\CodeExample.mcs (2924, 2007-03-13)
CE007_stack_error_trap\CodeExample.mcw (40448, 2007-03-20)
CE007_stack_error_trap\gld (0, 2007-03-28)
CE007_stack_error_trap\gld\linkerscript.gld (457, 2006-08-08)
CE007_stack_error_trap\src (0, 2007-03-28)
CE007_stack_error_trap\src\main.s (3829, 2007-03-20)
CE007_stack_error_trap\src\stack_error_trap.s (3812, 2007-03-20)

Readme File for Code Example: CE007 - Stack Error Traps for Easy Debugging ---------------------------------------------- This file contains the following sections: 1. Code Example Description 2. Folder Contents 3. Suggested Development Resources 4. Reconfiguring the project for a different dsPIC30F device 5. Revision History 1. Description: --------------- Microchip's 16-bit dsPIC Digital Signal Controllers feature a software stack, i.e., the stack is part of general purpose RAM. PUSH and POP instructions use the W15 register as a stack pointer to place variables on to the top of stack location or to unload variables from the top of stack location in RAM. The CPU also features a mechanism to detect software errors and take corrective action. Specifically, the ability to detect over-utilization or under-utilization of the Stack is provided by means of automatic Stack Error Trap detection. Stack Errors may be caused by one of the following: a. Stack Overflow - W15 is greater than the SPLIM register b. Stack Underflow - W15 is lesser than the base address of RAM (0x800). If the application defines a Stack Error Trap service routine (trap handler), the processor will vector to the trap handler when it detects a Stack Error trap. The attached code example contains two assembler files - "stack_error_trap.s" and "main.s". The "stack_error_trap.s" file provides a Stack Error Trap routine that may be useful during application development and debugging. The code example in this file demonstrates a simple means by which the user may detect whether a stack overflow or underflow occurred. If an overflow occurred, the location of the instruction that caused a stack overflow is also determined. The main() function in main.s file provides two simple examples that cause a stack overflow and stack underflow events. Note: The user should note that the MPLAB C30 C compiler will not intentionally generate any instructions that cause a stack error trap to occur. 2. Folder Contents: ------------------- This folder contains the following sub-folders: a. gld This folder contains a linker script file for the example project. This file is used for building the project for a 30F6014A device. This file simply includes the relevant device linker script, "p30F6014A.gld" and the relevant MPLAB C30 library files, "libdsp-coff.a", "libc-coff.a", and "libm-coff.a" or "libdsp-elf.a", "libc-elf.a", and "libm-elf.a" from their installed location. b. h This folder contains C header files useful in building this project. Device register and bit definitions are provided in the "p30F6014A.h" file, which may be found in the installation folder of the MPLAB C30 toolsuite. c. hex This folder contains three file types - coff, hex and map. These are files generated by the MPLAB C30 toolsuite on build operation performed within MPLAB IDE. The *.map file contains details on memory allocation for various variables, constants and dsPIC30F instructions specified in the source and library code. The *.hex file contains a binary file that may be programmed into the dsPIC30F device. The *.coff file contains a binary file that is used by MPLAB IDE for simulation. d. src This folder contains all the C and Assembler source files (*.c, *.s) used in demonstrating the described example. This folder also contains a sub-folder named "obj" that stores compiled object files generated when the project is built. 3. Suggested Development Resources: ----------------------------------- a. dsPICDEM 1.1 Development Board (See below) b. dsPIC30F6014A Digital Signal Controller Plug-In Module (See below) 4. Reconfiguring the project for a different dsPIC30F device: ------------------------------------------------------------- The Project/Workspace can be easily reconfigured for any dsPIC30F device. Please use the following general guidelines: a. Change device selection within MPLAB IDE to a dsPIC30F device of your choice by using the following menu option: MPLAB IDE>>Configure>>Select Device b. Provide the correct device linker script and header file for your device. Device linker scripts and header files are available in your MPLAB C30 installation folder under: Device Linker Script- YourDrive:>Program Files\Microchip\MPLAB C30\support\gld Device C Header file- YourDrive:>Program Files\Microchip\MPLAB C30\support\h Device ASM Include file- YourDrive:>Program Files\Microchip\MPLAB C30\support\inc c. Provide the appropriate path to your MPLAB C30 support file locations using the menu option: MPLAB IDE>>Project>>Build Options>>Project d. Chose the development board applicable to your device. Some options are provided below: - dsPICDEM 2 Development Board supports: 30F2010, 30F2011, 30F2012, 30F3010, 30F3011, 30F3012, 30F3013, 30F3014, 30F4011, 30F4012, 30F4013 - dsPICDEM 1.1 Development Board supports: 30F5013, 30F6010, 30F6011, 30F6012, 30F6013, 30F6014, 30F6011A, 30F6012A, 30F6013A, 30F6014A - dsPICDEM MC1 Development Board supports: 30F6010, 30F6010A, 30F5016 e. Re-build the MPLAB project using the menu option: MPLAB IDE>>Project>>Build All f. Download the hex file into the device and run. 5. Revision History : --------------------- 09/30/2005 - Initial Release of the Code Example

近期下载者

相关文件


收藏者