CS4101 Introduction to Embedded Systems Lab 1: MSP430 LaunchPad IDE

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

LAB 9: Environment Setup for Tower System Chung-Ta King National Tsing Hua University CS 4101 Introduction to Embedded Systems.
Code Composer Department of Electrical and Computer Engineering
Outline MSP430 LaunchPad MSP430 Microcontroller
Chung-Ta King National Tsing Hua University
Copyright  Oracle Corporation, All rights reserved. 1 Creating an Application: The AppBuilder for Java IDE.
Lab7: Introduction to Arduino
Chung-Ta King National Tsing Hua University
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
LAUNCHXL2-RM57L – Project 0
Using PDG with e2studio: Example
ECE 382 Lesson 2 Readings Lesson Outline Admin Assembler Linker
Bit-DSP-MicrocontrollerTMS320F2812 Module 2 : Program Development Tools.
C6713 DSK Diagnostic Utility included with DSK....
Introduction to CCSv5. Outline  Intro to CCSv5 Intro to CCSv5  Functional Overview Functional Overview  Perspectives Perspectives  Projects Projects.
Introduction Purpose Objectives Content Learning Time
LAB 7: WDT+ and Low-Power Optimization
Part 1 Using the ARM board And start working with C Tutorial 5 and 6
Development. Development Environment Editor Assembler or compiler Embedded emulator/debugger IAR Embedded Workbench Kickstart Code Composer Essentials.
The NetBeans IDE CSIS 3701: Advanced Object Oriented Programming.
P.1ECE 331, Prof. A. Mason Professor Andrew Mason Michigan State University Spring 2013 ECE 331: PC Lab 1: Using HC12 ASM Simulators.
Computing IV Visual C Introduction with OpenCV Example Xinwen Fu.
BYU CS 124Lab 0 - Warm-up Lab1 Lab 0 – Warm-up Lab 1.Acquire a Texas Instruments MSP430 LaunchPad Development Tool. 2.Setup a CS user account. 3.Install.
ADAM2 Single Remocon MCU IDE User’s Manual S/W Integrated Development Environment - Assembler - Simulator - Code Wizard V1.0 Technical Sales Team, ETA.
Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. e 2 Studio – Getting Started.
Active-HDL Interfaces Debugging C Code Course 10.
Module 6: Debugging a Windows CE Image.  Overview Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging.
Allegro CL Certification Program Lisp Programming Series Level I Session Basic Lisp Development in the IDE.
Bit-DSP-MicrocontrollerTMS320F2812 Texas Instruments Incorporated European Customer Training Center University of Applied Sciences Zwickau (FH)
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course explains how to use section setting and memory.
Programming and Debugging with the Dragon and JTAG Many thanks to Dr. James Hawthorne for evaluating the Dragon system and providing the core content for.
Lab (6) Introduction to Assembly Language 1. Introduction Objectives : Learn EMU8086 installation EMU8086 environment Learn how to: Assemble instructions.
National Tsing Hua University CS4101 嵌入式系統概論 Introduction to LaunchPad Prof. Chung-Ta King Department of Computer Science National Tsing Hua University,
Introduction In this lab , we will learn
Workshop Setup The software/hardware used in this workshop are:
Lab 7 Basic 1: Game of Memory
Introduction In this lab , we will learn
CS4101 嵌入式系統概論 General Purpose IO
Programming and Debugging with the Dragon and JTAG
Lecture 8: TI MSP430 Interrupts, ISRs
CS4101 嵌入式系統概論 Introduction to LaunchPad
CS4101 Introduction to Embedded Systems Lab 8: Tower System
CS4101 Introduction to Embedded Systems Lab 6: Low-Power Optimization
CS4101 Introduction to Embedded Systems Lab 1: General Purpose IO
Prof. Chung-Ta King Department of Computer Science
CS4101 嵌入式系統概論 General Purpose IO
My First Nios II for Altera DE2-115 Board
Blinking an LED Using MSP430ware to Control GPIO
National Tsing Hua University CS4101 Introduction to Embedded Systems Lab 2: Timer and Clock Prof. Chung-Ta King Department of Computer Science National.
National Tsing Hua University CS4101 Introduction to Embedded Systems Lab 3: Interrupt Prof. Chung-Ta King Department of Computer Science National Tsing.
Using Visual Studio with C#
CS4101 Introduction to Embedded Systems Lab 4: Interrupt
RX111 Promotion Board (RPB) hands on
Debugging with Eclipse
Social Media And Global Computing Introduction to Visual Studio
DEBUGGING JAVA PROGRAMS USING ECLIPSE DEBUGGER
ECE 3567 Microcontroller Lab
Software Setup & Validation
Module 6: Debugging a Windows CE Image
CS4101 Introduction to Embedded Systems Lab 2: Basic IO and Timer
Code Composer Essentials 3.0
Prof. Chung-Ta King Department of Computer Science
CSCE 206 Lab Structured Programming in C
Debugging with Eclipse
Embedded Development Tools
ECE 3567 Microcontrollers Lab
ECE 3567 Microcontrollers Lab
Chapter 1: Introduction to Computers and Programming
A modular robot for use in the RoboSumo lab
Presentation transcript:

CS4101 Introduction to Embedded Systems Lab 1: MSP430 LaunchPad IDE Prof. Chung-Ta King Department of Computer Science National Tsing Hua University, Taiwan

Introduction In this lab, we will learn the IDE for MSP430 LanuchPad, Code Composer Studio (CCS) Learn how to set up the LaunchPad development board Learn how to create a new project on CCS Learn how to upload a program to the board Debug a program Run a program Use disassembly window

Hardware Setup Please check the version of the MSP430 microcontroller and use the right header files in your programs MSP430G2553

Code Composer Studio (CCS) An Integrated Development Environment (IDE) based on Eclipse Integrated “Debugger” and “Editor” – IDE Edit and Debug have the own “perspectives” (menus, windows) Contains all development tools – compilers, TI-RTOS kernel and includes one target – the Simulator

Code Composer Studio (CCS) TI-RTOS Libraries Config (.cfg) Bios.cmd Compiler Standard Runtime Libraries .out .lib .map User.cmd Launch Pad EVM Stand Alone Emulator (MSP430 FET) Target Cfg File .ccxml .asm .c Edit .asm Asm .obj Link Debug

CCS GUI – EDIT Perspective Menus & Buttons Specific actions related to EDIT’ing Perspectives EDIT and DEBUG Project Explorer Project(s) Source Files Source EDIT’ing Tabbed windows Color-coded text Outline View Declarations and functions

CCS GUI – DEBUG Perspective Connection Type Specified in Target Cfg file What options do users have when connecting to a target? This window also provides a “call” stack Menus & Buttons Related to DEBUG’ing Play, Pause, Terminate DEBUG Windows Watch Variables Memory Browser PC execution point Console Window

Create a New CCS Project 1

Create a New CCS Project Type 2553 to find MSP430G2553 2 3 Type the project name 4 5

Build and Load the Project Three buttons on the horizontal toolbar control code generation. You can move your mouse over each button to read their descriptions. Click the “Build” button and watch the tools run in the Console window. Check for any errors in the Problems window.

Build and Load the Project CCS can automatically save modified source files, build the program, open the debug perspective view for debugging, download the program to the target, and run the program at the beginning of the main() function Click on the “Debug” button (green bug) or Click Target → Debug Active Project

Debug Environment The basic buttons that control the debug environment are located in the top of CCS: At this point you should still be at the beginning of main(). Click the Run button to run the code. Notice that the LEDs are toggling, as expected. RUN

End Debug Session and Close Project The Terminate All button will terminate the active debug session, close the debugger and return CCS to the “C/C++ Perspective” view Click Target → Terminate All or use the Terminate All button Next, close the project by right-clicking on project-name in the C/C++ Projects window and select Close Project.

Use Disassembly Window in Debug

Sample Code: Blinking the Red LED #include <msp430x2553.h> int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer P1DIR |= 0x01; // Set P1.0 as output for(;;) { volatile unsigned int i; // prevent optimization P1OUT ^= 0x01; // Toggle P1.0 using XOR i = 10000; // SW Delay do i--; while(i != 0); } return 0;

Lab 1 Upload sample code to the board and run it. The red LED should blink. Basic 1: Modify the code to blink the green and red LED, which are located at Port 1 Bit 0 and Bit 6. If we want to turn on green LED, we should assign P1OUT to 0x40, which is 01000000 in binary. WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR = 0x41; // P1.0 & 6 outputs (red & green LEDs) 0100 0001 0100 0000 while(1) { P1OUT = 0x40; // P1.6 on (green LED) _delay_cycles(100); P1OUT = 0; // green LED off _delay_cycles(5000); }

Lab 1 Basic 2: Modify the code to blink the green and red LED alternatively. Basic 3: Modify the sample code to remove the volatile keyword in declaring the variable i. Observe how the LaunchPad behaves. To explain the behavior of LaunchPad, let us study the assembly code of the two programs. Use the disassembly window to obtain the assembly code of the original sample code and the modified sample code Observe the differences of these two assembly programs and explain the behavior of LaunchPad.

Assembly for Not Using volatile WDTCTL = WDTPW | WDTHOLD; main(): c078: 40B2 5A80 0120 MOV.W #0x5a80,&Watchdog_Timer_WDTCTL P1DIR |= 0x01; c07e: D3D2 0022 BIS.B #1,&Port_1_2_P1DIR 31 P1OUT ^= 0x01; $C$L1: c082: E3D2 0021 XOR.B #1,&Port_1_2_P1OUT 34 do i--; c086: 3FFD JMP ($C$L1) 65 func_epilog_7: POP r4 __mspabi_func_epilog(), __mspabi_func_epilog_7(): c088: 4134 POP.W R4 66 func_epilog_6: POP r5 __mspabi_func_epilog_6(): c08a: 4135 POP.W R5

Assembly for Using volatile 23 int main(void) { main(): c05e: 8321 DECD.W SP WDTCTL = WDTPW | WDTHOLD; c060: 40B2 5A80 0120 MOV.W #0x5a80,&Watchdog_Timer_WDTCTL P1DIR |= 0x01; c066: D3D2 0022 BIS.B #1,&Port_1_2_P1DIR 31 P1OUT ^= 0x01; $C$L1: c06a: E3D2 0021 XOR.B #1,&Port_1_2_P1OUT i = 10000; c06e: 40B1 2710 0000 MOV.W #0x2710,0x0000(SP) 34 do i--; $C$L2: c074: 8391 0000 DEC.W 0x0000(SP) 36 } c078: 9381 0000 TST.W 0x0000(SP) c07c: 27F6 JEQ ($C$L1) c07e: 3FFA JMP ($C$L2)

Assembly for Using volatile 179 { _c_int00(), _c_int00_noexit(): c080: 4031 0400 MOV.W #0x0400,SP 182 if(_system_pre_init() != 0) _auto_init(); c084: 12B0 C0B0 CALL #_system_pre_init c088: 930C TST.W R12 c08a: 2402 JEQ ($C$L2) c08c: 12B0 C000 CALL #_auto_init 183 main(0); $C$L2: c090: 430C CLR.W R12 c092: 12B0 C05E CALL #main 184 abort(); c096: 12B0 C0B4 CALL #abort 65 func_epilog_7: POP r4 __mspabi_func_epilog(), __mspabi_func_epilog_7(): c09a: 4134 POP.W R4 66 func_epilog_6: POP r5 __mspabi_func_epilog_6():

Grading Policies DEMO in the lab --------------------------------------100% DEMO within a week (before lab starts) ---------80% DEMO after a week (before lab starts) -----------60% After two weeks (after lab starts)------------------- 0% TA office hour: Wed 10:00 – 12:00 Thr 13:00 – 15:00