5 Replies Latest reply on Nov 22, 2019 7:01 AM by DheerajK_81

    OpenOCD failes to program PSoC6 when CM0+ has restricted access to the internal flash memory

    OnPi_2263161

      Hi All,

      our project aims to use SMPU to protect a bootloader IP. Our current security setup is that PC1 can read/execute from the bootloader flash section and other PCs (except PC0) have all permissions disabled [1] for this section. TC bus master is kept in PC0. Whenever PC2 is set to CM0+ OpenOCD ends with an error during internal flash memory erase [2]. Therefore new code cannot be loaded until we perform a full chip erase via PSoC Programmer application.

       

      Does OpenOCD use CortexM0+ to erase the internal flash memory? What steps should we take to be able to program with OpenOCD a chip with such security setting?

       

      [1]

      static const cy_stc_smpu_cfg_t BOOTLOADER_FULL_PROTECTION = {

        .address = (uint32_t *)CY_FLASH_BASE,

        .regionSize = CY_PROT_SIZE_128KB,

        .subregions = (uint8_t)((CY_PROT_SUBREGION_DIS6) | (CY_PROT_SUBREGION_DIS7)), /* Protects only the bootloader code (96KB). */

        .userPermission = CY_PROT_PERM_DISABLED,

        .privPermission = CY_PROT_PERM_DISABLED,

        .secure = false,

        .pcMatch = false,

        .pcMask = CY_SI_DEVICE_PC_MASK  /* Only allow PC=0 */

      };

       

      [2]

      target halted due to debug-request, current mode: Thread

      xPSR: 0x81000000 pc: 0x1001e90c msp: 0x0800ffc0

      Info : SWD DPIDR 0x6ba02477

      Error: Failed to read memory at 0x4025f00c

      Warn : FLASHC.GEOMETRY is not accessible, assuming device is PSoC6BLE2

      Info : SWD DPIDR 0x6ba02477

      Error: Failed to read memory at 0x4025f00c

      Warn : FLASHC.GEOMETRY is not accessible, assuming Flash Size is 1024 kB

      Error: SROM API execution failed. Status: 0xF0000005

      Error: SECTOR @10000000 not erased!

      Error: failed erasing sectors 0 to 2047