MCF5249 Software Examples Bootable example code for the MCF5249

Slides:



Advertisements
Similar presentations
May 12 th, 2002 Microprocessors. Introduction Motorola controls roughly 40% of the 32-bit embedded processor market ColdFire is the next generation 68K.
Advertisements

Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
Net+OS Initialization Initialization Sequence Initialization Routine Roles ROM Image Compression/Decompression.
Processor System Architecture
Architecture of the 680XX Outline Goal Reading 680XX Family
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
CSS 372 Lecture 1 Course Overview: CSS 372 Web page Syllabus Lab Ettiquette Lab Report Format Review of CSS 371: Simple Computer Architecture Traps Interrupts.
Implementing interrupt driven IO. Why use interrupt driven IO? Positive points –Allows asynchronous operation of IO events –Good use of resources –Leads.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Exception Processing ECE511: Digital System & Microprocessor.
7/23 Coldfire Exceptions and Interrupts Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee
Computer System Overview
1 Computer System Overview OS-1 Course AA
1 CSIT431 Introduction to Operating Systems Welcome to CSIT431 Introduction to Operating Systems In this course we learn about the design and structure.
OS Spring’03 Introduction Operating Systems Spring 2003.
Computer System Overview
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
TCSS 372A Computer Architecture. Getting Started Get acquainted (take pictures) Review Web Page (
Dr. Kimberly E. Newman Hybrid Embedded wk3 Fall 2009.
Midterm Wednesday 11/19 Overview: 25% First Midterm material - Number/character representation and conversion, number arithmetic - DeMorgan’s Law, Combinational.
COMPUTER SYSTEMS An Integrated Approach to Architecture and Operating Systems Chapter 4 Processor Implementation ©Copyright 2008 Umakishore Ramachandran.
Software Development and Software Loading in Embedded Systems.
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
Intel IA32 OS Support -Refresh
NET+OS 6.1 Training. BSP NET+OS 6.1 BSP Initialization Memory map New features Debugging Porting Issues.
Introduction to Embedded Systems
hardware and operating systems basics.
NetBurner MOD 5282 Network Development Kit MCF 5282 Integrated ColdFire 32 bit Microcontoller 2 DB-9 connectors for serial I/O supports: RS-232, RS-485,
Exceptions and Interrupts 2
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Computer System Overview Chapter 1. Operating System Exploits the hardware resources of one or more processors Provides a set of services to system users.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
7/23 C Programming in Embedded Systems Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 1 Computer System Overview.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 part 4 Exceptions.
Enforcing Modularity Junehwa Song CS KAIST. Network Computing Lab. How to run multiple modules? Emacs X server Mail Reader File Server.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
This material exempt per Department of Commerce license exception TSU Address Management.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose:  This course provides an overview of the Direct Memory.
Lecture 1: Review of Computer Organization
AT91 C-startup. 2 For reasons of modularity and portability most application code for an embedded application is written in C The application entry point.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course demonstrates the Project Generator function.
Chap. 4 ARM Boot Loader Internals. 2 S3C2500 ARM940T Core module ARM9TDMI CoreIC.
1 Computer System Overview Chapter 1. 2 Operating System Exploits the hardware resources of one or more processors Provides a set of services to system.
Lecture 3 Translation.
Interrupts and signals
MICROPROCESSOR BASED SYSTEM DESIGN
CS501 Advanced Computer Architecture
Timer and Interrupts.
The Stack.
Interrupts In 8085 and 8086.
Overview of today’s lecture
Introduction of microprocessor
Software Development with uMPS
The Arduino Microcontroller: Atmel AVR Atmega 328
Chapter 10 The Stack.
Arithmetic using a stack
The Hardware Interface
AT91RM9200 Boot strategies This training module describes the boot strategies on the AT91RM9200 including the internal Boot ROM and the U-Boot program.
AT91 C-startup This training module describes the C-Startup sequence, which performs initialization of the microcontroller from the reset up to the calling.
Introduction to the Intel x86’s support for “virtual” memory
Today’s agenda Hardware architecture and runtime system
CNET 315 Microprocessor & Assembly Language
Basic Instruction Cycle
Lecture 3 - Instruction Set - Al
Computer System Overview
Computer System Laboratory
CPU Structure and Function
Presentation transcript:

MCF5249 Software Examples Bootable example code for the MCF5249

Software Examples Overview Init Simple FAT

Init Module Processor and on-chip peripheral initialization Init Building block for all other modules Init Simple FAT

Processor Initialization VBR initialized to 0x0000_0000 Reset Signal (RSTI) *See Section 3.5.12 of MCF5249 User’s Manual ChipSelects reset CS0 is active SP and PC fetched from Vector Table in vectors.s Provided in ‘init’ module Low-level processor initialization in mcf5249_lo.s On-chip peripheral initialization in sysinit.c Main Process

Reset Exception Processor is placed in the supervisor mode VBR is initialized to 0x00000000 The first entry in the vector table (0x0) is loaded into the stack pointer (SP) The second entry in the vector table (0x4) is loaded into the program counter (PC) After the initial instruction is fetched from memory, program execution begins at the address in the PC vectors.s : Contains complete exception vector table including initial SP and PC

vectors.s /* Exception Vector Table */ VECTOR_TABLE: INITSP: .long ___SP_INIT /* Initial SP */ INITPC: .long 0x400 /* Initial PC */ vector02: .long _asm_exception_handler /* Access Error */ vector03: .long _asm_exception_handler /* Address Error */ vector04: .long _asm_exception_handler /* Illegal Instruction */ vector05: .long _asm_exception_handler /* Reserved */ vector06: .long _asm_exception_handler /* Reserved */ vector07: .long _asm_exception_handler /* Reserved */ vector08: .long _asm_exception_handler /* Privilege Violation */ vector09: .long _asm_exception_handler /* Trace */ vector0A: .long _asm_exception_handler /* Unimplemented A-Line */ vector0B: .long _asm_exception_handler /* Unimplemented F-Line */ vector0C: .long _asm_exception_handler /* Debug Interrupt */ vector0D: .long _asm_exception_handler /* Reserved */ vector0E: .long _asm_exception_handler /* Format Error */ vector0F: .long _asm_exception_handler /* Unitialized Int. */ vector10: .long _asm_exception_handler /* Reserved */ vector11: .long _asm_exception_handler /* Reserved */ vector12: .long _asm_exception_handler /* Reserved */ vector13: .long _asm_exception_handler /* Reserved */ vector14: .long _asm_exception_handler /* Reserved */ vector15: .long _asm_exception_handler /* Reserved */

Low-level Initialization mcf5249_lo.s : Initializes internal SRAM Initializes MBAR - pointer to on-chip module memory map Sets up temporary stack in internal SRAM Calls higher level module initialization Provides low-level routines to manage cache Provides functions for writing internal control registers

mcf5249_lo.s /* This is the main entry point upon hard reset. */ asm_startmeup: /* Invalidate the cache and disable it */ move.l #0x01000000,d0 movec d0,cacr /* Initialize SRAMBAR: locate SRAM and validate it */ move.l #0xE0000021,d0 movec d0,RAMBAR /* Point SP into SRAM (temporarily). SRAM is used as stack space * while initializing the mcf5249 periphs and memory controller. */ move.l #0xE0000000+SRAMsize,SP .... /* Initialize mcf5249 periphs, etc */ move.l d6,-(sp) /* pointer to internal resources */ jsr mcf5249_init lea 4(sp),sp jmp main /******************************************************************** * These routines write to the special purpose registers in the ColdFire * core. Since these registers are write-only in the supervisor model, * no corresponding read routines exist. */ mcf5249_wr_vbr: _mcf5249_wr_vbr: move.l 4(sp),d0 andi.l #0xFFF00000,d0 /* align to 1M boundary */ movec d0,VBR nop rts mcf5249_wr_cacr: _mcf5249_wr_cacr: move.l 4(sp),d0 movec d0,cacr mcf5249_wr_acr0: _mcf5249_wr_acr0: movec d0,ACR0 /******************************************************************** * mcf5249 has Icache only */ cpu_cache_flush: _cpu_cache_flush: nop /* sync */ move.l #0x01000000,d0 /* Invalidate the I-Cache */ movec d0,cacr rts /* * This routine is the lowest-level exception handler. asm_exception_handler: _asm_exception_handler: move.l (sp),a1 move.l a1,-(sp) jsr exception_handler lea 4(sp),sp rte

On-chip Peripheral Initialization sysinit.c : Initializes SDRAM Copies variable data from non-volatile memory to SDRAM Initializes UARTs for I/O Initializes the SIM and Chip Select modules appropriately for the M5249C3 evaluation board

sysint.c /* * Out of reset, the low-level assembly code calls this routine to * initialize the MCF5249 for this board. A temporary stack has been * setup in the internal SRAM, and the stack pointer will be changed * to point to SDRAM once this routine returns. */ void mcf5249_init (MCF5249_IMM *imm) { mcf5249_uart_init(imm); mcf5249_sim_init(imm); mcf5249_gpio_init(imm); mcf5249_cs_init(imm); /* Turn Instruction Cache ON */ mcf5249_wr_cacr(0x81000500); /* Copy the vector table to RAM */ if (__VECTOR_RAM != VECTOR_TABLE) for (n = 0; n < 256; n++) __VECTOR_RAM[n] = VECTOR_TABLE[n]; } mcf5249_wr_vbr((uint32)__VECTOR_RAM); /* Move initialized data from ROM to RAM. */ if (__DATA_ROM != __DATA_RAM) { dp = (uint8 *)__DATA_RAM; sp = (uint8 *)__DATA_ROM; n = __DATA_END - __DATA_RAM; while (n--) *dp++ = *sp++; } /* Zero uninitialized data */ if (__BSS_START != __BSS_END) sp = (uint8 *)__BSS_START; n = __BSS_END - __BSS_START; *sp++ = 0;

Processor Definition File mcf5249.h : #define for all internal memory-mapped registers read/write access macros for all internal registers bit level definitions and macros

mcf5249.h /* Do not initialize SDRAM if already running in SDRAM */ if (!(MCF5249_RD_SDRAMC_SDCCR(imm) & MCF5249_SDRAMC_SDCCR_ACT)) { /* Initialize SDRAMC Timing Register for 66MHz operation */ MCF5249_WR_SDRAMC_SDCTR(imm, 0 | MCF5249_SDRAMC_SDCTR_RTP_66MHz | MCF5249_SDRAMC_SDCTR_RC(1) | MCF5249_SDRAMC_SDCTR_RP(3) | MCF5249_SDRAMC_SDCTR_RCD(2) | MCF5249_SDRAMC_SDCTR_CLT_2 ); /* Initialize SDRAMC Control Register for M5249C3 board */ MCF5249_WR_SDRAMC_SDCCR(imm, 0 | MCF5249_SDRAMC_SDCCR_MCAS_A9 | MCF5249_SDRAMC_SDCCR_BALOC_A21 | MCF5249_SDRAMC_SDCCR_REG | MCF5249_SDRAMC_SDCCR_INIT } /********************************************************************** * SDRAM Controller Module Registers Description ***********************************************************************/ /* Offsets of the registers from the MBAR */ #define MCF5249_SDRAMC_SDCCR (0x0180) #define MCF5249_SDRAMC_SDCTR (0x0184) /* Read access macros for general use */ #define MCF5249_RD_SDRAMC_SDCCR(IMMP) \ Mcf5249_iord(IMMP,MCF5249_SDRAMC_SDCCR,32) #define MCF5249_RD_SDRAMC_SDCTR(IMMP) \ Mcf5249_iord(IMMP,MCF5249_SDRAMC_SDCTR,32) /* Write access macros for general use */ #define MCF5249_WR_SDRAMC_SDCCR(IMMP,DATA) \ Mcf5249_iowr(IMMP,MCF5249_SDRAMC_SDCCR,32,DATA) #define MCF5249_WR_SDRAMC_SDCTR(IMMP,DATA) \ Mcf5249_iowr(IMMP,MCF5249_SDRAMC_SDCTR,32,DATA) /* Bit level definitions and macros */ #define MCF5249_SDRAMC_SDCCR_MCAS_A7 (0x0 << 13) #define MCF5249_SDRAMC_SDCCR_MCAS_A8 (0x1 << 13) #define MCF5249_SDRAMC_SDCCR_MCAS_A9 (0x2 << 13) #define MCF5249_SDRAMC_SDCCR_MCAS_A10 (0x3 << 13)

Support Routines io.c : printf.c : stdlib.c : alloc.c : character input and output routines using the on-chip UARTs printf.c : simplified version of standard IO routine printf() stdlib.c : subset of the C standard library alloc.c : fixed run-time malloc() and free() routines

Simple Application Empty application template containing: main.c : simple main process int_handlers.c : template for handling interrupts and exceptions Init Simple FAT

Factory Acceptance Test: FAT Application Factory Acceptance Test: Tests the hardware of the M5249C3 including: SDRAM Ethernet Flash RS-232 terminals LEDs Init Simple FAT