1 © 2007 Mauro Morsiani Laboratorio di Sistemi Operativi Anno Accademico 2006-2007 Software Development with uMPS Part 3 Mauro Morsiani Copyright © 2007.

Slides:



Advertisements
Similar presentations
Introduction to the Omega Server CSE Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger.
Advertisements

Gnu Debugger (GDB) Topics Overview Quick Reference Card Readings: Quick Reference Card February 7, 2012 CSCE 212Honors Computer Organization.
Program Development Tools The GNU (GNU’s Not Unix) Toolchain The GNU toolchain has played a vital role in the development of the Linux kernel, BSD, and.
Utilizing the GDB debugger to analyze programs Background and application.
SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION
Computer Organization CS224 Fall 2012 Lesson 12. Synchronization  Two processors or threads sharing an area of memory l P1 writes, then P2 reads l Data.
Debugging What can debuggers do? Run programs Make the program stops on specified places or on specified conditions Give information about current variables’
Binghamton University CS-220 Spring 2015 Binghamton University CS-220 Spring 2015 The CS-220 Development Environment.
Memory & Storage Architecture Seoul National University Computer Architecture “ Bomb Lab Hints” 2nd semester, 2014 Modified version : The original.
Introduction to Linux/UNIX. History UNIX beginnings in 1969 (Linus Torvalds is born!) AT & T Bell Laboratories (Ken Thompson & Dennis Richie) Working.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
Spring 2014 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University.
Enabling the ARM Learning in INDIA ARM DEVELOPMENT TOOL SETUP.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
Introduction to Linux ( I ) Sidney Fong 4 th Feb 2006.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /29/2013 Lecture 13: Compile-Link-Load Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
CSE 451: Operating Systems Section 3: Project 0 recap, Project 1.
1 CS503: Operating Systems Spring 2014 Part 0: Program Structure Dongyan Xu Department of Computer Science Purdue University.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Debugging 1/6/2016. Debugging 1/6/2016 Debugging  Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a program.
CS 245 – Part 1 Using Operating Systems and Networks for Programmers Jiang Guo Dept. of Computer Science California State University Los Angeles.
First Compilation Rudra Dutta CSC Spring 2007, Section 001.
Chapter – 8 Software Tools.
CMSC 104, Version 8/061L14AssignmentOps.ppt Assignment Operators Topics Increment and Decrement Operators Assignment Operators Debugging Tips Reading Section.
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Embedded Software Design Week II Linux Intro Linux Kernel.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Gnu Debugger (GDB) Topics Overview Quick Reference Card Readings: Quick Reference Card February 4, 2010 CSCE 212Honors Computer Organization.
Hank Childs, University of Oregon April 13 th, 2016 CIS 330: _ _ _ _ ______ _ _____ / / / /___ (_) __ ____ _____ ____/ / / ____/ _/_/ ____/__ __ / / /
August 31, 2010Joris Geurts1 2IN05 Operating Systems Introduction to Linux More information for this course:
1 © 2007 Mauro Morsiani Sistemi Operativi Anno Accademico uMPS Introduction Mauro Morsiani (minor changes by Renzo Davoli) Copyright © 2007 Mauro.
1 © 2007 Mauro Morsiani Laboratorio di Sistemi Operativi Anno Accademico Software Development with uMPS Part 2 Mauro Morsiani Copyright © 2007.
1 © 2007 Mauro Morsiani Laboratorio di Sistemi Operativi Anno Accademico Software Development with uMPS Mauro Morsiani Copyright © 2007 Mauro.
1 © 2007 Mauro Morsiani Laboratorio di Sistemi Operativi Anno Accademico uMPS Introduction Part 2 Mauro Morsiani Copyright © 2007 Mauro Morsiani.
1 © 2006 Mauro Morsiani Laboratorio di Sistemi Operativi Anno Accademico Kaya Phase 1 Project Specifications Mauro Morsiani Copyright © 2006.
1 © 2007 Mauro Morsiani Laboratorio di Sistemi Operativi Anno Accademico uMPS Introduction Part 3 Mauro Morsiani Copyright © 2007 Mauro Morsiani.
Lecture 3 Translation.
Operating Systems {week 01.b}
Precept I : Lab Environment, Unix, Bash, Emacs
Topic 2: Hardware and Software
Computer System Laboratory
Discussion on mp1.
Computer Architecture & Operations I
Open Source Software Development Environment
Chapter 2: System Structures
CSCE 212Honors Computer Organization
AMIKaya Phase 1 Project Specifications
Software Development with uMPS
Software Development with uMPS
Von Neumann model - Memory
Computer Architecture “Bomb Lab Hints”
Introduction to Linux Week 0 - Thursday.
An overview of the kernel structure
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
9.0 EMBEDDED SOFTWARE DEVELOPMENT TOOLS
Introduction to Linux/UNIX
Von Neumann model - Memory
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Appendix F C Programming Environment on UNIX Systems
Video Notes.
Software Development Environment, File Storage & Compiling
CSCE 212Honors Computer Organization
Makefiles, GDB, Valgrind
SPL – PS1 Introduction to C++.
Presentation transcript:

1 © 2007 Mauro Morsiani Laboratorio di Sistemi Operativi Anno Accademico Software Development with uMPS Part 3 Mauro Morsiani Copyright © 2007 Mauro Morsiani Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found at:

2 © 2007 Mauro Morsiani uMPS software development Developing software with uMPS requires: basic knowledge of UNIX environment and commands knowledge of the uMPS architecture, GUI, and software development conventions setup of an effective debugging environment

3 © 2007 Mauro Morsiani uMPS software development uMPS simulator main commands: umps : the simulator itself umps-elf2umps : to convert the output of the compiler to files the simulator will understand umps-objdump : to analyze these files umps-mkdev : to build disks and tapes for the simulator

4 © 2007 Mauro Morsiani uMPS software development uMPS simulator-related files: In the support/ and example*/ directory: *.rom.umps : the ROM files *.core.umps : the kernel to be loaded *.stab.umps : the kernel symbol table *.aout.umps : for programs other than kernel other *.umps files ( term0.umps, printer0.umps… ): files associated to devices /etc/umpsrc and.umpsrc ( ls –a to see it): the simulator configuration file elf32*.x files: configuration files for the cross-compiler

5 © 2007 Mauro Morsiani uMPS software development uMPS other essential components: some libraries (XForms, libelf) for building the simulator libumps.e (and libumps.o ) under support/ : uMPS library for interfacing with ROM services, CP0 registers and issue TLB-related and SYSCALL instructions crtso.o and crti.o : kernel and program startup functions const.h and types.h under support/h : some useful types and constants (eg. processor state definition) a cross-compiler based on GNU gcc: mipsel-linux-gcc for little-endian uMPS (on x86) mips-linux-gcc for big-endian uMPS (on PPC) the make utility

6 © 2007 Mauro Morsiani uMPS software development libumps: uMPS support library libumps acts as a wrapper, allowing to: access ROM routines access special CP0 registers issue TLB-related and SYSCALL instructions libumps is composed by two parts: libumps.e : to be included in C programs source (see it for library description and details) libumps.o : to be linked with other object files to make an executable file

7 © 2007 Mauro Morsiani uMPS software development Common issues in uMPS development: setup of critical registers (esp. $gp, $sp, PC, CP0.Status): check values and bit masks data structure corruption: it’s easy to make coding mistakes or forget to (re-)initialize data structures overlapping of stack spaces among different processes unwanted compiler optimizations: use volatile (esp. when accessing device registers) use subroutines do not optimize (no –O flags) no printf() !

8 © 2007 Mauro Morsiani uMPS software development Breakpoint, Suspect and Trace: the debugger’s tools of trade Breakpoint: a position (an address) in the code; simulation stops when reaches it (may be referred to with a symbol + offset) Suspect area: a memory range (a set of addresses) containing data (array, variables…) under exam; may be a Read suspect and/or a Write suspect (may be referred with a symbol) Suspect: simulation stops when an access of the appropriate type (R, W) is made to the suspect area Traced range: a range of memory addresses selected for showing addresses may be physical or virtual ones only physical addresses may be traced in uMPS

9 © 2007 Mauro Morsiani uMPS software development Advanced uMPS debugging strategies how to replace printf() : initialize a global character array and provide some basic access function able to write contents (copy chars) into it trace the array (= show it in the GUI) set a write suspect on the array (or a breakpoint on the access function) see p1test.c for an example how to check internal variables and execution flow: use debugging functions define debugging functions and insert them into the code set breakpoints on debugging functions variables to be shown can be passed as parameters

10 © 2007 Mauro Morsiani uMPS software development Debugging functions: an example void debug(int where, int var1) { return; } … var_to_check = some_complex_calculation; debug(10,(int)var_to_check); … then check $a0-$a1 for values when breakpoint is reached

11 © 2007 Mauro Morsiani uMPS software development Debugging functions: an example (cont’d) if (some_condition) { debug(14,TRUE); … } else { debug(15,FALSE); … }

12 © 2007 Mauro Morsiani uMPS software development General software development strategies: define your goals (make a top-down analysis) share opinions with other group members keep a log; printing helps take your time: practice makes perfect backup, backup, backup know your tools (or know how to know…) do not “fear the machine” read the manual! (and the documentation, and the newsgroup, and…) look at examples (and Google…) be creative and curious (when all else fails) ask for help: don’t panic!

13 © 2007 Mauro Morsiani uMPS software development How to set up an effective debugging environment: Basic UNIX tools: command reference: man and info show and search: more / less, diff and grep editor: vi, emacs, joe, … compilation: make and makefile compiler flags: -v –E –S -c –o -ansi –pedantic –Wall backup: cp and tar ( plus mv and rm) log: >&, script and history Advanced code development tools: source control: rcs, cvs, subversion, …