Texas Instruments MSP-EXP430F5529LP 사용자 설명서

다운로드
페이지 61
User Experience Software
3.5.2
Pre-Initialization
Pre-initialization refers to the activity that happens before the first line of main().
As described for the simpleUsbBackchannel example (see
), it is often convenient during
development to disable the watchdog at the beginning of execution. But for some application programs,
including this demo, there's a twist. Programs that contain a large amount of allocated RAM may never
reach the first line of main(). This is because the first line of execution of a C program is not actually the
first line of main(); instead, the compiler inserts code prior to main that handles preparatory functions, like
initializing variables.
So if the amount of allocated RAM is large enough, the time required to initialize it may exceed the
watchdog's expiration time. To the developer, this appears as execution never quite arriving to the first line
of main().
A solution to this is to define a pre-init function. In CCS, this is the function _system_pre_init(); in IAR, it is
the function __low_level_init(). The developer can write code here that executes immediately after a reset,
before RAM is initialized. When large amounts of RAM are allocated, it can be necessary to hold the
watchdog here.
The F5529 LaunchPad software demo does this.
shows the implementation of both the
system_pre_init.c file in the project and the function inside it.
Figure 29. Disable the Watchdog in Pre-Initialization
3.5.3
Initialization
This demo uses driverlib somewhat more heavily than the simpleUsbBackchannel example does. driverlib
is used for the initialization of clocks, power, and ports. The use of driverlib makes the code appear
different in the two examples, but the same actions are being taken. See
for more
information on how to initialize these functions and initialize USB.
The following sections describe initialization that is unique to this example.
3.5.3.1
Configuring the Keyboard
The keyboard function must be initialized before operation. Keyboard.c maintains a report structure that
will later be sent by the USB API.
3.5.3.2
Configuring the MSC Interface
The MSC interface also must be initialized. First, initMscIntf() obtains from the USB API a pointer to a
structure that will later be used to exchange information about SCSI READ and WRITE commands. It also
registers with the API the location of a RAM buffer that the application has allocated for the exchange of
block data during READ and WRITE commands.
35
SLAU533A – September 2013 – Revised January 2014
MSP430F5529 LaunchPad™ Development Tool (MSP
EXP430F5529LP)
Copyright © 2013–2014, Texas Instruments Incorporated