Home

OSs-Micrium-Learning Centre-Application Notes

image

Contents

1. 1 03 01 IAR Example Project To view the IAR example project start an instance of IAR Embedded Workbench and open e LPC1768 OS Probe ewp located in Micrium Software EvalBoards NXP LPC1768 SK IAR OS Probe folder To do this use the Add Existing Project menu command under the Project menu Micrium uC OS II and uC Probe for the NXP LPC1768 SK CPUs JAR Embedded Workbench IDE Fie Edit view MJES Tools Window Help Add Files Jl VER D POH UR H Add Group Import File List Edit Configurations Remove Create New Project Add Existing Project Options Source Code Control Make Compile Rebuild All Clean Batch build Stop Build Debug Make amp Restart Debugger Figure 1 2 IAR EW Opening an existing project IAR EWARM Versions Be certain to open the proper project for your version of EWARM The NXP LPC1768 examples project was built using EWARM ver 5 4 1 03 02 IAR pC OS II Kernel Awareness The pC OS II Kernel Awareness plug in will allow you to examine information about system objects while using the C Spy debugger To gain access to this feature enable the plug in by right clicking on the project name in the work space browser and choosing Options Then select the Debugger entry in the list box and the Plug in tab pane Find the C OS II entry in the list and finally select the check box beside the entry Make sure you select
2. 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 2 Open wC Probe After downloading and installing this program open the example uC Probe workspace for wC 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 Connect Target to PC Currently uwC Probe can use RS 232 to retrieve information from the target You should connect a RS 232 cable between your target and computer 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 1x unless you specify otherwise To load this ELF file right click on the symbol browser and choos
3. The supported data types are booleans integers floats and ASCII strings uC Probe can have any number of data screens where these variables are displayed This allows to logically group different views into a product A 30 day trial version of C Probe is available on the Micrium website http www micrium com products probe probe html Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs 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 LPC1768 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 the software port described in this document uses the module versions in the table below Version Comment uCiOS I veo pS T C See Also In addition to the pC OS II pC FS wC USB Device C USB Host uC USB OTG yC TCP IP have been ported to the LPC17xx processors Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs 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 nu
4. 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 CMP Books Inc Century Plaza 1601 W 23rd St Suite 200 1065 E Hillsdale Blvd Lawrence KS 66046 9950 Foster City CA 94404 USA USA 1 785 841 1631 1 650 287 4250 1 785 841 2624 FAX 1 650 287 4253 FAX e mail rushorders cmpbooks com e mail Info IAR com WEB http Awww cmpbooks com WEB www IAR com Micrium 949 Crestview Circle Weston FL 33327 USA 1 954 217 2036 1 954 217 2037 FAX e mail support micrium com WEB www micrium com
5. 768 SK IAR BSP OS Probe LPC1768 SK Board Support Package LPC1768 IAR example project uC CPU ARM Cortex M3 IAR Doc uC LIB Doc Ports ARM Cortex M3 C OS II IAR ARM Cortex M3 Ti uC OS II port The Real Time uCOS II Doc uC OS II Ports i ARM M documematon i aed i pC OS II processor IAR independent source Source code Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs uC Probe Target uC Probe Communication Real Time Monitor DCC Generic Target Communication OS RS 232 RS 232 cane Communication NXP LPC17xx Source Source Workspace uC Probe Demos RS232 LPC17xx uC Probe Intro Ports Source uC OS II Plug in Workspa s Plugins uCOS II Figure 1 1 Directory Structure 1 02 Setting up the Hardware The processor can be programmed and debugged trough the 20 pin JTAG port using a JTAG emulator such as J Link The board can be power up from a standard 5v DC converter J Link or the USB connector The Power select jumper PWR_SEL will determine the power supply used To use uC Probe with the LPC1768 SK download and install the trial version of the program from the Micrium website as discussed in section 5 After programming your target with one of the included projects connect a RS 232 cable between the board and your PC configure RS 232 options and start running the program 1 03 Opening the Examples Projects
6. Micripm uC OS II and C Probe for the NXP LPC17xx CPUs Micrium Empowering Embedded Systems uC OS II uC Probe and the NXP LPC17xx Processors on the IAR LPC1768 SK development Board Application Note AN 1080 www Micrium com Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs 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 C 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 Thank you for your interest in pC OS II wC OS II is a preemptive real time multitasking kernel yC OS II has been ported to over 45 different CPU architectures and now has been ported to the NXP LPC17xx processors uC OS II is small yet provides all the services you would expect from an RTOS task management time and timer management semaphore and mutex message mailboxes
7. TaskCreateExt with the stack checking option set Listing 3 2 Note 4 Mem Init initializes the C LIB memory management module Mem Math initializes the pC LIB mathematical module Listing 3 2 Note 5 BSP_Ser Init Initializes the RS 232 communication port at 115200 Listing 3 2 Note 6 If 1 C OS Probe is enabled then the module s initialization procedure App_ProbeInit is called App _ProbeInit calls OSProbe Init which initializes the 18 Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs uC Probe plug in for wC OS II which maintains CPU usage statistics for each task ProbeCom_Init that initializes the pC Probe generic communication module and ProbeRS232_ Init that initializes the RS 232 communication module After these have been initialized the uC Probe Windows program will be able to download data from the processor For more information see Section 6 Listing 3 2 Note 7 App_EventCreate Creates all the application uC OS I events and App_TaskCreate creates all the application tasks Listing 3 2 Note 8 Any task managed by uC 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 it toggles the LEDs 3 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
8. and queues event flags a 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 uC 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 LPC1768 SK CPUs About C Probe uC Probe is a Windows application that allows a user to display the value at run time of virtually any variable or memory location on a connected embedded target The user simply populates C 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
9. e Add Symbols Configure the RS 232 Options In pC 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 b Start Running You should now be ready to run uC Probe Just press the run button to see the variables in the open data screens update Figure 6 3 displays two screens in the pC OS Il workspace which display detailed information about each task s state 23 Micrium uC OS II and uC Probe for the NXP LPC17xx CPUs Options Options E Communication Settings Setti RS 232 oe Bi RS 232 usB Link COM Port cOM i TCPAP O J Link Hew Target Server oe USB USB Baud Rate 115200 E Environment TCPAP UDP E Environment General General Screen Screen Target urate Target symbols sec bytes sec Slow queue update period sec C Calculate communication timeout automatically Wait Time ms Figure 5 2 C Probe Options T7 Micrium pC Probe 0S Probe Workspace wsp Jasmoig joquits G Figure 5 3 C Probe Run Time pC OS II Task Information Micripm uC OS II and C Probe for the NXP LPC17xx CPUs Licensing yuC OS II is provided in source form for FREE evaluation for educational use or for
10. 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 information about the purpose of each define can be found in Task sizes for the Idle OS_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 63 allowing up to 64 total tasks e OS MAX TASKS determines the number of application tasks and is currently set to 20 allowing 13 more tasks to be added to the example code 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 when the BSP_OS TmrTickInit is called if you change this value You would typically set the tick rate between 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 Micrium uC OS II and C Probe for the NXP LPC1768 SK CPUs 4 Board Support Package BSP The Board S
11. g this appnote is provided for evaluation purposes only If you choose to use WC 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 I Ports ARM Generic IAR 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 LPC1768 SK CPUs yC Probe Files Micrium Software uC Probe Communication Generic This directory contains the C Probe generic communication module the tar
12. get 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 LPC17xx These directories contain probe_rs232c c and probe_rs232c h the NXP LPC17xx port for the RS 232 communications Micrium Software uC Probe Communication Generic Source RS 232 O0S uCOS I1 This directory contains probe_rs232_os c which is the C OS II port for the pC Probe RS 232 communication module Micrium Software uC Probe Demos Intro Source This directory contains probe_demo_intro c which contains a self explanatory introductory demo showing how t
13. ill then begin executing App _TaskStart since that is the highest priority task created both OS TaskStat andOS_ TaskIdle having lower priorities Sita tC Ol CAD Omics kS tare vond pang void p_ arg BSP Taire Note 1 BSP_OS TmrTickInit OS TICKS PER SEC Note 2 if OS _TASK STAT EN gt 0 OSStatInit Note 3 endif Mem Init Note 4 Maci TARE BSP SerInit 115200 Note 5 ANDY WV IA TNO i i ae if APP CFG PROBE COM MODULE EN DEF ENABLED APP CFG PROBE OS PLUGIN EN DEF ENABLED App ProbeInit Note 6 endif APP TRACE INFO Creating Application Events n r App EventCreate Note 7 APP TRACE INFO Creating Application Tasks n r App TaskCreate while DEF TRUE Note 8 BSP LED Toggle 0 OSTimeDlyHMSM 0 0 0 100 Listing 3 2 App TaskStart Listing 3 2 Note 1 BSP PostInit initializes the Board Support Package drivers that are related to the OS or use a OS service semaphores mutexes queues etc Listing 3 2 Note 2 BSP_OS_ TmrTickInit Initializes the tick interrupt Listing 3 2 Note 3 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 tasks that have been created with OS
14. kage Configuration 21 4 03 Tick Interrupt code 21 5 yuC Probe 22 Licensing 25 References 25 Contacts 25 Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs 1 Getting Started The following sections step trough the prerequisites for using the demonstration application described in this document AN 1080 First installation of software and the setup of the hardware will be outlined Second the use and setup of the IAR embedded Workbench Thirdly the steps to build the projects and load the application onto the board trough JTAG will be described Lastly instructions will be provided for using the example application 1 01 Installing the Micirum Software The source code for wC OS II is provided in source form along with IAR Embedded Workbench for ARM project files that allow you to run wC OS II on the IAR LPC1768 SK development board To install the software simply run the self extracting executable Micrium NXP uCOS II LPC1768 SK exe You will be prompted to accept the simple terms of the licensing agreement If you answer Yes the software will be installed on your PC under the Micrium directory from the root as shown in Figure 1 1 Micrium AppNotes AN 1018 Licensing agreements acs AN1018 uCOS II Cortex M3 If hC OS ae AN1080 uCOS II NXP LPC1768 SK AN 1080 commercially AN9xxx MULT Contact AN 9913 PROBE DEMO INTRO www Micrium com for pricing Licensing Software EvalBoards NXP LPC1
15. mbers 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 LPC1768 SK CPUs Table of Contents 1 Getting Started 7 1 01 Installing the Micirum Software 7 1 02 Setting up the Hardware 8 1 03 Opening the Examples Projects 8 1 03 01 IAR Example Project 8 1 03 02 IAR pC OS II Kernel Awareness 9 1 03 03 IAR Project Options 10 1 04 Running the Example Applications 10 2 Directories and Files 12 3 Application Code 16 3 01 app c 16 3 02 os_cfg h 19 4 Board Support Package BSP 20 4 01 BSP bsp_xxx c and bsp_xxx h files 20 4 02 Board Support Pac
16. nd 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 uC Probe currently interfaces with a target processor with a RS 232 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 Fl Micrium pC Probe AT91SAM9263 0S Probe Workspace wsp iix Home Numeric Meters Graphs Sliders Tanks Miscellaneous Switches Leds Dials Levels 7 3 5 2 Workspace Ex HC OS II Workspan Ml 0S About ED 0S General Info EB 0S Task CPU Usage OS Task Stack Usage OS Task Info Gi OS Events OS Timers 0S Configuration General HOS Configuration E vents Timers 4 OS About_ OS General Info OS Task CPU Usage OS Task Stack Usage 0S TaskInfo OS Events OS Timers OS Configuration General OS Configure 4 gt X Start Button This button switches between Design and Run Time Views During Run Time View when data is A cou
17. nter is kept in the uC Probe OS plug in callback which is displayed with this gauge eg Atmel AT915AM9263 EK collected this will sat i Symbol Browser appear as a stop button appe T M a blue square 7 os_epuee SP TR ETCTeTSRENE TE sonar m E os_dbg c evaluation board which employs the Atmel m I os_dec c AT91SAM9263 processor Accompanying this E C os_probe c workspace is the source code for this example project probe_com c demonstrating how easily yC Probe can be used to m _ probe_com_os c provide greater insight into the behavior of your a E probe_rs232 embedded target m C probe_ts232_os c Download the code onto the target start execution on the target and then press the Start button on the upper left tool bar in this program The components to the right labels LEDs gauges e with values Symbol Browser Bataio Contains all symbols from the ELF files added to the workspace t this obe refer to the pC Probe user manual or visit www micrium com Ready RS 232 115200 COM7 Disconnected sa 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 Figure 5 1 C Probe Windows Program Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs To use pC Probe with the example project or your application
18. nts are labeled in the figure 1 4 Once the program is loaded onto the target the LEDs will start blinking The system state will be output to the color LCD display the joystick toggle left right can be used to move the output to a new item Micrium yC OS II and uC Probe for the NXP LPC1768 SK CPUs USB OTG port ice webeat ae uC OTG RS 232 for icia S Een aiea AN uC USB Host goa g i gt 3 k JTA connector Color LCD Nokia 6610 User s Push Jovstick User s Push Buttons High Speed SDCard interface HC FS Figure 1 4 IAR LPC1768 SK Development Board The RS232 port labeled RS232 for uC Probe is used for pC Probe at 115200 baud which allows you to view in real time the value of any variables in the target system Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs 2 Directories and Files Application Notes Micrium AppNotes ANIxxx RTOS AN1018 uCOS II Cortex M3 This directory contains AN 1018 pdf the application note describing the ARM Cortex M3 port for pC OS II Micrium AppNotes AN1xxx RTOS AN1080 uCOS H NXP LPC1768 SK This directory contains this application note AN 1080 pdf Micrium AppNotes AN9xxx MULT AN 9913 PROBE DEMO INTRO This directory contains this application note AN 9913 pdf describing the introductory demo for uC Probe Licensing Information Micrium Licensing Licensing agreements are located in this directory Any source code accompanyin
19. o use p C Probe consult the application note AN 9913 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 ARMVIAR 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 Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs uC 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 The files lib_mem c and lib_mem h contain code to replace the standard library functions memclr memset memcopy and memcmp These functions are replaced by Mem Clr Mem Set Mem Copy andMem Cmp respectively The files lib_str c and lib_str h contain code to replace the standard library functions str with the equivalent Str _ functions The files lib_str c and lib_str h contain code to replace the standard library f
20. ocessor e includes h is the master include file used by the application Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs os_cfg h is the pC OS II configuration file cpu_cfg h is the uwC CPU configuration file probe_com_cfg h is the pC Probe configuration file LPC1768 OS Probe are the IAR Embedded Workbench project files for the IAR LPC1768 SK board Micrium Software EvalBoards NXP LPC1768 AR BSP This directory contains the Board Support Package and chip support package for the IAR LPC1768 SK development board and LPC1768 processor bsp c h contain generic BSP functions which initialize critical processor functions e g the PLL and provide support for peripherals such as the push button and LEDs bsp_int c h contain routines to install ISRs and enable disable interrupt sources bsp_pmc c h_ Contain basic function to enable disable and retrieve clock frequency information from the peripheral and system clocks bsp_ser c h Provide simple serial interface for tracing functionality bsp_gpio c h Contain basic functionality to configure and manipulate I Os pins Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs 3 Application Code The example application described in this appnote AN 1080 is a simple demonstration of pC OS II and yC OS Probe for the NXP LPC1768 processors on the IAR LPC1768 SK developments board 3 01 app c Four functions of interest are located in app c 1 main is the en
21. rtup amp err endif OSStart Note 7 necurn 1 Listing 3 1 main Listing 3 1 Note 1 As with most C applications the code starts in main Listing 3 1 Note 2 CPU_Init initialize the pC CPU module CPU NameSet setthe CPU Host Name Listing 3 1 Note 3 CPU_IntDis Disable all the interrupts All interrupts are disabled to make sure the application does not get interrupted until is fully initialized Listing 3 1 Note 4 OSInit must be called before creating a task or any other kernel object as must be done with all wC OS II applications Listing 3 1 Note 5 At least one task must be created in this case using OSTaskCreateExt to obtain additional information about the task In addition pC OS II creates either one or two internal tasks in OSInit pC S II always creates an idle task OS_TaskIdle and will create a statistic task OS_TaskStat if you set OS_TASK_STAT_EN to 1 in os_cfg h Listing 3 1 Note 6 You can name pC 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 given 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 17 Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs Listing 3 1 Note 7 Finally multitasking under pC OS II is started by calling oSStart puC OS HI w
22. sing the following define Defines the BSP_SER_COMM UART_00 serial port used BSP_SER_COMM UART 01 to output the system state BSP CFG SER COMM SE 4 03 Tick Interrupt code Listings 5 2 gives the C OS II timer tick initialization function BSP_OS_TmrTickInit Voli s PEO Smumrninncaintau PUR NSU Meck w a ctasSc CPU_INT32U ents CEUR ENTS ZURE pU rEg cpu _ freq BSP_PM_CPU _FreqGet BSP_SYS_CLK_ID_MCIK Note 1 enes cpu freq tick_rate Note 2 OS_CPU_SysTickInit cnts Listing 5 2 BSP_OS_TmrTickInit The pC OS II ARM Cortex M3 port uses the SysTick timer On the NXP LPC17xx processors the SysTick clock is the CPU clock Listing 5 2 Note 1 Get the CP clock frequency Listing 5 2 Note 2 Calculate the reload value Listing 5 2 Note 3 OS_CPU_SysTickInit initialize the SysTick timer with the number of SysTick counts between two OS tick interrupts 21 Micripm yC OS II and uC Probe for the NXP LPC1768 SK CPUs 2 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 uC Probe The user places components such as gauges labels and charts into a Data Screen in a pC Probe workspace a
23. the correct plug in for the correct version of pC OS II e uC OS II for version 2 86 and earlier for wC OS II version 2 86 and earlier e uC OS II for wC OS II version 2 87 and above Micripm yC OS II and uC Probe for the NXP LPC1768 SK CPUs Options for node AT91SAM3U 0S Probe x Category Factory Settings General Options C C Compiler Assembler Output Converter Setup Download Extra Options Images Plugins Custom Build h Build Actions Select plugins to load Linker OSE Epsilon Power Pac RTOS Simulator ThreadX Angel uC OS II for versions 2 86 and earlier GDB Server V pC OS ll IAR ROM monitor Code Coverage J Link J Trace ORTIATOS LMI FTDI Description RTOS awareness for CMX Macraigor p Location C Program Files AR Systems Embedded Workbench 5 4_ Third Party Driver Originator IAR Systems Version 5 40 0 51529 Figure 1 3 Enabling the pC OS II Kernel Awareness Plug In 1 03 03 IAR Project Options The IAR project configurations allow you to compile link and load the software in different ways to the target The following configuration is available in the IAR project e FLASH This project option is configured to load the code into the Internal 256Kb Internal Flash 1 04 Running the Example Applications The example project includes a basic demonstration of wC OS II and pC Probe The evaluation board compone
24. try point for the application as it is with most C programs This function initializes the operating system creates the primary application task App TaskStart begins multitasking and exits 2 App _TaskStart after creating the application events and tasks enters an infinite loop in which it blinks the LEDs 3 App_TaskKbd polls the user inpbuts Board s Joystick and if new input is detected places a message in a mailbox for App _TaskUserIF 4 App TaskUserIF Outputs the state of the system based on the display state passed to it by App TaskKbd 16 Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs int main void Note 1 if OS TASK NAME EN gt 0 Pu WNWOSw Cis endif if CPU_CFG NAME EN DEF ENABLED CPU_ERR cpu_err endif CPU_Init Note 2 if CPU_CFG NAME EN DEF ENABLED CPU_NameSet CPU_CHAR LPC1768 CEURERR EE E CPU Rer E endif CRU Wines 2 Note 3 Semen ten Note 4 OSTaskCreateExt void void App TaskStart Note 5 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 CEG TASK START STK SIZE void On INT8U OS_TASK OPT _STK_CHK OS TASK OPT _STK_CLR if OS TASK NAME EN gt 0 Note 6 OSTaskNameSet APP CFG TASK START PRIO CPU_INTO8U Sta
25. unctions str with the equivalent Str _ functions The files lib_ascii c and lib_ascii h contain code to replace the standard library character classification and case conversion functions amp macros such as tolower toupper isalpha isdigit etc These functions are replaced with ASCII ToLower ASCII _ToUpper ASCII _IsAlpha and ASCII IsDig The files lib_math c and lib_math h contain code to replace the standard mathematics functions such as rand srand etc These functions are replaced with Math Rand Math RandSetSeed The reason Micium declare its own function of for third party certification for avionics and medical use Micrium Software uC LIB Doc This directory contains the documentation for pC LIB Application Code Micrium Software EvalBoards NXP LPC1768 SKVIAR OS Probe This directory contains the source code the 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 app_probe c h contain code to initialize wC Probe e app_hooks c h contain code for the pwC OS II application hooks e app_yvect c contain the initialization code for the NXP LPC17xx pr
26. upport 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 LPC1768 SK board 4 01 BSP bsp_xxx c and bsp_xxx h files Figure 4 1 shows the relationship between the BSP s functions list and the most important components on the Processor development boards Serial Interface OS Layer Power Management controller bsp_ser c h bsp_os c h bsp_pmc_ctrl c h BSP SerInit BSP OS SemCreate BSP PM PerClkEn BSP SerPrintf BSP OS SemWait BSP PM PerCl1kDi BSP SerRdByte BSP_OS_SemPost BSP PM PerCl BSP SerRdStr BSP_OS _TmrTickInit BSP_SerWrByte BSP_OS_ TimeDlyMs BSP PM CPU Cl BSP SerWrStr Parallel Input Output Joystick Controller Interrupt Controller bsp c h bsp_gpio c h bsp_int c h BSP Joy GetStatus BSP GPIO Cfg BSP_IntDis BSP Joy GetPos BSP GPIO Clr BSP IntDisAll BSP GPIO StatusGet BSP_IntEn Push Buttons BSP_GPIO Toggle BSP IntClr a BSP GPIO Set BSP IntInit BSP_GPIO_IntClr BSP_IntVectSet BSP PB GetStatus LEDs bsp c h ED On ED Off ED Toggle Figure 4 1 BSP s Functions List for the LPC1768 SK 20 Micripm uC OS II and C Probe for the NXP LPC1768 SK CPUs 4 02 Board Support Package Configuration The serial port used to output the system state can be configured at compile time u

Download Pdf Manuals

image

Related Search

Related Contents

OWNERS MANUAL - Club Piscine  Manual Vídeo Porteiro 070  Maxigrout  OUST® CHANDELLE - FRAÎCHEUR PLEIN AIR  AQUA STEAM POWER GOLD DAMPFREINIGER  Harbor Freight Tools 96144 User's Manual  VISUALIZZATORI 300S - Acu-Rite  

Copyright © All rights reserved.
Failed to retrieve file