- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please check your OpenOCD configuration file for the following:
(1) If you have used "cmsis-dap.cfg" instead of "kitprog3.cfg"
(2) If you have disabled Test Mode acquire (set ENABLE_ACQUIRE 0)
To solve this, do the following:
- Remove the -c "set ENABLE_ACQUIRE 0" command if it is present
- Change -c "source [find interface/cmsis-dap.cfg]" to -c "source [find interface/kitprog3.cfg]"
Let me know if this helps
Regards,
Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please copy the entire OpenOCD log into a file and then attach it here? It will give us more insight into your issue.
Regards,
Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please check your OpenOCD configuration file for the following:
(1) If you have used "cmsis-dap.cfg" instead of "kitprog3.cfg"
(2) If you have disabled Test Mode acquire (set ENABLE_ACQUIRE 0)
To solve this, do the following:
- Remove the -c "set ENABLE_ACQUIRE 0" command if it is present
- Change -c "source [find interface/cmsis-dap.cfg]" to -c "source [find interface/kitprog3.cfg]"
Let me know if this helps
Regards,
Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Remove -c "set ENABLE_ACQUIRE 0" helps.
What does ENABLE_ACQUIRE mean and why it is a problem with combination with SMPU?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This option disables Test Mode acquire.
The problem is that there is no easy way to stop the CPU right after Reset before it starts to execute the code. To do this Cypress uses something called Test Mode Acquisition.
In this particular case, once execution entered main() - user code protects the Flash and there is no way to reprogram it. SROM API returns corresponding error code (STATUS_NVL_PROTECTED) and refuses to program the Flash. This is normal and expected.
If Test Mode acquisition is disabled - nothing stops the CPU after reset.
Regards,
Dheeraj