Hi Everyone,
My goal is to configure the register values of the trace components (like DWT,ITM,TPIU) through the DAP (using SWD connection) while the prrocessor is runningI have two identical STM32F429I Discovery board which have STM32F429ZI processors which have Cortex-M4 architecture. One of the boards is used as a debugger and thorugh DAP it is able to write to the "debugged" MCUs memory in a non-invasive way. Basically after some initialization of course, I set the TAR register of the DAP with the required memory access to write to and then set the DRW register with the value to be written.This works flawlessly BUT when I'm trying to write to lets say the DWT->COMP0 register, so the 0xE0001020 address, at the next SWD transaction (so after the required value sent to DRW register) I get an acknowledge indicating FAULT (i.e: something went wrong on the other side)In short I manage to write to the SRAM (where a variable is located which is traced through SWO) but right after that request the write to the PPB region fails. I expect the trace to stop as the COMP0 shall hold an address to no write operation is performed (on the MCU under debug), but it continues.
I guess the debugger might not have the access permission. The mentioned units are in the Private Peripherial Register (PPB) memory region that is as far as I know can only be accessed with privileged accesses.But in the "Definitive Guide To ARM Cortex M3 and Cortex M4 processors" I read the following: "The debug state is used for debugging operations only. This state is entered by ahalt request from the debugger, or by debug events generated from debug componentsin the processor. This state allows the debugger to access or change the processor registervalues. The system memory, including peripherals inside and outside the processor,can be accessed by the debugger in either Thumb state or debug state."So I think that as a debugger connected to the MCU under debug through it's SWD pins I should be able to write the PPB memory region, as privilige or unpriviliged status only applies to the application.Any idesas on what am I missing here?Thanks in advanceViktor
Code snippet from the debugger side:
data_send = 0x20000000; acknowledge = SWD_Transfer(TAR_Write,&data_send); if (0x01 != acknowledge) { // ACK not OK } if (changeVal == TRUE){ data_send = 0xCCCCCCCC; changeVal = FALSE; } else{ data_send = 0x00000000; changeVal = TRUE; } acknowledge = SWD_Transfer(DRW_Write,&data_send); if (0x01 != acknowledge){ // ACK not OK } HAL_Delay(3000); data_send = 0xE0001020; acknowledge = SWD_Transfer(TAR_Write,&data_send); if (0x01 != acknowledge){ // ACK not OK } data_send = 0x2000000C; acknowledge = SWD_Transfer(DRW_Write,&data_send); if (0x01 != acknowledge) { // ACK not OK }
Are you sure that the DAP sees the Debug registers at the same address as the core?
Hi,I think yes. Going through a lot of ARM and ST documentation, haven't found any notes or remarks if these addresses differ. The DAP and Core both connect to the same Internal Bus Interconnect.