Boot ROM for the Other Members of the UCD3138 Family
449
SNIU028A – February 2016 – Revised April 2016
Copyright © 2016, Texas Instruments Incorporated
Boot ROM and Boot Flash
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 = ch (*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_a 1) ;
start_address = start_a 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
Purpose
0x07F8
Checksum for 2kB boot in program flash 0
0x7FF8
Checksum for 32kB program in program flash 0
0xFFF8
Checksum for 64kB program in program flash 0 and 1