This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Changing DBGLOCK from CC254x Software

Hi,

Is it possible to programmatically change the DBGLOCK bit, in order to disable all debug commands?

Currently, the following code will disable debug commands BUT only when downloaded and debugged via IAR. References were taken from section 3.4.1 of the User Guide.

// Flash page (last page)
#define BLOCK_DEBUG_CMDS_PAGE (HAL_NV_PAGE_END + 1)

// Flash Page offset, where 1 = sizeof(uint8)
#define BLOCK_DEBUG_CMDS_OFFSET (HAL_FLASH_PAGE_SIZE - 1)

// Flash Address
#define BLOCK_DEBUG_CMS_ADDR 0xFFFF

// Block Debug Commands Bit
#define BLOCK_DEBUG_CMS_BIT BV(7)

// Initially read bytes where debug lock bit resides
uint8 buff[4] = { 0 };
HalFlashRead(BLOCK_DEBUG_CMDS_PAGE, BLOCK_DEBUG_CMDS_OFFSET - 3, buff, sizeof(buff)); 

// Write to debug lock bit
buff[3] &= ~BLOCK_DEBUG_CMS_BIT; // Clears only 7th bit of last byte to retain other flash components; 0 Disable, 1 Enable
HalFlashWrite(BLOCK_DEBUG_CMS_ADDR, &buff[3], 1);

Based on the User Guide, I'm assuming it achieves this by using the debug interface in which DEBUG_INSTR commands are sent prior to flashing. Is there anyway to do this in a runtime image? I need to do this to ensure an image with OAD functionality will also have prevent debug commands.

Thanks in advance,

Jerome