)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"3d019814a1cd02906cca5d30894b411b919fc831","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":3,"id":"aa9970f1_2523322d","updated":"2025-03-09 15:25:47.000000000","message":"Does it exist any system register, readable by the debugger, that reports which cores (Cortex-M or RISC-V) are active?\nCan OpenOCD use such info to dynamically adapt its behavior?","commit_id":"2d95c6fda2fd4b10a5c70bd1c2f1b125a0597561"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"83c8877d10436ee039dfc8e24152b695ea903d4f","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"c4fcde85_cd8d4df3","in_reply_to":"06c5793d_abd5ba0c","updated":"2025-03-16 12:45:52.000000000","message":"Yep, the defer examine would be a good way to handle this case. Let\u0027s wait for further code upstreamed from risc-v fork","commit_id":"2d95c6fda2fd4b10a5c70bd1c2f1b125a0597561"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"74866e445b52953be17ecbded842b6ef437b68e3","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":3,"id":"06c5793d_abd5ba0c","in_reply_to":"aa9970f1_2523322d","updated":"2025-03-11 16:20:00.000000000","message":"Honestly OpenOCD infrastructure is not quite ready for \"slotted\" cores of different arch. To fully adapt such concept we would need a pseudo `target slot` which would switch access to one of slave targets, in this case either Cortex-M or RISC-V target. If we had `slot` target we would not need this hack in the flash driver.\n\nActually this patch series is a simplified version of https://github.com/tom-van/openocd-rp2350-riscv which instead of implementing `slot` pseudo target creates both Cortex-M and RISC-V targets for each slot and dynamically examines one core architecture and keeps the other in defer examine/unavailable state.\nAlthough this simplified version does not need the flash target switching at all (it lacks RISC-V over DAP support which waits for RISC-V code update from RISC-V collab fork) I decided to submit the flash driver code as close as possible to the version with dynamic core arch switching.\n\nThere are many system registers but there is also a chicken-egg problem for the debugger: you need to know the target architecture first to access any register. And there is no default configuration always usable for initialisation - the flash driver has to either use Cortex-M or RISC-V.\nActually there are two ways to read the selected arch type independently of the selected core arch: Coresight ROM table BASE has P (present) bit reflecting the actual state of Cortex-M core and RISC-V DMSTATUS register indicates allunavail/anyunavail if the hart is selected in DMCONTROL. All this is handled in Tcl config, outside of the flash driver because it mainly controls the targets.","commit_id":"2d95c6fda2fd4b10a5c70bd1c2f1b125a0597561"}],"src/flash/nor/rp2040.c":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"3cd743d72f5ef84de5622d302a3aeb485e5b8341","unresolved":true,"context_lines":[{"line_number":1017,"context_line":""},{"line_number":1018,"context_line":"\tstruct target *old_target \u003d get_target(CMD_ARGV[0]);"},{"line_number":1019,"context_line":"\tif (!old_target) {"},{"line_number":1020,"context_line":"\t\tLOG_ERROR(\"Unrecognised old target %s\", CMD_ARGV[0]);"},{"line_number":1021,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1022,"context_line":"\t}"},{"line_number":1023,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":3,"id":"13229315_2fbc4ef7","line":1020,"updated":"2025-03-09 15:17:21.000000000","message":"`command_print()` here and below","commit_id":"2d95c6fda2fd4b10a5c70bd1c2f1b125a0597561"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"6b508f29e519c88260b106d8f55467f16358c687","unresolved":false,"context_lines":[{"line_number":1017,"context_line":""},{"line_number":1018,"context_line":"\tstruct target *old_target \u003d get_target(CMD_ARGV[0]);"},{"line_number":1019,"context_line":"\tif (!old_target) {"},{"line_number":1020,"context_line":"\t\tLOG_ERROR(\"Unrecognised old target %s\", CMD_ARGV[0]);"},{"line_number":1021,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1022,"context_line":"\t}"},{"line_number":1023,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":3,"id":"bef8311c_e78781ae","line":1020,"in_reply_to":"13229315_2fbc4ef7","updated":"2025-03-11 17:35:43.000000000","message":"Done","commit_id":"2d95c6fda2fd4b10a5c70bd1c2f1b125a0597561"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"3cd743d72f5ef84de5622d302a3aeb485e5b8341","unresolved":true,"context_lines":[{"line_number":1018,"context_line":"\tstruct target *old_target \u003d get_target(CMD_ARGV[0]);"},{"line_number":1019,"context_line":"\tif (!old_target) {"},{"line_number":1020,"context_line":"\t\tLOG_ERROR(\"Unrecognised old target %s\", CMD_ARGV[0]);"},{"line_number":1021,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1022,"context_line":"\t}"},{"line_number":1023,"context_line":""},{"line_number":1024,"context_line":"\tstruct target *new_target \u003d get_target(CMD_ARGV[1]);"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"2c14bdaa_e446507e","line":1021,"updated":"2025-03-09 15:17:21.000000000","message":"`ERROR_COMMAND_ARGUMENT_INVALID`, here and below","commit_id":"2d95c6fda2fd4b10a5c70bd1c2f1b125a0597561"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"6b508f29e519c88260b106d8f55467f16358c687","unresolved":false,"context_lines":[{"line_number":1018,"context_line":"\tstruct target *old_target \u003d get_target(CMD_ARGV[0]);"},{"line_number":1019,"context_line":"\tif (!old_target) {"},{"line_number":1020,"context_line":"\t\tLOG_ERROR(\"Unrecognised old target %s\", CMD_ARGV[0]);"},{"line_number":1021,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":1022,"context_line":"\t}"},{"line_number":1023,"context_line":""},{"line_number":1024,"context_line":"\tstruct target *new_target \u003d get_target(CMD_ARGV[1]);"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"a7bd370e_502c02cb","line":1021,"in_reply_to":"2c14bdaa_e446507e","updated":"2025-03-11 17:35:43.000000000","message":"Done","commit_id":"2d95c6fda2fd4b10a5c70bd1c2f1b125a0597561"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"3cd743d72f5ef84de5622d302a3aeb485e5b8341","unresolved":true,"context_lines":[{"line_number":1031,"context_line":"\tfor (bank \u003d flash_bank_list(); bank; bank \u003d bank-\u003enext) {"},{"line_number":1032,"context_line":"\t\tif (bank-\u003edriver \u003d\u003d \u0026rp2040_flash) {"},{"line_number":1033,"context_line":"\t\t\tif (bank-\u003etarget \u003d\u003d old_target) {"},{"line_number":1034,"context_line":"\t\t\t\tbank-\u003etarget \u003d new_target;"},{"line_number":1035,"context_line":"\t\t\t\tstruct rp2040_flash_bank *priv \u003d bank-\u003edriver_priv;"},{"line_number":1036,"context_line":"\t\t\t\tpriv-\u003eprobed \u003d false;"},{"line_number":1037,"context_line":"\t\t\t\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"ee3de97a_65071390","line":1034,"updated":"2025-03-09 15:17:21.000000000","message":"so any target can be assigned to the bank, even a target that has nothing to do with it.\nI think it\u0027s safer having both targets on `flash bank` command, keep them in `priv`, using the first as default at startup, then checking here that it\u0027s allowed?","commit_id":"2d95c6fda2fd4b10a5c70bd1c2f1b125a0597561"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"74866e445b52953be17ecbded842b6ef437b68e3","unresolved":false,"context_lines":[{"line_number":1031,"context_line":"\tfor (bank \u003d flash_bank_list(); bank; bank \u003d bank-\u003enext) {"},{"line_number":1032,"context_line":"\t\tif (bank-\u003edriver \u003d\u003d \u0026rp2040_flash) {"},{"line_number":1033,"context_line":"\t\t\tif (bank-\u003etarget \u003d\u003d old_target) {"},{"line_number":1034,"context_line":"\t\t\t\tbank-\u003etarget \u003d new_target;"},{"line_number":1035,"context_line":"\t\t\t\tstruct rp2040_flash_bank *priv \u003d bank-\u003edriver_priv;"},{"line_number":1036,"context_line":"\t\t\t\tpriv-\u003eprobed \u003d false;"},{"line_number":1037,"context_line":"\t\t\t\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"b2ed1df4_35beeb27","line":1034,"in_reply_to":"ee3de97a_65071390","updated":"2025-03-11 16:20:00.000000000","message":"Sorry, but does `flash bank` command check if the target is the proper one? It does not! It simply probes the flash. All depends on correctness of the target config file. The same situation repeats here. The target is switched to new one provided by config and re-probing is forced before the next flash op.\n\nI also thought about storing the second target in priv but finally I decided that it would be useless paranoia. The explicitly entered old target is IMO sufficient for command safety.","commit_id":"2d95c6fda2fd4b10a5c70bd1c2f1b125a0597561"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"3cd743d72f5ef84de5622d302a3aeb485e5b8341","unresolved":true,"context_lines":[{"line_number":1054,"context_line":"\t\t.handler \u003d rp2040_rom_api_call_handler,"},{"line_number":1055,"context_line":"\t},"},{"line_number":1056,"context_line":"\t{"},{"line_number":1057,"context_line":"\t\t.name \u003d \"_switch_target\","},{"line_number":1058,"context_line":"\t\t.mode \u003d COMMAND_EXEC,"},{"line_number":1059,"context_line":"\t\t.help \u003d \"internal use\","},{"line_number":1060,"context_line":"\t\t.usage \u003d \"old_target new_target\","}],"source_content_type":"text/x-csrc","patch_set":3,"id":"abb3de56_75d0d9e9","line":1057,"updated":"2025-03-09 15:17:21.000000000","message":"To be added in `openocd.texi`","commit_id":"2d95c6fda2fd4b10a5c70bd1c2f1b125a0597561"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"6b508f29e519c88260b106d8f55467f16358c687","unresolved":false,"context_lines":[{"line_number":1054,"context_line":"\t\t.handler \u003d rp2040_rom_api_call_handler,"},{"line_number":1055,"context_line":"\t},"},{"line_number":1056,"context_line":"\t{"},{"line_number":1057,"context_line":"\t\t.name \u003d \"_switch_target\","},{"line_number":1058,"context_line":"\t\t.mode \u003d COMMAND_EXEC,"},{"line_number":1059,"context_line":"\t\t.help \u003d \"internal use\","},{"line_number":1060,"context_line":"\t\t.usage \u003d \"old_target new_target\","}],"source_content_type":"text/x-csrc","patch_set":3,"id":"8a0aadf2_fa45ece5","line":1057,"in_reply_to":"abb3de56_75d0d9e9","updated":"2025-03-11 17:35:43.000000000","message":"Ack","commit_id":"2d95c6fda2fd4b10a5c70bd1c2f1b125a0597561"}]}
