Component validity and internal error checking functionality to ensure reliable operation

Similar documents
Freescale MQX RTOS TWR-K64F120M Release Notes

Hands-On Workshop: Freescale MQX Drivers and BSP s

Lab Guide Rev. 1.1 TWRWIFIAR4100LAB

Lab Guide Rev. 0 TWRWIFIG1011MILAB

Quick Start Guide for TWR-MCF5225X TOWER SYSTEM. MCF5225X ColdFire connectivity MCUs

A brief intro to MQX Lite. Real work: hands-on labs. Overview, Main features and Code Size

Getting Started with Freescale MQX RTOS for Kinetis SDK and Kinetis Design Studio IDE

Keil uvision 4 Kinetis Support for Freescale MQX RTOS Release Notes

M52259DEMOKIT One-stop-shop connectivity MCU with USB, Ethernet and CAN, featuring Freescale MQX software solutions

Freescale MQX RTOS for Kinetis SDK Release Notes version beta

TWR-K60F120M Quick Start Guide

Kinetis SDK Release Notes for the TWR-K24F120M Tower System Module

Release Notes. Freescale MQX for TWR-K21D50M. Freescale MQX RTOS for TWR-K21D50M PRODUCT VERSION: 1.0 PRODUCT:

Getting Started with Kinetis SDK (KSDK) v.1.3

Kinetis SDK v Release Notes for KV5x Derivatives

Quick Start Guide TWR-PXS bit Dual-Core Power Architecture MCU for Industrial Control and Safety Applications TOWER SYSTEM

Getting Started with Kinetis SDK (KSDK) v.1.2

Quick Start Guide TWR-PXR bit Power Architecture MCU for High-Performance Real-Time Applications TOWER SYSTEM

Getting Started with Freescale MQX RTOS for Kinetis SDK and MDK-ARM Keil

Freescale Tower System

Quick Start Guide. TWR-KV10Z32 Development Kit for Kinetis KV1x Family TOWER SYSTEM

MQX -celeration RTOS-integrated solutions

Getting Started with MCUXpresso SDK

Quick Start Guide. TWR-K70F120M High-Performance MCUs with Graphics LCD, Connectivity and Security TOWER SYSTEM

Kinetis SDK v Release Notes for the MK21DA5 and MKW24D5 Devices

TWR-KV10Z32 Sample Code Guide for IAR Board configuration, software, and development tools

Kinetis SDK Freescale Freedom FRDM-KL03Z Platform User s Guide

Freescale Kinetis Software Development Kit Release Notes

TWR-KM34Z50MV3 Quick Start Guide

TWR-KV10Z32 Sample Code Guide for CodeWarrior Board configuration, software, and development tools

Quick Start Guide. TWR-MPC8309 PowerQUICC Processor with Industrial Connectivity and Protocol Off-Load Engine TOWER SYSTEM

Quick Start Guide. TWR-K70F120M High-Performance MCUs with Graphics LCD, Connectivity and Security TOWER SYSTEM

TWR-K70F120M Quick Start Guide

User Manual Rev. 0. Freescale Semiconductor Inc. FRDMKL02ZUM

MQX RTOS Release Notes for Kinetis SDK v1.2.0 for KL33Z64 for FRDM-KL43Z Freescale Freedom Development Platform

Quick Start Guide. TWR-P1025 QorIQ Processor with Networking and Industrial Connectivity and Protocol Offload Engine TOWER SYSTEM

Quick Start Guide TWR-S08PT60. 5-Volt S08P Family of 8-bit MCUs for Industrial and Appliance Applications TOWER SYSTEM

TWR-KL43Z48M Quick Start Guide

TWR K20D50M Quick Start Demo Lab Guide

Lab Tutorial for TWR-S08GW64 TOWER SYSTEM. MC9S08GW64 LCD segment MCU for flow meters and energy metering applications

TWR-K21F120MA Quick Start Guide

Microbee Technology FTM-3SE

Codewarrior for ColdFire (Eclipse) 10.0 Setup

Getting Started with MQX RTOS for Kinetis SDK

Quick Start Guide for TWR-S08LL64 TOWER SYSTEM MC9S08LL64. S08 ultra-low-power LCD segment MCU

Freescale MQX RTOS TWR-MCF51JF Patch. Release Notes

Getting Started with FreeRTOS BSP for i.mx 7Dual

MQX RTOS Release Notes for Kinetis SDK FRDM- KV10Z Freescale Freedom Development Platform

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

Installation and Quick Start of isystem s winidea Open in DAVE. Tutorial Version 1.0, May, 2014

Quick Start Guide. MED-SPO2 Pulse Oximetry Plug-in Board TOWER SYSTEM

BASICS OF THE RENESAS SYNERGY TM

OpenSDA on TWR-KW2x. User s Guide Rev 1.1

AVR32 Studio Tutorial AVR32 UC3. EVK1100 Control Panel Tutorial

Freescale MQX USB Stack for TWR-K24F120M GA User s Guide

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

Keil TM MDK-ARM Quick Start for. Holtek s HT32 Series Microcontrollers

Quick Start Guide. MED-SPI Spirometry Plug-in Board TOWER SYSTEM

Quick Start Guide. TWR-K60D100M Low-Power MCU with USB, Ethernet and Encryption TOWER SYSTEM

User Manual Rev. 0. Freescale Semiconductor Inc. FRDMKL02ZUM

User Manual. LPC-StickView V3.0. for LPC-Stick (LPC2468) LPC2478-Stick LPC3250-Stick. Contents

Kinetis KE1xF512 MCUs

Lab Tutorial for TWR-S08MM128-KIT TOWER SYSTEM LAB MC9S08MM128. Electrocardiogram (EKG) with Freescale USB stack

BASICS OF THE RENESAS SYNERGY PLATFORM

Hands-On Workshop: Developing with the Kinetis Software Development Kit

Figure 1. Simplicity Studio

Supporting New Toolchains with Freescale MQX RTOS Michal Princ and Michal Hanak Freescale MSG Software Team Roznov

MQX RTOS for Kinetis SDK Release Notes

Quick Start Guide for TWR-S08MM128-KIT TOWER SYSTEM MC9S08MM128. The industry s most complete solution for portable medical applications

Quick Start Guide TRK-KEA. Kinetis EA Series MCUs for Automotive Electronics Applications. StarterTRAK

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

TWR-K53N512 Quick Start Guide

Integrate TWR-EPD Software with MQX RTOS Based on the TWR-K21F120M Platform

Quick Start Guide. TWR-VF65GS10 For Vybrid Controller Solutions Based on ARM Cortex -A5 and Cortex-M4 Processors with the DS-5 Toolchain TOWER SYSTEM

LAB #1: The CSM12C32 Module and PBMCUSLK Project Board

NXP Semiconductors, 6501 William Cannon Drive West, Austin, Texas Kinetis SDK 2.0 Transition Guide Rev.

Freescale Semiconductor Inc. TWRWIFIGS1500MLAB. TWR-WIFI-GS1500M Lab Guide Rev. 1

IAR EWARM Quick Start for. Holtek s HT32 Series Microcontrollers

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

Contents. About This Guide... 2 Audience... 2 Revision History... 2 Conventions... 3 Definitions, Acronyms, and Abbreviations... 3

Getting Started with MCUXpresso SDK CMSIS Packs

Quick Start Guide (QSG) for - FRDM-KEAZ128 - FRDM-KEAZ64 - FRDM-KEAZN32

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

Lab 1 Introduction to Microcontroller

STM32L100C-Discovery Board Projects

ToolStick-EK TOOLSTICK USER S GUIDE. 1. Kit Contents. 2. ToolStick Overview. Green and Red LEDs. C8051F321 provides USB debug interface.

Hands-On Workshop: ARM mbed

Freescale, the Freescale logo and CodeWarrior are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Xtrinsic is a trademark of

Using Code Composer Studio IDE with MSP432

User's Manual Rev. 1. Freescale Semiconductor Inc. TWRS08UNIVUM

CodeWarrior Development Studio for etpu v10.x Quick Start SYSTEM REQUIREMENTS

WPR1500-LDO MP Receiver V2.1 Reference Design User s Guide

Kinetis KV5x Real-Time Control MCUs with Ethernet Up to 1 MB Flash and 256 KB SRAM

TWR-KE18F User's Guide

Creating a New USB project with KSDK and Processor Expert support in KDS

Controller Continuum. for Microcontrollers V6.3. Quick Start

Getting Started in C Programming with Keil MDK-ARM Version 5

Getting Started in C Programming with Keil MDK-ARM Version 5

HVP-56F82748 Quick Start Guide

AN HI-3200 Avionics Data Management Engine Evaluation Board Software Guide

Transcription:

October 2013

Overview of Tower system, CodeWarrior v10.3 and MQX 4.0 Easy OS configuration with GUI based interface Using BSP clone wizard to start with BSP porting Kernel debugging with task aware debugger tool Using Processor Expert together with MQX Estimate flash and RAM size usage for MQX based application Using performance tools for MQX 2

David Connelly Applications Engineer on the MCU Applications Team Based in Austin, TX 15 Years with Freescale 12 Years with Automotive Microcontrollers 3 Years with MCU Applications BSEE Rochester Institute of Technology (RIT) 3

Simple and Scalable Designed to be customized by Feature, Size, and Speed Lightweight services Smaller and faster vs. regular MQX services Allows control of RAM/ROM utilization New, custom components can be added Scalable Code Density ideal for MCU & MPU ROM size ranges from 10K to 150K RAM size starting at 2.5K Powerful and Integrated Full priority-based, pre-emptive scheduler Powerful real-time performance Fully re-entrant, including interrupt service routines Hand-optimized context switch & low-level interrupt times Time-critical services optimized for speed & deterministic performance Component validity and internal error checking functionality to ensure reliable operation 5

RTOS manages the time of the microcontroller Features of a RTOS: Allows multi-tasking Scheduling of the tasks with priorities Synchronization of the resource access Inter-task communication Time predictable Interrupt handling 6

Navigate to C:\Freescale\Freescale_MQX_4_0\config\twrk70f120m\cw10 and drag twrk70f120m.wsd to CW10.3 7

The MQX libraries projects for TWR-K70F120M has been imported as a working set. Select working set 8

Before building MQX libraries, you can try to delete the library files under D:\Freescale\Freescale_MQX_4_0\lib\twrk70f120m.cw10, so after building, you will know where MQX stores the libraries and header files for application usage. 9

Choose Project -> Build Working Set -> twrk70f120m and wait for libraries build completion 10

BSP Board Support Package Required Libraries PSP Processor Support Package (aka RTOS or MQX) RTCS Real-Time TCP/IP Communication Suite Shell Command Line Interface USB USB protocol stack MFS File System Optional Libraries AN3907 Using MQX Libraries 11

Check the file contents under folder D:\Freescale\Freescale_MQX_4_0\lib\twrk70f120m.cw10\debug again, libraries and header files are back!!! 12

Navigate to folder D:\Freescale\Freescale_MQX_4_0\demo\web_hvac\cw10\web _hvac_twrk70f120m Drag the.project file into CodeWarrior projects 13

Deselect working set and you will see the web-hvac demo 14

Choose Int Flash SramData Debug target Right click->build Configuration->Set Active Then hit to build the demo 15

K70 tower kit consists of TWR-K70FN1M TWR-SER Two elevator board: functional elevator and dummy elevator Face the side with white strip to function elevator, then insert TWR-K70FN1M and TWR-SER into functional elevator, you can insert into any of the elevator slot Put dummy elevator to the other side of TWR-K70FN1M and TWR-SER to complete the assembly 16

Connect USB cable to TWR-K70FN1M (J13) and laptop Click Debug configuration Select the Int Flash SramData Debug target and debug 17

If asked to update firmware, short J10, unplug and reinsert USB cable and click ok. Boards may already be updated. 18

After firmware updated, remove jumper on J10, unplug and reinsert USB cable. Install OSJTAG driver then click ok. 19

After downloading, code stops at main() where you see MQX entry point _mqx(). 20

Right click My Computer->Manage->Device Manager Find the CDC Virtual Serial Port 21

Click Windows Start Button->TeraTerm Then Select COMx port from previous step Then Setup->Serial Port Use 115200 8, N, 1 22

Set COM port settings as 115200bps 8N1 23

Set IP address for laptop, set it in the same subnet as TWR- K70FN1M, you can find the exact IP address setting for board in HVAC.h 24

Board IP address and subnet mask setting in HVAC.h 25

After hitting button, you will see a shell in the terminal window, you can type help to list available commands in shell You can also ping board with ping 192.168.1.202 On Terminal prompt, type ping 192.168.1.202 26

Type board IP address 192.168.1.202 in your web-browser 192.168.1.202/mqx.html 27

Click hvac demo, then choose hvac status Press SW1 or SW2 to see status change After changing temp, notice Fan/Furnace/AC settings 28

Open one of the MQX libraries, such as BSP library, then open user_config.h file All available MQX configuration options are displayed in several sheets based on its associated section BSP MQX RTCS MFS Shell USBH 30

Navigate folder D:\Freescale\Freescale_MQX_4_0\mqx\examples\nandflash\c w10\nandflash_twrk70f120m, drag.project file into CW10.3 Build the project and you will see error message displayed. This means you need to enable NAND flash driver using MQX configuration tool and recompile MQX libraries. 31

Reopen user_config.h file, select BSP sheet and change BSPCFG_ENABLE_NANDFLASH to TRUE and recompile BSP library Right click, bsp, Build Project 32

You are now setup to run nandflash demo on TWR-K70FN1M. This shows an example of features that can be enabled by recompiling the BSP. We will not load nandflash in today s demo, continue to the next Lab. 33

1. Select a baseline BSP to modify. 2. Clone selected BSP (and PSP) projects, configuration, and source code. 3. Prepare BSP-specific Debugger Configuration. 4. Modify BSP-specific include files. 5. Modify startup code. 6. Modify source code. 7. Create default initialization for I/O device drivers. 35

Existing BSP for Kinetis Kinetis 50MHz part twrk20d50m twrk21d50m Kinetis 72MHz part twrk20d72m Kinetis 100MHz part rev1.x twrk40x256 twrk53n512 twrk60n512 Kinetis 100MHz part rev2.x twrk40d100m twrk60d100m Kinetis 120MHz part twrk60f120m twrk70f120m Refer to AN4445 - Kinetis 100 MHz Rev 1.x to Rev 2.x Migration Guide for difference! Refer to AN4526 - Kinetis 100 MHz Rev 1.x to Kinetis 120MHz Migration Guide for difference! 36

Open BSP clone wizard Start->All Programs->Freescale MQX 4.0->MQX BSP Cloning Wizard Choose board name, MQX base and board base 37

Choose projects that need to be cloned and generate those projects, this may take some time. Only Select CodeWarrior 10.x, and a couple of examples Yes No Yes No 38

Key BSP project files bsp.h and <board_name>.h Main BSP header files, configuration constants, etc. <target_name>.lcf Linker command files (one for each memory configuration) init_hw.c (bsp_init.c in older BSPs) PLL, memory, FlexBus initialization init_bsp.c BSP timer, watchdog and IO drivers initialization init_gpio.c IO pin initialization routines called by IO drivers vectors.c Startup code (boot vector) and initial interrupt table Parameter Files init_<dev>.c Default initialization parameters structures for given IO device driver enet_ini.c Ethernet-specific initialization structures and functions mqx_init.c Default MQX initialization parameters structure Other bsp_prv.h Private structures and API functions cw.c CodeWarrior related initializations and CW startup functions overridden cw2.c MQX C entry code, main function 39

Navigate to folder D:\Freescale\Freescale_MQX_4_0\config\<Cloned K70 board>\cw10 and drag <Cloned K70 board>.wsd into CW10.3 Select working set for cloned K70 board 40

Collapse BSP files folder, all these files are supposed to be changed for a specific board. Each I/O device has a init_<dev>.c file mqx_main.c includes the _mqx() entry point OS tick interrupt routine and I/O driver installation is done in init_bsp.c We now have our own custom working set directory (.wsd) in /config And custom BSP, PSP, examples, etc! 41

Getting Started with Freescale MQX RTOS Getting Started with Runtime TAD Tool for Freescale MQX RTOS 43

MQX Task Aware Debugging plug-in (TAD) is an optional extension to a debugger tool which enables easy debugging of multi-tasking applications. It helps to visualize internal MQX data structures, task-specific information, I/O device drivers and other MQX context data. 44

The MQX TAD is available for the following platforms: Freescale CodeWarrior Classic which includes Development Studio for ColdFire version 7.x and Development Studio for Power Architecture MobileGT version 9.x. Eclipse-based CodeWarrior Development Studio version 10.x. IAR Embedded Workbench for ARM versions 5 and 6 and for ColdFire version 5 ARM-MDK uvision 4 45

Navigate to folder D:\Freescale\Freescale_MQX_4_0\mqx\examples\lwdemo\cw1 0\lwdemo_Customer_Board_K70 and import lwdemo Build the demo and choose debugger configuration 46

47

Select connection type you want to use in the Remote system list. If your connection is not available in the list define new one using New... menu Select Hardware and Simulator, Connection name and System type. In System tab specify Initialize target: as /lib/<board>/bsp/dbg/init_kinetis.tcl and Memory configuration: as /lib/ <board>/bsp/dbg/<board>.mem 48

Make sure the MQX OS Awareness is enabled in the Debugger tab. Press the Debug button in Debug configuration Window. The CodeWarrior will be switched to a debug perspective and will stop the program in the main() function. The MQX is not fully running in the main() point, so continue the application execution until the MQX is initialized to get the TAD features enabled. 49

TAD plug-in DLL is installed into the selected CodeWarrior tool automatically during Freescale MQX RTOS setup process. You may not need this step In case the plug-in was not properly installed (for example to a newly installed CodeWarrior studio, perform the following steps to install TAD manually: Close The CodeWarrior 10.x IDE Locate the tools/codewarrior_extensions/cw MCU v10.x directory in the Freescale MQX RTOS installation folder (by default C:/Program Files/Freescale/Freescale MQX x.y) Navigate to <install_dir>/tools/codewarrior_extensions/cw MCU v10.x directory Open the command like console and execute the command: install_cw10_plugin.bat <CW10.x install dir> Re-start the CodeWarrior 10.x IDE. 50

Navigate to MQX->Lightweight Events, Memory Pools, Memory Blocks To view the different TAD features 51

Task summary Stack usage summary 52

Memory pool summary 53

Info: Starting from MQX version 3.8.1, there is a new option for MQX debugging. With so called RuntimeTAD plug-in, the source of information displayed by TAD screens can be reconnected from a debugger to a run-time communication over serial line, CAN or direct BDM/JTAG access. 54

All Kinetis BSP projects are Processor Expert Ready and Processor Expert drivers are enabled in MQX RTOS environment You should have already imported the new Working Set (.wsd) you created previously. This is in <MQX install>\config\<clone k70 board>\cw10 56

Expand bsp_<clone k70 board> view Show processor expert view Generate code 57

Navigate to folder D:\Freescale\Freescale_MQX_4_0\demo\pe_demo\cw10\pe_d emo_customer_board_k70 and drag.project file into CW10.3 58

Expand bsp_<clone k70 board> project view Processor Expert Driver 59

Click on PE components to see the properties 60

Processor expert gives you a easy way to add device drivers to MQX BSP In BSP example one timer and one GPIO component are included Properties of component can be changed easily, for example GPIO pin 61

GPIO1 component in BSP drives LED s on tower board For exact GPIO used, refer to TWR-K70F120M Tower Module user s manual 4 Input/Output Connectors and Pin Usage Table 62

PWM configures channel 0 in Flex Timer 0 a PWM of 4096 timer-ticks 63

Build PE BSP and PE demo Debug the PE demo Check PWM output on A40, LED1 will toggle 64

Expand processor expert project view Search ADC_LDD in components library window 65

Right click on the component Select add to project 66

Double click on ADC_LDD Select ADC1 Enable interrupt service Select ADC1_DM1 channel, this is the ADC channel connected to Potentiometer on board 67

Enable static sample groups Open conversion time window Select 19.23us for conversion time 68

Click methods Tab Click to generate code for methods 69

The generated ADC LDD component code. 70

Expand pe_demo project view Hide processor expert view 71

Add new ADC task in main.c 72

Add task function and code 73

Add ADC1 event function code ADC1 channel is connected to TWR-K70FN1M potentiometer 74

Build the pe_demo project Test the new functionality in the application and the new LDD driver 75

The code size script file analyzes the generated xmap file produced by CodeWarrior or IAR Embedded Workbench or ARM-MDK Keil build tools and creates codesize report in an HL format. Freescale MQX 4.0\tools\codesize.exe Usage examples: codesize.exe -c cwcf7 <MAP_file> codesize.exe -M -c cwcf10 <MAP_file> codesize.exe +MFS -PSP -BSP -c cwcf10 <MAP_file> codesize.exe -c cwcf10 <MAP_file1> -c cwmpc9 <MAP_file2>... 77

Navigate to D:\Freescale\Freescale_MQX_4_0\demo\web_hvac\cw10\web _hvac_twrk70f120m\int Flash SramData Debug, copy intflash_sramdata_d.afx.xmap to D:\Freescale\Freescale_MQX_4_0\tools 78

Revisit the web-hvac demo 79

The MQX performance tool is a plug-in for CW10.3 IDE which can be used to display various run-time information about an MQX application. The information can also be retrieved from performance data file saved during any debugger session from Task-aware Debugger plug-in (TAD). 81

The current version of the MQX Performance Tool distributed with the MQX includes the following features Timeline graph of task switches, interrupts, synchronization objects, etc. Task Stack view which displays size of stacks and used stack sizes of all tasks. CPU Usage view displaying a pie chart of CPU runtime allocation among different tasks. Performance Data viewer. 82

Each view can be set to Online or Offline mode: In the Online mode, the Performance Tool uses data obtained through TAD and debugger connection from the MQX kernel log. To use the Performance Tool, the MQX application must have kernel logging enabled. In the Offline mode, the performance data file saved during a previous debugger session can be analyzed with Performance Tool views. In order to save the performance data file, the application should have the kernel logging enabled. Any time during a debugger session, use the MQX->Save Performance Data menu in the CodeWarrior IDE to save the data file for later analysis. 83

Open main.c in lwdemo project MQX_KERNEL_LOGGING need to be defined for using performance tool 84

Enable kernel logging with GUI based configuration tool Note: if MQX_USE_LOGS does not show up in GUI, right click user_config.h->open With->Text Editor and add the following #define MQX_USE_LOGS 1 #define MQX_KERNEL_LOGGING 1 Rebuild BSP and PSP library 85

In your imported lwdemo project, open the main.c file and increase the size of the kernel log being created. This is needed in order the Performance Tool has enough entries to display a meaningful information. The default value is set quite low to ensure application runs properly also on platforms with small RAM resources. Change to a big log size. 86

In the MQX tools menu select Timeline view. The timeline opens in an offline mode by default with no data to be displayed. Click the Toggle offline and online mode button to switch to online mode. Toggle online or offline 87

The graph shows task switches in your application. Icons represent various events logged by the MQX kernel such as interrupts, synchronization calls, message sending etc. 88

89

90

Overview of Tower system, CodeWarrior v10.3 and MQX 4.0 Easy OS configuration with GUI based interface Using BSP clone wizard to start with BSP porting Kernel debugging with task aware debugger tool Using Processor Expert together with MQX Estimate flash and RAM size usage for MQX based application Using performance tools for MQX 91