[MDK412] Automatic checksum calculation and insertion

I've downloaded the evaluation versin of uVision 4 and wondering if it is suitable for a project that we will be starting soon.

The SRS of the project states that the application must be broken into two parts:
Bootloader(8K Max)
Application(56K Max)

The boot loader must calculate the CRC32 of itself, then the application, and fall into fail safe if the checksum is incorrect.

Can the linker calculate the CRC32 and place the result in the destination executable? Or is there another application that can take the resulting file and calculate the checksum?

Parents
  • If you convert the file to binary format, then it's easy to compute the CRC and then extend the bin file with some optional pad bytes and the CRC value. Easiest is to make the bin file the maximum size allowed for the program, and to store the CRC value in the last two or four bytes.

    Note that if the boot loader CRC is wrong, then the boot loader may not be able to compute the CRC at all - it may compute the wrong value or totally fail to run at all. So it's hard for the boot loader to enter any safe mode - all you can do is to try to make it harder for it to leave any safe mode in case everything isn't 100% perfect.

    If seeing the problem as avoiding the boot loader to leave safe mode, you can design a solution with hardware locks, where the boot loader has to present "keys" to allow it to access other parts of hardware.

Reply
  • If you convert the file to binary format, then it's easy to compute the CRC and then extend the bin file with some optional pad bytes and the CRC value. Easiest is to make the bin file the maximum size allowed for the program, and to store the CRC value in the last two or four bytes.

    Note that if the boot loader CRC is wrong, then the boot loader may not be able to compute the CRC at all - it may compute the wrong value or totally fail to run at all. So it's hard for the boot loader to enter any safe mode - all you can do is to try to make it harder for it to leave any safe mode in case everything isn't 100% perfect.

    If seeing the problem as avoiding the boot loader to leave safe mode, you can design a solution with hardware locks, where the boot loader has to present "keys" to allow it to access other parts of hardware.

Children
More questions in this forum