Skip to main content
gerardo
Associate III
February 18, 2015
Question

Flash Memory check in STM32L0

  • February 18, 2015
  • 5 replies
  • 1592 views
Posted on February 18, 2015 at 10:34

Hi all,

I would like to check my whole flash memory integrity. I´ve the posibility of read the whole sectors and calculate a CRC and check if it is correct by firmware. 

My question is the following one. Is there any other possibility to do that with uController hardware resources?

    This topic has been closed for replies.

    5 replies

    Tesla DeLorean
    Guru
    February 18, 2015
    Posted on February 18, 2015 at 13:58

    Perhaps you can use DMA (Memory to Memory?) against the CRC peripheral's data register?

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    gerardo
    gerardoAuthor
    Associate III
    February 18, 2015
    Posted on February 18, 2015 at 15:09

    Hi clive1

    I am trying to use HAL_CRC_Accumulate(&CrcHandle, u32buff, u16Size);

    Is your way of doing it faster?

    Tesla DeLorean
    Guru
    February 18, 2015
    Posted on February 18, 2015 at 15:15

    I'm not using the L0 or HAL, but I would expect the DMA to be able to outpace a software loop reading and writing memory. Suggest you experiment, and benchmark.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    gerardo
    gerardoAuthor
    Associate III
    February 19, 2015
    Posted on February 19, 2015 at 16:03

    How can I know the size of my binary to do the correct check in my program?

    Tesla DeLorean
    Guru
    February 19, 2015
    Posted on February 19, 2015 at 16:14

    This would depend a lot on your tools and process.

    Most linkers have symbols, or you can place symbols, to know what the size of the image (code + statics) is. You can also post-process the output, and sign it with length and CRC information, or package the firmware suitably. If you package it properly, you know what the CRC is for the valid image, and also have it divide out to zero.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..