Home

View - Lysator

image

Contents

1. Listing 5 3 Note 2 OSTimeTick informs pn C OS II of the tick interrupt 24 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU uC Probe yu C 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 uC 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 m E Home Numeric Meters Graphs Sliders x E amp a LIEN 3 Alignment Workspace Explo 0S Generalinfo OS Task Info OS Task CPU Usage OS Task Stack Usa
2. Micrium Empowering Embedded Systems uC OS Il uC Probe and the NXP LPC2478 Using the IAR LPC2478 SK board Application Note AN 1479 www Micrium com Micrium uC OS II and uC Probe for the NXP LPC2478 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 pC OS II features the highest quality source code available for today s embedded market Micrium delivers to the embedded markeiplace 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 Il is a preemptive real time multitasking kernel pu C OS I has been ported to over 45 different CPU architectures u C OS I 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 uC OS II delivers on all your expectations and you will be pleased by its ease of use Licensing Uu C O
3. APP CFG TASK START PRIO APP CFG TASK START PRIO AJ amp App TaskStartsSstkIoOT APP CFG TASK START STK SIZE 0 OMEN 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 uyC OS II applications 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 pu C OS II always creates an idle task OS TaskrIdle and will create a statistic task OS TaskStat if you set OS TASK STAT EN to 1 in os cfg h Listing 4 1 Note 5 As of V2 6x you can now name u C 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 Listing 4 1 Note 6 Finally multitasking under
4. Listing 5 1 Note 1 All the Peripherals are initialized Listing 5 1 Note 2 The un C OS II tick interrupt source is initialized Listings 5 2 and 5 3 give the u 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 static void BSP Tmr TickInit void CPU INT32U pelk freg YVILCLNITSELZCII VICVECTADDR4 VICVEC PER LOR IWEY 4 VICINTENABLE l lt lt NAC AAO CPU Nes 72 ENSIS Tmi eal tlhe c mele ta Note 1 T5 L lt x VIC TIMERO pelk rreg rLla cente TOTCE THES TOC BOPNCPUSECUN ESSEN Clik sy Tila Os Polk rea OO T PER OEC Note 2 Cin 0 0 TOMRO TOMCR iJ cmoniss Note 2 3 TOCCR Or TOEMR QS MOREE iL Listing 5 2 BSP_Tmr TickInit Listing 5 2 Note 1 The tick ISR handler is programmed into the Vectored Interrupt controller and the interrupt is enabled Listing 5 2 Note 2 The number of counts per tick is calculated Listing 5 2 Note 3 The calculated re load value is programmed into the Timer Match O the timer interrupt is enabled and the timer is started 23 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU void BSP Tmr TickISR Handler void TOIR OxXEE gt Note 1 aequam eue Note 2 Listing 5 3 BSP Tnr TickISR Handler Listing 5 3 Note 1 The timer O interrupt is cleared
5. e BSP IntDisAL11 is called to disable all interrupts thereby preventing any interrupts until the processor is ready to handle them e BSP CPU ClkFreq returns the CPU clock frequency in Hz e BSP CPU PclkFreq returns the peripheral clock frequency in Hz based on the ID of the peripheral LEDs Functions 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 Push Buttons Functions e BSP PB GetStatus returns the status of the board s push buttons corresponding the ID passed as the argument ADC Functions e BSP ADC GetStatus returns the status of the ADC corresponding the ADC channel passed as the argument 21 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU Serial Interface Functions BSP Ser Init Initializes the serial port UART 0 BSP Ser WrByte and BSP Ser WrStr writes a byte and a string respectively to the serial port UART 0 BSP Ser RdByte and BSP Ser RdStr reads a byte and a string respectively to the serial port UART 0 BSP Ser Printf write a formatted C string to the serial port LCD Interface Functions BSP LCD Init BSP LCD TurnOn and BSP LCD TurnOff will initializes turn On and turn off the LCD display These functions will not be necessary if the GLCD library is used for acc
6. II which maintains CPU usage statistics for each task ProbeCom Init which initializes the uC 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 uC Probe see AN 9913 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 4 2 Note 4 App TaskCreate Creates all the application task App EventCreate creates all the application events in there a mailbox is created When the either the Next or Prev button are pressed the App TaskTouchScr will send a message to App TaskUserIF With the value of the state of the user interface changing the LCD output 19 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU Listing 4 2 Note 9 Any task managed by u C 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 uC 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 informat
7. OS II Stat uC OS II Idle Micrium uC OS II and uC Probe for the NXP LPC2478 CPU priority Function SOS Pw Starts uC OS Probe reads ADCs blinks LEDs Monitors the state of the Touch Screen Additionally this task draws the cursor using the LPC2478 Cursor Controller capabilities and sends messages to the App TaskUserIF Outputs the system state through the LCD display Updates CPU usage for uC Probe IAR Kickstart Kits Demo for the demo version of u C Probe L8 Executes when no other task is executing 2 3 4 7 7 29 30 31 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU 3 Directories and Files Application Notes Micrium AppNotes 4N1xxx RTOS AN1014 uCOS H ARM This directory contains AN 1014 pdf the application note describing the ARM port for n C OS I1 and AN 1014 PPT pdf a supplement to AN 014 pdf Micrium AppNotes AN1xxx RTOS AN1479 uCOS H NXP LPC2478 SK This directory contains this application note AN 1479 pdf Micrium AppNotes AN9xxx MULT AN 9913 IAR Probe Demo This directory contains this 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 uC OS II Files MicriumNSoftwareNuCOS IINDoc This direct
8. Source KSD u C Probe NSource IAR Kickstart Kits NWorkspace Demo Plugins AN 9913 NuCOS II Figure 2 1 Directory Structure 10 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU 2 03 Using the IAR Projects An IAR projects is located in the directory marked IAR Example Project in Figure 2 1 Micrium Software EvalBoards NXPMA R LPC2478MA R LPC2478 SK The example project LPC2478 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 LPC2478 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 2 03 01 uC OS II Kernel Awareness When running the IAR C Spy debugger the uC 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 wC OS II Kernel Awareness Plug In is currently enabled then a uC OS Il 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 pC 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 boa
9. be included In either case the software port described in this document uses the module versions in the table below Module Version Comment YEI ve SS CiProbe vag SS Micrium uC OS II and uC Probe for the NXP LPC2478 CPU Document Conventions Numbers and Number Bases Hexadecimal numbers are preceded by the 0x prefix and displayed in a monospaced font Example 0xFF886633 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 Other numbers in the document are decimal These are displayed in the proportional font prevailing where the number is used Typographical Conventions Hexadecimal and binary numbers are displayed in a monospaced font 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 File and directory names are always displayed in an italicized serif font Example Micrium Sofware uCOS Il Source A bold style may be layered on any of the preceding conventions or in ordinary text to more strongly emphasize a particular detail Any other text is displayed in a sans serif font Micrium uC OS II and uC Probe for the NXP LPC2478 CPU Table of Contents
10. wC OS II is started by calling OSSTart wC OS II will then begin executing App TaskStart since that is the highest priority task created both OS TaskStat andOS TaskIdle having lower priorities 18 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU static void App TaskStart void p arg CPU_INT32U i CT UNS gt 19s CPU INTOGU err roid ena ce BSP Init if OS TASK STAT EN gt 0 OSStatInit fendif if APP CFG PROBE COM MODULE EN DEF ENABLED App ProbeInit fendif App UserIF Scr APP USER IF SCR FIRST App TaskCreate App EventCreate BSP LED Off 0 while DEF TRUE BSP LED On 1 OSTimeD1yHMSM 0 BSP LED Off 1 OSTimeD1yHMSM 0 BSP LED On 2 OSTimeD1yHMSM 0 BSP LED Off 2 OSTimeD1yHMSM 0 Listing 4 2 App TaskStart Listing 4 2 Note 1 BSP Init initializes the Board Support Package the I Os tick interrupt etc oee Section 5 for details Listing 4 2 Note 2 OSStatInit initializes uC OS Il s statistic task This only occurs if you enable the statistic task by setting OS TASK STAT EN to 1 inos 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 OSTaskCreateExt with the stack checking option set Listing 4 2 Note 3 App ProbeInit initialize uC Probe This function calls OSProbe Init which initializes the uC Probe plug in for uC OS
11. 1 Introduction 7 2 Getting Started 9 2 01 Setting up the Hardware 9 2 01 01 Powering the board 9 2 01 02 Using uC Probe 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 14 4 Application Code 17 4 01 app c 17 4 02 os cfg h 20 5 Board Support Package BSP 21 5 01 BSP bsp c bsp lcd c bsp_touchscr and bsp h 21 6 yu C Probe 25 Licensing 28 References 28 Contacts 28 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU 1 Introduction This document AN 1479 explains example code for using pC OS II and p C OS Probe with the IAR LPC2478 SK Development board as shown in Figure 1 1 which employs NXP s ARM7TDMI based LPC2478 microcontroller The processor includes 512 kB on chip flash memory and 64 kB SRAM in addition to dedicated SRAM for the EMAC and DMA peripherals Additionally the chip includes serial interfaces such as an internal 10 100 EMAC USB device and host with support for an external OTG transceiver two CAN channels a SPI controller two SSP controllers four UARTs and several IC and S interfaces Additionally the chip has a SD MMC card interface many general purpose I O pins and a 10 bit A D converter The IAR LPC2478 SK board includes the following peripherals e PC2478 device e RS232 with ICSP control e LCD 3 5 320x200 24bit color TFT with e SD MMC card connector backlight and touch scre
12. 32 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 6 Start Running You should now be ready to run pC Probe Just press the run button 4 to see the variables in the open data screens update Figure 6 3 displays the wC OS II workspace which displays detailed information about each task s state 26 Uptions Uptions E Communication Settings amt Ai wnicatior Settings RS 232 USB Link TUNI J Link Hew Target Server TCPAIP USB Baud Rate S Environment 2 TERAP IDDI E Environment General General Screen Screen Hpeate ba Target symbols sec bytes sec Slow queue update period sec C Calculate communication timeout automatically Figure 6 2 wC Probe Options Micrium pC Probe 0S Probe Workspace wsp Jejo d 3 a2eds uo A ESj jasmoig joquits GE Figure 6 3 uC Probe Run Time C OS II Task Information Micrium uC OS II and uC Probe for the STMicroelectronics STM32 CPU Licensing uC OS II is provided in source form for FREE evaluation for educational use or for peaceful research If you plan on using u C 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 u C OS II The fact that the source is provided does NOT mea
13. 4002F28 04002028 Keyboard 8 4 Dly 30 157 04003060 34x 234 176 120 512 04003128 o4002F28 Probe Str q 5 Dly 12 i7 4 003278 45 34x 232 176 512 04003328 04003128 Probe OS PlugIn 4 6 Dly 30 157 04001370 ax fs 200 144 2048 04001400 40 00c0c00 ESD LED Task 6 7 Dy 10 780 O40034a40 37x 264 192 136 512 04003528 04003328 Probe R amp 5 232 5 11 Sen 0 Probe R amp 5 232 1 04002766 17x lee 184 128 1024 4 027E8 040023E8 ul OS II Tar 2 61 Sen 0 OS TmrSig 52 4 003A 8 35 254 164 128 512 4003B28 04003328 ucz DS II Stat 1 62 Dly 81 79 4 040036C0 aiz 204 160 104 512 04003728 04003528 gt uleOS II Idle 0 63 Ready 334 4 0 038Cl 20 204 104 104 512 04003928 04003728 Figure 2 3 uC OS I Task List 2 04 Example Applications Once the program is loaded onto the target the LEDs will begin blinking The system state will be updated using the LCD display There are several screens showing information related to the hardware and u C OS II as shown in Figure 2 4 To move to another item and the LCD the user should touch the Next or the Prev buttons Figure 2 4 IAR LPC2478 SK LCD Output Touch Screen Le Buttons Including the un C OS II system tasks the example application includes several tasks as listed in Table 2 1 12 Task Name App TaskStart Start Task App TaskTouchsScr Touch Screen App TaskUserIF User IF Probe OS Plugin KSD LED Task Probe RS 232 uC OS Il Tmr uC
14. LPC2478 processor on the IAR LPC2478 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 uC OS II The Real Time Kernel used on the NXP LPC2478 processor without the clutter or confusion of a more complex example 4 01 app c Four 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 Jj App TaskTouchScr Monitors the state of the Touch Screen and draws the cursor pointer using the LPC2478 Cursor Controller Hardware 4 App TaskUserIF Outputs the state of the system based on the display state passed to it by App TaskTouchScr Micrium uC OS II and uC Probe for the NXP LPC2478 CPU void main void Note 1 CPU TUNER SIE err ESSERI SES EIE O Note 2 OSInit Note 3 ECOSSE Tak SIE Note 4 Do amp amp App TaskStartStk APP CFG TASK START STK SIZE 1
15. S Il is provided in source form for FREE evaluation for educational use or for peaceful research If you plan on using u C OS Il 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 u 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 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU About uC 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 u 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 u C 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 u C Probe can have any number of data screens where these variabl
16. _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 un C OS II port for the un C 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 p C 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 LPC24xx This directory contains probe_rs232c c and probe_rs232c h the LPC24xx port for the RS 232 communications Micrium Software uC Probe Communication Generic Source RS 232 OS uCOS II This directory contains probe rs232 os c which is the un C OS II port for the uC Probe RS 232 communication module Micrium Software 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 u C Probe Micrium Software uC Probe Target Demo KSD Workspace This directory contains OS Probe Kickstart Demo Workspace wsp which is the generic uC Probe workspace the IAR Kickstart kits demo exam
17. en JTAG connector e MP3 decoder DSP codec VS1002D MICTOR TRACE connector 3 axis digital accelerometer with 11 bit Reset button accuracy 2 user buttons e 64M SDRAM Trim pot e USB host connector UEXT connector USB device connector Audio IN IrDA transceiver e Audio OUT e PS2 keyboard connector RTC battery e 100 Mbit Ethernet e RoHS CAN driver and connector Ethernet for uC TCP IP a wi wE C NE OU D X LICET Mamm CUM rt RS 232 for uC Probe USB Device for uC USB Device rik x aaaa t ae LE ce v a cs PR in 2 tma he gE oS E USB Host for uC USB Host LCD Display for uC GUI iiid e 3M jas Sn ue E CURRERE AS Lr HERRERA EE AREE ELE ELA NXP amp LPC2478 SD Card Slot USB State User LEDs Push Buttons Back View Figure 1 1 IAR LPC2478 SK Kickstart Kit Micrium uC OS II and uC Probe for the NXP LPC2478 CPU If this appnote was downloaded in a packaged executable zip file then it should have been found in the directory Micrium AppNotes AN Ixxx RTOS AN1479 uCOS II NXP LPC2478 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 uy C Probe is a Windows program which retrieves the value of variables form a connected embedded target and displays the values in an enginee
18. es are displayed This allows to logically grouping different views into a product This uC 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 u C Probe is available on the Micrium website http www micrium com products probe probe html About yu C Probe Full Version The full version of yu C 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 u 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 pu C Probe s data collection which will update the screen with variable values fetched from the target Micrium uC OS II and uC Probe for the NXP LPC2478 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 v1 00 2008 1072 Software Versions This document may or may not have been downloaded as part of an executable file Micrium NXP uCOS II LPC2478 SK exe containing the code and projects described here If so then the versions of the Micrium software modules in the table below would
19. ess the LCD These function are needed to be used with other Micrium s products e g uC GUI Touch Screen Interface Functions BSP TouchScr Init initializes the Touch Screen hardware BSP TouchScr Measurex this function measure the touch screen position in the x axis The value returned is in terms of the ADC resolution e g For 10 bits the values will be between 0x000 and Ox3FF BSP TouchScr MeasureY this function measure the touch screen position in the Y axis The value returned is in terms of the ADC resolution e g For 10 bits the values will be between 0x000 and Ox3FF BSP TouchScr Convert Convert the Touch screen coordinates from ADC values to Pixels The Touch Screen functions BSP TouchScr MeasureX BSP TouchScr MeasureY and BSP TouchScr Convert receives a pointer to the BSP TOUCH SCR STATUS structure defined as typeert struct bsp touch ser stacus CPU UNE Le Douehoer CPU INTLOU ToucnSerY C2U BOOLEAN TouchserisPressed BSP TOUCH SCR STATUS Where TouchScrX and TouchScryY are the coordinates and TouchScrIsPressed specified if the Touch Screen has been pressed form the last conversion function call 22 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU void BSP Init void BOPRSPLL Miel Note 1 BSP _ RTC Init BSP MAM Init BOP LED imit BSP PB Init BSP ADC te e 6 3e ctae camere Sie Wie c qnse deris 1 Note 2 Listing 5 1 BSP Init
20. ge OS About OS Events OS Timers Task CPU Usage iguration General iguration 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 For more information visit C OS II cH The Real Time str www micrium com 7j USB Setup c ico Y rnc Ihe D E i USB 34661 4650 Disconnected ak Figure 6 1 uC Probe Windows Program 25 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU To use uC Probe with the example project or your application do the following 1 Download and Install uC 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 u C 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 u C Probe with the IAR Kickstart kits 2 Open p C Probe After downloading and ins
21. ion about the purpose of each define can be found in Jean Labrosse s book uC OS IIl The Real Time Kernel 2nd Edition os_cfg h assumes you have u C OS IlI V2 83 or higher but also works with previous versions of n C OS I1 e OS APP HOOKS EN is set to 1 so that the cycle counters in the OS TCBS will be maintained e 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 u C 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 PRIOiS set to 63 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 pu C OS II will impose on the application However you will have better tick granularity with a higher tick rate 20 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU 5 Board Support Package BSP The Board Support Pac
22. kage 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 LPC2478 SK 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 bsp_Icd c bsp_touchscr and bsp h The file bsp c bsp_Icd c and bsp_touchscr c implement several global functions each providing some important service be that the initialization of processor functions for uC OS 1I 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 n C 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 several categories Critical Processor Initialization and Clock information e BSP Init is called by the application code to initialize critical processor features particularly the uC OS I 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 more details
23. n 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 uC 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 Awww AR com Micrium 1290 Weston Road Suite 306 Weston FL 33326 U S A 1 954 217 2036 1 954 217 2037 FAX WEB http Awww Micrium com
24. ory contains documentation for uC OS II Micrium Software uCOS I Ports ARM Generic IAR This directory contains the standard processor specific files for the generic n C 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 e os cpu h e os cpu a asm e Os Cpu c c e os dcc c e os dbg c With this port wC 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 14 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU u C Probe Files Micrium Software uC Probe Communication Generic This directory contains the pu C Probe generic communication module the target side code responsible for responding to requests from the pu C Probe Windows application including requests over RS 232 Micrium Software uC Probe Communication Generic Source This directory contains probe
25. ple for the demo version of uC Probe uC 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 15 These allow code to be independent of processor and compiler word size definitions Micrium uC OS II and uC Probe for the NXP LPC2478 CPU cpu a s contains generic assembly code for ARM7 and ARMS processors which is used to enable and disable interrupts within the operating system This code is called from C with OS ENTER CRITICAL and OS EXIT CRITICAG 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 Micrium Software uC LIB Doc This directory contains the documentation for n C LIB Application Code Micrium Software EvalBoards NXP LPC2478 SK IAR OS Probe This directory contains the soruce code the pC OS II and pC Probe example application app c contains the test code for the example application including calls to the functions that start multitasking within wC OS II register tasks with the kernel and update the user interface the LEDs the ADC the LCD and the
26. push buttons app cfg h is a configuration file specifying stack sizes and priorities for all user tasks and defines for important global application constants includes h is the master include file used by the application os cfg h is the un C OS II configuration file LPC2478 SK OS Probe Workspace wsp is an example uC Probe workspace LPC2478 SK OS Probe v5 2 v5 2 are the IAR EWARM v5 2x project files Micrium Software EvalBoards NXP LPC2478 SK IAR BSP This directory contains the Board Support Package for the IAR LPC2478 SK Kickstart Kit 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 bsp h contains prototypes for functions that may be called by the user 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 LPC2478 Flash icf is a IAR EWARM v5 xx linker file which contains information about the placement of data and code segments in the processor s memory map LPC2478_Flash mac contains instructions that are executed prior to loading code onto the processor 16 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU 4 Application Code The example application described in this appnote AN 479 is a simple demonstration of wC OS II and uC Probe for the NXP
27. r friendly format It interfaces with the IAR LPC2478 via RS 232C For more information including instructions for downloading a trial and the demo version of the program please refer to Section 6 zu Home Numeric Meters Graphs Sliders Tanks Miscellaneous Switches Leds Dials Levels le 4 a T of ud T4 Alignment M OS Configuration General ja OSs C 1 gt x OS General Info OS Task Info OS Task CPU Usage OS Task Stack Usage a OS About s OS Events a OS Timers s Task Stack Information B geek uesimen cs Pointer Maximum Current Starts Ends iasmosg oqui s GE jejjd 3 aoedssiojw GE uC OS II Idle uC OS II Stat uC OS II Tmr Start Probe RS 232 KSD LED Task Probe OS PlugIn Push Buttons SCP1000 Sensor Probe Str USB Task FS Task Probe USB MSD Task 0x20006C00 0x200069F0 0x20006DD8 0x200061D0 0x20005610 0x200067E8 0x20006FD8 0x200063D8 0x20002B98 0x200065E8 0x20003E10 0x20001388 0x200059D8 0x200041E0 80 512 112 512 104 512 228 512 112 1024 92 512 108 512 96 512 184 2048 124 512 680 4096 176 1024 376 1024 General Task Information 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 0x20006C48 0x20006A48 0x20006E48 0x20006248 0x20005688 0x20006848 0x20007048 0x20006448 0x20002C00 0x20006648 0x20003E88 0x20001400 0x20005AB8 0x20004288 0x20006A48 0x20006848 0
28. rd the uC OS Il menu should appear Options are 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 CIC4 Compiler Assembler Output Converter Setup Download Extra Options Plugins Custom Build Build Actions Linker Select plugins to load JSEGGER embOS OSE Epsilon Simulator Power Pac RTOS Angel Thread GDB Server vi wC 05 ll IAR ROM monitor Code Coverage J Link J Trace ORTI RTOS LMI FTDI Description RTOS awareness for CM Macraigor ines Location C Program Files 4R Systems E mbedded Workbench 5 2 Third Party Driver Originator IAR Systems Version 5 20 0 50993 OK Cancel Figure 2 2 Enabling the uC OS II Kernel Awareness Plug In 11 Micrium uC OS II and uC Probe for the NXP LPC2478 CPU Task List xj Name Ref Prio State Dly Waiting On __ Msg Cte Sv Stk Ptr HaxX CurX Max Cur Size Starts Ends Start Task 3 2 Dly 12 81 O4002CC0 40 204 208 104 512 04002028 04002B28 User I F 7 3 Hbox so 79 O4002EBO 46 23 240 120 512 O
29. structions will be provided for using the example application 2 01 Setting up the Hardware 2 01 01 Powering the board The IAR LPC2478 SK board can be power up using three different sources 6 9V AC External power adapter 9 12V DC External power adapter e Through J Link 2 01 02 Using uC Probe If uC Probe is being used then connect the RS 232 cable to the port labeled RS 232 for pu C 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 NXP uCOS II LPC2478 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 LPC2478 CPU Micrium AppNotes l anos Licensing agreements DE AN1014 uCOS II ARM Contact AN9xxx MULT www Micrium com AN9913 IAR Probe Demo for pricing Licensing Board Support Package Software EvalBoards BSP NXP LPC2478 SK Graphics LCD Library Provided by uCc CPuU IAR ARM IAR uC LIB IAR Example Project m uCOS II The Real Time Doc ARM7 ARM9 Ports u C OS Il port ARM wC OS II Generic documentation NIAR Source uC OS II processor independent source yu C Probe NuC Probe eda Real Time Monitor Target Communication DCC Target Generic Communication XOS NuCOS II RS 232 RS 232 NOS Communication NuCOS II NPorts NXP LPC24xx Port Source
30. talling this program open the example yu C Probe workspace for pu C OS Il named OS Probe Workspace wsp which should be located in your installation directory at Program Files Micrium uC Probe Target Plugins uCOS II 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 uC Probe user manual for directions for generating an ELF file with your compiler This file should be in Project Directory gt lt Configuration Name gt exe where Project Directory gt is the directory in which the IAR EWARM project is located extension ewp and Configuration Name 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 Project Name gt elf in EWARM v4 4x and Project Name out in EWARM v5 xx unless you specify otherwise To load this ELF file right click on the symbol browser and choose Add Symbols 5 Configure the RS 232 Options In su C 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 2
31. x20006C48 0x20006048 0x20005288 0x20006648 0x20006E48 0x20006248 0x20002400 0x20006448 0x20003A88 0x20000400 0x20005688 0x20003E88 Delay Waiting On Message Switches CPU Usage 30952 720 588 295 String 00012 String 00013 String 00014 String 00015 String 00016 String 00017 String 00018 String 00019 String 00020 String 00021 String 00022 String 00023 String 00024 String 00025 String 00026 String 00027 String 00028 uC OS II Idle uC OS II Stat uC OS II Tmr Start Probe RS 232 KSD LED Task Probe OS PlugIn Push Buttons SCP1000 Sensor Probe Str USB Task FS Task Probe USB MSD Task Semaphore Mailbox Semaphore Delay Delay Delay Delay Delay Delay Semaphore Ready Semaphore OS TmrSig Kbd Mbox Probe RS 232 App FS Lock uC USB Device ru C OS I p For more information visit The Real Time Kernel www micrium com Running USB 34661 4660 177469 bytes sec tp Figure 1 2 uy C Probe with Target Output Window Micrium uC OS II and uC Probe for the NXP LPC2478 CPU 2 Getting Started The following sections step through the prerequisites for using the demonstration application described in this document AN 1479 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 in

Download Pdf Manuals

image

Related Search

Related Contents

RM-770 ROBOT VACUUM CLEANER  Painéis pequenos Magelis - Manual do Utilizador HMI STO  Conditions générales du Contrat d`entretien et/ou  B R O A D B A N D R O U T E R 1 1 G W I R E L E S S    Fiche Technique - Enduit de lissage fermacell  dreamGEAR Magna Force  Omega FH3930B mobile headset  DNA IQ System-Small Sample Casework Protocol Technical Bulletin    

Copyright © All rights reserved.
Failed to retrieve file