Tileli Amimeur Sami Gharahi Fall 2009 *Drinking from a fire hose.

Post on 15-Jan-2016

224 views 0 download

Transcript of Tileli Amimeur Sami Gharahi Fall 2009 *Drinking from a fire hose.

Porting MicroMonitor on ARM7*

Tileli AmimeurSami Gharahi

Fall 2009

*Drinking from a fire hose

Problem Statement Project Overview Work Breakdown Architecture Implementation Details Design Tradeoff What would we do differently/future work

Agenda

Porting MicroMonitor onto the ARM7TDMI processor on the Keil MCB2387 Evaluation Board.

Problem Statement

LPC2387 ARM7TDMI Serial ports (USBs) Putty/HyperTerminal uMon codebase (available from web) Code sourcery GPS_bringup

Project Overview

Tileli – Research, Makefiles, Startup assembly, C code, Debugging

Sami – Research, Makefiles, Startup assembly, C code, Debugging

Pretty tough to split up

Work Breakdown

MicroMonitor Architecture

GPS_bringup code Makefile Startup Assembly Monitor Subsystem Configuration Bootup C Code I/O Debugging

Implementation Detail

Code given to us that establishes use of◦ UART: ability to print to console◦ LEDs

Helped with debug gps_bringup start up assembly uMon

assembly

GPS_bringup code

PLATFORM, FILETYPE, CPUTYPE, etc Includes all the relevant files

◦ LOCSSRC = rom_reset.S◦ LOCCSRC = cpuio.c, led.c, … ◦ COMCSRC = C Code at

umon_main/target/common Memory map configuration

Makefile

rom_reset.S Standard definitions of mode base,

interrupts, and stacks SCB Module Definitions Memory Accelerator module Boot sequence: start, reset, coldstart,

lukewarmstart, warmstart, etc. Make a call to the C code at the end

Start Up Assembly

config.h Memory block and heap size Ability to choose monitor subsytems

◦ MEMCMDS◦ MALLOC◦ SHELLVARS◦ XMODEM (As we found, requires Flash)

Monitor Subsystem Configuration

“start.c” – this is the first c code executed by the processor after startup assembly code

Keeps track of the state of the monitor◦ Initialize, App_exit, Exception

Declares and initializes the monitor’s stack/heap within its own .bss space

Initializes the CPU I/O and baud rate Initializes various features of umon as

specified in the config.h file

Bootup C Code

“cpuio.c” – this code takes care of I/O initialization and functionality

Uses “LPC2387.h” for register and port definitions

Contains LED and UART routines Contains target_putchar(…) routine required

by uMon’s printf

I/O

No debugging functionality at the start of the project

Getting the LEDs to work was a huge breakthrough

Were able to step through code using the LEDs to figure out where a routine was crashing – very slow process

Debugging uMon with LEDs

After the LEDs were in working order Stepped through rom_reset.s till right before

entering the C code Problems with entering the C code with

uMon’s assembly startup Started with gps_bringup assembly startup

and morphed it into uMon’s Entry to C code was successful

Debugging rom_reset.s

Using our LEDs to debug we were finally able to get the UART to work

Eventually were able to use printf to print “Hello World!” to the screen

The uMon prompt came up shortly after, but the uMon reset command caused the board to crash◦ Issues with the board’s bring up state

You had me at “Hello World!”

Reset was causing the board to crash We found that the “initialize” state was not

being passed correctly from the assembly startup to the starting c code (the board was starting in an unknown state)

Eventually realized that “warmstart” in the assembly startup was not functioning correctly◦ Fixed it to point the stack pointer to our state

variable before calling the c code

Debugging Reset

reset help pm (put memory) -> ex: pm –s 0x4000d000 “hello”

dm (dump memory) -> ex: dm 0x4000d000

cm (copy memory) –> ex: cm -2 0x4000d000 0x4000d070 0x20

mt (memory test) -> ex: mt 0x4000d000 0x20

sm (search memory) -> ex: sm –s 0x4000d000 0x4000d090 “hello”

Working uMon Features

Which subsystems to bring up first Even though we enabled Xmodem in

config.h Flash has to get configured first for it to be functional

Heap space decreased to 40x1024 (from 64x1024)

◦ Affects future applications meant to run on top of uMon

Design Tradeoffs

Documentation, Documentation, Documentation◦ It was hard to find sufficient documentation for

uMon’s large code base◦ Not knowing what to look for - Even when there

was some documentation, we often didn’t find it until we had already figured things out ourselves

Regrets

Include_Flash – write a device driver to interface with the flash on our board to allow for Xmodem serial file transfer

Build up uMon on this board to include more features

Future Work

Backup