This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/MSP430FR5969: MSP430-GCC linker section checksum

Part Number: MSP430FR5969

Tool/software: TI C/C++ Compiler

This question is targeted at the PC/build side of the project described in the related question. I need to calculate CRCs for the text and rodata sections of my application during the build process. Those values will eventually be compared against CRC values computed during run time by the MSP430.

In the related question, I found out that the CCS linker performs section CRCs during the build process. However, I have been unable to find equivalent functionality in the MSP430-GCC documents I've reviewed. Does the MSP430-GCC linker include this functionality or is it only available in the TI CCS linker?

  • Hi, EmbeddedMike, 

    From the GCC document GNU Compiler Collection (https://gcc.gnu.org/onlinedocs/gcc.pdf), there is no CRC32 option for MSP430. So it should be no this function in MSP430 GCC. 

    Thanks, 

    Lixin 

  • I can turn to compiler team to confirm this. 

    Thanks, 

    Lixin 

  • gdb has a compare-sections command which uses a CRC32 to compare memory in the target to the local copy. If you look at the documentation for the packets gdb sends to the gdb server you find a CRC packet. Which can use hardware support in the target if available. When I tried the compare-sections command it just reported a match and did not display the CRC

    This is different from enabling generation of CRC instructions by the gcc code generator. I see nothing in the man pages to indicate that any of the gcc tools will do what you want.

    Presumably you will be using the CRC32 hardware in the FR5969. I remember it took me a while to figure out the correct variation (bit reversal and such) to make the hardware match  a software implementation of CRC16. I expect CRC32 to be just as much fun.

  • Are there any online resources you would recommend from your experience with this? Looks like I'm going to have to do this the hard way so any good info would be appreciated.

  • I ran across a web page describing how to do it with the srecord tools but it seems like a lot of work. I think that keeping it all on the MSP430 would be easiest.

    mcuoneclipse.com/.../

  • There isn't any functionality built into MSP430-GCC to do this automatically.

    However, you should be able to use the binutils tools included with MSP430-GCC to insert the checksum into your executable file. Particularly the "msp430-elf-objcopy" tool should be able to help you achieve what you need. Documentation is here: https://sourceware.org/binutils/docs-2.26/binutils/index.html

    objcopy can output in the "srec" format, so you might be able to use the guide posted by David as a rough outline for the steps, and it may be a bit more straightforward since you don't need to install any extra tools or worry about how it integrates with Eclipse.

    So once you have a list of the commands you need to execute to calculate and insert the checksum, you might be able to script it up to do everything automatically.

    Regards,

**Attention** This is a public forum