cancel
Showing results for 
Search instead for 
Did you mean: 

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

n2wx
Senior

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

6 REPLIES 6

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

berendi
Principal

> 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;

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.

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

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.

Oh wow I don't remember anything about templates in gcc but I remember the discussions surrounding the use of glibc that I think still persists and spurred libnano and LGPL. Questions about GPL's infectious nature don't help further the spread of GNU stuff which I like (except for the info pages and gcc's funky assembly mnemonics) but help encourage more movement to clang and other stuff available under less onerous licenses.

One of the projects i work on - px4 for drones - is MIT three clause licensed and has a tremendous amount of community give back even from commercial entities. Another project - Betaflight - is GPL and does not get as much commercial support. They're not equivalent projects though. For px4 I know the proprietary stuff isn't pushed back in pull requests but everyone does a pretty good job of loosely coupling their modules so the stuff still works without the proprietary bits.