Application Note: AN00141 xcore-xa - Application Development

Similar documents
Application Note: AN00121 Using XMOS TCP/IP Library for UDP-based Networking

In-System Programmer USER MANUAL RN-ISP-UM RN-WIFLYCR-UM

APPLICATION NOTE. AT07175: SAM-BA Bootloader for SAM D21. Atmel SAM D21. Introduction. Features

3. Programming the STM32F4-Discovery

PC Base Adapter Daughter Card UART GPIO. Figure 1. ToolStick Development Platform Block Diagram

UG103.8 APPLICATION DEVELOPMENT FUNDAMENTALS: TOOLS

Computer Organization and Components

SIM900_Custom Application Building Tutorial_Application Note_V1.00

December 2002, ver. 1.0 Application Note 285. This document describes the Excalibur web server demonstration design and includes the following topics:

Getting Started with Kinetis SDK (KSDK)

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

AN1754 APPLICATION NOTE

Table of Contents. ARM Evaluation Board (AEB-1) Welcome Guide ARM DGI 0005D. Proprietary Notice

10 STEPS TO YOUR FIRST QNX PROGRAM. QUICKSTART GUIDE Second Edition

TI ARM Lab 7 Accelerometers

Embedded Linux Platform Developer

XMOS Programming Guide

An introduction to nxpusblib. March 2012

USER GUIDE EDBG. Description

RN-131-PICTAIL & RN-171-PICTAIL Evaluation Boards

How to Run the MQX RTOS on Various RAM Memories for i.mx 6SoloX

Programming the VEX Robot

Bootloader with AES Encryption

Using the TASKING Software Platform for AURIX

UM1676 User manual. Getting started with.net Micro Framework on the STM32F429 Discovery kit. Introduction

DFU loader for XMOS USB AUDIO devices

Lab 1: Introduction to Xilinx ISE Tutorial

UM0834 User manual. Developing and debugging your STM8S-DISCOVERY application code. Introduction. Reference documents

Tutorial: Packaging your server build

Von der Hardware zur Software in FPGAs mit Embedded Prozessoren. Alexander Hahn Senior Field Application Engineer Lattice Semiconductor

Getting Started with Embedded System Development using MicroBlaze processor & Spartan-3A FPGAs. MicroBlaze

Nios II Software Developer s Handbook

Adapting the PowerPC 403 ROM Monitor Software for a 512Kb Flash Device

XPort Universal Demo Board User Guide

Zynq-7000 Platform Software Development Using the ARM DS-5 Toolchain Authors: Simon George and Prushothaman Palanichamy

Using DAVE with MDK Version 5

GIVE WINGS TO YOUR IDEAS TOOLS MANUAL

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

Ride7 for ARM. RAISONANCE Tools for the STRx and STM32 families. Overview and Getting Started

UG103.8: Application Development Fundamentals: Tools

NVIDIA CUDA GETTING STARTED GUIDE FOR MICROSOFT WINDOWS

Q N X S O F T W A R E D E V E L O P M E N T P L A T F O R M v Steps to Developing a QNX Program Quickstart Guide

TWR-KV31F120M Sample Code Guide for IAR Board configuration, software, and development tools Rev.0

UEFI on Dell BizClient Platforms

Android Application Development and Bluetooth Technology

Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362

Instructions for Installing and Using the FOCUS DL-15 Data Transfer Software

Eddy Integrated Development Environment, LemonIDE for Embedded Software System Development

Installation Guide of the Change Management API Reference Implementation

FlowKit in-circuit debug system

Be sure to connect the USB cable from TonePort into your computer s USB port, and then proceed with the following steps

Block 3 Size 0 KB 0 KB 16KB 32KB. Start Address N/A N/A F4000H F0000H. Start Address FA000H F8000H F8000H F8000H. Block 2 Size 8KB 16KB 16KB 16KB

Programmazione Microcontrollori

Production Flash Programming Best Practices for Kinetis K- and L-series MCUs

BLE113 DEVELOPMENT KIT

LT Auditor Windows Assessment SP1 Installation & Configuration Guide

Microtronics technologies Mobile:

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

Installing Java (Windows) and Writing your First Program

QSG105 GETTING STARTED WITH SILICON LABS WIRELESS NETWORKING SOFTWARE

SMARTCARD XPRO. Preface. SMART ARM-based Microcontrollers USER GUIDE

ENGI E1112 Departmental Project Report: Computer Science/Computer Engineering

Performance Monitor on PowerQUICC II Pro Processors

An Introduction to MPLAB Integrated Development Environment

WAVES. MultiRack SETUP GUIDE V9.80

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

PetaLinux SDK User Guide. Application Development Guide

Developing an Application on Core8051s IP-Based Embedded Processor System Using Firmware Catalog Drivers. User s Guide

Test Center Enterprise. ios Device Onboarding Guide

Start A New Project with Keil Microcontroller Development Kit Version 5 and Freescale FRDM-KL25Z

The following is a summary of the key features of the ARM Injector:

Microcontroller Systems. ELET 3232 Topic 8: Slot Machine Example

Building an Embedded Processor System on a Xilinx Zync FPGA (Profiling): A Tutorial

Figure 1. 8-Bit USB Debug Adapter

How To Develop A Toolstick

7a. System-on-chip design and prototyping platforms

S/PDIF Software Component

M85 OpenCPU Solution Presentation

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

32-bit AVR UC3 Microcontrollers. 32-bit AtmelAVR Application Note. AVR32769: How to Compile the standalone AVR32 Software Framework in AVR32 Studio V2

Animated Lighting Software Overview

SCADAPack E ISaGRAF 3 User Manual

CP2110-EK CP2110 EVALUATION KIT USER S GUIDE. 1. Kit Contents. 2. Relevant Documentation. 3. Software Setup

Keil C51 Cross Compiler

EE8205: Embedded Computer System Electrical and Computer Engineering, Ryerson University. Multitasking ARM-Applications with uvision and RTX

Complete Integrated Development Platform Copyright Atmel Corporation

Application Note: AN00103 Enabling DSD256 in the USB Audio 2.0 Device Reference Design Software

E-Blocks Easy RFID Bundle

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Using C to Access Data Stored in Program Space Memory on the TMS320C24x DSP

Technical Training Module ( 30 Days)

E-Blocks Easy Internet Bundle

SmartFusion csoc: Basic Bootloader and Field Upgrade envm Through IAP Interface

AN LPC1700 timer triggered memory to GPIO data transfer. Document information. LPC1700, GPIO, DMA, Timer0, Sleep Mode

The Advanced JTAG Bridge. Nathan Yawn 05/12/09

APPLICATION NOTE. AT16268: JD Smart Cloud Based Smart Plug Getting. Started Guide ATSAMW25. Introduction. Features

DESIGN AND IMPLEMENTATION OF ONLINE PATIENT MONITORING SYSTEM

Embedded Development Tools

Transcription:

Application Note: AN00141 xcore-xa - Application Development This application note shows how to create a simple example which targets the XMOS xcore-xa device and demonstrates how to build and run this application using the XMOS development tools. The code associated with this application note provides an example of driving a LED connected to both the ARM and xcore GPIO. This simple example shows how to develop code targeting the xcore-xa, how to use the XMOS development tools to compile and build applications and how to deploy code onto an xcore-xa device using the supported development adapters. The example code in this application note does not communicate between the xcore tile and the ARM code in order to introduce the tools support and project structure which allows xcore-xa development. Required tools and libraries xtimecomposer Tools - Version 13.2.0 or later Required hardware This application note is designed to run on an XMOS xcore-xa series device. The example code provided with this application note has been implemented and tested on the xcore- XA core module board but there is no dependancy on this board and it can be modified to run on any development board which uses an xcore-xa series device. Prerequisites This document assumes familiarity with the XMOS xcore architecture, the XMOS tool chain and the xc language. Documentation related to these aspects which are not specific to this application note are linked to in the References appendix. For descriptions of XMOS related terms found in this document please see the XMOS Glossary 1. The XMOS tools manual contains information regarding the use of xcore-xa devices 2. 1 http://www.xmos.com/published/glossary 2 http://www.xmos.com/published/xtimecomposer-user-guide Copyright 2016 XMOS Ltd. 1 www.xmos.com

1 Overview 1.1 Introduction xcore-extended Architecture (the XA Family) combines multicore microcontroller technology with an ultra-low-power ARM Cortex-M3 processor, to create the next wave in programmable system-on-chip (SoC) products. The xcore-xa architecture allows embedded system designers to use high-level software to configure a device with the exact set of interfaces and peripherals needed for their design, while re-using existing ARM binary code and standard library functions, and taking advantage of ultra-low energy fixed-function peripherals. Designers can also add real-time data-plane plus control processing and DSP blocks, using multiple xcore processor cores, with the ARM available to run control plane processing software such as communication protocol stacks, standard graphics libraries, or complex monitoring systems. 1.2 Block diagram Figure 1: Block diagram of XMOS xcore-xa microcontroller Copyright 2016 XMOS Ltd. 2 www.xmos.com

2 xcore-xa Application Development The example in this document does not have any external dependancies on application libraries other than those supplied with the XMOS development tools. It demonstrates how to access an LED via the GPIO of both the xcore tile and the ARM core within the xcore-xa device. This simple example shows the additions that are required to XMOS makefiles to build an xcore-xa project and also how projects of this type are structured. This example is implemented using 2 tasks which are partitioned so that one executes on the ARM core and one on the xcore tile. The tasks perform the following operations. A task executing a loop and toggling a GPIO on the ARM core A task executing a loop and toggling a GPIO on the xcore tile This can be seen in the following task diagram. Figure 2: Task diagram of xcore-xa LED example 2.1 Source code structure for xcore-xa projects The XMOS development tools provide support for the compilation of code for both xcore and ARM targets within a common environment. This allows a single development environment to be used when developing xcore-xa application code. In order to achieve this, projects which are intended for deployment on an xcore-xa are required to have a specific layout. This involves partitioning the code into a directory structure that seperates the code which is ARM and xcore specific and allowing code which is common between both to be used within the project. In the example for this application note there are 2 source files, one for the main() function of the xcore tile main_xcore.xc and one for the main() function of the ARM core main_arm.c. These are stored in the following directory structure: Makefile src arm main_arm.c... xcore main_xcore.xc... <-- shared makefile for ARM and xcore targets <-- top level project source directory <-- ARM specific application code <-- xcore specific application code As you can see from this structure, it is clear that the code specific to either the xcore or the ARM is stored in the target specfic directory. This allows the XMOS build system to use the correct compiler when building the application. Any code that is not within either of these directories or within another directory within the project will be compiled and used with both the ARM and xcore targets of the xcore-xa. Copyright 2016 XMOS Ltd. 3 www.xmos.com

2.2 Makefile support for xcore-xa projects As there is only one makefile for xcore-xa based projects there is the requirement to tell the XMOS build system that a particular project is targeting a device of this type. This is done by setting a variable in the makefile to inform the build system that this is a multi-architecture target. Within the makefile the following variable is set to mark this project as this type: XCORE_ARM_PROJECT = 1 It is also a requirement to be able to pass compiler and build options to the specific tool chain used to build the application code for the ARM and the xcore. These are also makefile variables and are specified as follow in the example code for this application note. Options passed to xcore build tools from makefile: XCC_FLAGS = -O2 -g -report Options passed to ARM build tools from makefile: ARM_GCC_FLAGS = -std=c99 -O0 -g These variables allow a user to specify options such as the level of optimization and the linking of additional libraries when building an application. 2.3 Declaring resource and setting up the ARM core and xcore tile The example code in this application note is split into 2 files containing the implementation of a simple main() function for both the ARM core and xcore tile. This application simply executes a loop which flashes an LED on the development board from both the xcore tile and ARM core in parallel. There is no communication within this application so the LED flashing code is free to execute without any form of synchronization. 2.4 The ARM core application main() function The main() function for the ARM core is contained within the file main_arm.c and is as follows, int main(void) { // Enable GPIO clock CMU_ClockEnable(cmuClock_GPIO, true); setup_gpio_led(); set_led_off(); while (1) { for (unsigned int i = 0; i < 250000; i++) { set_led_on(); for (unsigned int i = 0; i < 250000; i++) { set_led_off(); return 0; Looking at this function in more detail you can see the following: The GPIO clock for the ARM core is explicitly enabled Copyright 2016 XMOS Ltd. 4 www.xmos.com

A function is called to configure the GPIO ports being used There is a while loop which executes forever Inside the while loop an LED is toggled on and off at a specific rate A for loop is used to add a delay between toggling the LED on and off 2.5 Setting up ARM GPIO for the application In order to use a GPIO on the ARM core for toggling an LED it needs to be configured into the mode that is required. This is done from the function setup_gpio_led() called from main() in the file main_arm.c void setup_gpio_led(){ // Green LED GPIO_PinModeSet(gpioPortB, 13, gpiomodepushpull, 1); This function configures GPIO port B13 on the ARM core to be used to toggle the LED in the example application. The GPIO configuration function is provided within the XMOS development tools and is accessed by including the following header file: #include <em_gpio.h> 2.6 Toggling the LED connected to the ARM GPIO In order to toggle the LED connected to the ARM core it is required to change the value being driven to the GPIO port. This is done in the application within the following functions, void set_led_on() { GPIO_PinOutClear(gpioPortB, 13); void set_led_off() { GPIO_PinOutSet(gpioPortB, 13); On the development board being used for this example the LED connected to the ARM core is active low so driving a 0 onto the GPIO pin to turn the LED on and a 1 onto the GPIO pin to turn it off. These functions are called from main() with a delay inbetween to control the speed of the LED flash. 2.7 The xcore tile application main() function The main() function for the xcore tile is contained within the file main_xcore.xc and is as follows, int main() { while (1) { set_led_on(); delay_seconds(1); set_led_off(); delay_seconds(1); return 0; Looking at this function in more detail you can see the following: There is a while loop which executes forever Inside the while loop an LED is toggled on and off at a specific rate Copyright 2016 XMOS Ltd. 5 www.xmos.com

A library function is used to add a delay between toggling the LED on and off 2.8 Setting up the xcore GPIO for the application In order to use a GPIO port on the xcore tile for toggling an LED it needs to be configured into the mode required. This is done in the file main_xcore.xc with the following code, out port green_led = XS1_PORT_1F; This configures the GPIO port XS1_PORT_1F on the xcore tile as an output port with the symbolic name green_led. This port can then be used from the application to toggle the LED that is connected. 2.9 Toggling the LED connected to the xcore GPIO In order to toggle the LED connected to the xcore GPIO it is required to change the value being driven to the GPIO port. This is done in the application within the following functions, void set_led_on() { green_led <: 0; void set_led_off() { green_led <: 1; On the development board being used for this example the LED connected to the xcore tile is active low so driving a 0 onto the GPIO pin will turn the LED on and a 1 onto the GPIO pin will turn it off. These functions are called from main() with a delay inbetween to control the speed of the LED flash. Copyright 2016 XMOS Ltd. 6 www.xmos.com

APPENDIX A - Example Hardware Setup This application example is designed to run on the xcore-xa core module board which has an LED connected to both the xcore and ARM GPIO ports. The xcore-xa core module board should be connected to both power and have the development adapters connected to a host machine to allow program download. This can be seen in the following image. Figure 3: XMOS xcore-xa core module board setup The hardware should be configured as displayed above for this example: Both the power and debug adapter USB cables should be connected The boot mode of the board should have the jumpers selecting boot from msel The ARM led will flash when the example is executing The xcore led will flash when the example is executing Copyright 2016 XMOS Ltd. 7 www.xmos.com

APPENDIX B - Launching the example application Once the example has been built either from the command line using xmake or via the build mechanism of xtimecomposer Studio the application can be executed on the xcore-xa core module board. Once built there will be a bin directory within the project which contains the binary for both the ARM core and xcore tile. The xcore binary has a XMOS standard.xe extension. In order to allow access to the debug interface of the ARM core the SEGGER gdb server application needs to be running. The documentation for setting up and executing this can be found in the XMOS development tools user guide and the xcore-xa development chapter. B.1 Launching from the command line From the command line the xrun tool is used to download code to both the ARM core and xcore tile. Changing into the bin directory of the project will allow the application to be executed on the xcore-xa microcontroller as follows: > xrun app_xcore_xa_leds <-- Download and execute the ARM code > xrun app_xcore_xa_leds.xe <-- Download and execute the xcore code Once these two commands have been executed the LED s connected to ARM core and xcore tile will be flashing. B.2 Launching from xtimecomposer Studio From xtimecomposer Studio there is the run mechanism to download code to both the ARM core and xcore tile. By selecting the ARM binary contained within the project bin directory, right click and then run as ARM application, the application will be downloaded and executed on the ARM core. Selecting the xcore binary, right click and then run as xcore application will perform the same operation for the xcore tile. Once these two commands have been executed the LED s connected to ARM core and xcore tile will be flashing. Copyright 2016 XMOS Ltd. 8 www.xmos.com

APPENDIX C - References XMOS Tools User Guide http://www.xmos.com/published/xtimecomposer-user-guide XMOS xcore Programming Guide http://www.xmos.com/published/xmos-programming-guide Copyright 2016 XMOS Ltd. 9 www.xmos.com

APPENDIX D - Full source code listing D.1 Source code for main_xcore.xc // Copyright (c) 2016, XMOS Ltd, All rights reserved #include <platform.h> #include <xs1.h> out port green_led = XS1_PORT_1F; void set_led_on() { green_led <: 0; void set_led_off() { green_led <: 1; int main() { while (1) { set_led_on(); delay_seconds(1); set_led_off(); delay_seconds(1); return 0; D.2 Source code for main_arm.c // Copyright (c) 2016, XMOS Ltd, All rights reserved #include "em_gpio.h" #include "em_cmu.h" void setup_gpio_led(){ // Green LED GPIO_PinModeSet(gpioPortB, 13, gpiomodepushpull, 1); void set_led_on() { GPIO_PinOutClear(gpioPortB, 13); void set_led_off() { GPIO_PinOutSet(gpioPortB, 13); int main(void) { // Enable GPIO clock CMU_ClockEnable(cmuClock_GPIO, true); setup_gpio_led(); set_led_off(); while (1) { for (unsigned int i = 0; i < 250000; i++) { Copyright 2016 XMOS Ltd. 10 www.xmos.com

set_led_on(); for (unsigned int i = 0; i < 250000; i++) { set_led_off(); return 0; Copyright 2016 XMOS Ltd. 11 www.xmos.com

Copyright 2016, All Rights Reserved. Xmos Ltd. is the owner or licensee of this design, code, or Information (collectively, the Information ) and is providing it to you AS IS with no warranty of any kind, express or implied and shall have no liability in relation to its use. Xmos Ltd. makes no representation that the Information, or any particular implementation thereof, is or will be free from any claims of infringement and again, shall have no liability in relation to any such claims. Copyright 2016 XMOS Ltd. 12 www.xmos.com