4 Replies Latest reply on Oct 26, 2020 6:56 PM by WaLo_3890256

    How to use openocd to write entire row of Sflash

    WaLo_3890256

      Hello,

       

      We need to pre-program Sflash before programming the application to PSoC6.

      If we need to write 64 bytes of hex value such as "cdaa5e5bbc31ed47b9e1f5b07b919815c2e1dde780d9b4701c01f812cad407ef"

      Is there any command can write hex value into entire Sflash row?

      I have studied "Cypress Programmer 2.1 OpenOCD" but there's only write 4 bytes at one time

      ./openocd.exe -s ../scripts -f ../scripts/interface/kitprog3.cfg -f ../scripts/target/psoc6.cfg -c "init; reset init; flash fillw 0x16000800 0xcdaa5e5b 4; shutdown"

       

      If I write next 4 bytes into next offset 0x16000900:

      ./openocd.exe -s ../scripts -f ../scripts/interface/kitprog3.cfg -f ../scripts/target/psoc6.cfg -c "init; reset init; flash fillw 0x16000800 0xcdaa5e5b 4; shutdown"

       

      The previous value would be earsed.

       

      Below is the way I used to read value form Sflash in my application:

      uint8_t otp_key1[4] = {0};

      uint8_t otp_key2[4] = {0};

      emcpy(otp_key1, (const void *)0x16000800, 4);

      memcpy(otp_key2, (const void *)0x16000900, 4);

       

      Please correct me and help if my way is suitable.

      Thanks.

       

      BR,

      Wayne