slau358q.pdf - 第96页
MSP-GANG.dll Description www.ti.com 96 SLAU358Q – September 2011 – Revised October 2019 Submit Documentation Feedback Copyright © 2011–2019, Texas Instruments Incorporated Dynamic Link Library for MSP-GANG Programmer 4.2…

www.ti.com
MSP-GANG.dll Description
95
SLAU358Q–September 2011–Revised October 2019
Submit Documentation Feedback
Copyright © 2011–2019, Texas Instruments Incorporated
Dynamic Link Library for MSP-GANG Programmer
4.2.29 MSPGANG_LoadImageBlock
MSPGANG_LoadImageBlock saves the previously prepared image contents into the selected image
memory. The selected image memory is automatically erased first (MSPGANG_EraseImage is called
automatically, your application code does NOT need to call it explicitly). Use the following sequence for
preparing and saving an image into image memory:
MSPGANG_CreateGangImage(name);
MSPGANG_SelectImage(lImage);
MSPGANG_EraseImage();
MSPGANG_LoadImageBlock();
MSPGANG_VerifyPSAImageBlock();
Syntax
LONG MSPGANG_LoadImageBlock(void)
Arguments
None
Result
LONG Error code
NOTE: Do not overwrite images unnecessarily during production
The image flash memory has a specified 10000 endurance cycles. Therefore, over the
lifetime of the product, each image can be reliably reprogrammed 10000 times.
Reprogramming images should be done once per production setup, rather than per
programming run. Reprogramming the image per programming run will quickly exhaust flash
endurance cycles and result in errant behavior.
//Ideally, load image once per setup. Reduce programming time and save flash endurance cycles.
//Loading an image usually takes longer than full target device programming.
MSPGANG_CreateGangImage(...);
MSPGANG_LoadImageBlock();
...
do
{
...
MSPGANG_MainProcess(...);
...
} while(...);
//Avoid loading image inside loop if possible.
//Loading image per programming cycle wastes time and quickly uses up flash endurance cycles.
do
{
MSPGANG_CreateGangImage(...);
MSPGANG_LoadImageBlock();
MSPGANG_MainProcess(...);
} while(...);

MSP-GANG.dll Description
www.ti.com
96
SLAU358Q–September 2011–Revised October 2019
Submit Documentation Feedback
Copyright © 2011–2019, Texas Instruments Incorporated
Dynamic Link Library for MSP-GANG Programmer
4.2.30 MSPGANG_VerifyPSAImageBlock
MSPGANG_VerifyPSAImageBlock verifies the checksum of all blocks used in the selected image
memory. The image memory number should be selected first using MSPGANG_SelectImage function.
Syntax
LONG MSPGANG_VerifyPSAImageBlock(void)
Arguments
None
Result
LONG Error code
4.2.31 MSPGANG_ReadImageBlock
MSPGANG_ReadImageBlock reads the header from the selected image memory. A maximum of
254 bytes can be read. Access to the remaining image memory (up to 512KB) is blocked.
Syntax
LONG MSPGANG_ReadImageBlock(LONG addr, LONG size, void *lpData)
Arguments
LONG address
LONG size
void *lpData Pointer to byte buffer where the result is saved
Result
LONG Error code
Data Format
union _IMAGE_HEADER
{
BYTE bytes[IMAGE_HEADER_SIZE];
WORD words[IMAGE_HEADER_SIZE/2];
struct
{
WORD own_PSA;
WORD global_PSA;
BYTE year;
BYTE month;
BYTE day;
BYTE hour;
BYTE min;
BYTE sec;
#define GLOBAL_PSA_START_OFFSET 10
// down - covered by global_PSA ----
#define SHORT_ID_2BYTE_OFFSET 10
WORD shortID;
#define CHUNKS_NO_2BYTE_OFFSET 12
WORD chunks;
#define IMAGE_DATA_2BYTE_OFFSET 14
WORD image_data_offset;
#define GLOBAL_SIZE_4BYTE_OFFSET 16
DWORD size; //global_size;

www.ti.com
MSP-GANG.dll Description
97
SLAU358Q–September 2011–Revised October 2019
Submit Documentation Feedback
Copyright © 2011–2019, Texas Instruments Incorporated
Dynamic Link Library for MSP-GANG Programmer
WORD ID_rev; //20
BYTE ID_name[HEADER_ID_SIZE]; //22
DWORD DLL_ver; //32
#define HEADER_COMMENT_ADDR 36
char comment[SCRIPT_TEXT_SIZE];
WORD used_tasks_mask; //52
BYTE Interface; //54 type (JTAG, SBW, BSL), speed(Fast,
Med, Slow)
BYTE GangMask; //55
BYTE Vcc_PowerEn; //56
BYTE Icc_HiEn; //57
WORD Vcc_mV; //58
WORD min_Vcc_mV; //60
WORD max_Vcc_mV; //62
WORD RST_time_ms; //64
WORD RST_release_ms; //66
BYTE InfoA_Erase_En; //68
BYTE BSL_Erase_En_mask; //69
BYTE SecureDev_En; //70
BYTE DCO_Flags; //71
#define DCO_RETAIN_EN 0x01
#define DCO_VALIDATION_EN 0x02
#define DCO_RECAL_EN 0x04
#define DCO_ONE_CONSTANTS 0x08
BYTE IO_cfg; //72
#define SBW_VIA_RST_BIT 0x01
BYTE MemoryOption; //73 for GUI only -
for displaying used memory option. No impact in firmware
BYTE InterfaceSpeed; //74 for GUI only -
for displaying used speeds (JTAG/SBW/CJTAG/BSL). No impact in firmware
BYTE VccSettleTime; //75 settle time *20ms
BYTE JTAG_unlockEn : 1; //76
BYTE HasLockedInfoA : 1;
BYTE HasAutoEraseInBSL : 1;
BYTE BSL_X_type : 1;
BYTE spare_flag4 : 1;
BYTE spare_flag5 : 1;
BYTE spare_flag6 : 1;
BYTE spare_flag7 : 1;
BYTE ClrSegments; //77 MSP432
// #define MSP432_CLR_LOCKING_INFOA_BIT 0x01
// #define MSP432_CLR_LOCKING_BSL_BIT 0x02
BYTE BSL_1st_Passw; //78
//BYTE free[112-78];
}prg;
struct
{
BYTE offset[IMAGE_HEADER_CTRL_OFFSET]; //offset 112
BYTE flags; //0x70
#define IMAGE_LOCK 0x10 //must be the same bit as in LOCK_LD_PRJ
BYTE sp1; //0x71
BYTE sp2; //0x72
BYTE sp3; //0x73
BYTE sp4; //0x74