The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

Volker Rzehak ABSTRACT bootstrap loader (sometimes called bootloa


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



Application Bootstrap Loader MSP430F11x Hardware Software Proposal
Volker Rzehak
ABSTRACT bootstrap loader (sometimes called bootloader) MSP430 derivatives with flash memory allows access their embedded memories during prototyping, production, field. possible download modify code flash memory (electrically-erasable programmable memory) store calibration data other system-relevant data flash memory RAM. This application note describes simple low-cost hardware software solutions access bootstrap loader functions MSP430F11x devices (F1121, F1101, F112, F110) serial port (RS-232) personal computer (PC). description provided C-source code software routines allow adaptation software specific requirements.
MSP/ALP Design
Contents Introduction Bootstrap Loader Basics Invoking Bootstrap Loader Access Bootstrap Loader Bootstrap Loader Functions 2.3.1 Unprotected Functions 2.3.2 Protected Functions Hardware Description Power Supply Serial Interface 3.2.1 Level Shifting 3.2.2 Control RST/NMI TEST Pins Parts List
Software Description Global Variables Initialization RS-232 Port Invoking Bootstrap Loader Access Bootstrap Loader 4.4.1 Synchronization 4.4.2 Transmission Frame Calling Bootstrap Loader Functions Releasing RS-232 Port
SLAA096A
Complete Application Error Recovery Advanced Features 4.9.1 Detecting Bootstrap Loader's Version 4.9.2 Executing Code 4.10 Patch First Version Bootstrap Loader References Appendix Listings Building Demonstration Program Bootstrap Loader Communication Header File-bslcomm.h Bootstrap Loader Communication Implementation File-bslcomm.c Serial Communication Header File-ssp.h Serial Communication Implementation File-ssp.c Bootstrap Loader Demonstration Program-bsldemo.c File Bootstrap Loader Patch-patch.txt Appendix Layout Suggestion Appendix Demonstration Program Usage Appendix Universal Bootstrap Loader Interface Board List Figures RST/NMI TEST Sequence Start User Program RST/NMI TEST Sequence Start Bootstrap Loader Frame Sent Bootstrap Loader Bootstrap Loader Interface Schematic Component Placement Layout Universal Interface Schematic Universal Interface Layout-Top Universal Interface Layout-Bottom Universal Interface Component Placement Universal Interface Component Placement List Tables Bootstrap Loader UART Settings Bootstrap Loader Functions Overview Serial-Port Signals Assignments RS-232 Levels Parts List Additional Connectors/Pads Bootstrap Loader Access Functions Command-Line Parameters Program-Flow Modifiers Invocation Examples Universal Interface Parts List Assignment Target Connector
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Introduction
MSP430 derivatives with flash memory (electrically-erasable programmable memory) allow modification data program code matter seconds. Erasure cycles using light clear EPROM longer required. control unit required access these features. Part this control unit bootstrap loader, implemented MSP430 devices with flash memory. This report describes hardware software solutions access loader from control simple bootstrap loader.
Bootstrap Loader Basics
This section reviews basic principals bootstrap loader. Please documentation MSP430F11x (SLAS256) MSP430F11x1 (SLAS241) application note Features MSP430 Bootstrap Loader MSP430F1121 (SLAA089) more details. bootstrap loader program that allows communication with MSP430 serial link, even when flash memory completely erased. confuse bootstrap loader with programs found some digital signal processors (DSP) that automatically load program code (and data) from external memory internal memory DSP. These programs often referred bootstrap loaders, too.
Invoking Bootstrap Loader
MSP430 bootstrap loader does start automatically; special sequence required RST/NMI TEST pins. user program, with reset vector located memory address 0FFFEh, starts when TEST pulled during low-to-high transition RST/NMI (see Figure Figure shows sequence required start bootstrap loader. Please documentation mentioned Bootstrap Loader Basics section more information start-up sequences.
RST/NMI Test/VPP User Program Starts
Figure RST/NMI TEST Sequence Start User Program
RST/NMI Test/VPP Boot Loader Starts Test/VPP Intern
Figure RST/NMI TEST Sequence Start Bootstrap Loader
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Access Bootstrap Loader
After invoking bootstrap loader TEST RST/NMI pins, communication established using standard-asynchronous-serial protocol. MSP430 port P1.1 (BSLTX) used transmit data, port P2.2 (BSLRX) used receive data. UART settings shown Table Table Bootstrap Loader UART Settings
SETTING Baudrate Data bits Parity Stop bits VALUE 9600 baud (binary) Even
protocol used communicate with bootstrap loader derived from more complex protocol; this adds some overhead user program. First must send synchronization byte. bootstrap loader receives this character correctly, returns acknowledge byte. After successful synchronization, sends frame containing command data. frame (see Figure divided into header section, data section, check-sum bytes. data section contains least four bytes data: usually start address length, some commands ignore contents interpret differently. case word data (two bytes word), byte order always low-byte/high-byte.
(lo) (hi) (hi) Data Data Data Data Check Address (Start) Length Byte High Byte
Header Section Hdr: Cmd: (Always) Code Requested Function Number Bytes Data Section
Data Section (lo): (hi):
Figure Frame Sent Bootstrap Loader After processing frame, bootstrap loader either returns acknowledge signal, negative acknowledge frame valid), command-failed signal command allowed).
Bootstrap Loader Functions
bootstrap loader protected unprotected functions. enable protected functions fully-programmed interrupt-vector table (located address range 0FFE0h 0FFFFh) must sent bootstrap loader. This section gives brief overview commands available. commands their usage described more detail Features MSP430 Bootstrap Loader MSP430F1121 document, literature number SLAA089, software section this application note.
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
2.3.1
Unprotected Functions
password, enables protected functions Mass erase, completely erases flash memory. Afterwards password access protected functions times 0FFFFh.
2.3.2
Protected Functions
Transmit block, writes data into MSP430's memory Receive block, reads data MSP430's memory Erase segment Load program counter, starts execution Table Bootstrap Loader Functions Overview
FUNCTION password Mass erase Transmit byte Receive byte Erase Load L1=L2 ADDRESS Flash Start Start Segment Start LENGTH 0A506h 0A502h DATA Password Data byte)
Hardware Description
low-cost hardware presented this application note (Figure consists mainly low-dropout voltage regulator, some inverters, operational amplifier. There also some resistors, capacitors, diodes. complete parts list provided later this section. functional blocks described more detail following subsections.
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
PINHD-1X10
PINHD-2X7 JTAG 0603
LM358D IC3B
SERIAL
P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.0 P2.4 P2.3
330k
MSP430
P2.5 XOUT P2.0 P2.1
330k
PINHD-1X10
PINHEAD
7414 IC2A 7414 IC2B 7414 IC2D
330k
330k BAV70
Quarz CON2 CON1 I-meassure
7414 IC2C
330k
680k
680k
TPS76030 2.2yF 6.3V
680k
BAV70
33yF 33yF BAR43C
IC3A LM358D
100nF 100nF RESET CON3
IC2P
7414 IC2F
IC2E 7414
Figure Bootstrap Loader Interface Schematic
Power Supply
Power bootstrap loader hardware supplied RS-232 interface. RS-232 signals (pin serial connector) (pin serial connector) normally deliver positive voltage load capacitor power low-dropout voltage regulator (Texas Instruments TPS76030 LP2980-3.0, equivalent low-dropout regulator). Using fairly capacitor, possible draw short-duration current that higher than driving serial port supply. This feature required program flash memory, example. also possible connect external supply voltage (Vext, CON4) supply power hardware JTAG connector. Diodes used prevent reverse-polarity flow.
Serial Interface
Table shows signals used communicate with bootstrap loader. names refer function seen from example, receives data pin, whereas bootstrap loader needs drive this signal. assignment shown sub-D connector refers connector assembled into seen from outside).
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
Vext CON4
SLAA096A
Table Serial-Port Signals Assignments
NAME FULL NAME Receive data Transmit data Data terminal ready Request send Ground SERIAL 3-PIN SUB-D (PC)
3.2.1
Level Shifting
Simple CMOS inverters with Schmitt-trigger characteristics (IC2) used transform RS-232 levels (see Table CMOS levels. Table RS-232 Levels
LOGIC LEVEL RS-232 LEVEL Mark Space RS-232 VOLTAGE LEVEL
Depending overvoltage protection device family selected, excess voltage either conducted 74HC14) 74AHC14). protection diode conducts Vcc, voltage regulator needs compensate overvoltage. Therefore 74AHC14 device, which conducts ground (GND), recommended; however, 74HC14 also works well. avoid excessive power dissipation damage protection diodes, series resistors (R1, used limit input current. operational amplifier (IC3) used generate RS-232 levels CMOS levels. level positive input Vcc/2 (1.5-V nominal). level negative input rises above this level, output pulled negative supply operational amplifier (mark). level drops below Vcc/2, output pulled positive rail (space). positive supply operational amplifier same input voltage regulator. separate capacitor (C10) used generate negative-supply voltage. This capacitor charged receiving signal bootstrap loader hardware (Pin SERIAL connector). During asynchronous serial communication, combination stop start used synchronize sender receiver. After transmission data byte, stop forces transmission line into defined state, which usually logic RS-232 terms, mark. This means that transmission-line voltage negative when there transmission capacitor charged. Diodes used prevent discharge capacitor during transmission. Because half-duplex protocol used communicate with bootstrap loader (there only sender time), voltage receiving line negative stable used supply operational amplifier with required voltage.
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
3.2.2
Control RST/NMI TEST Pins
RST/NMI TEST pins MSP430 controlled signals, respectively. These signals must deliver positive voltage supply bootstrap loader hardware. They also used control levels RST/NMI TEST pins. levels RST/NMI TEST during normal operation logic logic respectively. achieve these levels corresponding RS-232 signals power-supply lines, necessary inverters RST/NMI inverter TEST pin. Diodes prevent discharge capacitor allow control RS-232 lines (RTS DTR).
Parts List
Table Parts List
PART JTAG SERIAL
VALUE/ PART NUMBER BAV70 BAV70 BAR43C MSP430F11x TPS76030 74AHC14 LM358D PINHD-1X10 PINHD-1X10 PINHD-2X7 PINHD-2x5
PACKAGE 7243 0805 1206 0805 7243 SOT23 SOT23 SOT23 SO20 SOT23/5 SO14 0603 0603 0603 0603 0603 0603 0603 0603 0603 0603 2X05 2X05 2X07 2X05 RS-232 connector (see Table High-speed double diode High-speed double diode Schottky (alternate: 74HC14 text)
COMMENT
Assemble only with programming adapter: forces Vext Access pins 11-20 MSP430F11x Access pins 1-10 MSP430F11x
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Table Additional Connectors/Pads
NAME CON1 CON2 CON3 CON4 DESCRIPTIVE NAME I-measure Quartz RESET Vext LAYOUT 0805 0805 0805 0805 COMMENT current measurements connect optional quartz connect optional reset button connect optional external-power supply
Software Description
This section explains basic sequences required access bootstrap loader using RS-232 interface code presented here written language using 32-bit WindowsAPI calls under Microsoft Visual C++5.0 also work seamlessly under version 6.0). code originally written 16-bit Windows ported 32-bit Windows (Win32TM, Windows 95/98TM, Windows NTTM) mainly replacing function names. Some Win32 features were used maintain portability. commercial library used instead Windows interface. detailed description titled Serial Communications Win32 available online Online documentation Visual also available from Microsoft development network library. Please consult Windows software development (SDK) documentation detailed description functions used. Complete software listings found Appendix
Global Variables
following global variables used throughout code examples. definitions types DCB, COMSTAT, COMMTIMEOUTS found Windows documentation.
HANDLE COMSTAT COMMTIMEOUTS hComPort; comDCB; comState; orgTimeouts; COM-port COM-port COM-port Original handle control settings status information COM-port time-out
Initialization RS-232 Port
access serial RS-232 port, program must request handle port wants (usually either COM1 COM2). following code used this request:
Size internal WINDOWS-Comm buffer: #define QUEUE_SIZE char* lpszDevice= "COM1" example hComPort= CreateFile(lpszDevice, GENERIC_READ GENERIC_WRITE, OPEN_EXISTING, (hComPort INVALID_HANDLE_VALUE) Error! (SetupComm(hComPort, QUEUE_SIZE, QUEUE_SIZE) Error!
Microsoft, Windows, Win32, Windows Windows Visual trademarks Microsoft Corporation.
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
operation known overlapped input/output (I/O) performed under Win32. This means that system immediately return caller, even operation finished, signal caller when operation complete. Overlapped operation good choice when portability concern because most operating systems support this reason used this program, corresponding parameters required when calling CreateFile zero. After receiving valid handle, settings communication port need defined assigned (see Table original settings first:
(!GetCommState(hComPort, &comDCB)) Error!
Then they modified. most important settings communication with bootstrap loader shown following program section:
comDCB.BaudRate comDCB.ByteSize comDCB.Parity comDCB.StopBits comDCB.fBinary comDCB.fParity comDCB.fRtsControl CBR_9600; EVENPARITY; ONESTOPBIT; TRUE; TRUE; RTS_CONTROL_ENABLE; Startup Baudrate: 9,6kBaud
comDCB.fDtrControl DTR_CONTROL_ENABLE;
Enable Binary Transmission Enable Parity Check power supply TEST control power supply RST/NMI control
Finally, modified settings assigned port:
(!SetCommState(hComPort, &comDCB)) Error!
Win32 application should always communication time-outs when using communication port; otherwise, default settings left-over values from previous applications used. This application does require time-out functionality. Therefore, time-outs completely disabled once original settings saved they restore program:
Save original time-out values: GetCommTimeouts(hComPort, &orgTimeouts); Windows time-out values (disable built-in time-outs): COMMTIMEOUTS timeouts; timeouts.ReadIntervalTimeout= (!SetCommTimeouts(hComPort, &timeouts)) Error!
transmit receive buffers cleared complete initialization sequence:
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
PurgeComm(hComPort, PURGE_TXCLEAR PURGE_TXABORT); PurgeComm(hComPort, PURGE_RXCLEAR PURGE_RXABORT);
complete example initialization routine found under Serial Communication Implementation File (see Appendix routine:
comInit(LPCSTR lpszDevice, DWORD aTimeout, aProlongFactor)
Invoking Bootstrap Loader
levels RST/NMI TEST must toggled shown section invoke bootstrap loader. following subroutines used control corresponding RS-232 lines DTR:
void SetRSTpin(BOOL level) Controls RST/NMI GND; VCC) (level TRUE) comDCB.fDtrControl DTR_CONTROL_ENABLE; else comDCB.fDtrControl DTR_CONTROL_DISABLE; SetCommState(hComPort, &comDCB); SetRSTpin void SetTESTpin(BOOL level) Controls TEST VCC; GND) (level TRUE) comDCB.fRtsControl RTS_CONTROL_ENABLE; else comDCB.fRtsControl RTS_CONTROL_DISABLE; SetCommState(hComPort, &comDCB); SetTESTpin
Calling function SetRSTpin with pulls RST/NMI ground, whereas calling function SetTESTpin with applies TEST pin. This difference different number inverters used these pins (see Section following subroutine allows resetting MSP430 bootstrap loader hardware using functions previously shown. First necessary charge capacitor supply power board. Then RST/NMI TEST pins toggled required. possible reset MSP430 start user program (invokeBSL=FALSE) invoke bootstrap loader with invokeBSL=TRUE:
void bslReset(BOOL invokeBSL) charge capacitor boot loader hardware: SetRSTpin(1); SetTESTpin(1); delay(250); SetRSTpin(0); pin: (invokeBSL)
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
SetTESTpin(1); SetTESTpin(0); SetTESTpin(1); SetTESTpin(0); SetRSTpin (1); SetTESTpin(1);
TEST TEST TEST TEST TEST
pin: pin: pin: pin: pin: pin:
else SetRSTpin(1); pin: Give MSP430's oscillator time stabilize: delay(250); Clear buffers: PurgeComm(hComPort, PURGE_TXCLEAR); PurgeComm(hComPort, PURGE_RXCLEAR); bslReset
possible gain access RS-232 interface invoke bootstrap loader using functions presented far. ready access bootstrap loader.
Access Bootstrap Loader
This section describes basic routines access bootstrap loader. Table gives overview functions presented indicates sections within Appendix where their complete listings found. constant definitions located header listings. Table Bootstrap Loader Access Functions
SECTIONS Bootstrap loader communication header file, bootstrap loader communication implementation file Serial-communication header file, serial-communication implementation file FUNCTIONS bslReset, bslSync, bslTxRx comInit, comTxRx, comDone
4.4.1
Synchronization
MSP430 must synchronized before each frame that calls function. following character (0x80) must sent MSP430 this purpose:
#define BSL_SYNC 0x80
Therefore, this value assigned variable function WriteFile called with communication-port handle first parameter. number bytes transmit must specified used here). last parameters unimportant ignored this particular case.
Send synchronization byte: BSL_SYNC; WriteFile(hComPort, &ch, &NrTx, NULL);
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
bootstrap loader receives this character correctly, returns DATA_ACK (0x90); otherwise, returns unknown value because loader needs this synchronization character generate timing (for serial communication, example). also possible that character returned, like when MSP430 with bootstrap loader function connected. following subroutine used check whether given number characters received within given time period. uses function ClearCommError receive actual status communication port. field cbInQue COMSTAT structure holds number received bytes:
comWaitForData(int count, DWORD timeout) DWORD errors; rxCount= DWORD startTime= GetTickCount(); ClearCommError(hComPort, &errors, &comState); while (((rxCount= comState.cbInQue) count) (calcTimeout(startTime) timeout)); return(rxCount);
This subroutine used synchronization function wait character. characters received, they queried using function ReadFile, shown following program section. synchronization successful when character received DATA_ACK.
Wait byte; time-out: 100ms rxCount= comWaitForData(1, 100); (rxCount ReadFile(hComPort, &ch, &NrRx, NULL); DATA_ACK) return(ERR_NONE); Sync. successful
routine bslSync() implements function previously described.
4.4.2
Transmission Frame
following function used send receive frame:
comTxRx(BYTE cmd, BYTE data[], BYTE length)
This function implements functionality Standard Serial Protocol. Only subset functionality needed supported bootstrap loader communication. This routine uses Win32 functions already described. function
bslTxRx(BYTE cmd, WORD addr, WORD len, BYTE blkout[], BYTE blkin[])
combines synchronization transmission frame. also configures frame requirements bootstrap loader. important requirement that number bytes sent bootstrap loader (using command TXBLK, instance) requested loader (using command RXBLK) must always even.
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Calling Bootstrap Loader Functions
fairly simple call functions bootstrap loader using function bslTxRx presented before. parameters must required within function call (see examples Complete Application section). constant definitions corresponding available commands found Bootstrap Loader Communication Header File (see Appendix
Releasing RS-232 Port
program, RS-232 port must released using function CloseHandle(hComPort). Otherwise other applications this port because access rights serial communication ports usually granted only program time. routine comDone( provides more sophisticated method release RS-232 port. waits until remaining data transmitted, clears buffers, restores original time-out settings. Note that closing serial communication port usually cuts power application which powered serial port, because corresponding control lines disabled.
Complete Application
small application developed this section program file TI-TXT format into MSP430's flash memory. complete demonstration program code contained Bootstrap Loader Demonstration Program Appendix definitions variables used also found there. First, communication port opened. COM-port name changed particular needs, obtained from command line.
(comInit("COM1", DEFAULT_TIMEOUT, Error!
Then bootstrap loader invoked:
bslReset(1);
next step, flash memory completely erased using mass erase command:
((error= bslTxRx(BSL_MERAS, 0xff00, 0xa506, NULL, blkin)) Error! Command: Mass Erase address within flash memory. Required setting mass erase!
password access protected functions bootstrap loader gets reset when flash memory erased. memory cells 0FFh. protected functions enabled sending corresponding password.
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Fill blkout with 0xff 0x20; i++) blkout[i]= 0xff; ((error= bslTxRx(BSL_TXPWORD, Command: transmit password 0xffe0, Address interrupt vectors 0x0020, Number bytes blkout, blkin)) Error! Special case here: 7(ERR_RX_NAK): Password accepted!
Afterwards, file TI-TXT format parsed data programmed into flash memory verified. There separate subroutine demonstration listing that called from main program parse file program verify flash contents:
Program: ((error= programFlash("TEST.TXT", ACTION_PROGRAM)) Error! Verify: ((error= programFlash("TEST.TXT", ACTION_VERIFY)) Error!
routine programFlash simply parses file with given name (the file name derived from command line), fills buffer with extracted data, calls another subroutine when buffer almost full. data must programmed, sent bootstrap loader using transmit-block command (BSL_TXBLK).
error= bslTxRx(BSL_TXBLK, addr, len, blkout, blkin);
Data read from bootstrap loader (receive block, BSL_RXBLK) compared against contents transmission buffer verification:
error= bslTxRx(BSL_RXBLK, addr, len, NULL, blkin); (error Cancel! else len; i++) Compare data blkout blkin: (blkin[i] blkout[i]) printf("Verification failed (%x, %x)\n", addr+i, blkin[i], blkout[i]);
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
return(ERR_VERIFY_FAILED); Verify failed!
Note that similar sequence used check erasure this range. this case, contents blkin compared against erasure pattern 0xff. After successful verification MSP430 reset user program start executing:
bslReset(0);
serial communication port must released program:
comDone();
users have pieces together write their applications access MSP430 bootstrap loader adapt their special needs.
Error Recovery
There error-recovery mechanism implemented within demonstration program. program aborted when error detected. some cases might useful implement some kind error-recovery mechanism. data frame transmitted MSP430 rejected with data-not-acknowledged signal (DATA_NAK), transmission frame simply repeated. possible that wrong data been programmed flash, more complex recovery mechanism that includes verification, erasure, reprogramming might required. received frame correct (wrong checksum, inconsistent lengths), command previously sent receive block from MSP430 needs repeated.
Advanced Features
4.9.1
Detecting Bootstrap Loader's Version
Detecting bootstrap loader version within device currently connected requires unlocking protected functions (see previous sections). address (0x0ffa) where bootstrap loader version stored then read. version information consists bytes: main revision number stored first byte, subrevision number stored second byte. After extracting this information from input buffer, version displayed used further processing, depending current loader version.
Read actual bootstrap loader version. ((error= bslTxRx(BSL_RXBLK, Command: Read/Receive Block 0x0ffa, Start address bytes read NULL, blkin)) ERR_NONE) BYTE bslVerLo; BYTE bslVerHi; memcpy(&bslVerHi, &blkin[0], memcpy(&bslVerLo, &blkin[1], bslVer= (bslVerHi bslVerLo; printf("Current bootstrap loader version: %x.%x\n", bslVerHi, bslVerLo); else Error Handling
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
4.9.2
Executing Code
bootstrap loader command LOADPC allows execution previously-programmed code. This command loads given address program counter starts execution this address. executed code located type memory (such flash memory). example, this feature used load calibration routine into RAM, calibration, return bootstrap loader, read back calibration data. used program execute another loader with additional features. available memory (RAM flash), resources required bootstrap loader, their initialization (for example, P1SEL, P2SEL, CCTL0 must cleared), especially stack usage must carefully considered. Note that initialization stack pointer differs from version version bootstrap loader. loader's start-address vector stored address (0x0c00) used return from loaded routine bootstrap loader:
&00C00h Return bootstrap loader
demonstration program shows program updated bootstrap loader into then execute prerequisite, protected functions loader must unlocked sending appropriate password. After obtaining access protected bootstrap loader commands, subroutine within loader's code must called prepare position stack pointer, loader version 1.10 below. These versions loader have so-called dynamic stack pointer initialization, there guarantee that loading data will interfere with actual stack. stack pointer initialized point fixed loader's stack frame loading with address appropriate routine within bootstrap loader. Calling this function locks protected commands, password must resent.
(bslVer 0x0110) Version 1.10 below? ((error= bslTxRx(BSL_LOADPC, Command: load 0x0C22, Address load into additional data! NULL, blkin)) ERR_NONE) Error! Resend password regain access protected functions. ((error= txPasswd(passwdFile)) ERR_NONE) Error! Special case here: 7(ERR_RX_NAK): Password accepted!
possible program data into using standard bootstrap loader methods. demonstration program, routineTIText used program verify another loader with name corresponding Text file given variable newBSLFile:
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
printf("Load \"%s\" into RAM.\n", newBSLFile); ((error= programTIText(newBSLFile, File program ACTION_PROGRAM)) ERR_NONE) Error! printf("Verify \"%s\".\n", newBSLFile); ((error= programTIText(newBSLFile, File verify ACTION_VERIFY)) ERR_NONE) Error!
programmed code executed. loader start-up vector located address 0x0300. After reading this address, contents start-up vector (variable startaddr following code snippet) used load program counter:
Read startvector bootstrap loader: ((error= bslTxRx(BSL_RXBLK, 0x0300, NULL, blkin)) WORD startaddr; memcpy(&startaddr, &blkin[0], printf("Starting %x.\n", startaddr); error= bslTxRx(BSL_LOADPC, Command: Load startaddr, Address load into additional data! NULL, blkin); Error Handling ERR_NONE)
loaded program executed now. Since just another loader with same communication protocol original one, possible continue programming flash memory original loader. protected functions loader locked, since started with start address pointing initialization routine. password must sent again unlock these commands. Execution then proceed normal. Within demonstration program, command-line parameter controls loader used. example, loader contained Text File BL_130V.TXT, following command line used:
BSLDEMO -bBL_130V.TXT +epr TEST.TXT
4.10 Patch First Version Bootstrap Loader
first versions (1.10 below) bootstrap loader require small patch program flash. patch described this section, handling included program BSLDEMO.C (see Bootstrap Loader Demonstration Program Appendix text file patch.txt, included Appendix also required. patch handling within demonstration program switched (for future versions bootstrap loader) deleting, commenting out, following line:
#define WORKAROUND
parts code required workaround surrounded preprocessor commands:
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
#ifdef WORKAROUND #endif
After obtaining access protected bootstrap loader commands, position stack pointer must prepared patch described section 4.9.2. Afterwards, patch written into RAM. text file patch.txt holding patch found Appendix Downloading performed flash-programming function that parses text file:
programFlash("PATCH.TXT", ACTION_PROGRAM ACTION_VERIFY);
this case, masks ACTION_PROGRAM ACTION_VERIFY used together program verify patch single pass. This means that file patch.txt read only once. Note that patch must located same directory executable program. patch programming, only needs loaded with start address patch (0x0220) before sending frame. demonstration program, invocation patch done separate preparePatch function (see Bootstrap Loader Demonstration Program Appendix There another that affect memory cells (either peripheral-module registers) transmitted frame certain checksum; unfortunately, general workaround provided. Transmitting data receiving data from MSP430 using patch prevents this error. other cases, only help that provided warning when this situation occurs (however, unlikely that error occurs reading writing performed using patch.) warning generated within comRxTx function contained file SSP.C (see Serial Communication Implementation File Appendix
#define BSL_CRITICAL_ADDR 0x0A00 WORD accessAddr= (0x0212 (checksum^0xffff)) 0xfffe; (BSLMemAccessWarning (accessAddr BSL_CRITICAL_ADDR)) printf("WARNING: This command might change data address %x!\n", accessAddr, accessAddr
global variable BSLMemAccessWarning allows warning message turn-on turn-off. Since patch fixes this bug, warning turned within preparePatch function, turned back postPatch function (see Bootstrap Loader Demonstration Program listing Appendix complete sequence receiving data from MSP430 becomes:
error= preparePatch(); (error ERR_NONE) return(error); error= bslTxRx(BSL_RXBLK, addr, len, NULL, blkin); postPatch();
Similarly, transmission data MSP430 handled follows:
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
error= preparePatch(); (error ERR_NONE) return(error); error= bslTxRx(BSL_TXBLK, addr, len, blkout, blkin); postPatch();
demonstration program solves additional problem that applies only devices with flash memory sizes greater than bytes. these memories, built-in mass-erase time short erase completely. This problem fixed simply repeating mass-erase command several times. This workaround activated defining default number mass-erase cycles:
#define ADD_MERASE_CYCLES
number mass-erase cycles changed value using demonstration program's command-line parameter example, used have only mass-erase cycle with MSP430F11x(1), which sufficient these devices.
References
MSP430F11x Mixed Signal Microcontroller data sheet, literature number SLAS256 MSP430F11x1 Mixed Signal Controller data sheet, literature number SLAS241 Graf, Franz. Features MSP430 Bootstrap Loader MSP430F1121, literature number SLAA089. Denver, Allen. Serial Communication Win32, Microsoft Developer Network (MSDN) Library Microsoft Win32 Software Development (SDK) Documentation
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Appendix
Building Demonstration Program
Listings
build demonstration program, necessary compile files bslcomm.c bsldemo.c link resulting object files. necessary compile file ssp.c separately because directly included file bslcomm.c. prefer different approach, copy paste contents ssp.c into bslcomm.c position following line, remove this line:
#include "ssp.c"
example, using Visual C++, create project select Win32 Console Application template. project created must empty. Include files bsldemo.c, bslcomm.c, bslcomm.h build your project. stated before, files ssp.c ssp.h included automatically. building process will fail include ssp.c file your project.
Bootstrap Loader Communication Header File-bslcomm.h
Copyright 1999-2000 Texas Instruments, Inc. Author: Volker Rzehak software related documentation provided without warranty support kind Texas Instruments expressly disclaims other warranties, express implied, including, limited implied warranties merchantability fitness particular purpose. Under circumstances shall Texas Instruments liable incidental, special consequential damages that result from inability software related documentation, even Texas Instruments been advised liability. Unless otherwise stated, software written copyrighted Texas Instruments distributed "freeware". modify this software without charge restriction. distribute others, long original author acknowledged. Project: MSP430 Bootstrap Loader Demonstration Program File: BSLCOMM.H History: Version 1.00 (05/2000) Version 1.11 (09/2000) Added definition BSL_CRITICAL_ADDR. #ifndef BSLComm_H
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
#define BSLComm_H #include "ssp.h" Transmit password boot loader: #define BSL_TXPWORD 0x10 Transmit block boot loader: #define BSL_TXBLK 0x12 Receive block from boot loader: #define BSL_RXBLK 0x14 Erase segment: #define BSL_ERASE 0x16 Erase complete FLASH memory: #define BSL_MERAS 0x18 Load start execution: #define BSL_LOADPC 0x1A Bootstrap loader synchronization error: #define ERR_BSL_SYNC Upper limit address range that might modified "BSL checksum bug". #define BSL_CRITICAL_ADDR 0x0A00 #ifdef _cplusplus extern #endif extern BSLMemAccessWarning; void bslReset(BOOL invokeBSL); Applies entry sequence RST/NMI TEST/VPP pins Parameters: invokeBSL TRUE: complete sequence invokeBSL FALSE: only RST/NMI accessed bslSync(); Transmits Synchronization character expects receive Acknowledge character Return Return Sync. failed. bslTxRx(BYTE cmd, WORD addr, WORD len, BYTE blkout[], BYTE blkin[]); Transmits command (cmd) with parameters: start-address (addr), length (len) additional data (blkout) boot loader. Parameters return boot loader passed blkin. Return Return Error! #ifdef _cplusplus #endif #endif
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Bootstrap Loader Communication Implementation File-bslcomm.c
Copyright 1999-2000 Texas Instruments, Inc. Author: Volker Rzehak software related documentation provided without warranty support kind Texas Instruments expressly disclaims other warranties, express implied, including, limited implied warranties merchantability fitness particular purpose. Under circumstances shall Texas Instruments liable incidental, special consequential damages that result from inability software related documentation, even Texas Instruments been advised liability. Unless otherwise stated, software written copyrighted Texas Instruments distributed "freeware". modify this software without charge restriction. distribute others, long original author acknowledged. Project: MSP430 Bootstrap Loader Demonstration Program File: BSLCOMM.C History: Version 1.00 (05/2000) Version 1.11 (09/2000) Added handling frames with starting address (This required bootstrap loaders with word programming algorithm! BSL-Version 1.30) Usage BSL_CRITICAL_ADDR warnings about memory accesses "BSL checksum bug". #include <windows.h> #include <string.h> #include <stdio.h> #include <fcntl.h> #include "bslcomm.h" #include "ssp.c" #define BSL_SYNC 0x80 Warning, access memory below 0x1000 possible. This happen error first version(s) bootstrap loader code combination with specific checksum values. Warning.
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
BSLMemAccessWarning= Default: warning. void SetRSTpin(BOOL level) Controls RST/NMI GND; VCC) (level TRUE) comDCB.fDtrControl DTR_CONTROL_ENABLE; else comDCB.fDtrControl DTR_CONTROL_DISABLE; SetCommState(hComPort, &comDCB); SetRSTpin void SetTESTpin(BOOL level) Controls TEST VCC; GND) (level TRUE) comDCB.fRtsControl RTS_CONTROL_ENABLE; else comDCB.fRtsControl RTS_CONTROL_DISABLE; SetCommState(hComPort, &comDCB); SetTESTpin void bslReset(BOOL invokeBSL) Applies entry sequence RST/NMI TEST/VPP pins Parameters: invokeBSL TRUE: complete sequence invokeBSL FALSE: only RST/NMI accessed inverted twice boot loader hardware TEST inverted (only once) Need positive voltage DTR, power-supply hardware charge capacitor boot loader hardware: SetRSTpin(1); SetTESTpin(1); delay(250); SetRSTpin(0); pin: (invokeBSL) SetTESTpin(1); TEST pin: SetTESTpin(0); TEST pin: SetTESTpin(1); TEST pin: SetTESTpin(0); TEST pin: SetRSTpin (1); pin: SetTESTpin(1); TEST pin: else SetRSTpin(1); pin: Give MSP430's oscillator time stabilize: delay(250); Clear buffers: PurgeComm(hComPort, PURGE_TXCLEAR); PurgeComm(hComPort, PURGE_RXCLEAR);
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
bslReset bslSync() Transmits Synchronization character expects receive Acknowledge character Return Return Sync. failed. BYTE rxCount, loopcnt; const BYTE cLoopOut Max. trials synchronization DWORD NrTx; DWORD NrRx; (loopcnt=0; loopcnt cLoopOut; loopcnt++) PurgeComm(hComPort, PURGE_RXCLEAR); Clear receiving queue Send synchronization byte: BSL_SYNC; WriteFile(hComPort, &ch, &NrTx, NULL); Wait byte; Timeout: 100ms rxCount= comWaitForData(1, 100); (rxCount ReadFile(hComPort, &ch, &NrRx, NULL); DATA_ACK) return(ERR_NONE); Sync. successful (loopcount) return(ERR_BSL_SYNC); Sync. failed bslSync bslTxRx(BYTE cmd, WORD addr, WORD len, BYTE* blkout, BYTE* blkin) Transmits command (cmd) with parameters: start-address (addr), length (len) additional data (blkout) boot loader. Parameters return boot loader passed blkin. Return Return Error! BYTE dataOut[MAX_FRAME_SIZE]; error; WORD length= Make sure that even, when sending data BSL: ((cmd BSL_TXBLK) ((len Inc. fill blkout with 0xFF even number bytes send! blkout[(len++)]= 0xFF;
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
(cmd BSL_TXBLK) Align even start address ((addr Decrement address addr--; fill first byte blkout with 0xFF memmove(&blkout[1], &blkout[0], len); blkout[0]= 0xFF; len++; Make sure that even ((len Inc. fill last byte blkout with 0xFF blkout[(len++)]= 0xFF; Make sure that even, receiving data from BSL: ((cmd BSL_RXBLK) ((len len++; (cmd BSL_RXBLK) Align even start address ((addr Decrement address addr--; request additional byte. len++; Make sure that even ((len len++; ((cmd BSL_TXBLK) (cmd BSL_TXPWORD)) length necessary information data frame: dataOut[0] (BYTE)( addr 0x00ff); dataOut[1] (BYTE)((addr 0x00ff); dataOut[2] (BYTE)( 0x00ff); dataOut[3] (BYTE)((len 0x00ff); (blkout NULL) Copy data blkout into frame:
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
memcpy(&dataOut[4], blkout, len); (bslSync() ERR_NONE) return(ERR_BSL_SYNC); Send frame: error comTxRx(cmd, dataOut, (BYTE)length); (blkin NULL) Copy received data frame buffer into blkin: memcpy(blkin, &rxFrame[4], rxFrame[2]); return (error);
Serial Communication Header File-ssp.h
Copyright 1999-2000 Texas Instruments, Inc. Author: Volker Rzehak software related documentation provided without warranty support kind Texas Instruments expressly disclaims other warranties, express implied, including, limited implied warranties merchantability fitness particular purpose. Under circumstances shall Texas Instruments liable incidental, special consequential damages that result from inability software related documentation, even Texas Instruments been advised liability. Unless otherwise stated, software written copyrighted Texas Instruments distributed "freeware". modify this software without charge restriction. distribute others, long original author acknowledged. #ifndef SSP_H #define SSP_H #include <windows.h> #define MODE_SSP #define MODE_BSL Error Codes: Error: #define ERR_NONE Unspecific error: #define ERR_COM
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
OpenComm failed: #define ERR_OPEN_COMM SetCommState failed: #define ERR_SET_COMM_STATE Synchronisation failed: #define ERR_SYNC_FAILED Unspecific error concerning transmission command: #define ERR_SEND_COMMAND Timeout while receiving header": #define ERR_RX_HDR_TIMEOUT received: #define ERR_RX_NAK Command send ACK: indicates that didn't complete correctly: #define ERR_CMD_NOT_COMPLETED Command failed, defined allowed: #define ERR_CMD_FAILED CloseComm failed: #define ERR_CLOSE_COMM Header Definitions: #define CMD_FAILED 0x70 #define DATA_FRAME 0x80 #define DATA_ACK 0x90 #define DATA_NAK 0xA0 #define QUERY_POLL 0xB0 #define QUERY_RESPONSE 0x50 #define OPEN_CONNECTION 0xC0 #define ACK_CONNECTION 0x40 #define DEFAULT_TIMEOUT #define DEFAULT_PROLONG #define MAX_FRAME_SIZE #define MAX_DATA_BYTES #define MAX_DATA_WORDS #ifdef _cplusplus extern #endif Support Subroutines: extern DWORD calcTimeout(DWORD startTime); Calculates difference between startTime actual windows time milliseconds). extern void delay(DWORD time); Delays execution given time extern comWaitForData(int count, DWORD timeout); Waits until given number (count) bytes received given time (timeout) passed.
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
extern void comTxHeader(const BYTE txHeader); Communication Subroutines: extern comGetLastError(); Returns error code generated last function call SERCOMM-Function. this function returned without errors, comGetLastError will return zero (errNoError) well. #ifdef _cplusplus extern comInit(LPCSTR lpszDevice "COM1", DWORD aTimeout DEFAULT_TIMEOUT, aProlongFactor= DEFAULT_PROLONG); #else extern comInit(LPCSTR lpszDevice, DWORD aTimeout, aProlongFactor); #endif Tries open serial port given 'lpszDevice' initializes port global variables. timeout number allowed errors multiplied 'aProlongFactor' after transmission command give plenty time micro controller finish command. Returns zero function successful. extern comDone(); Closes used serial port. This function must called program, otherwise serial port might released used other programs. Returns zero function successful. #ifdef _cplusplus #endif #endif
Serial Communication Implementation File-ssp.c
Copyright 1999-2000 Texas Instruments, Inc. Author: Volker Rzehak software related documentation provided without warranty support kind Texas Instruments expressly disclaims other warranties, express implied, including, limited implied warranties merchantability fitness particular purpose. Under circumstances shall Texas Instruments liable
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
incidental, special consequential damages that result from inability software related documentation, even Texas Instruments been advised liability. Unless otherwise stated, software written copyrighted Texas Instruments distributed "freeware". modify this software without charge restriction. distribute others, long original author acknowledged. #include <string.h> #include <stdio.h> #include <windows.h> #include "ssp.h" Global Constants: Size internal WINDOWS-Comm-Buffer: #define QUEUE_SIZE #define MAX_FRAME_COUNT #define MAX_ERR_COUNT Global Variables: const unsigned short protocolMode= MODE_BSL; HANDLE hComPort; COM-Port Handle comDCB; COM-Port Control-Settings COMSTAT comState; COM-Port Status-Information COMMTIMEOUTS orgTimeouts; Original COM-Port Time-out Time milliseconds until timeout occurs: DWORD timeout DEFAULT_TIMEOUT; Factor which timeout after sending frame prolonged: prolongFactor= DEFAULT_PROLONG; Variable save latest error (used comGetLastError): lastError; BYTE seqNo, reqNo, txPtr, rxPtr; BYTE rxFrame[MAX_FRAME_SIZE]; DWORD nakDelay; Delay before DATA_NAK will send DWORD calcTimeout(DWORD startTime) exported! Calculates difference between startTime actual windows time milliseconds). return((DWORD)(GetTickCount() startTime)); void delay(DWORD time) exported! Delays execution given time #ifndef WIN32 DWORD startTime= GetTickCount(); while (calcTimeout(startTime) time); #else
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Sleep(time); #endif WORD calcChecksum(BYTE data[], WORD length) Calculates checksum "data". WORD* i_data; WORD checksum= BYTE i_data= (WORD*)data; length/2; i++) checksum^= i_data[i]; xor-ing return(checksum 0xffff); inverting comWaitForData(int count, DWORD timeout) exported! Waits until given number (count) bytes received given time (timeout) passed. DWORD errors; rxCount= DWORD startTime= GetTickCount(); ClearCommError(hComPort, &errors, &comState); while (((rxCount= comState.cbInQue) count) (calcTimeout(startTime) timeout)); return(rxCount); comRxHeader(BYTE *rxHeader, BYTE *rxNum, DWORD timeout) BYTE Hdr; DWORD dwRead; (comWaitForData(1, timeout) ReadFile(hComPort, &Hdr, &dwRead, NULL); *rxHeader= 0xf0; *rxNum 0x0f; (protocolMode MODE_BSL) reqNo= seqNo= *rxNum= return(ERR_NONE); else
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
*rxHeader= *rxNum= return(lastError= ERR_RX_HDR_TIMEOUT); void comTxHeader(const BYTE txHeader) DWORD dwWrite; BYTE Hdr= txHeader; WriteFile(hComPort, &Hdr, &dwWrite, NULL); comGetLastError() Returns error code generated last function call SERCOMM-Function. this function returned without errors, comGetLastError will return zero (errNoError) well. return(lastError); comInit(LPCSTR lpszDevice, DWORD aTimeout, aProlongFactor) Tries open serial port given 'lpszDevice' initializes port global variables. timeout number allowed errors multiplied 'aProlongFactor' after transmission command give plenty time micro controller finish command. Returns zero function successful. COMMTIMEOUTS timeouts; DWORD dwCommEvents; Init. global variables: seqNo= reqNo= rxPtr= txPtr= timeout= aTimeout; prolongFactor= aProlongFactor; hComPort= CreateFile(lpszDevice, GENERIC_READ GENERIC_WRITE, OPEN_EXISTING, this application serial port used nonoverlapped mode! (hComPort INVALID_HANDLE_VALUE) hComPort= return (lastError= ERR_OPEN_COMM); Error! (SetupComm(hComPort, QUEUE_SIZE, QUEUE_SIZE) CloseHandle(hComPort);
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
hComPort= return (lastError= ERR_OPEN_COMM); Error! Save original timeout values: GetCommTimeouts(hComPort, &orgTimeouts); Windows timeout values (disable build-in timeouts): timeouts.ReadIntervalTimeout= (!SetCommTimeouts(hComPort, &timeouts)) CloseHandle(hComPort); hComPort= return (lastError= ERR_OPEN_COMM); Error! dwCommEvents= EV_RXCHAR EV_TXEMPTY EV_RXFLAG EV_ERR; SetCommMask(hComPort, dwCommEvents); state modify (!GetCommState(hComPort, &comDCB)) CloseHandle(hComPort); hComPort= return (lastError= ERR_OPEN_COMM); Error! comDCB.BaudRate CBR_9600; Startup-Baudrate: 9,6kBaud comDCB.ByteSize nakDelay= comDCB.Parity EVENPARITY; comDCB.StopBits ONESTOPBIT; comDCB.fBinary TRUE; Enable Binary Transmission comDCB.fParity TRUE; Enable Parity Check comDCB.ErrorChar (char)0xff; Char. Parity-Err replaced with 0xff *(if fErrorChar TRUE) comDCB.fRtsControl RTS_CONTROL_ENABLE; power supply comDCB.fDtrControl DTR_CONTROL_ENABLE; power supply comDCB.fOutxCtsFlow= FALSE; comDCB.fOutxDsrFlow= FALSE; comDCB.fOutX FALSE; comDCB.fInX FALSE; comDCB.fNull FALSE; comDCB.fErrorChar FALSE; Assign state: (!SetCommState(hComPort, &comDCB)) CloseHandle(hComPort); hComPort= return(lastError= ERR_SET_COMM_STATE); Error! Clear buffers: PurgeComm(hComPort, PURGE_TXCLEAR PURGE_TXABORT);
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
PurgeComm(hComPort, PURGE_RXCLEAR PURGE_RXABORT); return(lastError= comInit comDone() Closes used serial port. This function must called program, otherwise serial port might released used other programs. Returns zero function successful. DWORD errors; DWORD startTime= GetTickCount(); Wait until data transmitted, long. (Timeout-Time) ClearCommError(hComPort, &errors, &comState); while ((comState.cbOutQue (calcTimeout(startTime) timeout)); Clear buffers: PurgeComm(hComPort, PURGE_TXCLEAR PURGE_TXABORT); PurgeComm(hComPort, PURGE_RXCLEAR PURGE_RXABORT); Restore original timeout values: SetCommTimeouts(hComPort, &orgTimeouts); Close COM-Port: (!CloseHandle(hComPort)) return(lastError= ERR_CLOSE_COMM); Error! else return(lastError= ERR_NONE); comDone comRxFrame(BYTE *rxHeader, BYTE *rxNum) DWORD dwRead; WORD checksum; BYTE* rxLength; WORD rxLengthCRC; rxFrame[0]= DATA_FRAME *rxNum; (comWaitForData(3, timeout) ReadFile(hComPort, &rxFrame[1], &dwRead, NULL); ((rxFrame[1] (rxFrame[2] rxFrame[3])) rxLength= &rxFrame[2]; Pointer rxFrame[2] rxLengthCRC= *rxLength CRC-Bytes length (comWaitForData(rxLengthCRC, timeout) rxLengthCRC) ReadFile(hComPort, &rxFrame[4], rxLengthCRC, &dwRead, NULL); Check received frame:
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
checksum= calcChecksum(rxFrame, (WORD)(*rxLength+4)); rxLength+4: Length with header ((rxFrame[*rxLength+4] (BYTE)checksum) (rxFrame[*rxLength+5] (BYTE)(checksum 8))) return(ERR_NONE); Frame received correctly send next frame) (Checksum correct?) (Data: timeout?) (Add. header info. correct?) (Add. header info.: timeout?) return(ERR_COM); Frame errors! comRxFrame comTxRx(BYTE cmd, BYTE dataOut[], BYTE length) Sends command with data given dataOut microcontroller expects either acknowledge frame with result from microcontroller. results stored dataIn NULL pointer passed). this routine necessary protocol stuff handled. Returns zero function successful. DWORD dwWrite; DWORD errors; BYTE txFrame[MAX_FRAME_SIZE]; WORD checksum= errCtr= resendCtr= BYTE rxHeader= BYTE rxNum= resentFrame= pollCtr= Transmitting part Prepare data transmit ((length Fill with byte have even number bytes send (protocolMode MODE_BSL) dataOut[length++]= 0xFF; fill with 0xFF else dataOut[length++]= fill with zero txFrame[0]= DATA_FRAME seqNo; txFrame[1]= cmd; txFrame[2]= length; txFrame[3]= length; reqNo= (seqNo MAX_FRAME_COUNT; memcpy(&txFrame[4], dataOut, length); checksum= calcChecksum(txFrame, (WORD)(length+4)); txFrame[length+4]= (BYTE)(checksum); txFrame[length+5]= (BYTE)(checksum
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
WORD accessAddr= (0x0212 (checksum^0xffff)) 0xfffe; 0x0212: Address wCHKSUM (BSLMemAccessWarning (accessAddr BSL_CRITICAL_ADDR)) printf("WARNING: This command might change data address %x!\n", accessAddr, accessAddr Transmit data: Clear receiving queue: PurgeComm(hComPort, PURGE_RXCLEAR PURGE_RXABORT); WriteFile(hComPort, &txFrame[k++], &dwWrite, NULL); ClearCommError(hComPort, &errors, &comState); while length (comState.cbInQue 0)); Check after each transmitted character, microcontroller send character (probably NAK!). Receiving part rxFrame[2]= rxFrame[3]= lengths received data lastError= Clear last error (comRxHeader(&rxHeader, &rxNum, timeout*prolongFactor) prolong timeout allow execution sent command Header received resentFrame= switch (rxHeader) case DATA_ACK: (rxNum reqNo) seqNo= reqNo; return(lastError= ERR_NONE); Acknowledge received correctly next frame break; case DATA_ACK case DATA_NAK: return(lastError= ERR_RX_NAK); break; case DATA_NAK case DATA_FRAME: (rxNum reqNo) (comRxFrame(&rxHeader, &rxNum) return(lastError= ERR_NONE); break; case DATA_FRAME case CMD_FAILED: Frame command failed. return(lastError= ERR_CMD_FAILED);
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
break; case CMD_FAILED default: switch errCtr= MAX_ERR_COUNT; while ((resentFrame (errCtr MAX_ERR_COUNT)); (comRxHeader) else Timeout while receiving header errCtr= MAX_ERR_COUNT; else (comRxHeader) while (errCtr MAX_ERR_COUNT); (lastError ERR_CMD_NOT_COMPLETED) Accept QUERY_RESPONSE real correct Seq.-No.: seqNo= reqNo; (lastError ERR_NONE) return(lastError= ERR_COM); else return(lastError); comTxRx
Bootstrap Loader Demonstration Program-bsldemo.c
Copyright 1999-2000 Texas Instruments, Inc. Author: Volker Rzehak software related documentation provided without warranty support kind Texas Instruments expressly disclaims other warranties, express implied, including, limited implied warranties merchantability fitness particular purpose. Under circumstances shall Texas Instruments liable incidental, special consequential damages that result from inability software related documentation, even Texas Instruments been advised liability. Unless otherwise stated, software written copyrighted Texas Instruments distributed "freeware". modify this software without charge restriction. distribute others, long original author acknowledged. Project: MSP430 Bootstrap Loader Demonstration Program File: BSLDEMO.C
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Description: This main program bootstrap loader demonstration. main function holds general sequence access bootstrap loader program/verify file. parsing file done separate function. couple parameters passed program control functions. detailed description appendix corresponding application note. History: Version 1.00 (05/2000) Version 1.10 (08/2000) Help screen added. Additional mass erase cycles added (Required larger flash memories) Defined with: #define ADD_MERASE_CYCLES Possibility load completely into (supposing there enough RAM) Mainly test feature! workaround method cope with checksum established. Because this workaround incompatible with former required file renamed "PATCH.TXT". Version 1.11 (09/2000) Added handling frames with starting address BSLCOMM.C. (This required loaders with word programming algorithm! BSL-Version 1.30) Changed default number data bytes within frame bytes (old: 64). Speeds programming. Always read version number (even loaded into RAM. Fixed setting warning flag conjunction with loading into RAM. Added byte counter programTIText function. Number mass erase cycles changed command line option (-m) Version 1.12 (09/2000) Minor fixes cosmetics. #include <string.h> #include <stdio.h> #include <windows.h> #include "bslcomm.h" Defines: This definition includes code load into RAM: NOTE: only used with devices with sufficient RAM!
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
program flow changed slightly compared version without "NEW_BSL" defined. definition also defines filename TI-TXT file with code. #define NEW_BSL "WORKAROUND" definition includes code workaround required first version(s) bootstrap loader. #define WORKAROUND "DEBUG" defined, checked programmed blocks logged screen. //#define DEBUG Additional mass erase cycles required (some) F149 devices. ADD_MERASE_CYCLES defined only mass erase cycle executed. Remove #define fixed F149 F11xx devices. #define ADD_MERASE_CYCLES Error: verification failed: #define ERR_VERIFY_FAILED Error: erase check failed: #define ERR_ERASE_CHECK_FAILED Error: unable open input file: #define ERR_FILE_OPEN Mask: program data: #define ACTION_PROGRAM 0x01 Mask: verify data: #define ACTION_VERIFY 0x02 Mask: erase check: #define ACTION_ERASE_CHECK 0x04 Mask: transmit password: Note: Should used conjunction with other action! #define ACTION_PASSWD 0x08 Global Variables: char *programName= "MSP430 Bootstrap Loader Demonstration Program"; char *programVersion= "Version 1.12"; Max. bytes sent within frame parsing file. n*16 MAX_DATA_BYTES!) maxData= 240; Buffers used store data transmitted received from BSL: BYTE blkin [MAX_DATA_BYTES]; Receive buffer BYTE blkout[MAX_DATA_BYTES]; Transmit buffer #ifdef WORKAROUND char *patchFile "PATCH.TXT"; #endif WORKAROUND BOOL patchRequired FALSE; BOOL patchLoaded FALSE;
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
WORD bslVer= char *newBSLFile= NULL; struct toDoList unsigned MassErase unsigned EraseCheck: unsigned Program unsigned Verify unsigned Reset unsigned Wait Wait <Enter> program yes): unsigned OnePass EraseCheck, Program Verify pass file read only once) toDo; void *errData= NULL; byteCtr= Functions: preparePatch() error= ERR_NONE; #ifdef WORKAROUND (patchLoaded) Load with 0x0220. This will invoke patched bootstrap loader subroutines. error= bslTxRx(BSL_LOADPC, Command: Load 0x0220, Address load into additional data! NULL, blkin); (error ERR_NONE) return(error); BSLMemAccessWarning= Error removed within workaround code #endif WORKAROUND return(error); void postPatch() #ifdef WORKAROUND (patchLoaded) BSLMemAccessWarning= Turn warning back #endif WORKAROUND verifyBlk(WORD addr, WORD len, unsigned action) error= ERR_NONE;
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
((action (ACTION_VERIFY ACTION_ERASE_CHECK)) #ifdef DEBUG printf("Check starting bytes. addr, len); #endif DEBUG error= preparePatch(); (error ERR_NONE) return(error); error= bslTxRx(BSL_RXBLK, addr, len, NULL, blkin); postPatch(); #ifdef DEBUG printf("Error: %i\n", error); #endif DEBUG (error ERR_NONE) return(error); Cancel, read error else len; i++) ((action ACTION_VERIFY) Compare data blkout blkin: (blkin[i] blkout[i]) printf("Verification failed (%x, %x)\n", addr+i, blkin[i], blkout[i]); return(ERR_VERIFY_FAILED); Verify failed! continue; ((action ACTION_ERASE_CHECK) Compare data blkin with erase pattern: (blkin[i] 0xff) printf("Erase Check failed (%x)\n", addr+i, blkin[i]); return(ERR_ERASE_CHECK_FAILED); Erase Check failed! continue; ACTION_ERASE_CHECK else ACTION_VERIFY ACTION_ERASE_CHECK return(error); programBlk(WORD addr, WORD len, unsigned action) error= ERR_NONE; ((action ACTION_PASSWD) return(bslTxRx(BSL_TXPWORD, Command: Transmit Password
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
addr, Address interrupt vectors len, Number bytes blkout, blkin)); ACTION_PASSWD Check, specified range erased: error= verifyBlk(addr, len, action ACTION_ERASE_CHECK); (error ERR_NONE) return(error); ((action ACTION_PROGRAM) #ifdef DEBUG printf("Program starting bytes. addr, len); #endif DEBUG error= preparePatch(); (error ERR_NONE) return(error); Program block: error= bslTxRx(BSL_TXBLK, addr, len, blkout, blkin); postPatch(); #ifdef DEBUG printf("Error: %i\n", error); #endif DEBUG (error ERR_NONE) return(error); Cancel, error (ACTION_VERIFY skipped!) ACTION_PROGRAM Verify block: error= verifyBlk(addr, len, action ACTION_VERIFY); (error ERR_NONE) return(error); return(error); programBlk programTIText (char *filename, unsigned action) next= error= ERR_NONE; linelen= linepos= WORD dataframelen=0; WORD currentAddr; char strdata[128]; FILE* infile; byteCtr= ((infile fopen(filename, "rb")) errData= filename; return(ERR_FILE_OPEN);
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Convert data MSP430, TXT-File parsed line line: (next= next>=1; Read line: ((fgets(strdata, 127, infile) File (strdata[0] 'q')) (last character file) send frame quit (dataframelen Data frame? error= programBlk(currentAddr, dataframelen, action); byteCtr+= dataframelen; Byte Counter dataframelen=0; next=0; Quit! continue; linelen= strlen(strdata); (strdata[0] '@') address send frame addr. (dataframelen error= programBlk(currentAddr, dataframelen, action); byteCtr+= dataframelen; Byte Counter dataframelen=0; sscanf(&strdata[1], "%lx\n", &currentAddr); continue; Transfer data line into blkout: for(linepos= linepos linelen-3; linepos+= dataframelen++) sscanf(&strdata[linepos], "%3x", &blkout[dataframelen]); (Max bytes line!) (dataframelen maxData-16) frame getting full send frame error= programBlk(currentAddr, dataframelen, action); byteCtr+= dataframelen; Byte Counter currentAddr+= dataframelen; dataframelen=0; (error ERR_NONE) next=0; Cancel loop, error fclose(infile);
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
return(error); programTIText txPasswd(char* passwdFile) (passwdFile NULL) Send "standard" password access protected functions. printf("Transmit Password.\n"); Fill blkout with 0xff (Flash completely erased, contents Flash cells 0xff) 0x20; i++) blkout[i]= 0xff; return(bslTxRx(BSL_TXPWORD, Command: Transmit Password 0xffe0, Address interupt vectors 0x0020, Number bytes blkout, blkin)); else Send file holding interrupt vector data password: printf("Transmit password file \"%s\".\n", passwdFile); ACTION_PASSWD)); txPasswd signOff(int error, BOOL passwd) (toDo.Reset) bslReset(0); Reset MSP430 start user program. switch (error) case ERR_NONE: printf("Programming completed!\n"); break; case ERR_BSL_SYNC: printf("ERROR: Synchronization failed!\n"); printf("Device with boot loader connected?\n"); break; case ERR_VERIFY_FAILED: printf("ERROR: Verification failed!\n"); break; case ERR_ERASE_CHECK_FAILED: printf("ERROR: Erase check failed!\n"); break; case ERR_FILE_OPEN: printf("ERROR: Unable open input file \"%s\"!\n", (char*)errData); break; default:
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
((passwd) (error ERR_RX_NAK)) last command transmit password Error: printf("ERROR: Password accepted!\n"); else printf("ERROR: Communication Error!\n"); switch (toDo.Wait) printf("Press <ENTER> .\n"); getchar(); comDone(); Release serial communication port. After having released serial port, target longer supplied this port! (error ERR_NONE) return(0); else return(1); signOff void showHelp() char *help[]= "BSLDEMO [-h] [-c{port}] [-p{file}] [-w] [-1] [-m{num}] [+ecpvrw] {file}", "The last parameter required: file name TI-TXT file programmed.", "Options:", Shows this help screen.", -c{port} Specifies communication port used (e.g. -cCOM2).", -p{file} Specifies TI-TXT file with interrupt vectors that are", used password (e.g. -pINT_VECT.TXT).", Waits <ENTER> before closing serial port.", Programming verification done pass through file.", -a{file} Filename workaround patch (e.g. -aWAROUND.TXT).", -b{file} Filename complete loader loaded into (e.g. bBSL.TXT).", -f{num} Max. number data bytes within transmitted frame (e.g. -f240).", #ifdef ADD_MERASE_CYCLES -m{num} Number mass erase cycles (e.g. -m20).", #endif ADD_MERASE_CYCLES "Program Flow Specifiers [+ecpvrw]", Mass Erase", Erase Check file {file}", Program file {file}", Verify file {file}", Reset connected MSP430. Starts application.",
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Wait <ENTER> before closing serial port.", Only specified actions executed!", "Default Program Flow Specifiers explicitly given): +ecpvr", "\0" Marks help! while (help[i] "\0") printf("%s\n", help[i++]); Main: main(int argc, char *argv[]) error= ERR_NONE; char comPortName[10]= "COM1"; Default setting. char *filename= NULL; char *passwdFile= NULL; #ifdef ADD_MERASE_CYCLES meraseCycles= ADD_MERASE_CYCLES; #else const meraseCycles= #endif ADD_MERASE_CYCLES #ifdef NEW_BSL newBSLFile= NULL; #endif NEW_BSL Default: actions turned toDo.MassErase toDo.EraseCheck= toDo.Program toDo.Verify toDo.Reset toDo.Wait wait <Enter> end! toDo.OnePass erase check, program verify sequential! #ifdef WORKAROUND Show memory access warning, working with bootstrap loader version(s) requiring workaround patch. Turn warning default until determine actual version bootstrap loader. BSLMemAccessWarning= #endif WORKAROUND printf("%s (%s)\n", programName, programVersion); Parse Command Line Parameters (argc (argc i++)
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
switch (argv[i][0]) case '-': switch (argv[i][1]) case 'h': case 'H': showHelp(); Show help screen return(1); exit program. break; case 'c': case 'C': memcpy(comPortName, &argv[i][2], strlen(argv[i])-2); break; case 'p': case 'P': passwdFile= &argv[i][2]; break; case 'w': case 'W': toDo.Wait= wait <Enter> end! break; case '1': toDo.OnePass= break; case 'f': case 'F': (argv[i][2] sscanf(&argv[i][2], "%i", &maxData); Make sure that conditions maxData met: n*16 MAX_DATA_BYTES!) maxData= (maxData MAX_DATA_BYTES) MAX_DATA_BYTES maxData; maxData= (maxData maxData; maxData= maxData (maxData 16); printf("Max. number data bytes within frame %i.\n", maxData); break; #ifdef ADD_MERASE_CYCLES case 'm': case 'M': (argv[i][2] sscanf(&argv[i][2], "%i", &meraseCycles); meraseCycles= (meraseCycles meraseCycles; printf("Number mass erase cycles %i.\n", merase Cycles); break; #endif ADD_MERASE_CYCLES #ifdef WORKAROUND case 'a': case 'A': patchFile= &argv[i][2]; break; #endif WORKAROUND #ifdef NEW_BSL
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
case 'b': case 'B': newBSLFile= &argv[i][2]; break; #endif NEW_BSL default: printf("ERROR: Illegal command line parameter!\n"); switch argv[i][1] break; case '+': Turn actions off: toDo.MassErase toDo.EraseCheck= toDo.Program toDo.Verify toDo.Reset toDo.Wait Turn only specified actions back (int)(strlen(argv[i])); j++) switch (argv[i][j]) case 'e': case 'E': Erase Flash toDo.MassErase break; case 'c': case 'C': Erase Check file) toDo.EraseCheck= break; case 'p': case 'P': Program file toDo.Program break; case 'v': case 'V': Verify file toDo.Verify break; case 'r': case 'R': Reset MSP430 before waiting <Enter> toDo.Reset break; case 'w': case 'W': Wait <Enter> before closing serial port toDo.Wait break; default: printf("ERROR: Illegal action specified!\n"); switch break; default:
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
printf("ERROR: Illegal command line parameter!\n"); switch argv[i][0] (stricmp("-h", argv[i]) showHelp(); Show help screen return(1); exit program. else filename= argv[i]; else printf("ERROR: Filename required!\n"); printf("Use help!\n"); return(1); Communication with Bootstrap Loader Open COMx port (Change COM-port name your needs!): (comInit(comPortName, DEFAULT_TIMEOUT, printf("ERROR: Opening COM-Port failed!\n"); return(1); bslReset(1); Invoke boot loader. #ifdef NEW_BSL ((newBSLFile NULL) (passwdFile NULL)) password file specified "new" bootstrap loader loaded also specified) before mass erase performed. Than mass erase done using "new" BSL. Otherwise mass erase done now! #endif NEW_BSL (toDo.MassErase) Erase flash memory completely (with mass erase command): printf("Mass Erase.\n"); meraseCycles; i++) printf("Additional Mass Erase Cycles.\n");
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
((error= bslTxRx(BSL_MERAS, 0xff00, 0xa506, NULL, blkin)) return(signOff(error, FALSE));
Command: Mass Erase address within flash memory. Required setting mass erase! ERR_NONE)
passwdFile= NULL; password file required! #ifdef NEW_BSL ((newBSLFile NULL) (passwdFile NULL)) #endif NEW_BSL Transmit password access protected functions. ((error= txPasswd(passwdFile)) ERR_NONE) return(signOff(error, TRUE)); Password transmitted! Read actual bootstrap loader version. ((error= bslTxRx(BSL_RXBLK, Command: Read/Receive Block 0x0ffa, Start address bytes read NULL, blkin)) ERR_NONE) BYTE bslVerLo; BYTE bslVerHi; memcpy(&bslVerHi, &blkin[0], memcpy(&bslVerLo, &blkin[1], printf("Current bootstrap loader version: %x.%x\n", bslVerHi, bslVerLo); bslVer= (bslVerHi bslVerLo; (bslVer 0x0110) #ifdef WORKAROUND #ifdef NEW_BSL (newBSLFile NULL) #endif NEW_BSL printf("Patch flash programming required!\n"); patchRequired= TRUE; #ifdef NEW_BSL #endif NEW_BSL #endif WORKAROUND BSLMemAccessWarning= else BSLMemAccessWarning= Fixed newer versions BSL. (patchRequired ((newBSLFile NULL) (bslVer 0x0110)))
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Execute function within bootstrap loader prepare stack pointer following patch. This function will lock protected functions again. printf("Load with 0x0C22.\n"); ((error= bslTxRx(BSL_LOADPC, Command: Load 0x0C22, Address load into additional data! NULL, blkin)) ERR_NONE) return(signOff(error, FALSE)); Re-send password re-gain access protected functions. ((error= txPasswd(passwdFile)) ERR_NONE) return(signOff(error, TRUE)); Password transmitted! #ifdef NEW_BSL (newBSLFile NULL) printf("Load \"%s\" into RAM.\n", newBSLFile); ((error= programTIText(newBSLFile, File program ACTION_PROGRAM)) ERR_NONE) return(signOff(error, FALSE)); printf("Verify \"%s\".\n", newBSLFile); ((error= programTIText(newBSLFile, File verify ACTION_VERIFY)) ERR_NONE) return(signOff(error, FALSE)); Read start vector bootstrap loader: ((error= bslTxRx(BSL_RXBLK, 0x0300, NULL, blkin)) ERR_NONE) WORD startaddr; memcpy(&startaddr, &blkin[0], printf("Starting %x.\n", startaddr); error= bslTxRx(BSL_LOADPC, Command: Load startaddr, Address load into additional data! NULL, blkin); (error ERR_NONE) return(signOff(error, FALSE)); BSL-Bugs should fixed within "new" BSL: BSLMemAccessWarning= patchRequired= FALSE;
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
patchLoaded
FALSE;
Re-send password re-gain access protected functions. ((error= txPasswd(passwdFile)) ERR_NONE) return(signOff(error, TRUE)); Password transmitted! #endif/* NEW_BSL #ifdef WORKAROUND (patchRequired) printf("Load verify patch \"%s\".\n", patchFile); Programming verification done pass. patch file only read parsed once. ((error= programTIText(patchFile, File program ACTION_PROGRAM ACTION_VERIFY)) ERR_NONE) return(signOff(error, FALSE)); patchLoaded= TRUE; #endif WORKAROUND #ifdef NEW_BSL ((newBSLFile NULL) (passwdFile NULL) toDo.MassErase) Erase flash memory completely (with mass erase command): printf("Mass Erase.\n"); ((error= bslTxRx(BSL_MERAS, Command: Mass Erase 0xff00, address within flash memory. 0xa506, Required setting mass erase! NULL, blkin)) ERR_NONE) return(signOff(error, FALSE)); passwdFile= NULL; password file required! #endif NEW_BSL*/ (!toDo.OnePass) (toDo.EraseCheck) Parse file TXT-Format check erasure required flash cells. printf("Erase Check file \"%s\".\n", filename); ((error= programTIText(filename, ACTION_ERASE_CHECK)) ERR_NONE) return(signOff(error, FALSE));
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
(toDo.Program) Parse file TXT-Format program data into flash memory. printf("Program \"%s\".\n", filename); ((error= programTIText(filename, ACTION_PROGRAM)) ERR_NONE) return(signOff(error, FALSE)); else printf("%i bytes programmed.\n", byteCtr); (toDo.Verify) Verify programmed data: printf("Verify \"%s\".\n", filename); ((error= programTIText(filename, ACTION_VERIFY)) ERR_NONE) return(signOff(error, FALSE)); else unsigned action= (toDo.EraseCheck) action ACTION_ERASE_CHECK; printf("EraseCheck (toDo.Program) action ACTION_PROGRAM; printf("Program (toDo.Verify) action ACTION_VERIFY; printf("Verify (action printf("\"%s\" .\n", filename); error= programTIText(filename, action); (error ERR_NONE) return(signOff(error, FALSE)); else printf("%i bytes programmed.\n", byteCtr);
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
return(signOff(ERR_NONE, FALSE));
File Bootstrap Loader Patch-patch.txt
@0220
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Appendix
Layout Suggestion
Figure B-1. Component Placement
Bottom
Figure B-2. Layout
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Appendix
Demonstration Program Usage
bootstrap loader demonstration program simple command-line interface. only parameter required name file program. other parameters optional must entered before file name. file name must last parameter. Table shows command-line parameters available. Table C-1. Command-Line Parameters
PARAMETER
-c{COM-port name} -p{TI TXT-file name} Shows help screen Specifies port used (default: COM1) Specifies file containing actual password access bootstrap loader. program will wait after successful programming reset <ENTER> key. application powered serial port. erase-check, programming, verification pass (the file read parsed only once). This option discouraged with first version(s) bootstrap loader that require workaround patch. Specifies file containing valid patch bootstrap loader Specifies file containing valid loadable bootstrap loader that loaded before further programming takes place that replaces original programming Specifies maximum number data bytes within transmitted frame Specifies number mass erase cycles
DESCRIPTION
EXAMPLE
-cCOM2 -pint_vect.txt
-a{TI TXT-file name} -b{TI TXT-file name} -f{num} -m{num}
-apatch.txt -bbl_130v.txt -f240 -m20
addition these command-line parameters, parameter exists that allows control program flow. example, possible just verify contents flash memory. This parameter introduced character. character followed specification steps taken (and only these steps taken). Table shows modifiers available. steps taken order modifiers within Table C-2. Table C-2. Program-Flow Modifiers
MODIFIER
Erase complete flash (mass erase) Check erasure Program given file Verify against given file Reset device Wait <ENTER>
DESCRIPTION
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Table shows some examples demonstration program's invocation. Table C-3. Invocation Examples
EXAMPLE
bsldemo bsldemo test.txt bsldemo -cCOM2 test.txt bsldemo +vrw -pint_vect.txt test.txt bsldemo -pint_vect.txt test.txt bsldemo -bbl_130v.txt +epr test.txt Shows help screen Erase flash, check erasure, program verify file test.txt, exit Same above, hardware connected COM2; erase-check, program, verify done pass through file test.txt; program waits <ENTER> end. data within file int_vect.txt password, verify against file test.txt erasure programming), reset MSP430, wait <ENTER> end. Reset MSP430 wait <ENTER> end. Password file name also required. Load bootstrap loader bl_130v.txt into program file test.txt using loader (the verification step omitted because loader bl_130v.txt does verification internally during programming.) Note: There needs enough memory load loader.
DESCRIPTION
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Appendix
Schematic
Universal Bootstrap Loader Interface Board
Figure D-1. Universal Interface Schematic
LAYOUT
Figure D-2. Universal Interface Layout-Top
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Figure D-3. Universal Interface Layout-Bottom
Figure D-4. Universal Interface Component Placement
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
60.0
SLAA096A
Figure D-5. Universal Interface Component Placement
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
60.0
SLAA096A
Parts List
Table D-1. Universal Interface Parts List
PART CON3 VALUE/PART NUMBER BAV70 BAV70 BAV70 TPS76030 74AHC14 TL3472D F09HP284 RESET PACKAGE 7243 0805 1206 0805 7243 0805 SOT23 SOT23 SOT23 SOT23/5 SO14 0805 0805 0805 0805 0805 0805 0805 0805 0805 0805 0805 0805 0805 2X05 9-SUB-D female SMD0805 Target connector (see Table D-2) RS-232 connector Pads connect optional reset button (alternate: 74HC14) High-speed double diode High-speed double diode COMMENT
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
SLAA096A
Table D-2. Assignment Target Connector
SIGNAL NAME (3.0 VCC_IN connected connected MSP430F11x(1) P1.1 connect (see Note P2.2 RST/NMI (see Note Test (see Note MSP430F14x MSP430F13x P1.1 P2.2 RST/NMI (see Note connect (see Note
NOTE Signal must connected MSP430F11x(1) devices. NOTE (3.0 voltage source that provide limited current, depending serial port driver's capability. external power supply used, (3.0 must connected target. this case, external supply voltage must connected VCC_IN. Otherwise, VCC_IN must unconnected.
Application Bootstrap Loader MSP430F11x Hardware Software Proposal
IMPORTANT NOTICE Texas Instruments subsidiaries (TI) reserve right make changes their products discontinue product service without notice, advise customers obtain latest version relevant information verify, before placing orders, that information being relied current complete. products sold subject terms conditions sale supplied time order acknowledgment, including those pertaining warranty, patent infringement, limitation liability. warrants performance semiconductor products specifications applicable time sale accordance with TI's standard warranty. Testing other quality control techniques utilized extent deems necessary support this warranty. Specific testing parameters each device necessarily performed, except those mandated government requirements. Customers responsible their applications using components. order minimize risks associated with customer's applications, adequate design operating safeguards must provided customer minimize inherent procedural hazards. assumes liability applications assistance customer product design. does warrant represent that license, either express implied, granted under patent right, copyright, mask work right, other intellectual property right covering relating combination, machine, process which such semiconductor products services might used. TI's publication information regarding third party's products services does constitute TI's approval, warranty endorsement thereof.
Copyright 2000, Texas Instruments Incorporated

Other recent searches


SOS-4250-119+ - SOS-4250-119+   SOS-4250-119+ Datasheet
PT7712--3 - PT7712--3   PT7712--3 Datasheet
MT90869 - MT90869   MT90869 Datasheet
ADF4000 - ADF4000   ADF4000 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive