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

23
Porting MicroMonitor on ARM7* Tileli Amimeur Sami Gharahi Fall 2009 *Drinking from a fire hose

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

Page 1: 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

Page 2: Tileli Amimeur Sami 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

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

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

Problem Statement

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

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

Project Overview

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

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

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

Pretty tough to split up

Work Breakdown

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

MicroMonitor Architecture

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

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

Implementation Detail

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

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

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

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

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

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

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

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

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

Monitor Subsystem Configuration

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

“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

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

“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

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

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

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

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

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

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!”

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

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

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

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

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

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

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

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

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

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

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

Backup

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