Skip to main content
n2wx
Senior
February 23, 2020
Question

How can I get Atollic to append a CRC to the flash image?

  • February 23, 2020
  • 2 replies
  • 1457 views

IAR would fill unused flash and optionally append a crc to aid with the integrity check some of us need to do for regulatory compliance But since IAR's been replaced what provisions are in Atollic to fill unused flash and optionally append a crc? Is there a caonical way to do this?

I found https://github.com/nine/stm32_append_crc but it's GPL. I'm not our company's lawyer but I'm still reluctant to drag anything GPL into my project.

TIA

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
February 24, 2020

I'd recommend you to use srecord (srecord.sourceforge.net ) in a post-linking step, which is much more versatile albeit arguably harder to use than a single-purpose utility.

It's GPL, too; but in any case, merely *using* a GPL-licenced program should not impose any further constraint on you. IANAL of course.

JW

n2wx
n2wxAuthor
Senior
February 24, 2020

srecord looks very promising and it's a lot more flexible than stm32_append_crc. Thank you for the pointer. Have you used it before?

I am a lawyer but I'm not my employer's lawyer so I tend to be gun shy. And now that I've been reminded that the compiler is gcc I'm wondering if the newliv it arrived with will infect my product through the GPL for libraries. OK it looks like newlib is BSD licensed which is fine. So many licenses so little time.

berendi
Principal
February 25, 2020

In case you need more licensing stuff to worry about, gcc produces an intermediate assembly source when compiling a C program, and this code is pieced together from templates in the gcc source. Of course the licensing is sorted out 30+ years ago, those templates are exempted from the GPL.

berendi
Principal
February 24, 2020

> merely *using* a GPL-licenced program should not impose any further constraint on you

AFAIK Atollic is using the gcc compiler, which is GPL licensed too,

If you can use gcc to compile the code, you can use another GPL licensed program to compute the checksum.

Verifying it on the MCU side is just a straightforward application of the on-chip hardware CRC module.

You might need a handful of delay cycles after enabling the CRC clock in RCC

RCC->AHB1ENR |= RCC_AHB1Periph_CRC; // enable clock for crc-module
RCC->AHB1ENR;__ISB();__ISB();__ISB();__ISB(); // for good measure
CRC->CR = CRC_CR_RESET;

n2wx
n2wxAuthor
Senior
February 24, 2020

Good reminder on the time delay, thanks. Yes Atollic TrueStudio definitely uses gcc and all of its utilities