No announcement yet.

CRC integrity check of flash memory

  • Filter
  • Time
  • Show
Clear All
new posts

  • CRC integrity check of flash memory


    is it possible to do a CRC check of the flash memory during program start
    and how does it work? THX.

  • #2

    que veux dire CRC


    mean that CRC



    • #3

      Unfortunately it's not possible ATM, we are looking at how it might be achieved, but it cannot be done with the current Picaso and Goldelox processors.


      • #4

        I am also looking for something like this.
        Is there any progress on that since last post, please ?

        in the meanwhile,
        I am trying to implement a check after starting the application for now and facing some strange Pb:
        I used the map file to know the address of my application code.

        I want to compute a CRC on it,

        I am currently testing on a specific function to start with,
        The map file give me this:
        linked : 26 process_information 000891
        stmt:Offset stmtffset stmtffset stmtffset stmtffset stmtffset stmtffset stmtffset
        144:000891 145:00089b 147:0008a5 150:0008c4 152:0008cc 153:0008d2 154:0008d8 155:0008e0
        156:0008e6 160:0008e9 167:0008fd 168:000907 171:00090a 174:000912 176:00091a 177:000924
        181:000927 183:000932 184:00093c 188:00093f 191:000947 192:00094e 193:000951 195:000959
        197:000961 198:00096b 202:00096e 205:000988 208:000997 209:0009a1 212:0009a4 213:0009a7
        216:0009af 218:0009b7 219:0009c1 220:0009c9 221:0009d0 225:0009d3 228:0009e8 229:0009f2
        230:0009fa 231:000a01 235:000a04 238:000a0c 240:000a13 242:000a1a 243:000a1d 245:000a25
        247:000a2d 248:000a37 249:000a3f 250:000a46 254:000a49 257:000a5e 258:000a68 259:000a70
        260:000a77 264:000a7a 267:000a94 269:000aa2 270:000aac 271:000ab4 272:000abb 277:000abe
        278:000ac1 280:000ac9 282:000ad1 283:000adb 284:000ae3 285:000aea 289:000aed 292:000b02
        293:000b0c 294:000b14 295:000b1b 299:000b1e 302:000b26 303:000b31 305:000b3c 306:000b43
        307:000b46 309:000b4e 311:000b56 312:000b60 315:000b63 318:000b6b 319:000b75 320:000b7d
        321:000b85 323:000bc6 324:000bd0 325:000bd8 327:000be0 328:000be7 329:000bea 331:000bf2
        333:000bfa 334:000c04 335:000c0c 336:000c13 340:000c16 343:000c2b 344:000c35 345:000c3d
        346:000c44 350:000c47 353:000c4f 355:000c56 357:000c5d 358:000c60 360:000c68 362:000c70
        363:000c7a 364:000c82 365:000c89 369:000c8c 372:000ca1 373:000cab 374:000cb3 375:000cba
        379:000cbd 382:000cd7 384:000ce5 385:000cef 386:000cf7 387:000cfe 391:000d01 392:000d04
        394:000d0c 396:000d14 397:000d1e 398:000d26 399:000d2d 403:000d30 406:000d45 407:000d4f
        408:000d57 409:000d5e 413:000d61 415:000d69 417:000d70 418:000d73 420:000d7b 422:000d83
        423:000d8d 424:000d95 425:000d9c 429:000d9f 433:000dbf 434:000dc9 435:000dd1 436:000dd8
        440:000ddb 443:000de3 444:000dee 446:000df9 447:000e00 448:000e03 450:000e0b 451:000e13
        452:000e1d 456:000e20 457:000e29 458:000e33 462:000e36 464:000e3e 465:000e45 466:000e48
        468:000e50 469:000e58 470:000e62 476:000e65 477:000e68 479:000e70 480:000e78 481:000e82
        485:000e85 486:000e8e 487:000e98 490:000e9b 493:000ea2 495:000eaa 496:000eb1 497:000eb4
        499:000ebc 500:000ec4 501:000ece 504:000ed1 507:000ed8 509:000ee0 510:000ee7 511:000eea
        513:000ef2 514:000efa 515:000f04 520:000f07 521:000f0a 523:000f12 524:000f1a 525:000f24
        530:000f27 531:000f2a 534:000f2a 535:000f32 536:000f3c 537:000f44 538:000f4b 542:000f4e

        So I would like to compute the CRC on this memory block from 0x000891 to 0x000f54 at least.

        I am using this simple code to perform the CRC computation:

        func check_memory()

        var* buffer;

        buffer := 0x000891;
        var buffer_size := 0x000f54 - 0x000891;
        var crc32[4];
        compute_crc32( buffer, &buffer_size, &crc32[0]);
        print("crc32 : ",crc32[0], crc32[1], crc32[2], crc32[3],"\n");

        But this function fail at the following address 0x000C13 at least,

        from the map file I can see that the check_memory function is at the very end 0x001B6E,
        so any change in this function shall not affect the memory I am computing CRC on.

        Do you have any memory protection to prevent code reading at specific address within the application code?

        Or do you have any suggestion on how to debug this, please?

        Thanks in advance for your help.
        Last edited by HealthDev; 14th July 2018, 01:08 AM.


        • #5
          I kept working on this for some time,

          I realized that my previous issue was due to the compute_crc32() function.
          I fixed it.

          But I still have the same kind of Pb:
          meaning that I can compute the CRC of my flash up to a certain memory location ONLY.

          Here my code:
          func check_memory(var* crc32_1, var start_address, var end_address)

          var* buffer_1;
          buffer_1 := start_address;

          //working 0x001E5D - 0x0006FD starting from 0x0006FD
          //not working from 0x001E5F
          var buffer_size;
          buffer_size := end_address - start_address;

          compute_crc32( buffer_1, &buffer_size, crc32_1);


          I call it from my main program using this:
          //test computing crc
          var crc32_1[4];
          var start_address := 0x0006FD;
          var end_address := 0x001E5D;
          check_memory(crc32_1, start_address, end_address);

          print("crc32 : ",crc32_1[0], crc32_1[1], crc32_1[2], crc32_1[3],"\n");

          var* buffer;
          buffer := 0x001E5C;
          //read this value -> succeed
          print("test: ",[HEX]buffer[0],"\n");
          buffer := 0x001E5D;
          //read this value -> fail and restart prog over and over
          print("test: ",buffer[0],"\n");

          and here is the compiler output
          0 errors
          0 warnings
          3 notices
          No Errors, code size = 9947 bytes out of 14400 total
          Initial RAM size = 4384 bytes out of 14400 total
          Download to Flash successful.

          using the gen4_uLCD_24PT - Picasso procesor

          As written in the comment,
          Read to memory located at address 0x001E5D and beyond are failing.
          Failing leads to a restart of the program from the beginning, so it loops over and over.

          Do you see any reason for that ?

          I would like to ba able to compute my crc on the entire flash area.
          which is of 9947 bytes so up to 0x0026DB, if I am not wrong

          Thanks in advance for your support.
          Last edited by HealthDev; 14th July 2018, 01:07 AM.


          • #6
            You cannot read all of flash, as there is no accessible flash beyond the end of your program.

            If you try, for a few bytes you get 'garbage' and then the processor will reset.

            Regardless, there is nothing beyond your program, the first part of loading a program into flash erases it all, there are no remnants of a previous program that can possibly be 'seen'.

            There is more information coming in your technical enquiry.