Starting a debug session is done using the “attach” function. This can be done simply after configuration and activation of physical(in the case of attaching to a running process, or when programming is not required), or it can follow after a “leave programming mode” command. A parameter specifies whether the target should break immediately (normal) or continue running, if possible. Attaching to a target will start a polling process to monitor the state of the OCD module.
After completion of a session, a detach command should be executed. This stops the polling process and puts the target into run mode. The “deactivate physical” command should be executed afterwards. If reprogramming of the target is required during or after (fuses) a debug session, the “enter programming mode” command can be executed in place of a “detach” command.