CMPE3D02/SMD02 Embedded Systems

Similar documents
ECE 254/MTE241 Lab1 Tutorial Keil IDE and RL-RTX Last updated: 2012/09/25

Lab 3a: Scheduling Tasks with uvision and RTX

Lab 3b: Scheduling Multithreaded Applications with RTX & uvision

ARM RTX Real-Time Operating System A Cortex-M Optimized RTOS that Simplifies Embedded Programming

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

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

ECE254 Lab3 Tutorial. Introduction to MCB1700 Hardware Programming. Irene Huang

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

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

Migrating to Cortex-M3 Microcontrollers: an RTOS Perspective

Start a New Project with Keil MDK-ARM Version 5 and ST Micro Nucleo-F446RE

Project Debugging with MDK-ARM

ARM TrustZone for ARMv8-M for software engineers

5/11/2012 CMSIS-RTOS. Niall Cooling Feabhas Limited CMSIS. Cortex Microcontroller Software Interface Standard.

Freescale Kinetis: Cortex -M4 Training Lab

MDK-ARM Version 5. ULINK Debug Adapters. Microcontroller Development Kit.

COEN-4720 Embedded Systems Design Lecture 9 Real Time Operating Systems (RTOS) Part 1: Processes/Tasks and Threads

Migrate RTX to CMSIS-RTOS

MDK-Professional Middleware Components. MDK-ARM Microcontroller Development Kit MDK-ARM Version 5. USB Host and Device. Middleware Pack.

Application Note: 200

Freescale Kinetis: Cortex -M4 Training Lab

STMicroelectronics: Cortex -M4 Training STM32F407 Discovery evaluation board using ARM Keil MDK Toolkit

Getting Started with MDK. Create Applications with µvision for ARM Cortex -M Microcontrollers

Implementing Secure Software Systems on ARMv8-M Microcontrollers

Lab 1 Introduction to Microcontroller

Cortex -M3 Hands-On LAB featuring Serial Wire Viewer

TN0132 Technical note

Freescale Kinetis L Series: Cortex-M0+ Training Using the Freedom KL25Z

MDK-ARM. Microcontroller Development Kit

Heterogeneous multi-processing with Linux and the CMSIS-DSP library

Real Time Operating System

VORAGO VA108xx FreeRTOS port application note

Component validity and internal error checking functionality to ensure reliable operation

Chapter 4. Enhancing ARM7 architecture by embedding RTOS

embos Real Time Operating System CPU & Compiler specifics for RENESAS M16C CPUs and HEW workbench Document Rev. 1

NXP lab: Cortex-M3 Training with Serial Wire Viewer LPC1768/65: Keil MCB1700 evaluation board

STMicroelectronics STM32: Cortex -M4 Lab

Introduction to the ThreadX Debugger Plugin for the IAR Embedded Workbench C-SPYDebugger

ECE254 Lab3 Tutorial. Introduction to Keil LPC1768 Hardware and Programmers Model. Irene Huang

Getting Started in Assembly Programming with Keil uvision and MSP432

Programming in the MAXQ environment

Peripheral Dialog for CAN

STM32L100C-Discovery Board Projects

Install Keil Microcontroller Development Kit Version 5 for ST Microelectronics STM32F446

Tutorial. How to use Keil µvision with Spansion templates Spansion Inc.

STMicroelectronics: Cortex -M7 Training STM32 F7 Discovery evaluation board using ARM Keil MDK 5 toolkit

Keil uvision development story (Adapted from (Valvano, 2014a))

CS355 Hw 4. Interface. Due by the end of day Tuesday, March 20.

Arm TrustZone Armv8-M Primer

NXP LPC4300: Cortex -M4/M0 Hands-On Lab

S1C31W74 Peripheral Circuit Sample Software Manual

Application Note: AN00194 Getting Started with VCD Tracing in xtimecomposer

UM1862 User manual. Getting started with STM32F411E Discovery software Development Tools. Introduction

RTOS Debugger for RTX51 tiny

Embedded Technosolutions

Introduction to uvision and ARM Cortex M3

embos Real Time Operating System CPU & Compiler specifics for ARM core with ARM RealView Developer Suite 3.0 Document Rev. 1

3L Diamond. Multiprocessor DSP RTOS

Microsemi (Actel) SmartFusion: Cortex -M3 Lab: ARM Keil MDK toolkit featuring Serial Wire Viewer

BASICS OF THE RENESAS SYNERGY TM

Getting Started with MCUXpresso SDK CMSIS Packs

Sharing Task Switch Information between ARM 1136JF-S Processor and StarCore SC 1200 Processor on SMA Board

Real Time Kernel v1.1

Microprocessors and Microcontrollers (EE-231)

EKK-LM3S811 QUICKSTART

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

BASICS OF THE RENESAS SYNERGY PLATFORM

Processes and Multitasking

SN32F100 Series QUICK START. SN32F100 Series SN32F107 SN32F108 SN32F109. SONiX TECHNOLOGY CO., LTD Page 1 Version 3.1

IAR PowerPac RTOS for Texas Instruments MSP430 Microcontroller Family

AGH University of Science and Technology Cracow Department of Electronics

uip, TCP/IP Stack, LPC1700

Micrium OS Kernel Labs

WS_CCESSH5-OUT-v1.01.doc Page 1 of 7

Getting Started with DS-MDK. Create Applications for Heterogeneous ARM Cortex -A/Cortex-M Devices

NXP LPC4000: Cortex -M4/M0 Lab

Getting Started with DS-MDK. Create Applications for Heterogeneous ARM Cortex -A/ Cortex -M Devices

Maxim. Zeus: Summer The purpose of. of Keil RTX RTOS. MDK is a turn- type license. real-time. This more. and J-Link Lite. J-Link.

STM32SnippetsL0. STM32L0xx Snippets firmware package. Features. Description

ECEN 449 Microprocessor System Design. Hardware-Software Communication. Texas A&M University

MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine

AN207 Building Mbed OS projects with Keil uvision

M2351 TrustZone Program Development

NXP LPC4000: Cortex -M4/Cortex-M0 Lab

Cortex-M3/M4 Software Development

embos Real Time Operating System CPU & Compiler specifics for Texas Instruments MSP430 CPUs and Rowley compiler for MSP430 Document Rev.

UM1677 User manual. Getting started with STM32F030 Value Line Discovery development tools. Introduction

Chapter 12 Visual Program Debugger

PS Telematik-Projekt: Wireless Embedded Systems

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab

Computer Systems II. First Two Major Computer System Evolution Steps

STM32-SK/KEIL STR91X-SK/KEI, STR7-SK/KEIL

Experiment 1. Development Platform. Ahmad Khayyat, Hazem Selmi, Saleh AlSaleh

Embedded Technosolutions

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

Realtek Ameba-1 Power Modes

Windows QuickStart Guide Page 1 of Ambiq Micro, Inc All rights reserved.

Application Note 112 version 1.1 Installing a User program in EPROM on the Intel 8x930 4 Port USB Evaluation Board

Script Host 2.0 Developer's Guide

Cypress FM4 Tools Set-up with Keil 5.x

Transcription:

School of Computing Sciences CMPE3D02/SMD02 Embedded Systems Laboratory Sheet 5: 1.0 Introduction MDK-ARM: Introduction to RL-RTX RL-RTX is the real-time operating system (RTOS) component of the ARM Real- Time Library (RL-ARM). RL-RTX provides a framework to manage several jobs (tasks) on a single CPU that supports task priorities, context switching, and messaging. 2.0 Objective To introduce RL-RTX and configure a simple RTX application program. 3.0 Procedure 1. Create a new project named /RTX_ex1/RTX_ex1.uvproj. In the Target tab of the Options for Target select the Operating system: RTX Kernel and tick the option Use MicroLIB. 2. Copy the following files and include them in your project: a. RTX_Conf_CM.c b. system_stm32f10x_cl.c These can be found in a number of places e.g. (C:\Keil\ARM\Boards\Keil\MCBSTM32C\RTX_Blinky) 3. Consider the following scenario: A microcontroller must continuously execute two activities (tasks). Activity 1 must begin 50 ms after activity 2 completes and activity 2 must begin 20 ms after activity 1 completes; as shown in the following diagram: Task 1 Task 2 20 ms 50 ms

4. The code for the two activities can be defined as two separate functions (task1 and task2). Declare the two functions as tasks using the keyword task (defined in RTL.H) which indicates a RTX task. The main() function simply initialises the timers and calls RTX function Pass the function name of the first task as the parameter to the os_sys_init function. int main (void) { SystemInit(); /* initialize clocks */ os_sys_init (task1); /* Initialize RTX and start task1 */ 5. Consider the function task1() (Appendix A). Each task has a unique idnumber; task1 first assigns its own id_number and then creates task2, assigning its id-number. Since task1 must repeat indefinitely the task1 s code is placed in an infinite loop. Task 1 doesn t do any useful work (for now) it simply uses an Event Flag to send a signal to (wake up) task 2 and wait for task 2 to signal it has completed. Then it must wait for 50 ms before it can perform the activity again. The os_dly_wait() function with argument 5 provides the delay. RTX uses timer 0 to provide system timing; if you take a look at the configuration file RTX_Config_CM.c and select the Configuration Wizard tab then you ll see the Tick value is set to 10 ms. The os_evt_wait_or function is used to make task1 wait for completion of task2, and the os_evt_set function sends the signal to task2. This example uses bit 2 (position 3) of the event flags to inform the other task when it completes. 6. Modify the code to toggle a LED (i.e. task 1 switches the LED ON and task 2 switches it OFF). Change the os_dly_wait parameter so that the led is ON for 1 sec. and OFF for 0.5 sec. 7. The debugger can be used to display general information about system resources (i.e. Debug -> OS Support). First check that the operating system (RTX Kernel) has been selected in the Target tab of the Project Options dialog and then run the code in the debugger. Active Tasks: shows currently active tasks and their status. System: shows the system information for the application.

8. The event viewer can be used (while debugging) to display a real-time execution trace for your code. Before you can use this feature (with ULINK2) you must enable serial wire trace. To Enable the Trace Port Interface create the file called conf_stm32f10_swo.ini shown in Appendix B and save it in your project folder [2]. Set Options for Target -> Debug as shown (entering the name of the initialization file). In the Settings dialog (Debug tab) select the Serial Wire Interface.

In the Trace tab select Enable Trace Now invoke the debugger, execute the code, and select the Event Viewer. 9. The project RTX_Blinky supplied by Keil has more tasks and gives a more interesting trace.

Note: The RTX example projects in C:\Keil\ARM\Boards\Keil\MCBSTM32C deal with more challenging scenarios. Try these before attempting assignment 2. 4.0 References 1. Keil Software, Getting Started: Building Applications with RL-ARM, Keil Software, 2010. 2. ULINK2 User s Guide, http://www.keil.com/support/man/docs/ulink2/ulink2_stm32f10xxx_swt.ht m (last accessed 18.11.13).

Appendix A * RL-ARM - RTX *---------------------------------------------------------------------------- * Name: RTX_EX1.C * Purpose: Your First RTX example program *---------------------------------------------------------------------------- * This code is part of the RealView Run-Time Library. * Copyright (c) 2004-2010 KEIL - An ARM Company. All rights reserved. #include <RTL.h> /* RTX kernel functions & defines */ #include <stm32f10x_cl.h> /* id1, id2 will contain task identifications at run-time */ OS_TID id1, id2; /* Forward reference */ task void task1 (void); task void task2 (void); * Task 1: RTX Kernel starts this task with os_sys_init (task1) task void task1 (void) { /* Obtain own system task identification number */ id1 = os_tsk_self (); /* Assign system identification number of task2 to id2 */ id2 = os_tsk_create (task2, 1); for (;;) { /* do-this */ /* Indicate to task2 completion of do-this */ os_evt_set (0x0004, id2); /* Wait for completion of do-that (0xffff means no time-out)*/ os_evt_wait_or (0x0004, 0xffff); /* Wait now for 50 ms */ os_dly_wait (5); * Task 2: RTX Kernel starts this task with os_tsk_create (task2, 1) task void task2 (void) { for (;;) { /* Wait for completion of do-this (0xffff means no time-out) */ os_evt_wait_or (0x0004, 0xffff); /* do-that */ /* Pause for 20 ms until signaling event to task1 */ os_dly_wait (2); /* Indicate to task1 completion of do-that */ os_evt_set (0x0004, id1); * Main: Initialize and start RTX Kernel int main (void) { SystemInit(); /* initialize clocks */ os_sys_init (task1); start task1 */ /* Initialize RTX and * end of file

Appendix B - /* Code to Enable Serial wire Trace on ULINK2 /* See http://www.keil.com/support/man/docs/ulink2/ulink2_stm32f10xxx_swt.htm /*---------------------------------------------------------------------------/* - ** Define the function to enable the trace port * FUNC void EnableTPIU(void) { _WDWORD(0xE0042004, 0x00000020); // Set asynchronous communication via DBGMCU_CR - ** Invoke the function at debugger startup * EnableTPIU();