mirror of https://github.com/rusefi/openblt.git
- Fixed bug where the checksum was incorrectly programmed during a programming sequence that doesn't include data for the bootblock.
git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@21 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
parent
abe5a26e27
commit
33e35e1c22
|
@ -297,6 +297,15 @@ blt_bool FlashWriteChecksum(void)
|
|||
* signature_checksum = Two's complement of (SUM(exception address values))
|
||||
*/
|
||||
|
||||
/* first check that the bootblock contains valid data. if not, this means the
|
||||
* bootblock is not part of the reprogramming this time and therefore no
|
||||
* new checksum needs to be written
|
||||
*/
|
||||
if (bootBlockInfo.base_addr == FLASH_INVALID_ADDRESS)
|
||||
{
|
||||
return BLT_TRUE;
|
||||
}
|
||||
|
||||
/* compute the checksum. note that the user program's vectors are not yet written
|
||||
* to flash but are present in the bootblock data structure at this point.
|
||||
*/
|
||||
|
@ -310,16 +319,6 @@ blt_bool FlashWriteChecksum(void)
|
|||
signature_checksum = ~signature_checksum; /* one's complement */
|
||||
signature_checksum += 1; /* two's complement */
|
||||
|
||||
/* check that this value of the checksum is not already present, which means
|
||||
* the program area with the vector table was not programmed, so the checksum
|
||||
* also doesn't need to be written. this check is important because it allows
|
||||
* for additional data to be programmed, such as calibration parameters, in
|
||||
* which case the checksum doesn't not need to be rewritten
|
||||
*/
|
||||
if (signature_checksum == FlashVerifyChecksum())
|
||||
{
|
||||
return BLT_TRUE;
|
||||
}
|
||||
/* write the checksum */
|
||||
return FlashWrite(flashLayout[0].sector_start+0x14, sizeof(blt_addr),
|
||||
(blt_int8u*)&signature_checksum);
|
||||
|
|
|
@ -297,6 +297,15 @@ blt_bool FlashWriteChecksum(void)
|
|||
* signature_checksum = Two's complement of (SUM(exception address values))
|
||||
*/
|
||||
|
||||
/* first check that the bootblock contains valid data. if not, this means the
|
||||
* bootblock is not part of the reprogramming this time and therefore no
|
||||
* new checksum needs to be written
|
||||
*/
|
||||
if (bootBlockInfo.base_addr == FLASH_INVALID_ADDRESS)
|
||||
{
|
||||
return BLT_TRUE;
|
||||
}
|
||||
|
||||
/* compute the checksum. note that the user program's vectors are not yet written
|
||||
* to flash but are present in the bootblock data structure at this point.
|
||||
*/
|
||||
|
@ -310,16 +319,6 @@ blt_bool FlashWriteChecksum(void)
|
|||
signature_checksum = ~signature_checksum; /* one's complement */
|
||||
signature_checksum += 1; /* two's complement */
|
||||
|
||||
/* check that this value of the checksum is not already present, which means
|
||||
* the program area with the vector table was not programmed, so the checksum
|
||||
* also doesn't need to be written. this check is important because it allows
|
||||
* for additional data to be programmed, such as calibration parameters, in
|
||||
* which case the checksum doesn't not need to be rewritten
|
||||
*/
|
||||
if (signature_checksum == FlashVerifyChecksum())
|
||||
{
|
||||
return BLT_TRUE;
|
||||
}
|
||||
/* write the checksum */
|
||||
return FlashWrite(flashLayout[0].sector_start+0x14, sizeof(blt_addr),
|
||||
(blt_int8u*)&signature_checksum);
|
||||
|
|
|
@ -317,6 +317,15 @@ blt_bool FlashWriteChecksum(void)
|
|||
* checksum.
|
||||
*/
|
||||
|
||||
/* first check that the bootblock contains valid data. if not, this means the
|
||||
* bootblock is not part of the reprogramming this time and therefore no
|
||||
* new checksum needs to be written
|
||||
*/
|
||||
if (bootBlockInfo.base_addr == FLASH_INVALID_ADDRESS)
|
||||
{
|
||||
return BLT_TRUE;
|
||||
}
|
||||
|
||||
/* compute the checksum. note that the user program's vectors are not yet written
|
||||
* to flash but are present in the bootblock data structure at this point.
|
||||
*/
|
||||
|
@ -330,16 +339,6 @@ blt_bool FlashWriteChecksum(void)
|
|||
signature_checksum = ~signature_checksum; /* one's complement */
|
||||
signature_checksum += 1; /* two's complement */
|
||||
|
||||
/* check that this value of the checksum is not already present, which means
|
||||
* the program area with the vector table was not programmed, so the checksum
|
||||
* also doesn't need to be written. this check is important because it allows
|
||||
* for additional data to be programmed, such as calibration parameters, in
|
||||
* which case the checksum doesn't not need to be rewritten
|
||||
*/
|
||||
if (signature_checksum == FlashVerifyChecksum())
|
||||
{
|
||||
return BLT_TRUE;
|
||||
}
|
||||
/* write the checksum */
|
||||
return FlashWrite(flashLayout[0].sector_start+FLASH_VECTOR_TABLE_CS_OFFSET,
|
||||
sizeof(blt_addr), (blt_int8u*)&signature_checksum);
|
||||
|
|
Loading…
Reference in New Issue