Advertisement

Quick Links

Application Note
AN2157/D
Rev. 3, 05/2002
Programming the
MSC8101ADS Flash
Memory
Donald Simon and
This application note describes how to set up and program the MSC8101ADS board to run an application
Duberly Mazuelos
out of its Flash memory so that the application can execute immediately after the board is powered up or
reset. The application is first built using CodeWarrior
CONTENTS
provided with CodeWarrior software runs on the MSC8101ADS. This application interacts with the
HyperTerminal application on a PC (using an RS-232 interface) that sends the S-record file to the
1 References ....................... 1
MSC8101ADS. Finally, the application running on the MSC8101ADS parses the S-records and loads
2 Background ..................... 2
them into Flash memory.
3 Flash Memory ................. 2
After describing the general programming procedure, this application note walks you through a simple
File .................................. 3
example that causes two LEDs on the MSC8101ADS board to flash at power-up or reset. This application
5
note assumes you are familiar with the Metrowerks
File .................................. 3
6
and the MSC8101ADS.
the Application ................ 5
7
8
1
Appendix Aflash.lcf ................ 9
• MSC8101 Reference Manual
• MSC8101ADS User's Manual
• CodeWarrior Flash program and documentation. The Flash program is located in C:\Program
S-Record File ....................... 14
Commands .......................... 17
Script File .......................... 18
2
On power-up, the MSC8101 goes through a power-on reset (
jumping to an address vector (
signal = 1). This application note assumes the former, and that the address vector is located in Flash
memory. To run an application from Flash memory automatically after
programmed in Flash memory:
• Hard Reset Configuration Word (HRCW)
• Address table vector
• The application
The MSC8101ADS offers an option to allow the MSC8101 to load the HRCW from the on-board Altera
FPGA. When this option is selected, the HRCW need not be programmed in Flash memory. For
completeness however, this application note assumes that the HRCW is programmed in Flash memory.
Freescale Semiconductor, Inc.

References

Files\Metrowerks\CodeWarrior\StarCore_Support\
flash_programmer_support.
Background
For More Information On This Product,
Go to: www.freescale.com
®
to generate an S-record file. Then, an application
®
CodeWarrior development tools for the MSC8101
signal = 0) or downloading code through the host interface (
HPE
) sequence followed by either
PORESET
, three sections must be
PORESET
HPE

Advertisement

Table of Contents
loading

Summary of Contents for Motorola Digital dna MSC8101ADS

  • Page 1: Table Of Contents

    Freescale Semiconductor, Inc. Application Note AN2157/D Rev. 3, 05/2002 Programming the MSC8101ADS Flash Memory Donald Simon and This application note describes how to set up and program the MSC8101ADS board to run an application Duberly Mazuelos out of its Flash memory so that the application can execute immediately after the board is powered up or ®...
  • Page 2: Background

    Freescale Semiconductor, Inc. Flash Memory The following hardware is used in the procedure described in this application note: • Personal computer (PC). Runs CodeWarrior and the HyperTerminal application. • Parallel cable and parallel command converter. Connects the PC to the MSC8101ADS for use by the CodeWarrior debugger.
  • Page 3: Generating An S-Record File

    Freescale Semiconductor, Inc. Generating an S-record File Generating an S-record File The following steps generate an S-record file from an application that is later loaded into Flash memory. Create a project for the application. Using the menu option, create a project within the CodeWarrior directory and Project->Add Files include all the relevant files for the application.
  • Page 4 Freescale Semiconductor, Inc. Loading the S-record File Connect a serial cable between the COM port on the PC and the top RS-232 connector on the MSC8101ADS. This is the physical connection that allows the HyperTerminal application on the PC to communicate with the Flash loader application on the MSC8101ADS. Start up the flash programmer.
  • Page 5: Switch Settings To Run The Application

    Freescale Semiconductor, Inc. Switch Settings to Run the Application -->h00000000 hff800008 program_word -->h02000000 hff800010 program_word -->h0a000000 hff800018 program_word Program the starting address of the application in the address table at location 0xFF800110. The address table starts at 0xFE000110. The MSC8101ADS maps this address to 0xFF800110. The following command loads a vector of 0xFF840000: -->hff840000 hff800110 program_word In this example, 0xFF840000 is the location where the address table starts in Flash memory.
  • Page 6: Application Example

    Freescale Semiconductor, Inc. Application Example Table 3 shows all the MSC8101ADS switch settings to run the application discussed in Appendix B from Flash memory Table 3. MSC8101ADS Switch Settings Switch SW10 SW11 To run an application from the MSC8101ADS Flash memory, perform the following steps: (Optional) Remove the command converter connector from the MSC8101ADS.
  • Page 7 Freescale Semiconductor, Inc. Application Example Edit the calc.h file for the corresponding crystal oscillator frequency on the MSC8101ADS (U18) and the baud rate used with the HyperTerminal application. Build the application if the calc.h file was modified. Start the HyperTerminal application on the PC and then run the Flash programmer application on the MSC8101ADS.
  • Page 8: Running Ledblinker From Internal Sram

    Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM Note that the HRCW is four bytes and is every eighth byte starting at 0xFF800000. -->hff800000 dump Hit return for next sixteen, q to quit FF800000 2C 0 FF FF FF FF 0 FF FF FF FF ....
  • Page 9: Appendix Aflash.lcf

    Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM If the application in Appendix B runs out of internal SRAM, the following changes must be made: • LED on and off times modified in the FlashLed function in both case statements. Currently there are example wait times for using Flash memory and internal SRAM in the function.
  • Page 10: Appendix B Ledblinker.c

    Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM Appendix B LEDblinker.c file name: LedblinkerOutOfFlash.c v0.1 15May01 original v0.2 07June01 clean up v0.3 30Jan02 clean up v0.4 01Apr02 Add comments for Sinit() Description: Flash green and red LED on MSC8101ADS board (green on, green off, red on, red off, then repeat all) Notes: Change loop time in FlashLed if running out of internal...
  • Page 11 Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM IMM = (t_8101IMM *)0x14700000; // MSC8101 internal register map IMM->memc_regs[1].br = 0x14501801; // Base register 1. Allows access to BCSR IMM->memc_regs[1].or = 0xffff8010; // Option register 1 BCSR0 = (UWord32 *)0x14500000;// Init Board Control/Status Registers (BSCR) BCSR1 = (UWord32 *)0x14500004;...
  • Page 12 Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM * FUNCTION NAME: FlashLed * DESCRIPTION: This function flashes the Red LED on the 8260 Board. * EXTERNAL EFFECTS: None * PARAMETERS: GREEN or RED * RETURNS: None *------------------------------------------------------------------------- void FlashLed(UWord16 setting) UWord32 jj;...
  • Page 13: Appendix C Find_Imm.asm

    Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM Appendix C find_IMM.asm write IMM address to IMMR section .text global _Sinit _Sinit type func move.l emr,d1 extractu #3,#19,d1,d3 #4,d3.l cmpeq.w #0,d3 move.l #$f0000000,d1 stcmp cmpeq.w #1,d3 move.l #$f0f00000,d1 stcmp cmpeq.w #2,d3 move.l #$ff000000,d1 stcmp...
  • Page 14: Appendix D Resulting S-Record File

    Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM Appendix D Resulting S-Record File Following is the S-record generated from the LEDblinker application. S0030000FC S325FF840000311C303CBF8490C090C090C090C090C090C090C090C090C090C090C090C090C04B S325FF84002090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C037 S325FF84004090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C017 S325FF84006090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0F7 S325FF840080311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C0CD S325FF8400A090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0B7 S325FF8400C0311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C08D S325FF8400E090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C077 S325FF840100311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C04C S325FF84012090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C036 S325FF840140311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C00C S325FF84016090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0F6 S325FF840180311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C0CC S325FF8401A090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0B6 S325FF8401C0311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C08C S325FF8401E090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C076 S325FF840200311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C04B S325FF84022090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C035 S325FF840240311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C00B S325FF84026090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0F5...
  • Page 15 Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM S325FF84076090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0F0 S325FF840780311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C0C6 S325FF8407A090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0B0 S325FF8407C0311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C086 S325FF8407E090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C070 S325FF840800311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C045 S325FF84082090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C02F S325FF840840311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C005 S325FF84086090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0EF S325FF840880311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C0C5 S325FF8408A090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0AF S325FF8408C0311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C085 S325FF8408E090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C06F S325FF840900311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C044 S325FF84092090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C02E S325FF840940311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C004 S325FF84096090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0EE S325FF840980311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C0C4 S325FF8409A090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0AE S325FF8409C0311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C084 S325FF8409E090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C06E S325FF840A00311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C043 S325FF840A2090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C02D S325FF840A40311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C003 S325FF840A6090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0ED S325FF840A80311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C0C3 S325FF840AA090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0AD S325FF840AC0311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C083 S325FF840AE090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C06D S325FF840B00311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C042 S325FF840B2090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C02C S325FF840B40311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C002 S325FF840B6090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0EC S325FF840B80311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C0C2 S325FF840BA090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0AC...
  • Page 16 Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM S325FF840F80311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C0BE S325FF840FA090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C0A8 S325FF840FC0311C303ABF8490C090C090C090C090C090C090C090C090C090C090C090C090C07E S325FF840FE090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C090C068 S325FF841000311C30CCBF84081E34D8BF8490C0E7E8331C3438BF849F7C39002000800090C0E5 S325FF8410205099331C3416BF84331C343ABF84331C3440BF84311C30C8BF849F7194C0C08030 S325FF841040C1809CC07550765075D176D1C980CA803E00A00A7750745077D174D1CB80CC8028 S325FF8410603E00A00F7550765075D176D1EDE9EEE93A00A10C775077D1EFE9E8E93680A1003F S325FF841080E9E9EAE93680A100EBE9ECE93680A100EDE9EEE93680A000EFE9E0E994C0E1E909 S325FF8410A0E2E9E3E99AC02C02800090C02D0280009AC02E02800090C02F0280003503200C9A S325FF8410C080E4311C3000BF849F799F713818349CBF846C305A9890C02A0A8001EAF1EA611F S325FF8410E0351C3006BF8459985B985C989F4B90C02103800A92D09DE19D829F4C90C021E39F S325FF8411009FD792C890828FCF9F719F719F719F713480A0009F639F71C06932CB80D30A03DA S325FF841120A004D1A02718800E31182000B0002118806CD1A12718800E31182000B0F0211885 S325FF841140805CD1A22718800E31182000BF002118804CD1A32718800E31182000BFF021182B S325FF841160803CD1A52718800E3100200080F02118802CD1A62718800E310020008F002118E4 S325FF841180801CD1A72718800E310020008FF02118800CD1A4271880069E7030002000800137 S325FF8411A06CD1C84130F83FC3BFFFB04122009470020081A83800200094713000380194508C S325FF8411C00080810830982010BFFF0080810C9F7194C096209720E748F003F004311C31E273 S325FF8411E0BF84C1827079351C325CBF847C42F0416461320021008000D442F041C84090C0AF S325FF8412005990F94199610A06211C800090C05092F0410910A300F0414092311C3282BF84F5 S325FF8412200A06211C800090C05392F34134F93FFFBDFFDD84F3414392311C3282BF840A060A S325FF841240211C800090C05592F54136F93FFFBEFFDE86F5414592311C3282BF840A06211CAF S325FF841260800090C05792F7413820A00030F93FFFBEFF3400A800DF80F7414792311C32828B S325FF841280BF84E76894C0962197219F7194C096209720E74830012000947000022114800064 S325FF8412A0310021008001D441F042C84090C0E848F8423201380194504290000621148000EC S325FF8412C0D4C0F142C94190C0E948F942E944F94233992010BFFF43913401200094500402C3 S325FF8412E0211C80003501200494500502212080003601200894500602211880006C30331CB3 S325FF84130031D0BF84E76894C0962197219F71E750F005F006311C331ABF84C84090C0E8613E S325FF841320F842C98190C0E889351C340CBF84E8FEF8423A00210C800090C0E81AF842509098 S325FF841340F042CB4090C09B61C081331C31D0BF846CB0F144222087107179371C3376BF8454 S325FF841360F8C490C0E841F8442920871090C0E988351C3360BF846C30331C31D0BF846CB060 S325FF841380F144222087107179371C33A4BF84F8C490C0E841F8442920871090C0E988351CFC S325FF8413A0338EBF84311C3412BF84C082331C31D0BF846CB0F144222087107179371C33D883 S325FF8413C0BF84F8C490C0E841F8442920871090C0E988351C33C2BF846C30331C31D0BF8477...
  • Page 17: Appendix E Flash Program Commands

    Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM Appendix E Flash Program Commands The Flash program supports the commands listed in Table 4. Table 4. Flash Program Commands Command Syntax Description Examples Prints the number of the result of the last print <number><print>...
  • Page 18: Appendix F Example Hyperterminal Script File

    Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM Appendix F Example HyperTerminal Script File The HRCW and address table example in this application note resides in sector 0 of Flash memory. The application resides in sector 1. Scripts can be used with HyperTerminal to program Flash memory. Erasing sectors are not included in the script because there is a delay when these commands are run, and HyperTerminal does not have a way to delay between sending lines out the next line.
  • Page 19 Freescale Semiconductor, Inc. Running LEDblinker from Internal SRAM NOTES: For More Information On This Product, Go to: www.freescale.com...
  • Page 20 Tai Po, N.T., Hong Kong support or sustain life, or for any other application in which the failure of the Motorola product could 852-26668334 create a situation where personal injury or death may occur. Should Buyer purchase or use Motorola...

Table of Contents