Checksums Used By Ucd3138A64 Boot Rom Program; Ucd3138A64 And Ucd3138A64A - Texas Instruments UCD3138 Technical Reference Manual

Digital power supply controller
Hide thumbs Also See for UCD3138:
Table of Contents

Advertisement

www.ti.com

13.8.2 UCD3138A64 and UCD3138A64A

On the UCD3138 and UCD3138064, the checksum for an area of program flash is calculated as the sum
of bytes over the program flash area.
For example, to calculate the checksum from start_address to end_address, the Boot ROM program on
the UCD3138 and UCD3138064 executes something like the following code:
Uint32 calculate_checksum(register Uint32 start_address, register Uint32 end_address)
{
Uint32 checksum = 0;
Uint8 *addr;
for(addr=(Uint8 *)start_address; (Uint32)addr < end_address; addr++)
{
checksum = checksum + (*addr); // read byte data from flash
}
return checksum;
}
For the UCD3138A64 and UCD3138128 (and A versions), the checksum is calculated as the sum of 32-bit
words in the program flash area covered by the checksum, rather than the sum of 8-bit bytes. This makes
the checksum calculation approximately 4 times faster. It means that the Boot ROM program can verify
the checksum for 64kB in around 5ms, while the UCD3138 Boot ROM program takes 10ms to verify 32kB
of program flash. Here is the code for calculating the checksum.
void calculate_checksum(register Uint32 *start_address, register Uint32 *end_address)
{
//use local register variable for speed.
register unsigned long long lcs = long_checksum;
while(start_address < end_address)
{
lcs = lcs + *start_address ;
lcs = lcs + (Uint32)*(start_address + 1) ;
start_address = start_address + 2;
}
long_checksum = lcs;
}
Two words are added each pass through the loop to increase the execution speed even further.
The checksums for the UCD3138A64 and UCD3138128 are now 8 bytes in length (versus 4 bytes for the
UCD3138 and UCD3138064).
The checksums and their locations are shown in
Table 13-5. Checksums Used by UCD3138A64 Boot ROM Program
Checksum Location
0x07F8
0x7FF8
0xFFF8
SNIU028A – February 2016 – Revised April 2016
Submit Documentation Feedback
Boot ROM for the Other Members of the UCD3138 Family
Table
13-5.
Purpose
Checksum for 2kB boot in program flash 0
Checksum for 32kB program in program flash 0
Checksum for 64kB program in program flash 0 and 1
Copyright © 2016, Texas Instruments Incorporated
449
Boot ROM and Boot Flash

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents