Home

OSs-Micrium-Learning Centre-Application Notes

image

Contents

1. Note 2 Listing 5 3 BSP_Tmr_ TickISR_Handler Listing 5 3 Note 1 The timer 0 interrupt is cleared Listing 5 3 Note 2 OSTimeTick informs pC OS II of the tick interrupt 21 Micrium yC OS II and uC Probe for the NXP LPC2103 CPU 6 uC Probe uC Probe is a Windows program which retrieves the values of global variables from a connected embedded target and displays the values in a engineer friendly format To accomplish this an ELF file created by the user s compiler and containing the names and addresses of all the global symbols on the target is monitored by pC Probe The user places components such as gauges labels and charts into a Data Screen in a pC Probe workspace and assigns each one of these a variable from the Symbol Browser which lists all symbols from the ELF file The symbols associated with components placed on an open Data Screen will be updated after the user presses the start button assuming the user s PC is connected to the target A small section of code resident on the target receives commands from the Windows application and responds to those commands The commands ask for a certain number of bytes located at a certain address for example Send 16 bytes beginning at 0x0040102C The Windows application upon receiving the response updates the appropriate component s on the screens with the new values te J Home l Numeric Meters Graphs Sliders Tanks Miscellaneous Switc
2. 232 KSD LED Task Probe OS PlugIn Push Buttons SCP1000 Sensor Probe Str USB Task FS Task Probe USB MSD Task Jasmosg joquids saiojdxg aaeds yo Faj ba 0x20006C00 0x200069F0 0x20006DD8 0x200061D0 0x20005610 0x200067E8 0x20006FD8 0x200063D8 0x20002B98 0x200065E8 0x20003E10 0x20001388 0x200059D8 0x200041E0 72 512 88 512 112 512 120 512 120 1024 96 512 112 512 112 512 104 2048 96 512 120 1024 120 4096 176 1024 168 1024 512 220 1024 376 1024 General Task Information 0x20006C48 0x20006A48 0x20006E48 0x20006248 0x20005688 0x20006848 0x20007048 0x20006448 0x20002C00 0x20006648 0x20003E88 0x20001400 0x20005A88 0x20004288 0x20006A48 0x20006848 0x20006C48 0x20006048 0x20005288 0x20006648 0x20006E48 0x20006248 0x20002400 0x20006448 0x20003A88 0x20000400 0x20005688 0x20003E88 uC OS II Idle Ready uC OS II Stat Delay uC OS II Tmr Semaphore Start Mailbox Probe RS 232 Semaphore Target Output 0 xj KSO LED Task pay String Tx 00012 al Probe OS PlugIn Delay String Tx 00013 Push Buttons Delay String Tx 00014 SCP1000 Sensor Delay String Tx 00015 Probe Str Delay String Tx 00016 USB Task Delay String Tx 00017 FS Task Semaphore App FS Lock String Tx 00018 Probe USB Ready String Tx 00019 MSD Task Semaphore String Tx 00020 String Tx 00021 String Tx 00022 String Tx 00023 String Tx 00024 oo String Tx 0
3. OS II is provided in source form for FREE evaluation for educational use or for peaceful research If you plan on using pC OS II in a commercial product you need to contact Micrium to properly license its use in your product We provide ALL the source code with this application note for your convenience and to help you experience C OS II The fact that the source is provided does NOT mean that you can use it without paying a licensing fee Please help us continue to provide the Embedded community with the finest software available Your honesty is greatly appreciated References HC OS II The Real Time Kernel 2nd Edition Jean J Labrosse R amp D Technical Books 2002 ISBN 1 57820 103 9 Embedded Systems Building Blocks Jean J Labrosse R amp D Technical Books 2000 ISBN 0 87930 604 1 Contacts IAR Systems Century Plaza 1065 E Hillsdale Blvd Foster City CA 94404 USA 1 650 287 4250 1 650 287 4253 FAX e mail Info lIAR com WEB http www lAR com Micrium 949 Crestview Circle Weston FL 33327 USA 1 954 217 2036 1 954 217 2037 FAX e mail Jean Labrosse Micrium com WEB http www Micrium com
4. Support Package BSP provides functions to encapsulate common I O access functions and make porting your application code easier Essentially these files are the interface between the application and the IAR LPC2103 02 SK evaluation board Though one file bsp c contains some functions which are intended to be called directly by the user all of which are prototyped in bsp h the other files serve the compiler as with cstartup 5 01 BSP bsp c and bsp h The file bsp c implements several global functions each providing some important service such as the initialization of processor functions for wC OS II to operate or the toggling of an LED Several local functions are defined as well to perform some atomic duty initializing the I O for the LED or initialize the yC OS II tick timer The discussion of the BSP will be limited to the discussion of the global functions that might be called from user code and may be called from the example application The global functions defined in bsp c and prototyped in bsp h may be roughly divided into two categories critical processor initialization and user interface services Three functions constitute the former e BSP_Init is called by the application code to initialize critical processor features particularly the C OS II tick interrupt after multitasking has started i e OS Start has been called This function should be called before any other BSP functions are used See Listing 5 1 for mo
5. the processor s memory map e LPC2103_Flash mac contains instructions that are executed prior to loading code onto the processor Micripm uC OS II and C Probe for the NXP LPC2103 CPU 4 Application Code The example application described in this appnote AN 073 is a simple demonstration of wC OS II and uC Probe for the NXP s LPC2103 processor on the IAR LPC2103 02 SK evaluation board The basic procedure for setting up and using each of these can be gleaned from an inspection of the application code contained in app c which should serve as a beginning template for further use of these software modules Being but a basic demonstration of software and hardware functionality this code will make evident the power and convenience of wuC OS Il The Real Time Kernel used on the NXP s LPC2103 processor without the clutter or confusion of a more complex example 4 01 app c Five functions of interest are located in app c 1 main is the entry point for the application as it is with most C programs This function initializes the operating system creates the primary application task AppTaskStart begins multitasking and exits 2 App _TaskStart after creating the user interface tasks enters an infinite loop in which it blinks the LEDs on the board void main void Note 1 CEU UN TO SUMS tas BSP IntDisAll Note 2 OSInit Note 3 OSTaskCreateExt void void App Tas
6. the software port described in this document uses the module versions in the table below Version Comment uCiOS I a uCiProbe va OC Micripm uC OS II and C Probe for the NXP LPC2103 CPU Document Conventions Numbers and Number Bases e Hexadecimal numbers are preceded by the Ox prefix and displayed in a monospaced font Example 0xFF886633 e Binary numbers are followed by the suffix b for longer numbers groups of four digits are separated with a space These are also displayed in a monospaced font Example 0101 1010 0011 1100b e Other numbers in the document are decimal These are displayed in the proportional font prevailing where the number is used Typographical Conventions e Hexadecimal and binary numbers are displayed in a monospaced font e Code excerpts variable names and function names are displayed in a monospaced font Functions names are always followed by empty parentheses e g OS _Start Array names are always followed by empty square brackets e g BSP_ Vector Array e File and directory names are always displayed in an italicized serif font Example Micrium Sofware uCOS II Source e A bold style may be layered on any of the preceding conventions or in ordinary text to more strongly emphasize a particular detail e Any other text is displayed in a sans serif font Micrium yC OS II and uC Probe for the NXP LPC2103 CPU Table of Contents Table of Contents 6 1 Introd
7. 0025 ucC O S I For more information visit string T ooozs ring Tx The Real Time Kernel www micrium com String Tx 00028 USB 34661 4660 177469 bytes sec tm Running Figure 1 2 C Probe with Target Output Window Micripm uC OS II and C Probe for the NXP LPC2103 CPU 2 Getting Started The following sections step through the prerequisites for using the demonstration application described in this document AN 1074 First the setup of the hardware will be outlined Second the use and setup of the IAR Embedded Workbench project will be described Thirdly the steps to build the projects and load the application onto the board through a JTAG will be described Lastly instructions will be provided for using the example application 2 01 Setting up the Hardware The evaluation board can only be powered through the USB connector on the board The processor on the evaluation board can be programmed and debugged through the USB J LINK port To use pC Probe with the IAR LPC2103 02 SK download and install the trial version of the program from the Micrium website as discussed in Section 6 After programming your target with one of the included example projects connect a RS 232 cable between your PC and the evaluation board configure the RS 232 options also covered in Section 6 and start running the program The open data screens should update The IAR LPC2103 02 SK example application is configured to us
8. C OS II is provided in source form for FREE evaluation for educational use or for peaceful research If you plan on using pC OS II in a commercial product you need to contact Micrium to properly license its use in your product We provide ALL the source code with this application note for your convenience and to help you experience wC OS II The fact that the source is provided DOES NOT mean that you can use it without paying a licensing fee Please help us continue to provide the Embedded community with the finest software available Your honesty is greatly appreciated Micripm uC OS II and C Probe for the NXP LPC2103 CPU About pC Probe Demo Version uC Probe is a Windows application that allows a user to display and change the value at run time of virtually any variable or memory location on a connected embedded target The user simply populates uC Probe s graphical environment with gauges tables graphs and other components and associates each of these with a variable or memory location Once the application is loaded onto the target the user can begin uC Probe s data collection which will update the screen with variable values fetched from the target uC Probe retrieves the values of global variables from a connected embedded target and displays the values in an engineer friendly format The supported data types are booleans integers floats and ASCII strings uC Probe can have any number of data screens where these variabl
9. C2103 CPU yC Probe Files Micrium Software uC Probe Communication Generic This directory contains the jC Probe generic communication module the target side code responsible for responding to requests from the wC Probe Windows application including requests over RS 232 Micrium Software uC Probe Communication Generic Source This directory contains probe_com c and probe_com h the source code for the generic communication module Micrium Software uC Probe Communication Generic OS uCOS II This directory contains probe_com_os c which is the pC OS II port for the pC Probe generic communication module Micrium Software uC Probe Communication Generic Source RS 232 This directory contains the RS 232 specific code for uC Probe generic communication module the target side code responsible for responding to requests from the wC Probe Windows application over RS 232 Micrium Software uC Probe Communication Generic Source RS 232 Source This directory contains probe_rs232 c and probe_rs232 h the source code for the generic communication module RS 232 code Micrium Software uC Probe Communication Generic Source RS 232 Ports NXP LPC21xx This directory contains probe_rs232c c and probe_rs232c h the LPC21xx port for the RS 232 communications Micrium Software uC Probe Communication Generic Source RS 232 O0S uCOS II This directory contains probe_rs232_os c which is the pC OS II port for the pC Probe RS 232 communication module Micrium S
10. IAR OS Probe This directory contains the soruce code the uC OS II and pC Probe example application e app c contains the test code for the example application including calls to the functions that start multitasking within pC OS II register tasks with the kernel and update the user interface the LEDs and the push buttons e app_cfg h is a configuration file specifying stack sizes and priorities for all user tasks and defines for important global application constants e includes h is the master include file used by the application e os_cfg h is the pwC OS II configuration file e LPC2103 02 SK OS Probe Workspace wsp is an example pC Probe workspace e LPC2103 02 SK OS Probe v5 2 are the IAR EWARM v5 2x project files Micrium Software EvalBoards NXP LPC2103 02 SK IAR BSP This directory contains the Board Support Package for the IAR LPC2103 02 SK evaluation board e bsp c contains the board support package functions which initialize critical processor functions e g the PLL and provide support for peripherals such as the push buttons and LEDs e bsp h contains prototypes for functions that may be called by the user e cstartup s is the IAR EWARM v5 2x startup file This file performs critical processor initialization Such as the initialization of task stacks readying the platform to enter main e LPC2103_Flash icf is a AR EWARM v5 2x linker file which contains information about the placement of data and code segments in
11. Micrium Empowering Embedded Systems uC OS II uC Probe and the NXP LPC2103 Using the IAR LPC2103 02 SK Kickstart Kit Application Note AN 1074 www Micrium com Micripm uC OS II and C Probe for the NXP LPC2103 CPU About Micrium Micrium provides high quality embedded software components in the industry by way of engineer friendly source code unsurpassed documentation and customer support The company s world renowned real time operating system the Micrium wC OS II features the highest quality source code available for today s embedded market Micrium delivers to the embedded marketplace a full portfolio of embedded software components that complement wC OS II A TCP IP stack USB stack CAN stack File System FS Graphical User Interface GUI as well as many other high quality embedded components Micrium s products consistently shorten time to market throughout all product development cycles For additional information on Micrium please visit www micrium com About pC OS II uC OS II is a preemptive real time multitasking kernel sC OS II has been ported to over 45 different CPU architectures uC OS II is small yet provides all the services you d expect from an RTOS task management time and timer management semaphore and mutex message mailboxes and queues event flags an much more You will find that pC OS II delivers on all your expectations and you will be pleased by its ease of use Licensing u
12. e UARTO the RS 232C connector labeled RS 232 for yC Probe in Figure 1 1 2 02 Directory Tree If this file were downloaded as part of an executable zip file which should have been named Micrium NX P uCOS II LPC2103 02 SK exe then the code files referred to herein are located in the directory structure shown in Figure 2 2 Micrium uC OS II and uC Probe for the NXP LPC2103 CPU Micrium AppNotes J anons 018 AN1xxx RTOS AN1014 uCOS II ARM AN1074 uCOS II NXP LPC2103 02 SK AN 1074 Licensing agreements If pC OS I1 is used commercially Contact AN9xxx MULT www Micrium com AN9913 IAR Probe Demo for pricing Licensing Software EvalBoards lt NXP gt Board Support Package LPC2103 02 SK BSP IAR BSP OS Probe IAR Example Project uC CPU ARM IAR uC LIB pcos uCOS II The Real Time Doc ARM7 ARM9 Ports uC OS II port ARM yC OS II Generic documentation IAR Source uC OS II processor independent source uC Probe uC Probe code Real Time Monitor Target l l Communication DCc Target Generic Communication Os uCOSs II RS 232 RS 232 os Communication uCOS II Ports NXP uC Probe LPC21xx LPC21xx Port Source Source KSD uC Probe oonTGS IAR Kickstart Kits Workspace Plugins Demo uCOS II AN 9913 Figure 2 1 Directory Structure Micripm uC OS II and C Probe for the NXP LPC2103 CPU 2 03 Using the IAR Projects One IAR project is loca
13. es are displayed This allows to logically grouping different views into a product This pC Probe demo version can only retrieve information from RS 232C or J LINK interfaces and is limited up to 15 symbols The demo version of pC Probe is available on the Micrium website http www micrium com products probe probe html About pC Probe Full Version The full version of uC Probe allows you to use a TCP IP is a Windows application that allows a user to display and change the value at run time of virtually any variable or memory location on a connected embedded target The user simply populates pC Probe s graphical environment with gauges tables graphs and other components and associates each of these with a variable or memory location Once the application is loaded onto the target the user can begin uC Probe s data collection which will update the screen with variable values fetched from the target Micripm uC OS II and C Probe for the NXP LPC2103 CPU Manual Version If you find any errors in this document please inform us and we will make the appropriate corrections for future releases Version Date By Description SCS Software Versions This document may or may not have been downloaded as part of an executable file Micrium NXP uCOS II LPC2103 02 SK exe containing the code and projects described here If so then the versions of the Micrium software modules in the table below would be included In either case
14. hes Leds Dials Levels figuration General figuration E vents Timers Start Button This button switches between Design and Run Time Views During Run Time View when data is collected this will appear as a stop button a blue square Data Screen Components are placed onto the data screen and assigned symbols during Design View During Run Time View these components are updated with values of those symbols from the target Symbol Browser Contains all symbols from the ELF files added to the workspace C OS II For more information visit The Real Time Kernel www micrium com USB_Setup c FR neo v rnea E Ready USB 34661 4860 Disconnected i Figure 6 1 1C Probe Windows Program 22 Micripm uC OS II and C Probe for the NXP LPC2103 CPU To use pC Probe with the example project or your application do the following 1 Download and Install pC Probe A trial version of uC Probe can be downloaded from the Micrium website at http www micrium com products probe probe html IAR Kickstart Kits Users If this development board is part of the IAR Kickstart Kit a demo version of uC Probe is already included in the installation CD Please refer to the application note AN 9913 for more details in how to use the demo version of p C Probe with the IAR Kickstart kits 2 Open uC Probe If the trail version was instal
15. included to display lists of kernel objects such as semaphores queues and mailboxes including for each entry the state of the object Additionally a list of the current tasks may be displayed including for each task pertinent information such as used stack space task status and task priority in addition to showing the actively executing task An example task list for this project is shown in Figure 2 5 Category Factory Settings General Options C C Compiler Assembler Output Converter Setup Download Extra Options Plugins Custom Build Build Actions Select plugins to load Linker J SEGGER emb0S OOSE Epsilon Simulator C Power Pac RTOS Angel CO Threadx GDB Server M pC OS I IAR ROM monitor C Code Coverage J Link J Trace MORTI RTOS LMI FTDI Description RTOS awareness for CMX Macraigor por r Location C Program Files IAA Systems Embedded Workbench 5 25 Third Party Driver Originator IAR Systems Version 5 20 0 50993 OK Cancel Figure 2 4 Enabling the pC OS II Kernel Awareness Plug In Micripm yC OS II and uC Probe for the NXP LPC2103 CPU E iianc __ Ret Prio State Diy Waiting On usa Cte Su Stk ptx max cuex Nex Cur Size Starts Ends Start Task Dly 04002CC0 512 04002D28 04002B28 User I F Mbox 04002EB0 512 04002F28 04002D28 Keyboard Dly 040030B0 512 04003128 04002F28 Probe Str Dly 04003278 512 04003328 04003128 Probe OS Pl
16. kStart Note 4 void O OS STK amp AppTaskStartStk APP CFG TASK START STK SIZE 1 INT8U APP CFG TASK START PRIO INT16U APP CFG TASK START PRIO OS_STK amp AppTaskStartStk 0 INT32U APP CFG TASK START STK SIZE void 0h INT16U OS_TASK OPT STK CHK OS TASK OPT STK CLR if OS TASK NAME SIZE gt 13 Note 5 OSTaskNameSet APP CFG TASK START PRIO Start Task amp err endif OSStart Note 6 Listing 4 1 main Listing 4 1 Note 1 As with most C applications the code starts in main Listing 4 1 Note 2 All interrupts are disabled to make sure the application does not get interrupted until it is fully initialized Listing 4 1 Note 3 OSInit must be called before creating a task or any other kernel object as must be done with all wC OS II applications 16 Micripm uC OS II and C Probe for the NXP LPC2103 CPU Listing 4 1 Note 4 At least one task must be created in this case using OSTaskCreateExt to obtain additional information about the task In addition wC OS II creates either one or two internal tasks in OSInit wC OS II always creates an idle task OS_TaskIdle and will create a statistic task OS _TaskStat ifyousetOS TASK STAT EN to 1 in os_cfg h Listing 4 1 Note 5 As of V2 6x you can now name wC OS II tasks and other kernel objects and display task names at run time or with a debugger In this case the App _TaskStart is give
17. led open the example C Probe workspace for yuC OS II named OS Probe Workspace wsp which should be located in your installation directory at Program Files Micrium uC Probe Target Plugins uCOS I Workspace If the demo version was installed open the example workspace for the IAR Kickstarts kits named OS Probe Kickstart Demo Workspace wsp which should be located in your installation directory at Micrium Software uC Probe Target Demo KSD Workspace 3 Connect Target to PC Currently uC Probe can use RS 232 to retrieve information from the target You should connect a RS 232 cable between your target and computer 4 Load Your ELF File The example projects included with this application note are already configured to output an ELF file If you are using your own project please refer to Appendix A of the pC Probe user manual for directions for generating an ELF file with your compiler This file should be in lt Project Directory gt lt Configuration Name gt exe where lt Project Directory gt is the directory in which the IAR EWARM project is located extension ewp and lt Configuration Name gt is the name of the configuration in that project which was built to generate the ELF file and which will be loaded onto the target The ELF file will be named lt Project Name gt elf in EWARM v4 4x and lt Project Name gt out in EWARM v5 xx unless you specify otherwise To load this ELF file right click on the symbol browser and choo
18. mation about the purpose of each define can be found in Jean Labrosse s book uC OS II The Real Time Kernel 2nd Edition os_cfg h assumes you have uC OS II V2 83 or higher but also works with previous versions of uC OS II e OS_APP_ HOOKS ENis set to 1 so that the cycle counters in the OS_TCBs will be maintained e Task sizes for the Idle O0S_TASK_IDLE STK_SIZE statistics OS_TASK_ STAT STK SIZE and timer OS_TASK_TMR_STK_SIZE task are set to 128 OS_STK elements each is 4 bytes and thus each task stack is 512 bytes If you add code to the examples make sure you account for additional stack usage e OS _DEBUG EN is set to 1 to provide valuable information about pC OS II objects to IAR s C Spy through the Kernel Awareness plug in Setting OS DEBUG _EN to 0 should some code space though it will not save much e OS LOWEST_PRIO is set to 31 allowing up to 64 total tasks e OS MAX TASKS determines the number of application tasks and is currently set to 10 e OS TICKS PER_SEC is set to 1000 Hz This value can be changed as needed and the proper tick rate will be adjusted in bsp c if you change this value You would typically set the tick rate betweek 10 and 1000 Hz The higher the tick rate the more overhead pC OS II will impose on the application However you will have better tick granularity with a higher tick rate Micripm uC OS II and C Probe for the NXP LPC2103 CPU 5 Board Support Package BSP The Board
19. n the name Start Task Because C Spy can work with the Kernel Awareness Plug In available from Micrium task names can be displayed during debugging Listing 4 1 Note 6 Finally multitasking under pC OS II is started by calling oSSTart puC OS HI will then begin executing App _TaskStart since that is the highest priority task created both OS TaskStat andOS_ TaskIdle having lower priorities static void App TaskStart void p arg CPU_INTO8U i void p arg BSP Init Note 1 if OS TASK _STAT_EN gt 0 OSS tartelinbisen pe Note 2 endif if APP CFG PROBE COM EN DEF ENABLED APP CFG PROBE OS PLUGIN EN DEF ENABLED App ProbelInit Note 3 endif App _TaskCreate Note 4 App _EventCreate BSP LED Off 0 while DEF TRUE Note 5 for i 1 i lt 16 i BSP LED Toggle i OSTimeDlyHMSM 0 0 0 100 foie i lp i lt 10 att 4 BSP _LED Toggle 0 OSTimeD1lyHMSM 0 0 0 50 Listing 4 2 App TaskStart Listing 4 2 Note 1 BSP Init initializes the Board Support Package the I Os tick interrupt etc See Section 5 for details Listing 4 2 Note 2 OSStatInit initializes pC OS IIs statistic task This only occurs if you enable the statistic task by setting OS TASK STAT EN to 1 in os_cfg h The statistic task measures overall CPU usage expressed as a percentage and performs stack checking for all the ta
20. ng RS 232 for pC Probe og Ge 5 lt 2 g t2eeeeee eee eeu LPC21283 MINI DEY UW IAR COM Ar per et aaa Push Buttons Figure 1 1 IAR LCP2103 02 SK J LINK on chip with USR Cabe Micrium yC OS II and uC Probe for the NXP LPC2103 CPU If this appnote was downloaded in a packaged executable zip file then it should have been found in the directory Micrium Appnotes ANIxxx RTOS AN1074 uCOS lI NXP LPC2103 02 SK and the code files referred to herein are located in the directory structure displayed in Section 2 02 these files are described in Section 3 The executable zip also includes example workspaces for uC Probe uC Probe is a Windows program which retrieves the value of variables form a connected embedded target and displays the values in an engineer friendly format as shown in Figure 1 2 It interfaces with the IAR LPC2103 02 SK via RS 232C For more information including instructions for downloading a trial and the demo version of the program please refer to Section 6 a Home Numeric Meters Graphs Sliders Tanks Miscellaneous Switches Leds Dials Levels o le al a Too wo m Alignment 05 General Info OS Task Info QS Task CPU Usage OS Task Stack Usage OS About OS Events OS Timers 0S Configuration Genera 05 04 gt x Task Stack Information Ce Pointer Maximum Current Starts Ends uC OS II Idle uC OS II Stat uC OS II Tmr Start Probe RS
21. oftware uC Probe Target Demo KSD Source This directory contains ksd c and ksd h the source code for the IAR Kickstart kits demo example for the demo version of pC Probe Micrium Software uC Probe Target Demo KSD Workspace This directory contains OS Probe Kickstart Demo Workspace wsp which is the generic pC Probe workspace for the IAR Kickstart kits Micripm uC OS II and C Probe for the NXP LPC2103 CPU yC CPU Files Micrium Software uC CPU This directory contains cpu_def h which declares define constants for CPU alignment endianness and other generic CPU properties Micrium Software uC CPU ARM VIAR This directory contains cpu h and cpu_a s cpu h defines the Micrium portable data types for 8 16 and 32 bit signed and unsigned integers such as CPU_INT16U a 16 bit unsigned integer These allow code to be independent of processor and compiler word size definitions cpu_a s contains generic assembly code for ARM7 and ARM9 processors which is used to enable and disable interrupts within the operating system This code is called from C with OS ENTER CRITICAL andOS EXIT CRITICAL yC LIB Files Micrium Software uC LIB This directory contains lib_def h which provides defines for useful constants like DEF TRUE and DEF_DISABLED and macros Micrium Software uC LIB Doc This directory contains the documentation for wC LIB Application Code Micrium Software EvalBoards NXP LPC2103 02 SK
22. re details e BSP_IntDis is called to disable an specific interrupt source e BSP_IntDisAl11 is called to disable all interrupts thereby preventing any interrupts until the processor is ready to handle them e BSP_IntEn is called to enable a specific interrupt souce e BSP_IntVectSet is called to assign a ISR handler to a specific interrupt source e BSP_CPU_ClkFreq returns the clock frequency in Hz Several functions provide access to user interface components e BSP_LED Toggle BSP_LED On and BSP_LED Off will toggle turn on and turn off respectively the LED corresponding to the ID passed as the argument If an argument of 0 is provided the appropriate action will be performed on all LEDs Valid IDs are 1 2 3 and 4 inclusive e BSP_PB GetStatus returns the status of the board s push buttons corresponding the ID passed as the argument 19 Micripm uC OS II and C Probe for the NXP LPC2103 CPU 5 02 Processor Initialization Functions void BSP_Init void MEMMAP 1 Note 1 362 Wink Wetec P Note 2 SSP VIC imich Note 3 ase pa Woulie Note 4 BSP_LED_Init SSI muie miek trith p Note 5 Listing 5 1 BSP_Init Listing 5 1 Note 1 MEMMAP register is set to User Flash Mode in this mode the interrupt vectors are not re mapped and reside in Flash Listing 5 1 Note 2 The PLL is initialized Listing 5 1 Note 3 The vectored in
23. s application note AN 9913 pdf Licensing Information Micrium Licensing Licensing agreements are located in this directory Any source code accompanying this appnote is provided for evaluation purposes only If you choose to use pC OS II in a commercial product you must contact Micrium regarding the necessary licensing yC OS II Files Micrium Software uCOS II Doc This directory contains documentation for uwC OS II Micrium Software uCOS II Ports ARM Generic AR This directory contains the standard processor specific files for the generic pC OS II ARM port assuming the IAR toolchain These files could easily be modified to work with other toolchains i e compiler assembler linker locator debugger however the modified files should be placed into a different directory The following files are in this directory os_cpu h OS_cpu_d asm OS_CPU_C C os_dcc c os_dbg c With this port uC OS II can be used in either ARM or Thumb mode Thumb mode which drastically reduces the size of the code was used in this example but compiler settings may be switched as discussed in Section 2 30 to generate ARM mode code without needing to change either the port or the application code The ARM Thumb port is described in application note AN 1014 which is available from the Micrium web site Micrium Software uCOS I Source This directory contains the processor independent source code for uC OS II Micripm uC OS II and C Probe for the NXP LP
24. se Add Symbols 5 Configure the RS 232 Options In uC Probe choose the Options menu item on the Tools menu A dialog box as shown in Figure 6 2 left should appear Choose the RS 232 radio button Next select the RS 232 item in the options tree and choose the appropriate COM port and baud rate The baud rate for the projects accompanying this appnote is 115200 23 Micrium yC OS II and uC Probe for the NXP LPC2103 CPU 6 Start Running You should now be ready to run pC Probe Just press the run button ty to see the variables in the open data screens update Figure 6 3 displays the C OS II workspace which displays detailed information about each task s state Options Options a T E Commuricaton Settings RS 232 eee RS 232 O use Sink COM Port COM TCPAP O J Link Hew Target Server TCP IP USB USB Baud Rate 115200 Environment TCPAP UDP B Environment General General Screen Screen Update Target R Target symbols sec bytes sec Slow queue update period 10 v sec ag C Calculate communication timeout automatically Wait Time 10 ms Figure 6 2 uC Probe Options a Micrium pC Probe 05 Probe Workspace wsp a saioydkg aoeds 0A asworg quits GE General Task Information RS 232 115200 COM 2359 bytes sec omy Figure 6 3 wC Probe Run Time C OS II Task Information 24 Licensing yuC
25. sks that have been created with oSTaskCreateExt with the stack checking option set 17 Micripm uC OS II and C Probe for the NXP LPC2103 CPU Listing 4 2 Note 3 App ProbeInit initialize pC Probe This function calls oSProbe Init which initializes the uC Probe plug in for C OS II which maintains CPU usage statistics for each task ProbeCom_ Init which initializes the C Probe generic communication module ProbeRS232 Init which initializes the RS 232 communication module and KSD_Init which initializes the IAR Kickstart kit demo KSD for the demo version of C Probe see AN 9913 After these have been initialized the uwC Probe Windows program will be able to download data from the processor For more information see Section 6 Listing 4 2 Note 4 App TaskCreate App EventCreate Creates all the application tasks and events respectively Listing 4 2 Note 9 Any task managed by pC OS II must either enter an infinite loop waiting for some event to occur or terminate itself This task enters an infinite loop in which the LEDs are toggled 4 02 os_cfg h The file os_cfg h is used to configure pC OS II and defines the maximum number of tasks that your application can have which services will be enabled semaphores mailboxes queues etc the size of the idle and statistic task and more In all there are about 60 or so define that you can set in this file Each entry is commented and additional infor
26. ted in the directory marked IAR Example Project in Figure 2 1 Micrium Software EvalBoards NXP LPC2103 02 SK IAR OS Probe The example project LPC2103 02 SK OS Probe v5 2 ewp is intended for EWARM v5 2x To view this example start an instance of IAR EWARM v5 2x and open the workspace file LPC2103 02 SK OS Probe v5 2 eww To do this select the Open menu command under the File menu select the Workspace submenu command and select the workspace file after navigating to the project directory The project tree shown in Figure 2 2 should appear In addition the workspace should be openable by double clicking on the file itself in a Windows Explorer window 2 03 01 yC OS II Kernel Awareness When running the IAR C Spy debugger the p C OS II Kernel Awareness Plug In can be used to provide useful information about the status of wC OS II objects and tasks If the pC OS II Kernel Awareness Plug In is currently enabled then a uC OS II menu should be displayed while debugging Otherwise the plug in can be enabled Stop the debugger if it is currently active and select the Options menu item from the Project menu Select the Debugger entry in the list box and then select the Plugins tab pane Find the wC OS II entry in the list and select the check box beside the entry as shown in Figure 2 4 When the code is reloaded onto the evaluation board the uC OS II menu should appear Options are
27. terrupt controller is initialized Listing 5 1 Note 4 The I Os for the board s peripherals are initialized LEDs and Push buttons Listing 5 1 Note 4 The pC OS II tick interrupt source is initialized Listings 5 2 and 5 3 give the C OS II timer tick initialization function BSP_Tmr TickInit the tick ISR handler BSP_Tmr_ TickISR_Handler These may serve as examples for initializing an interrupt and servicing that interrupt 20 Micripm uC OS II and C Probe for the NXP LPC2103 CPU static void BSP_Tmr TickInit void CEURUNTS AUR O CIs ise cy CPU_INT32U tmr_reload BSP_IntVectSet CPU_INTO8U BSP_INT ID TMRO Note 1 CPU_LINTO8U O CPU_LINTO8U BSP INT TYPE NO VEC IRQ CPU_FNCT_VOID BSP Tmr TickISR_ Handler BSP_IntEn BSP_INT ID TMRO pelk freq BSP CPU PclkFreq Note 2 tmr_ reload pclk freq OS TICKS PER SEC TOTCR 0 Note 3 TOPC Of TOMRO tmr_reload TOMCR DEF BIT 00 DEF BIT 01 MOGER OP TOEMR Oy TOTCR DEF BIT 00 Listing 5 2 BSP_Tmr_TickInit Listing 5 2 Note 1 The tick ISR handler is programmed into the vectored interrupt controller Listing 5 2 Note 2 The number of counts per tick is calculated Listing 5 2 Note 2 The calculated re load value is programmed into the Timer 0 the timer interrupt is enabled and the timer is started void BSP_Tmr TickISR_ Handler void TOIR DEF BIT 00 Note 1 OSTime luck
28. uction 7 2 Getting Started 9 2 01 Setting up the Hardware 9 2 02 Directory Tree 9 2 03 Using the IAR Projects 11 2 03 01 uC OS II Kernel Awareness 11 2 04 Example Applications 12 3 Directories and Files 13 4 Application Code 16 4 01 app c 16 4 02 os_cfg h 18 5 Board Support Package BSP 19 5 01 BSP bsp c and bsp h 19 5 02 Processor Initialization Functions 20 6 yuC Probe 22 Licensing 25 References 25 Contacts 25 Micripm uC OS II and C Probe for the NXP LPC2103 CPU 1 Introduction This document AN 1074 explains example code for using wC OS II and pC Probe with the NXP LPC2103 processor on the IAR LPC2103 02 SK evaluation board shown in Figure 1 The LPC2103 microcontroller is based on a 16 bit 32 bit ARM7TDMI S CPU with real time emulation that combines the microcontroller with 32 kB of embedded high speed flash memory A blend of serial communications interfaces ranging from multiple UARTS SPI and SSP to two I2Cs and on chip SRAM of 8 kB make these devices very well suited for communication gateways and protocol converters The IAR LPC2103 02 SK board includes e NXP LPC2103 MCU e J LINK on chip with USB cable e One serial port e Reset button e In system programming ISP button e Two user defined buttons e 16 fully configurable LEDs e Power on LED e Lithium back up battery and holder e Breakout headers for all pins suitable for mounting daughter boards e Small array of plated holes for prototypi
29. ugIn Dly 04001370 2048 04001400 04000C00 Dly 04003440 512 04003528 04003328 Sen Probe RS 232 04002768 1024 040027E8 040023E8 Sen 0S TmrSig 04003448 12 04003B28 04003928 Dly 040036C0 x 512 04003728 04003528 Ready 040038C0 x 512 04003928 04003728 KSD LED Task Probe RS 232 uC 0S II Tnr uC OS II Stat gt uC OS II Idle CRPNODBFwWo AIwW Figure 2 5 pC OS II Task List 2 04 Example Applications The example projects include a basic demonstration of the wC OS II and pC Probe After you load the evaluation board the sample project the LEDs will start blinkging Stack Out of Range Notification While debugging this project or any other uC OS II project IAR may log a SVC stack pointer out of range notification in the Debug Log window This is actually normal behavior and does NOT indicate an error IAR EWARM does not understand that the SVC stack pointer points to the stack for the current task stack 12 Micripm uC OS II and C Probe for the NXP LPC2103 CPU 3 Directories and Files Application Notes Micrium AppNotes AN1xxx RTOS AN1014 uCOS H ARM This directory contains AN 1014 pdf the application note describing the ARM port for pwC OS II and AN 1014 PPT pdf a supplement to AN 1014 pdf Micrium AppNotes ANI1xxx RTOS AN1074 uCOS II NXP LPC2103 02 SK This directory contains this application note AN 1074pdf Micrium AppNotes AN9xxx MULT AN 9913 IAR Probe Demo This directory contains thi

Download Pdf Manuals

image

Related Search

Related Contents

Criterion - 株式会社太陽インターナショナル    ZUO 50088 Installation Guide  User Manual - OBR  Bicama 3139BA  Les grands succès  Transdutor de corrente a pressão 846 da Fisher  Mitteilungsblatt - Bundesanstalt für Wasserbau  Triplex Digital Video Recorder DVR-450 User`s manual    

Copyright © All rights reserved.
Failed to retrieve file