Home

Asynchronous Serial Communication

image

Contents

1. BSP PwrCtrl Init BoP PwrCtrl CPU Modeser Bor PwrCrerl CPU ModeGer BOP PwrCtrl HCLK FreqGet BoP PwrCtrl HCLR Freqset BSP PwrCtrl POLE FreqGet BSP PwrCtrl POLK Freqset BoP PwrCrril SYSCiR Srcoet BoP PwrCtrl SYSCUR SrcGet BoP PwrCtrl sYochh Freqcet OS Layer bsp_os c h LEDs bsp c h BSP OS SemCreate BSP OS SemWait BSP OS SemPost Touch Screen controller bsp_touchscr c h BSP LED On Boe LED OTL Bor LED Toggle BoP OS TmrTickinit BSP Touchscr InNit E T BSP OS TmrTickISR_ Handler BoP Touchscr Getstactus Figure 5 2 BSP functions for the Phycore LPC3250 RDK 22 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs 5 02 Board Support Package Configuration Different aspects of the BSP can be configured at compile time allowing the user to select the version of the board the serial port used to output the system state or the timer used for the tick interrupt BSP CFG SER COMM SEL Defines the serial port used to output the system state BSP SER COMM UART 05 UART 5 BSP SER COMM UART 03 UART 3 Phytec LPC3250 only BSP SER COMM UART 02 UART 2 Phytec LPC3180 Only BSP CFG SER TMR SEL Defines the Match register used in the High speed timer module 0 1 or 2 for the tick Interrupt BSP CFG SOM VER Defines the version of the module board Phytec LPC3250 only BSP SOM VER 0 Phytec Module bo
2. Micrium Empowering Embedded Systems ucC OsS II uC Probe and the NXP LPC3250 LPC3180 Processors Using the phyCORE ARM9 LPC3250 LPC3180 Rapid Development Kit Application Note AN 1250 www WMicrium com Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x 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 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 Thank you for your interest in wC OS II wC OS II is a preemptive real time multitasking kernel uC OS II has been ported to over 45 different CPU architectures and now has been ported to the Phytec phyCORE ARM9 LPC3250 and phyCORE ARM9 LPC3180 Rapid Development Kit RDK evaluation boards which include the ARM based NXP LPC3250 and LPC3180 respectively processors uC OS II
3. INEO 2Creating Application Tasko n Appo TaskCreare l while DEF TRUE BoP LED Toggle 0 OSTimeD1yHMSM 0 ae NEE Pol elep loge lex0 7 OSTimeD1yHMSM 0 pe Oe oO Listing 4 2 App TaskStart 18 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs Listing 4 2 Note 1 BSP Init initializes the Board Support Package the I Os LEDs etc See Section 5 for details Listing 4 2 Note 2 OS CPU InitExceptVect Initializes the CPU interrupt vectors in RAM Listing 4 2 Note 3 BSP OS TmrTickInit Initializes the tick interrupt Listing 4 2 Note 4 OSStatInit initializes uC OS II 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 5 BSP Ser Init Initializes the RS 232 communication port at 115200 Listing 4 2 Note 6 If C OS Probe is enabled then the module s initialization procedure App ProbeInit is called App ProbeInit calls OSProbe Init which initializes the uC Probe plug in for wC OS II which maintains CPU usage statistics for each task ProbeCom Init that initializes the C Probe generic communication module and ProbeRS232 Init that initializes the RS 232 communication module After these have been in
4. as shown in Figure 1 1 Micrium AppNotes AN 1018 Licensing agreements ae a AN1014 uCOS II ARM cya AN1250 UCO6 I1 NXP LPC3xx lt ANTES commercially Licensing Contact Software www Micrium com EvalBoards for pricing NXP Phytec LPC3250 Board LPC3250 Phytec Support Package IAR Phytec LPC3180 Board BSP eee ee oe IAR Example Project for LPC3180 Phytec the Phytec LPC3250 IAR Example Project for IAR Development Board the Phytec LPC3180 BSP Development Board Os v2 OS Probe uC CPU ARM IAR uC LIB uC OS Il eee The Run Time uCOS ii The Real Time Dot Torts ARM7 ARM9 ARM uC OS II port Generic uC OS II documentation IAR weer ec uC OS II processor C Prob eae ean independent source uC Probe Real Time Monitor Communication code BCC Target Generic Communication OS RS 232 RS 232 Communication LPC3xxx uC Probe Soumrce LPC32x0 LPC318x Port POUL Workspace Plugins uCOS II Figure 1 1 Directory Structure Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs 2 Using the Micirum IAR Example Project To view the example project start an instance of IAR Embedded Workbench and open e For the Phytec LPC3250 evaluation board LPC3250 Phytec OS Probe ewp located in Micrium Software EvalBoards NXP LPC3250 Phytec IAR OS Probe e For the Phytec LPC3180 evaluation board LPC3180 Phytec OS Probe ewp located in Micri
5. 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 with OS ENTER CRITICAL andOS EXIT CRITICAL 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 14 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs Micrium Software uC LIB Doc This directory contains the documentation for pC LIB Application Code Micrium Software EvalBoards NXP LPC3180 Phytec AR OS Probe Micrium Software EvalBoards NXP LPC3250 Phytec AR OS Probe This directory contains the source code the example application 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 app _cfg h is a configuration file specifying stack size
6. 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 Start Running You should now be ready to run pC Probe Just press the run button 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 25 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs Options Options E Communication Seltngs Settings RS 232 use Link COM Port COM J Link Hew Target Server TCPAP USB Baud Rate 115200 v Environment TCPAP UDP Ej Environment i General General Upd Screen A Target symbols sec bytes sec Slow queue update period sec C Calculate communication timeout automatically Wait Time ms gt Target Figure 6 2 wC Probe Options 2 Micrium pC Probe LPC2478 EA 05 Probe Workspace wsp i OS General Info H OS Task CPU Usage H OS Task Stack Usage i OS Task Info Ei OS Everts gt i OS Timers E0 OS Configuration General 1 OS Cor iguration Events Timers Application 2 Apo EALPC2478 Apo Communication Sbai Biome A os _Cpu_ce OSDaasize OSDebugEn OSEndiarmessTest OSEverntEn OSE vertMax OSEvertNameSize OSE
7. is small yet provides all the services you would expect from an RTOS task management time and timer management semaphore and mutex message mailboxes and queues event flags a 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 wiC 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 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs 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 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 pC Probe s data collection which will update the screen wit
8. response updates the appropriate component s on the screens with the new values 4 Micrium pC Probe LPC3250 Phytec 0S Probe Workspace wsp Oo x KT Home Numeric Meters Graphs Sliders Tanks Miscellaneous Switches Leds Dials Levels le 4 al gt T ot alt b Alignment M QS Configuration Events Tir 4 gt X OS Task Stack Usage OS TaskInfo 0S Events orkspace Explorer 4 OS Task CPU Usage yC OS II Workspace za aj OS About OS General Info OS Task CPU Usage OS Task Stack Usage OS Timers OS Configuration General yC Probe Example on the Phytec phyCORE ARM9 LPC3250 RDK Callback Counter A counter is kept in the OS Task Info Evaluation Board uC Probe OS plug in callback OS Events which is displayed with this OS Configuration General OS Configuration Events Timers fl OS Timers J America LLC SIAR NO Phytec phyCORE ARM9 LPC3250 RDK cuC OS I uC Probe gt gt Phytec LPC3250 Dev Board gl App Phytec LPC3250 App Probe Communication Start Button This button menn al app c switches Z bsp os_core c between Design J lt lt C os_dbg c and Run Time deee Views During 2 pre come Run Time View reac wh en d ata is C probe_ts232_os c collected this will appear as a stop button a blue square This workspace is an example pC Pr
9. vernSize OSE vereT biSize OSFlagEn OSFlagGipSize OSFlagMax OSFlagNemeSize OSFlagNodeSize OSFlagwidth OSLowestPrio OSMbosEn OSMemEn OSMemM ax OSMemNameSize OSMemSize OSMemTbSize OSMulexEn OSPuSize OSQEn OSQMax OSOQSize OSRaTbSize OSSemEn OSStkwidth OSTCBPiioTbMax OSTCBSze OST askCreateEn OST askCreteEnEn OSTaskDelEn DET ab idel WE ie m CJ C m m C C m l CJ C C CJ m m C m o i o CJ C CJ CJ A Figure 6 3 uC Probe Run Time pC OS II Task Information 26 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 pC 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 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 CMP Books Inc Century Plaza 1601 W 23rd St Suite 200 1065 E Hi
10. C Probe Communication Generic This directory contains the mC 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 pwC Probe generic communication module Micrium Software uC Probe Communication Generic Source RS 232 This directory contains the RS 232 specific code for wC 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 LPC3xxx This directory contains probe_rs232c c and probe_rs232c h the NXP LPC3xxx port for the RS 232 communications Micrium Software uC Probe Communication Generic Source RS 232 OS uCOS IT This directory contains probe_rs232_os c which is the pC OS II port for the uC Probe RS 232 communication module uC CPU Files Micrium Software uC CPU This directory
11. Getotatus BoP Intis BoP IntDisaAli BSP_IntEn BoP INECINIT BoP Intvectoet BSP _IntSched Serial Interface bsp_ser c h BSP Ser Init BSP Ser Printi BoP Ser RaByte BoP er Rascr BSP Ser WrByte Bor Ser Wrsctr Power amp Clock Controller bsp_pwr_ctrl c h BSP Pwrotrl Ime Bor PwECerl CPU Moda oei Bor Pwrcurl CPU ModeGet LEDs bsp c h Bor PwrCtrl HCLK Preqcet 7 BSP_ LED On BoP PwrCurl MCh Freqcer BSP LED Off Bol LED Toggle BoP PwreCtrl POLE Freqgcec BSP PwrCtrl PCLK FreqSet OS Layer bsp_os c h Bor PwrCtrl SYSCLR Sresec BSP PwrCtrl SYSCLK SrcGet Bor PwrCrrl sYoCbh Freget BSP Os_ Ssemcreate BSP OS SemWait BSP OS SemPost BoP O9 ImeTruckinit BoP O9 TmrTickloR fandler Figure 5 1 BSP functions for the Phycore LPC3150 RDK 21 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs Serial Interface bsp_ser c h Push Buttons bsp c h Bor oer Init BoP Ser Printi BSP Ser RdByte BSP Ser RdStr BSP Ser WrByte BoP Ser WESCE BSP PB GetStatus LCD controller bsp_Icd c h BSP LCD Init BoP LCD BackhightOrt Bor LCD BackinigqhtOn BoP LCD IF Bn BoP LCD IF Das BSP LCD TurnOn BSP LCD TurnOoff Power amp Clock Controller bsp_pwr_ctrl c h
12. Options Plugins Custom Build Build Actions Select plugins to load Linker CI SEGGER emb0S COSE Epsilon Simulator C Power Pac RTOS Angel Threads GDB Server wC 0S I IAR ROM monitor J Link J Trace ORTIATOS LMI FTDI Description RTOS awareness for CMX Macraigor RDI Location C Program Files I4R Systems Embedded Workbench 5 25 Third Party Driver Originator IAR Systems Version 5 20 0 50993 OK Cancel Figure 2 2 Enabling the pC OS II Kernel Awareness Plug In 2 01 02 IAR Project Configurations The IAR project configurations allow you to compile link and load the software in different ways to the target The following configurations are available in the IAR projects as shown in figure 2 3 e IRAM This project option is configured to load the code into the processor s internal RAM IRAM e XRAM This project option is configured to load the code into the board s external SDRAM XRAM e IRAM boot from NAND This option is configured to flash the code into the board s external NAND memory and load it to the IRAM using the example bootloader provided by IAR e XRAM boot from NAND This option is configured to flash the code into the board s external NAND memory and load it to the XRAM using the example bootloader provided by IAR Note 1 In order to used the IRAM boot from NAND configuration in the Phytec LPC3250 project you must copy the file FlashPhytecLPC3250_NAND_IRAMload x
13. PC318x CPUs e bsp_ser c bsp_ser h contains functions related to UARTs e cstartup s performs critical processor initialization such as the initialization of task stacks readying the platform to enter main e LPC3250_xRAM icf LPC3180_xRAM icf is the IAR linker files which contain information about the placement of data and code segments in the processor s memory map where x can be I for internal RAM IRAM or X for external RAM XRAM e LPC3250_xRAM mac LPC3180_xRAM mac contains instructions that are executed prior to loading code onto the processor where x can be T for internal RAM IRAM or X for external RAM XRAM Micrium Software EvalBoards NXP LPC3180 Phytec AR BSP OS v2 Micrium Software EvalBoards NXP LPC3250 Phytec AR BSP OS v2 e bsp_os c h encapsulates some of the pC OS II kernel services Implements the timer initialization needed for the ticker interrupt needed in uC OS II 16 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs 4 Application Code The example application described in this appnote AN 1250 is a simple demonstration of wC OS II and wC OS Probe for the NXP LPC3250 processor on the PHYCore LPC3250 RDK and the NXP LPC3180 LPC3250 processor on the PHYCore LPC3180 RDK 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 syste
14. ard ver 1304 0 BSP SOM VER 0 _ Phytec Module board ver 1304 1 BSP CFG RDK VER Defines the version of the Rapid development kit Phytec LPC3250 Only BSP RDK VER _0O Phytec Module board ver 1305 0 BSP RDK VER 1 Phytec Module board ver 1305 1 BSP RDK VER 2 Phytec Module board ver 1305 2 BSP RDK VER 3 Phytec Module board ver 1305 3 23 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs 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 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
15. bsite at http www micrium com products probe probe html Open uC Probe After downloading and installing this program open the example pC Probe workspace for pC OS II named OS Probe Workspace wsp which should be located in your installation directory at Program Files Micrium uC Probe Target Plugins uCOS l Workspace Connect Target to PC Currently wC 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 xx unless you specify otherwise To load this ELF file right click on the symbol browser and choose Add Symbols Configure the RS 232 Options In pC Probe choose the Options menu item on the Tools menu A
16. e 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 Micrium Software uCOS I Doc This directory contains documentation for wC OS II Micrium Software uCOS I Ports ARM Generic IAR This directory contains the standard processor specific files for the generic pwC OS If ARM port assuming the IAR toolchain and the ARM Keil RealView Microprocessor Development Kit 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_CPUu_C C os_dcc c 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 wC OS II 13 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs uC Probe Files Micrium Software u
17. ets e g BSP Vector Array File and directory names are always displayed in an italicized serif font Example Micrium Sofware uCOS l 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 C Probe for the NXP LPC32x0 and LPC318x CPUs Table of Contents 1 Installing the Micirum Software 7 2 Using the Micirum IAR Example Project 8 2 01 01 IAR pC OS II Kernel Awareness 8 2 01 02 IAR Project Configurations 9 2 02 Running the Example Applications 10 3 Directories and Files 13 4 Application Code 17 4 01 app c 17 4 02 os_cfg h 19 5 Board Support Package BSP 21 5 01 BSP bsp_xxx c and bsp_xxx h files 21 5 02 Board Support Package Configuration 23 6 uC Probe 24 Licensing 27 References 27 Contacts 27 Micrium uC OS II and uC Probe for the NXP LPC32x0 and LPC318x CPUs 1 Installing the Micirum Software The source code for pC OS II is provided in source form along with IAR EW project files that allows you to run pC OS II on the Phytec LPC3250 and LPC3180 development boards To install the software simply run the self extracting executable Micrium NXP uCOS I LPC3xxx Phytec 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
18. h 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 variables 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 uC 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 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs Manual Versions If you find any errors in this document please inform us and we will make the appropriate corrections for future relea
19. ion board components are labeled in the figures 2 3 and 2 4 The example application is the same for the both Phytec boards To communicate with the board through RS 232 connect a serial cable between the evaluation board serial port BTM UART5 and your PC and open a HyperTerminal or any Terminal program window Configure the RS 232 interface with the following settings Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs e Bits per Second 115200 e Data bits 8 e Parity None e Stops bits 1 e Flow Control None Once the program is loaded onto the target the LEDs will start blinking JTAG connector lt UART2 3 for o o uC OS Probe R t t m SDMMC i g p gt e mn i ALESTIT min erres Push Buttons Figure 2 3 Phycore LPC3180 Rapid Development Kit RDK UART2 3 for uC OS Probe UART5 for Svstem State DC Adaptor USB Device LCD Display A L soo Module Push Buttons Single board computer Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs Figure 2 4 Phycore LPC3250 Rapid Development Kit RDK The lower RS 232 port labeled as BTM UART5 at 115200 baud is used to output text The upper RS 232 port labeled as TOP UART 3 2 is used for wC Probe at 115200 baud which allows you to view in real time the value of static global variables in the target sy
20. itialized the wC Probe Windows program will be able to download data from the processor For more information see Section 6 Listing 4 2 Note 7 App EventCreate Creates all the application uC OS II events and App TaskCreate creates all the application tasks Listing 4 2 Note 8 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 it toggles the LEDs 4 02 os_cfg h The file os_cfg h is used to configure wC 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 information 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 yC OS II 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 pC OS I objects to IAR s C Spy thro
21. llsdale 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 lAR com Micrium NXP 949 Crestview Circle 1110 Ringwood Court Weston FL 33327 San Jose CA 95131 USA USA 1 954 217 2036 1 408 474 8142 1 954 217 2037 FAX WEB www nxp com e mail Jean Labrosse Micrium com WEB www Micrium com
22. m 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 inouts the push buttons and if new input is detected places a message in a queue for App _TaskSer 4 App _TaskUserIF Outputs the state of the system based on the display state passed to it by App TaskKbd int main void Note 1 if OS TASK NAME EN gt 0 CPU INTOSU err endif BSP_IntDisAll Note 2 O inici Note 3 App TaskStart Note 4 O 7 amp sAppTaskStartStk APP CFG TASK START STK SIZE 1 APP CFG TASK START PRIO x cA ppr o k eaae ek APP CFG TASK START STK SIZE 0 EES PARP CRG IAC START PRIO O MOSTA r ORT sie Chia Os TAS ORT Folk ein if OS TASK NAME EN gt 0 Note 5 OSTaskNameSet APP CFG TASK START PRIO CPU_INTO8U Startup cerr endif OSStart Note 6 Listing 4 1 main 17 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs 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 mus
23. ml from the example project folder Micrium Software EvalBoards NXP LPC3250 Phytec IAR OS Probe to the IAR EW installation folder Program Files MAR Systems Embedded Workbench 5 4 arm config flashloader NXP Note 2 In order to used the IRAM boot from NAND configuration in the Phytec LPC3180 project you must copy the file FlashPhytecLPC3180_NAND_IRAMload xml from the example project folder Micrium Software EvalBoards NXP LPC3180 Phytec IAR OS Probe to the IAR EW installation folder Program Files MAR Systems Embedded Workbench 5 4 arm config flashloader NXP Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs Phytec LPC3250 Only Note 3 Be certain to select the proper configuration for you revision of the board IRAM boot from NAND 32M XRAM boot from NAND 32 M Only can be used with revision 1304 0 of the Module board IRAM boot from NAND 64 M XRAM boot from NAND 64 M Only can be used with revision 1304 1 of the Module board 2 IAR Embedded Workbench IDE File Edit wiew Project Tools Window Help x Phytec LPC31250 Module Board ver 1304 0 Workspace RAM boot from NAND 32 M IRAM boot trom HAND E4 M ARAM Boot from MAND 32M Ju g a G uC LIB a G ucyos a G uC Probe Ly 9 Output xk x x x Figure 2 3 IAR project configurations 2 02 Running the Example Applications The example project includes a basic demonstration of pC OS II and pC Probe The evaluat
24. obe workspace for the phyCORE ARMS LPC3250 RDK evaluation board which employs the NXP LPC3250 processor Accompanying this workspace is the source code for this example project demonstrating how easily yC Probe can be used to provide greater insight into the behavior of your embedded target 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 and spreadsheets will begin to update with values from the target uC Probe can download data from the LPC3250 RDK through RS 232 at 115200 baud For more information about this workspace or about pC Probe refer to the pC Probe user manual or visit Data Screen Components are placed onto the data screen and wenn na nnnnn nn 2 22 22 22 22 2 22 22 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 Ready RS 232 115200 COM Disconnected say Figure 6 1 u C Probe Windows Program 24 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs To use pC Probe with the example project or your application do the following 1 1 Download and Install C Probe A trial version of pC Probe can be downloaded from the Micrium we
25. s and priorities for all user tasks and defines for important global application constants app_probe c h contain code to initialize pC Probe app_hooks c h contain code for the pC OS I application hooks includes h is the master include file used by the application os_cfg h is the pC OS II configuration file probe_com_cfg h is the uC Probe configuration file LPC3250 Phytec OS Probe are the IAR Embedded Workbench project files for the Phytec LPC3250 Board LPC3180 Phytec OS Probe are the IAR Embedded Workbench project files for the Phytec LPC3180 board Micrium Software EvalBoards NXP LPC3180 Phytec AR BSP Micrium Software EvalBoards NXP LPC3250 Phytec AR BSP This directory contains the Board Support Package for the PHYCore LPC3250 RDK bsp c bsp 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_a s contains the low level functions written in assembly language for the PHYCore LPC3250 RDK bsp_int c bsp_int h contains functions related to the interrupt controller bsp_Icd c bsp_Icd h contains functions related to the LCD controller LPC3250 only bsp_pwr_ctrl c bsp_pwr_ctrl h contains functions related to Power amp clock controller bsp_touch_scr c bsp_touch_scr h contains functions related to the touch screen controller LPC3250 only 15 Micrium uC OS II and C Probe for the NXP LPC32x0 and L
26. ses Version Date By Description SCS V 1 00 2009 03 31 Updated for Phytec LPC3250 rev 1305 3 board v 1 00 2008 08 20 Software Versions This document may or may not have been downloaded as part of an executable file Micrium NXP uCOS II LP C3250 Phytec 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 Module Version Comment uC OS II V2 88 ucios Probe v0 SSCS Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs Document Conventions Numbers and Number Bases Hexadecimal numbers are preceded by the Ox 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 brack
27. stem The text shown in Figure 2 5 will be displayed in the HyperTerminal Window Phytec LPC3250 HyperTerminal i Fie Edit View Call Transfer Help O x piel ala aea Initializing uC Probe Creating Application Events Creating Application Tasks Micrium uC OS II on the NXP LPC3250 Micrium uC 0 II on the NXP LPC3250 uC 0S II 2 88 running at CPU Usage Ticks 3 at CPU Speed 260 MHz 9644 CtxSw 8019 Micrium uC OS II on the NKP LPC3250 1008 ticks sec OS ver amp Ticks per Sec General Info CPU Usage amp CPU Speed Ticks amp ContextSwitches Connected 0 00 24 ANSI 115200 8 N 1 SCRO Figure 2 5 Application output LPC3250 The push buttons can be used to change the output to a new item If you use the IRAM XRAM boot from NAND configuration you might have to stop the debugger first and power cycle the board 12 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs 3 Directories and Files Application Notes Micrium AppNotes ANIxxx RTOS AN1014 uCOS II ARM This directory contains AN 1014 pdf the application note describing the ARM port for pC OS II and AN 1014 PPT pdf a supplement to AN 1014 pdf Micrium AppNotes ANIxxx RTOS AN1250 uCOS II NXP LPC3xxx This directory contains this application note AN 1250 pdf Licensing Information Micrium Licensing Licensing agreements are located in this directory Any sourc
28. t be done with all uC 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 OSTnit pC OS I always creates an idle task OS_TaskIdle and will create a statistic task OS _TaskStat if yousetOS TASK STAT EN to 1 in os_cfg h Listing 4 1 Note 5 You can 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 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 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 Sle eile Wool Mere AleiSicSieskere a a yey circ Core p BSP Init Coe CLUS Iie rece E ee BoP oe imetrekinit Oc E a Hales Ors e oa jail gt OSS rene lose Gy s sOn E e RE n ALIS 2100 APP TRACE INFO T ninir if APP CFG PROBE COM EN DEF ENABLED APP CFG PROBE OS PLUGIN EN DEF ENABLED APP EET OO Iidelic 2 endif BSP _LED Off 0 N21 ANNO ID NIB Cree aline eyjolb e cabo Ib vedies aa App EyentCrearte ARP PRACE
29. ugh 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 19 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs 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 20 Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs 5 Board Support Package BSP The Board 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 PHYCore LPC3250 LPC3180 RDK 5 01 BSP bsp_xxx c and bsp_xxx h files Figure 5 1 and 5 2 shows the relationship between the BSP s files and the most important components on the development boards not all functions are listed only the most relevants Push Buttons bsp c h Interrupt Controller bsp_int c h BOP PB
30. um Software EvalBoards NXP LPC3250 Phytec IAR OS Probe To do this use the Add Existing Project menu command under the Project menu IAR Embedded Workbench IDE Sele Add Files W772 PERE B Add Group Import File List Edit Configurations Remove Create Mew Project Add Existing Project Options Source Code Control Make FF Compile Chrl FF Rebuild All Clean Batch build Stop Build Debug Ctrl D Make amp Restart Debugger Add an existing pre i ee ai EA Figure 2 1 IAR EW Opening an existing project IAR EWARM Versions Be certain to open the proper project for your version of EWARM The Phytec LPC3250 PC3280 examples projects were created using EWARM ver 5 3 2 01 01 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 wC OS II entry in the list and finally select the check box beside the entry Micrium uC OS II and C Probe for the NXP LPC32x0 and LPC318x CPUs Options for node LPC3250 Phytec 0S Probe 5 2 i x Category Factory Settings General Options C C Compiler Assembler Output Converter Setup Download Extra

Download Pdf Manuals

image

Related Search

Related Contents

AII 13050 - Automatic Day And Night Mirror.recover.fm  Compléments alimentaires : Législation et commentaire concernant  1 - PlumbersStock  

Copyright © All rights reserved.
Failed to retrieve file