)]}'
{"src/target/adi_v5_swd.c":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"37fbf08b57a4b853e05d2b8b004a46cc6afdf025","unresolved":false,"context_lines":[{"line_number":205,"context_line":"\t\tswd_clear_sticky_errors(dap);"},{"line_number":206,"context_line":"\t} else {"},{"line_number":207,"context_line":"\t\t/* Ideally just clear ORUN flag which is set by reset */"},{"line_number":208,"context_line":"\t\tretval \u003d swd_queue_dp_write_inner(dap, DP_ABORT, ORUNERRCLR);"},{"line_number":209,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":210,"context_line":"\t\t\treturn retval;"},{"line_number":211,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"aedf27f1_754ea074","line":208,"range":{"start_line":208,"start_character":0,"end_line":208,"end_character":63},"updated":"2021-04-19 06:07:25.000000000","message":"REVISIT: do we need to clear sticky at all? Only DP access follows...\nDoing so may hide a previous overrun","commit_id":"c6e5e4464ce1839d1688e701851c21d412ada16f"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"37fbf08b57a4b853e05d2b8b004a46cc6afdf025","unresolved":false,"context_lines":[{"line_number":254,"context_line":""},{"line_number":255,"context_line":"\tif (swd_multidrop_selected_dap \u003d\u003d dap)"},{"line_number":256,"context_line":"\t\treturn ERROR_OK;"},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"\tint retval \u003d ERROR_OK;"},{"line_number":259,"context_line":"\tfor (unsigned int retry \u003d 0; ; retry++) {"},{"line_number":260,"context_line":"\t\tbool clear_sticky \u003d retry \u003e 0;"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"aedf27f1_55491c69","line":257,"updated":"2021-04-19 06:07:25.000000000","message":"swd_run_inner(swd_multidrop_selected_dap) to flush before swd_send_sequence(dap, LINE_RESET)","commit_id":"c6e5e4464ce1839d1688e701851c21d412ada16f"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"37fbf08b57a4b853e05d2b8b004a46cc6afdf025","unresolved":false,"context_lines":[{"line_number":542,"context_line":"/** Executes all queued DAP operations. */"},{"line_number":543,"context_line":"static int swd_run(struct adiv5_dap *dap)"},{"line_number":544,"context_line":"{"},{"line_number":545,"context_line":"\tint retval \u003d swd_multidrop_select(dap);"},{"line_number":546,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":547,"context_line":"\t\treturn retval;"},{"line_number":548,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"aedf27f1_b52c0891","line":545,"range":{"start_line":545,"start_character":0,"end_line":545,"end_character":40},"updated":"2021-04-19 06:07:25.000000000","message":"RECHECK!\nThe only reason of issuing targetsel here is possible finish read - so we might issue select only if there is a pending read to finish.","commit_id":"c6e5e4464ce1839d1688e701851c21d412ada16f"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"6019319148c25a6353da999dad165771435050ea","unresolved":true,"context_lines":[{"line_number":564,"context_line":""},{"line_number":565,"context_line":"\tdone \u003d true;"},{"line_number":566,"context_line":"\tif (swd_dap_is_multidrop(dap))"},{"line_number":567,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_DORMANT);"},{"line_number":568,"context_line":"\telse"},{"line_number":569,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_JTAG);"},{"line_number":570,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"e1e659ef_d6e1db2a","line":567,"updated":"2021-11-10 11:06:39.000000000","message":"We have to put the target back in default JTAG mode when we quite OpenOCD.\nHere we need the sequence:\nswd-\u003eswitch_seq(SWD_TO_DORMANT);\nswd-\u003eswitch_seq(DORMANT_TO_JTAG);","commit_id":"1e552b6dac12ac877caeea55d5fdb522cd30c9eb"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"cc6fa4697a6f74f01e1f676aa31ea6526a211b02","unresolved":true,"context_lines":[{"line_number":564,"context_line":""},{"line_number":565,"context_line":"\tdone \u003d true;"},{"line_number":566,"context_line":"\tif (swd_dap_is_multidrop(dap))"},{"line_number":567,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_DORMANT);"},{"line_number":568,"context_line":"\telse"},{"line_number":569,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_JTAG);"},{"line_number":570,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"af8e8dd8_232d9512","line":567,"in_reply_to":"3188dccd_a81f1dfe","updated":"2021-11-11 09:59:10.000000000","message":"Yes I know, according to IHI0031 everything works perfectly. SW-DP stays in dormant and SWJ-DP returns to JTAG, so both DP types are in power-on state.\n\nJust for illustration: the very document reads in chapter B2.5.1 \"Limitations of system reset control\": \"When nSRST is asserted, the debugger can access the debug domain.\" Huh?\n\nMy intuition tells that vendors are not eager to implement multidrop SW-DP because it is not compatible with the plain SWD protocol (unlike SWJ-DP). AFAIK just RPi2040 has multidrop SW-DP. We might expect some vendor modification of SW-DP to make it compatible to plain SWD, who knows...\n\nPerhaps you\u0027re right. But IHI0031 does not explicitly require the debugger to leave a device in power-on-state, does it? I admit it\u0027s a good habit to do so but the dormant state is attractive for its neutrality as neither JTAG nor SWD is selected.\n\nLet\u0027s compare what happens when we leave devices in dormant versus in JTAG.\n\nBoth multidrop SWD and multidrop JTAG will work. The debugger issues xx_TO_DORMANT\nand DORMANT_TO_yy to select right protocol regardless of the previous state of the devices.\n\nIf a debugging session uses plain SWD then devices won\u0027t connect if they are in dormant. Assuming we have more than one SWJ-DP in multidrop config, plain SWD connects *ALL* devices (we left in JTAG state) as one DP and as all outputs race for one SWDIO line very weird things happen. If devices are similar, only occasional parity errors show the problem. I can imagine even the scenario where user issues mass erase and unintentionally clears all connected devices at once. That\u0027s why I regard the dormant state as *safer* to leave the device in. Of course SWJ-DPs can always run into this problem after power on.\n\nPlain JTAG will not work if devices are in dormant. Yes, this is a problem. But honestly who wants to combine plain JTAG and multidrop SWD? If we exclude OpenOCD testing, it makes little sense for real work... (BTW remember OpenOCD has been leaving SWJ-DP in SWD mode for long time - since introducing SWD in ~2010 to 2018)\n\nSo both after-quit states have some pros and cons and neither is completely wrong. Graham\u0027s #4935 sets dormant before quit and as I guess he tested with SW-DPs. I didn\u0027t change quit behaviour and tested with SWJ-DPs. If you\u0027re asking to change after-quit state to JTAG, please add a new patch a test it with both SWJ-DP and SW-DP. I can do it as well but later, not this year.","commit_id":"1e552b6dac12ac877caeea55d5fdb522cd30c9eb"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"3faa4028df4341c04702ddcaac6cbbe8a81d3e6c","unresolved":true,"context_lines":[{"line_number":564,"context_line":""},{"line_number":565,"context_line":"\tdone \u003d true;"},{"line_number":566,"context_line":"\tif (swd_dap_is_multidrop(dap))"},{"line_number":567,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_DORMANT);"},{"line_number":568,"context_line":"\telse"},{"line_number":569,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_JTAG);"},{"line_number":570,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"dcdc2077_547bb7da","line":567,"in_reply_to":"4fa3aa8a_94e6107e","updated":"2021-11-12 16:38:44.000000000","message":"I use to test new OpenOCD builds by running them few times alternating SWD and JTAG, than change adapter and run again.\nIf we do not return in JTAG, a SWJ-DP will not be accessible in JTAG after a SWD multidrop session.\nEven if it has no practical use, it\u0027s possible running a single device with SWD multidrop and then with JTAG, at least for test.\n\nIf you agree, we (me?) could add an independent patch on top of this series to add DORMANT_TO_JTAG. I would prefer this extra patch to be merged asap so we can get quickly complains if some device doesn\u0027t work with it.","commit_id":"1e552b6dac12ac877caeea55d5fdb522cd30c9eb"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"cb2121a21da6a61a91017fef60f05a96b5a75edc","unresolved":true,"context_lines":[{"line_number":564,"context_line":""},{"line_number":565,"context_line":"\tdone \u003d true;"},{"line_number":566,"context_line":"\tif (swd_dap_is_multidrop(dap))"},{"line_number":567,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_DORMANT);"},{"line_number":568,"context_line":"\telse"},{"line_number":569,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_JTAG);"},{"line_number":570,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"2d30c7cd_0ea145e3","line":567,"in_reply_to":"6153c5b3_2402bb77","updated":"2021-11-12 21:25:53.000000000","message":"I see a value for OpenOCD to be able to recover from an undefined initial state, maybe caused by a crash or a disconnection of the adapter.\nI don\u0027t see a value to left the target, on purpose, in a state that requires extra operation for attaching it.\nAs Tomas reported, OpenOCD used to left SWJ-DP in SWD. Should that fix be reverted too?","commit_id":"1e552b6dac12ac877caeea55d5fdb522cd30c9eb"},{"author":{"_account_id":1000005,"name":"Andreas Fritiofson","email":"andreas.fritiofson@gmail.com","username":"Nattgris"},"change_message_id":"ec5a2773fa814d83fe56ae22da2731964854b30b","unresolved":true,"context_lines":[{"line_number":564,"context_line":""},{"line_number":565,"context_line":"\tdone \u003d true;"},{"line_number":566,"context_line":"\tif (swd_dap_is_multidrop(dap))"},{"line_number":567,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_DORMANT);"},{"line_number":568,"context_line":"\telse"},{"line_number":569,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_JTAG);"},{"line_number":570,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"4fa3aa8a_94e6107e","line":567,"in_reply_to":"af8e8dd8_232d9512","updated":"2021-11-11 14:23:42.000000000","message":"Who cares what state the target is in when we quit? That\u0027s nothing anyone can guarantee anyway, so the important thing is that we can *start* with the target in any random weird state. If we don\u0027t, the target will be inaccessible after someone unplugs the debugger before properly shutting down OpenOCD.","commit_id":"1e552b6dac12ac877caeea55d5fdb522cd30c9eb"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"2353a57420383975212d00ced547d0934768df01","unresolved":true,"context_lines":[{"line_number":564,"context_line":""},{"line_number":565,"context_line":"\tdone \u003d true;"},{"line_number":566,"context_line":"\tif (swd_dap_is_multidrop(dap))"},{"line_number":567,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_DORMANT);"},{"line_number":568,"context_line":"\telse"},{"line_number":569,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_JTAG);"},{"line_number":570,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"3188dccd_a81f1dfe","line":567,"in_reply_to":"b3238874_88dc0959","updated":"2021-11-10 15:13:40.000000000","message":"Multidrop is introduced in IHI0031C.\nSame in latest IHI0031F, chapter B5.3.1 \"Using the dormant state outside of SWJ-DP\".\nThere is the simplified state diagram for SWD-only. Any unrecognized transaction starting from dormant make it return in dormant.\nThis is done to mix SWD multidrop devices with JTAG devices. Switch to JTAG through SWD_TO_DORMANT + DORMANT_TO_JTAG will left in dormant the SWD-only devices.\nI think it\u0027s safe to add DORMANT_TO_JTAG here.","commit_id":"1e552b6dac12ac877caeea55d5fdb522cd30c9eb"},{"author":{"_account_id":1000005,"name":"Andreas Fritiofson","email":"andreas.fritiofson@gmail.com","username":"Nattgris"},"change_message_id":"cf0f7c334b85773e496be778fa8898847e71380d","unresolved":true,"context_lines":[{"line_number":564,"context_line":""},{"line_number":565,"context_line":"\tdone \u003d true;"},{"line_number":566,"context_line":"\tif (swd_dap_is_multidrop(dap))"},{"line_number":567,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_DORMANT);"},{"line_number":568,"context_line":"\telse"},{"line_number":569,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_JTAG);"},{"line_number":570,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"6153c5b3_2402bb77","line":567,"in_reply_to":"dcdc2077_547bb7da","updated":"2021-11-12 17:20:04.000000000","message":"So why don\u0027t we instead *start* by issuing swd-to-dormant-to-jtag, or whatever is needed to recover from the inaccessible state, rather than try to leave the target ready to speak JTAG, which only works in some scenarios?","commit_id":"1e552b6dac12ac877caeea55d5fdb522cd30c9eb"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"63bd8a30f9ed099f9c612a4ab9b2f4997bd647d2","unresolved":true,"context_lines":[{"line_number":564,"context_line":""},{"line_number":565,"context_line":"\tdone \u003d true;"},{"line_number":566,"context_line":"\tif (swd_dap_is_multidrop(dap))"},{"line_number":567,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_DORMANT);"},{"line_number":568,"context_line":"\telse"},{"line_number":569,"context_line":"\t\tswd-\u003eswitch_seq(SWD_TO_JTAG);"},{"line_number":570,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":2,"id":"b3238874_88dc0959","line":567,"in_reply_to":"e1e659ef_d6e1db2a","updated":"2021-11-10 11:29:09.000000000","message":"I prefer not to do so.\nJust a speculation, I\u0027m afraid of silicon bugs in SWD only devices:\nI doubt these chips are tested with DORMANT_TO_JTAG and what if issuing this sequence block the SWDP irreversibly?\nIf somebody uses multidrop-SWD how likely he needs switch to JTAG?\nI would prefer sending DORMANT_TO_JTAG seq before we start JTAG communication, not here.","commit_id":"1e552b6dac12ac877caeea55d5fdb522cd30c9eb"}]}
