)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1002315,"name":"liangzhen","email":"zhen.liang@spacemit.com","username":"liangzhen"},"change_message_id":"70a20f54bf733e321867378b71de1cb28ad46c00","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"a50de98b_d5baf23c","updated":"2025-11-20 01:23:12.000000000","message":"Imported from\nhttps://github.com/riscv-collab/riscv-openocd/pull/1252","commit_id":"fdf0d1484ac4654a9478216da563c9fb188fdccc"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"9fb98cad9b6f132e808278f61852d5a2a126c665","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"d3b9fb12_a0bb034d","updated":"2025-11-20 10:08:20.000000000","message":"LGTM (reviewed on GitHub). One minor style suggestion.","commit_id":"fdf0d1484ac4654a9478216da563c9fb188fdccc"}],"src/target/riscv/riscv-013.c":[{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"9fb98cad9b6f132e808278f61852d5a2a126c665","unresolved":true,"context_lines":[{"line_number":542,"context_line":"\tif (dmi_write(target, DM_DMCONTROL + dm_base_addr, DM_DMCONTROL_DMACTIVE) !\u003d ERROR_OK)"},{"line_number":543,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":544,"context_line":""},{"line_number":545,"context_line":"\tconst time_t start \u003d time(NULL);"},{"line_number":546,"context_line":"\tLOG_TARGET_DEBUG(target, \"Waiting for the DM to become active.\");"},{"line_number":547,"context_line":"\twhile (1) {"},{"line_number":548,"context_line":"\t\tif (dmi_read(target, \u0026dmcontrol, DM_DMCONTROL + dm_base_addr) !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"77c39db6_66b53be5","line":545,"updated":"2025-11-20 10:08:20.000000000","message":"I\u0027d suggest removing this `const`.\nI like to put `const` whenever I want and Jan supported me in this endeavor, so this was the style we used in RISC-V OpenOCD.\nHowever, we got some backlash when working with the mainline -- this is not the style accepted here.\nSince this is purely a question of taste I suggest to use the accepted style and to remove this `const`.","commit_id":"fdf0d1484ac4654a9478216da563c9fb188fdccc"},{"author":{"_account_id":1002315,"name":"liangzhen","email":"zhen.liang@spacemit.com","username":"liangzhen"},"change_message_id":"0b6d3a9f1f7148f2fb440e956259524445d7347a","unresolved":false,"context_lines":[{"line_number":542,"context_line":"\tif (dmi_write(target, DM_DMCONTROL + dm_base_addr, DM_DMCONTROL_DMACTIVE) !\u003d ERROR_OK)"},{"line_number":543,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":544,"context_line":""},{"line_number":545,"context_line":"\tconst time_t start \u003d time(NULL);"},{"line_number":546,"context_line":"\tLOG_TARGET_DEBUG(target, \"Waiting for the DM to become active.\");"},{"line_number":547,"context_line":"\twhile (1) {"},{"line_number":548,"context_line":"\t\tif (dmi_read(target, \u0026dmcontrol, DM_DMCONTROL + dm_base_addr) !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"af48a1a7_4382343a","line":545,"in_reply_to":"77c39db6_66b53be5","updated":"2025-11-21 01:12:20.000000000","message":"done","commit_id":"fdf0d1484ac4654a9478216da563c9fb188fdccc"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"513d06a8e86240c81b2954e04195104456ddd57e","unresolved":true,"context_lines":[{"line_number":536,"context_line":""},{"line_number":537,"context_line":"static int activate_dm(struct target *target, uint32_t dm_base_addr)"},{"line_number":538,"context_line":"{"},{"line_number":539,"context_line":"\tuint32_t dmcontrol \u003d 0;"},{"line_number":540,"context_line":""},{"line_number":541,"context_line":"\tLOG_TARGET_DEBUG(target, \"Activating the DM with DMI base address (dbgbase) \u003d 0x%x\", dm_base_addr);"},{"line_number":542,"context_line":"\tif (dmi_write(target, DM_DMCONTROL + dm_base_addr, DM_DMCONTROL_DMACTIVE) !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"d2d3056d_4602cec3","line":539,"updated":"2025-11-21 08:42:10.000000000","message":"Move into while-loop (see coding style). Why do you need to initialize the variable?","commit_id":"b64de0c1aa352cd687eb01af54d30702ac003e49"},{"author":{"_account_id":1002315,"name":"liangzhen","email":"zhen.liang@spacemit.com","username":"liangzhen"},"change_message_id":"6932d9557fb8c9137bbacd918adefc9c5796b7dd","unresolved":false,"context_lines":[{"line_number":536,"context_line":""},{"line_number":537,"context_line":"static int activate_dm(struct target *target, uint32_t dm_base_addr)"},{"line_number":538,"context_line":"{"},{"line_number":539,"context_line":"\tuint32_t dmcontrol \u003d 0;"},{"line_number":540,"context_line":""},{"line_number":541,"context_line":"\tLOG_TARGET_DEBUG(target, \"Activating the DM with DMI base address (dbgbase) \u003d 0x%x\", dm_base_addr);"},{"line_number":542,"context_line":"\tif (dmi_write(target, DM_DMCONTROL + dm_base_addr, DM_DMCONTROL_DMACTIVE) !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"05d8f7d3_123deef6","line":539,"in_reply_to":"d2d3056d_4602cec3","updated":"2025-11-21 09:32:42.000000000","message":"Done","commit_id":"b64de0c1aa352cd687eb01af54d30702ac003e49"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"513d06a8e86240c81b2954e04195104456ddd57e","unresolved":true,"context_lines":[{"line_number":543,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":544,"context_line":""},{"line_number":545,"context_line":"\ttime_t start \u003d time(NULL);"},{"line_number":546,"context_line":"\tLOG_TARGET_DEBUG(target, \"Waiting for the DM to become active.\");"},{"line_number":547,"context_line":"\twhile (1) {"},{"line_number":548,"context_line":"\t\tif (dmi_read(target, \u0026dmcontrol, DM_DMCONTROL + dm_base_addr) !\u003d ERROR_OK)"},{"line_number":549,"context_line":"\t\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"fb8938a8_cf3360e5","line":546,"updated":"2025-11-21 08:42:10.000000000","message":"Please remove the periods in your log messages (see coding style).","commit_id":"b64de0c1aa352cd687eb01af54d30702ac003e49"},{"author":{"_account_id":1002315,"name":"liangzhen","email":"zhen.liang@spacemit.com","username":"liangzhen"},"change_message_id":"6932d9557fb8c9137bbacd918adefc9c5796b7dd","unresolved":false,"context_lines":[{"line_number":543,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":544,"context_line":""},{"line_number":545,"context_line":"\ttime_t start \u003d time(NULL);"},{"line_number":546,"context_line":"\tLOG_TARGET_DEBUG(target, \"Waiting for the DM to become active.\");"},{"line_number":547,"context_line":"\twhile (1) {"},{"line_number":548,"context_line":"\t\tif (dmi_read(target, \u0026dmcontrol, DM_DMCONTROL + dm_base_addr) !\u003d ERROR_OK)"},{"line_number":549,"context_line":"\t\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"73ea7602_e5c5675f","line":546,"in_reply_to":"fb8938a8_cf3360e5","updated":"2025-11-21 09:32:42.000000000","message":"Done","commit_id":"b64de0c1aa352cd687eb01af54d30702ac003e49"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"513d06a8e86240c81b2954e04195104456ddd57e","unresolved":true,"context_lines":[{"line_number":544,"context_line":""},{"line_number":545,"context_line":"\ttime_t start \u003d time(NULL);"},{"line_number":546,"context_line":"\tLOG_TARGET_DEBUG(target, \"Waiting for the DM to become active.\");"},{"line_number":547,"context_line":"\twhile (1) {"},{"line_number":548,"context_line":"\t\tif (dmi_read(target, \u0026dmcontrol, DM_DMCONTROL + dm_base_addr) !\u003d ERROR_OK)"},{"line_number":549,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":550,"context_line":"\t\tif (get_field32(dmcontrol, DM_DMCONTROL_DMACTIVE))"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"adfee7fa_d979825a","line":547,"updated":"2025-11-21 08:42:10.000000000","message":"1 -\u003e true","commit_id":"b64de0c1aa352cd687eb01af54d30702ac003e49"},{"author":{"_account_id":1002315,"name":"liangzhen","email":"zhen.liang@spacemit.com","username":"liangzhen"},"change_message_id":"6932d9557fb8c9137bbacd918adefc9c5796b7dd","unresolved":true,"context_lines":[{"line_number":544,"context_line":""},{"line_number":545,"context_line":"\ttime_t start \u003d time(NULL);"},{"line_number":546,"context_line":"\tLOG_TARGET_DEBUG(target, \"Waiting for the DM to become active.\");"},{"line_number":547,"context_line":"\twhile (1) {"},{"line_number":548,"context_line":"\t\tif (dmi_read(target, \u0026dmcontrol, DM_DMCONTROL + dm_base_addr) !\u003d ERROR_OK)"},{"line_number":549,"context_line":"\t\t\treturn ERROR_FAIL;"},{"line_number":550,"context_line":"\t\tif (get_field32(dmcontrol, DM_DMCONTROL_DMACTIVE))"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"3841dbfa_df82a439","line":547,"in_reply_to":"adfee7fa_d979825a","updated":"2025-11-21 09:32:42.000000000","message":"It seems there is no strict rule regarding the use of while (1), while (true), or for (;;). I personally prefer using while (1) because the target/riscv code follows this style.","commit_id":"b64de0c1aa352cd687eb01af54d30702ac003e49"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"513d06a8e86240c81b2954e04195104456ddd57e","unresolved":true,"context_lines":[{"line_number":567,"context_line":"\triscv013_info_t *info \u003d get_info(target);"},{"line_number":568,"context_line":""},{"line_number":569,"context_line":"\tLOG_TARGET_DEBUG(target, \"Searching for DM with DMI base address (dbgbase) \u003d 0x%x\", target-\u003edbgbase);"},{"line_number":570,"context_line":"\twhile (1) {"},{"line_number":571,"context_line":"\t\tuint32_t current_dm \u003d next_dm;"},{"line_number":572,"context_line":"\t\tif (current_dm \u003d\u003d target-\u003edbgbase)"},{"line_number":573,"context_line":"\t\t\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"b07f6d5b_397b3017","line":570,"updated":"2025-11-21 08:42:10.000000000","message":"Same","commit_id":"b64de0c1aa352cd687eb01af54d30702ac003e49"},{"author":{"_account_id":1002315,"name":"liangzhen","email":"zhen.liang@spacemit.com","username":"liangzhen"},"change_message_id":"6932d9557fb8c9137bbacd918adefc9c5796b7dd","unresolved":false,"context_lines":[{"line_number":567,"context_line":"\triscv013_info_t *info \u003d get_info(target);"},{"line_number":568,"context_line":""},{"line_number":569,"context_line":"\tLOG_TARGET_DEBUG(target, \"Searching for DM with DMI base address (dbgbase) \u003d 0x%x\", target-\u003edbgbase);"},{"line_number":570,"context_line":"\twhile (1) {"},{"line_number":571,"context_line":"\t\tuint32_t current_dm \u003d next_dm;"},{"line_number":572,"context_line":"\t\tif (current_dm \u003d\u003d target-\u003edbgbase)"},{"line_number":573,"context_line":"\t\t\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"f342e359_51173cf2","line":570,"in_reply_to":"b07f6d5b_397b3017","updated":"2025-11-21 09:32:42.000000000","message":"Done","commit_id":"b64de0c1aa352cd687eb01af54d30702ac003e49"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"513d06a8e86240c81b2954e04195104456ddd57e","unresolved":true,"context_lines":[{"line_number":572,"context_line":"\t\tif (current_dm \u003d\u003d target-\u003edbgbase)"},{"line_number":573,"context_line":"\t\t\treturn ERROR_OK;"},{"line_number":574,"context_line":""},{"line_number":575,"context_line":"\t\tuint32_t dmcontrol \u003d 0;"},{"line_number":576,"context_line":"\t\tif (dmi_read(target, \u0026dmcontrol, DM_DMCONTROL + current_dm) !\u003d ERROR_OK)"},{"line_number":577,"context_line":"\t\t\tbreak;"},{"line_number":578,"context_line":"\t\tif (!get_field32(dmcontrol, DM_DMCONTROL_DMACTIVE) \u0026\u0026 activate_dm(target, current_dm) !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"4834a451_699322b4","line":575,"updated":"2025-11-21 08:42:10.000000000","message":"Why is it necessary to initialize the variable?","commit_id":"b64de0c1aa352cd687eb01af54d30702ac003e49"},{"author":{"_account_id":1002315,"name":"liangzhen","email":"zhen.liang@spacemit.com","username":"liangzhen"},"change_message_id":"6932d9557fb8c9137bbacd918adefc9c5796b7dd","unresolved":false,"context_lines":[{"line_number":572,"context_line":"\t\tif (current_dm \u003d\u003d target-\u003edbgbase)"},{"line_number":573,"context_line":"\t\t\treturn ERROR_OK;"},{"line_number":574,"context_line":""},{"line_number":575,"context_line":"\t\tuint32_t dmcontrol \u003d 0;"},{"line_number":576,"context_line":"\t\tif (dmi_read(target, \u0026dmcontrol, DM_DMCONTROL + current_dm) !\u003d ERROR_OK)"},{"line_number":577,"context_line":"\t\t\tbreak;"},{"line_number":578,"context_line":"\t\tif (!get_field32(dmcontrol, DM_DMCONTROL_DMACTIVE) \u0026\u0026 activate_dm(target, current_dm) !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"48b1b4e0_6dfa52b5","line":575,"in_reply_to":"4834a451_699322b4","updated":"2025-11-21 09:32:42.000000000","message":"Done","commit_id":"b64de0c1aa352cd687eb01af54d30702ac003e49"}]}
