)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"change_message_id":"5a746cdb582611efa5696a9b58945a97d6a843a3","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"7e97a2fe_fb01c92a","updated":"2026-01-03 09:55:36.000000000","message":"Thanks Marc. Seems me sufficient","commit_id":"e93a65009d7b9bce03e4376e73b3fed4506e68b0"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"1fadcab9f525aaf2c4e16a51fb28c280f45474f4","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"8aecf06e_4804ddde","updated":"2025-12-17 12:09:21.000000000","message":"Tomas, this is a workaround to have non-flash NVM and sectorless bank support now and without heavy changes in the code base.\n\nI think in the future we can remove the \"cached\" erase state entirely from the flash infrastructure. What do you think? We do not rely on the erase state at all, correct? So in my opinion we could change the `erase_check()` API in a way that it returns directly the erase state. Something like that:\n\n```\nstruct flash_erase_state {\n  bool bank_erased;\n  bool *sector_erased;\n};\n\nint erase_check(struct flash_bank *bank, struct flash_erase_state *state) {\n  ...\n}\n```\n\n`bank_erased` is always valid and if we have sectors the array contains information about the erase state of the individual sectors.","commit_id":"e93a65009d7b9bce03e4376e73b3fed4506e68b0"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"change_message_id":"325d31312523850852fc4bfd3549eedf76cb8eb5","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":1,"id":"f79ff6ac_cb4992d9","updated":"2026-09-09 07:40:22.000000000","message":"Unfortunately does not compile after merging\n9386: target: clean up return value of target_type::blank_check_memory() | https://review.openocd.org/c/openocd/+/9386","commit_id":"e93a65009d7b9bce03e4376e73b3fed4506e68b0"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"change_message_id":"0439813394d29a4a48e0f6be7c837e28e6946439","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"a3d1d3d1_9995a74e","in_reply_to":"8c377271_0eeebb1f","updated":"2026-09-10 10:08:25.000000000","message":"Okay, you fixed it too","commit_id":"e93a65009d7b9bce03e4376e73b3fed4506e68b0"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"change_message_id":"e4c915c54c2243365613aab2939446bb2a57ab63","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":1,"id":"8c377271_0eeebb1f","in_reply_to":"f79ff6ac_cb4992d9","updated":"2026-09-09 08:05:07.000000000","message":"If you want I can upload fixed patch","commit_id":"e93a65009d7b9bce03e4376e73b3fed4506e68b0"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"784f57c21ce8d9539261f6becc59c9cb8626e1fe","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"b2109053_355570a4","updated":"2026-09-11 11:09:09.000000000","message":"The sectorless-bank fast and fallback erase checks are integrated into the existing blank-check path,\nbut the new fallback scans bytes that `target_read_memory()` did not read when the bank size is not 4-byte aligned. \n\nSuggested vote: -1\n\n_This review was performed by an AI agent._","commit_id":"9e32e194169ab9f04155afb318bd6599d0c9421c"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"a6622dd48a795b4f2891e26a2fadd3a54d18c1cf","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"036ca82d_50d3c3fe","updated":"2026-09-14 08:42:30.000000000","message":"The sectorless fallback can leave `bank-\u003eis_erased` set to `1` when `target_read_buffer()` fails, so `flash erase_check` reports both an error and `Bank is erased`.\n\nSuggested vote: -1\n\n_This review was performed by an AI agent._","commit_id":"445aa616893516e94786f4406bb0ff08595cf557"}],"src/flash/nor/core.c":[{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"784f57c21ce8d9539261f6becc59c9cb8626e1fe","unresolved":true,"context_lines":[{"line_number":411,"context_line":"\t\tretval \u003d target_read_memory(target,"},{"line_number":412,"context_line":"\t\t\t\tbank-\u003ebase + offset,"},{"line_number":413,"context_line":"\t\t\t\t4,"},{"line_number":414,"context_line":"\t\t\t\tchunk_size / 4,"},{"line_number":415,"context_line":"\t\t\t\tbuffer);"},{"line_number":416,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":417,"context_line":"\t\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"5e635258_865dc087","line":414,"updated":"2026-09-11 11:09:09.000000000","message":"The fallback reads only `chunk_size / 4` words but the loop below inspects all `chunk_size` bytes. For a sectorless bank whose size is not 4-byte aligned (or is smaller than 4 bytes), the tail is never read and `buffer[i]` comes from stale/uninitialized data, so the erase result can be wrong. Please handle the remainder explicitly or limit the scan to the bytes actually read.","commit_id":"9e32e194169ab9f04155afb318bd6599d0c9421c"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"tomas.vanek.oocd@gmail.com","username":"vanekt"},"change_message_id":"8fb4d2b58c1d00cb2834ef5abf53708ae99dc3d7","unresolved":true,"context_lines":[{"line_number":411,"context_line":"\t\tretval \u003d target_read_memory(target,"},{"line_number":412,"context_line":"\t\t\t\tbank-\u003ebase + offset,"},{"line_number":413,"context_line":"\t\t\t\t4,"},{"line_number":414,"context_line":"\t\t\t\tchunk_size / 4,"},{"line_number":415,"context_line":"\t\t\t\tbuffer);"},{"line_number":416,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":417,"context_line":"\t\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"d40fc51d_be655e3d","line":414,"in_reply_to":"5e635258_865dc087","updated":"2026-09-11 19:36:18.000000000","message":"\u003e For a sectorless bank whose size is not 4-byte aligned (or is smaller than 4 bytes)\n\nHard to imagine something like this.\nAnyway we can use `target_read_buffer()` instead with no performance penalty.","commit_id":"9e32e194169ab9f04155afb318bd6599d0c9421c"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"1c95c76287fedfc523fd51f52366845f8566c4aa","unresolved":false,"context_lines":[{"line_number":411,"context_line":"\t\tretval \u003d target_read_memory(target,"},{"line_number":412,"context_line":"\t\t\t\tbank-\u003ebase + offset,"},{"line_number":413,"context_line":"\t\t\t\t4,"},{"line_number":414,"context_line":"\t\t\t\tchunk_size / 4,"},{"line_number":415,"context_line":"\t\t\t\tbuffer);"},{"line_number":416,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":417,"context_line":"\t\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":2,"id":"3108fa65_7244471b","line":414,"in_reply_to":"d40fc51d_be655e3d","updated":"2026-09-14 07:26:43.000000000","message":"Done","commit_id":"9e32e194169ab9f04155afb318bd6599d0c9421c"},{"author":{"_account_id":1000863,"name":"Tarek BOCHKATI","email":"tarek.bouchkati@gmail.com","username":"BouchkatiTarek"},"change_message_id":"a6622dd48a795b4f2891e26a2fadd3a54d18c1cf","unresolved":true,"context_lines":[{"line_number":403,"context_line":""},{"line_number":404,"context_line":"\tLOG_WARNING(\"Fast erase check failed, running slow fallback\");"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"\tbank-\u003eis_erased \u003d 1;"},{"line_number":407,"context_line":""},{"line_number":408,"context_line":"\tfor (uint32_t offset \u003d 0; offset \u003c bank-\u003esize; offset +\u003d buffer_size) {"},{"line_number":409,"context_line":"\t\tuint32_t chunk_size \u003d MIN(buffer_size, bank-\u003esize - offset);"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"b9b3ab63_db5bfab5","line":406,"updated":"2026-09-14 08:42:30.000000000","message":"If a later `target_read_buffer()` fails, this remains `1` and the function returns the error without marking the bank unknown. The caller in `src/flash/nor/tcl.c` still evaluates `p-\u003eis_erased` and prints `Bank is erased` even though the command reports a failed check. Set the state to unknown on failure, or make the command suppress the bank-status line when `retval !\u003d ERROR_OK`.","commit_id":"445aa616893516e94786f4406bb0ff08595cf557"},{"author":{"_account_id":1000853,"name":"zapb","display_name":"Marc Schink","email":"dev@zapb.de","username":"zapb"},"change_message_id":"a752bede72a41365f9fe8fd5427f434d5b82cc3c","unresolved":false,"context_lines":[{"line_number":403,"context_line":""},{"line_number":404,"context_line":"\tLOG_WARNING(\"Fast erase check failed, running slow fallback\");"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"\tbank-\u003eis_erased \u003d 1;"},{"line_number":407,"context_line":""},{"line_number":408,"context_line":"\tfor (uint32_t offset \u003d 0; offset \u003c bank-\u003esize; offset +\u003d buffer_size) {"},{"line_number":409,"context_line":"\t\tuint32_t chunk_size \u003d MIN(buffer_size, bank-\u003esize - offset);"}],"source_content_type":"text/x-csrc","patch_set":3,"id":"5500bb69_9ad292b4","line":406,"in_reply_to":"b9b3ab63_db5bfab5","updated":"2026-09-15 15:36:33.000000000","message":"This clearly is a problem of the code calling `erase_check()`, but let\u0027s fix both.","commit_id":"445aa616893516e94786f4406bb0ff08595cf557"}]}
