)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ace5bc280291fb8a0d87cb7735f0f2114cd1c51f","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"00a118e7_9755e4e6","updated":"2022-08-11 21:33:54.000000000","message":"Thanks for this patch.\n\nI don\u0027t expect I will review it because I\u0027m not confident about working on the flash subsystem.\n\nNevertheless I would like to ask you to:\n- add a section in doc/openocd.texi about this driver. Every section for flash driver starts with:\n@deffn {Flash Driver} {driver_name}\nso in your case it would be\n@deffn {Flash Driver} {rsl10}\nYou can easily find where the other drivers are listed\n\n- add the SPDX tag to every new file you have added. For files .c .h and .S use\n/* SPDX-License-Identifier: GPL-2.0-or-later */\nfor Makefile and .cfg use\n# SPDX-License-Identifier: GPL-2.0-or-later\nfor the automatically generated file .inc no need to add any license tag\n","commit_id":"5738178d50c4eb3baeea497cb7c9d0ec26de38d6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"fd56cee091cb831d5dcbd3a14785a08bb3fff522","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"74653364_2eaae908","in_reply_to":"00a118e7_9755e4e6","updated":"2022-08-12 19:48:12.000000000","message":"No problem. Who should I add as reviewer, or someone will assign himself?","commit_id":"5738178d50c4eb3baeea497cb7c9d0ec26de38d6"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ce24fde0b37b56975db028b99ec31893c544c4df","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"feda21bb_d1781250","in_reply_to":"74653364_2eaae908","updated":"2022-08-15 16:01:38.000000000","message":"I expect some maintainer would take it. Otherwise check the git log of src/flash/nor to find someone active on the folder and add him as reviewer","commit_id":"5738178d50c4eb3baeea497cb7c9d0ec26de38d6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":12,"id":"43033494_6cf4836a","updated":"2022-08-16 10:51:06.000000000","message":"Hi Toms,\n\nunfortunately you started from nrf5.c, not the best driver to choose.\nPlease pay more attention to commented headers like target/target.h\nand flash/nor/core.h","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"f1f30409885d985fa4313ce1f9a0c90271841de5","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":13,"id":"eeb62bf7_8c8bf0a0","updated":"2022-08-17 08:24:58.000000000","message":"And couple of types\nhttps://openocd.org/doc/doxygen/html/stylec.html#styletypes","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"82e0e1e817b075d8f53bd7027140e1c809cca520","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":16,"id":"ce13fe8f_407aaca6","updated":"2022-08-22 19:20:04.000000000","message":"Toms,\nthe switch of flash write to async algo needs more work.\nMy thoughts:\n1) The patchset 15 code with fixes from patchset 16 without async write would be almost ready to merge.\nDon\u0027t you want to merge first the simpler version and then submit a new patch with update to async?\n\n2) Async code uses the stack. The driver should setup it.\nTo be investigated: do ROM routines use the stack internally?\n\n3) Flash write granularity:\nThe async code looks like it assumes the flash write begins at the flash sector boundary.\nThis is mostly true with standard images. However user may want to write some additional flash data at arbitrary address, not aligned to sectors.\n\nIMO target_run_flash_async_algorithm() should use block_size 8, what is real minimum to write and the driver asks the flash infrastructure to ensure 8-byte alignment.\n\nThe async target code may monitor the flash write address and wait until the end of sector is filled into circular buffer and then start ROM write subroutine. But if you also want to guarantee the circular buff roll over fits to the sector boundary then there is no other way than asking the flash infrastructure for write alignment @ sector boundary. I would not recommend it as it spoils the real ability to write 8-byte word at a time. Does it makes any difference calling ROM write of sector versus calling ROM write of arbitrary number of 8-byte words?\n\n4) Using async with the ROM code looks somewhat complicated. Are you sure it really pays off in terms of flashing speed up?","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"9fc29cc296db72a30b08a322793ad77f480cf59b","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":16,"id":"ecea8140_fb6b000e","in_reply_to":"6693cc94_1a9604b5","updated":"2022-09-03 21:17:11.000000000","message":"Thanks, I understand the problem now. Before running algorithms, I\u0027m setting SP to 0x20002000.","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"555c427681eedd8067b0ced9c0d2a63ef6cc4d61","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":16,"id":"6693cc94_1a9604b5","in_reply_to":"c058da64_6da7598c","updated":"2022-09-01 12:00:22.000000000","message":"\u003e 2) SP is set to 0x20002000, before calling ROM algo,\n\nI don\u0027t see where the SP setting takes place.\nCortex-M sets SP after reset to the value of word @ addr 0. This word is programmed with the app image. It means that invalid SP value might be loaded from erased flash (or might not, if detected and overridden in ROM boot code) and also if a wrong image is flashed. Would the ROM algo work even in such corner case? If both erase and mass erase fails (because CPU enters hard fault on stack op), OpenOCD is not able to revive the device.\n\n\u003e From datasheet: \n\u003e   Program RAM: 4*0x2000 @ 0x200000   (I use it as workarea now)\n\u003e   Data RAM:    3*0x2000 @ 0x20000000 (I used it as workarea before, when failed)\n\nLooks reasonable.","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":16,"id":"c058da64_6da7598c","in_reply_to":"ce13fe8f_407aaca6","updated":"2022-08-25 11:35:24.000000000","message":"1) Yes, you\u0027re right, lets merge simpler version, and I\u0027ll add async update after merge.\nIn patchset 17 I fixed all proposed fixes, and in patchset 18 I removed all async code.\n\n2) SP is set to 0x20002000, before calling ROM algo, and I had set as workarea 0x20000000. So they overlapped when I used buffer with size more than 8192(0x2000).\nFrom datasheet: \n  Program RAM: 4*0x2000 @ 0x200000   (I use it as workarea now)\n  Data RAM:    3*0x2000 @ 0x20000000 (I used it as workarea before, when failed)\n\n3) ROM algo does setup and multiple checks (address, count, protect), and tests if all data where written correctly. It all creates overhead. For example async algo, with buffer sizes(test: flash fillw 0x100000 0x12345678 0x18000):\n0x8  : ~8kB/s\n0x800: ~30kB/s\nWithout async algo, with FLASH_SECTOR_SIZE:\n0x200: ~15kB/s\n0x400: ~20kB/s\n0x800: ~22kB/s\n0x2000: ~25kB/s\n0x4000: ~25kB/s\n\nI guess, by not using ROM algo, and implementing write part in asm, and doing checks and setups on host before writing, could improve speeds even more.\n\n4)Yes, it saves couple seconds in my use case.","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"b9d02dd64bcb814cda6894fff0979e93c93bc7b1","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":16,"id":"0a8adb99_fc73fc8d","in_reply_to":"ecea8140_fb6b000e","updated":"2022-09-04 16:26:52.000000000","message":"Usually the allocation of a working area for the stack and setting SP to point to it is better solution as the working area can be backed up. Because rsl10.cfg does not request working area backup and only one working area can be defined in OpenOCD, the fixed SP setting has an advantage for RSL10 as it enables using the second RAM area for the stack. OK with me.","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"555c427681eedd8067b0ced9c0d2a63ef6cc4d61","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":19,"id":"33ec9bd1_9beeb88a","updated":"2022-09-01 12:00:22.000000000","message":"My concern is the SP setting.\nBesides that just couple of cosmetic nits.","commit_id":"507e67ae28a89978ace58bf114392567339ad3ee"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"b9d02dd64bcb814cda6894fff0979e93c93bc7b1","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":20,"id":"3f921fbf_b901ff74","updated":"2022-09-04 16:26:52.000000000","message":"Thanks for yout work, Toms.\n","commit_id":"f0912e6b21ed4470b4c91d3905a2df9fbcb89e87"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b6e310d3d053b882d8dcc3328ac4e61d10603e83","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":21,"id":"b444def7_7536d030","updated":"2022-09-07 08:01:40.000000000","message":"thanks!","commit_id":"848a96ce5201cab48c7a27b36ca2e5953079d2bb"}],"contrib/loaders/flash/rsl10/async_write.S":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":1,"context_line":""},{"line_number":2,"context_line":"\t.text"},{"line_number":3,"context_line":"\t.syntax unified"},{"line_number":4,"context_line":"\t.cpu cortex-m0"}],"source_content_type":"text/x-asm","patch_set":16,"id":"000121e8_e2e44010","line":1,"updated":"2022-08-22 13:51:02.000000000","message":"Please add:\n/* SPDX-License-Identifier: GPL-2.0-or-later */","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":1,"context_line":""},{"line_number":2,"context_line":"\t.text"},{"line_number":3,"context_line":"\t.syntax unified"},{"line_number":4,"context_line":"\t.cpu cortex-m0"}],"source_content_type":"text/x-asm","patch_set":16,"id":"4c6783fc_de3b768f","line":1,"in_reply_to":"000121e8_e2e44010","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"}],"doc/openocd.texi":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ce24fde0b37b56975db028b99ec31893c544c4df","unresolved":true,"context_lines":[{"line_number":7496,"context_line":"flash bank $_FLASHNAME rsl10 $_FLASHBASE $_FLASHSIZE 0 0 $_TARGETNAME"},{"line_number":7497,"context_line":"@end example"},{"line_number":7498,"context_line":""},{"line_number":7499,"context_line":"There are 1 command defined in the @var{rsl10} driver:"},{"line_number":7500,"context_line":""},{"line_number":7501,"context_line":"@deffn {Command} {rsl10_flash lock} key1 key2 key3 key4"},{"line_number":7502,"context_line":"Writes @var{key1 key2 key3 key4} words to @var{0x81044 0x81048 0x8104c"}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"c8191368_d0a6e173","line":7499,"updated":"2022-08-15 16:01:38.000000000","message":"Remove this line, no need for this. Just list the commands in sequence.\nBy the way, it should have been \"There is one command ...\"","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"e49edf7bb17f5c61ac88b1d751e88a125467cc04","unresolved":false,"context_lines":[{"line_number":7496,"context_line":"flash bank $_FLASHNAME rsl10 $_FLASHBASE $_FLASHSIZE 0 0 $_TARGETNAME"},{"line_number":7497,"context_line":"@end example"},{"line_number":7498,"context_line":""},{"line_number":7499,"context_line":"There are 1 command defined in the @var{rsl10} driver:"},{"line_number":7500,"context_line":""},{"line_number":7501,"context_line":"@deffn {Command} {rsl10_flash lock} key1 key2 key3 key4"},{"line_number":7502,"context_line":"Writes @var{key1 key2 key3 key4} words to @var{0x81044 0x81048 0x8104c"}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"fb7027fb_1264a97b","line":7499,"in_reply_to":"c8191368_d0a6e173","updated":"2022-08-15 22:08:52.000000000","message":"Done","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ce24fde0b37b56975db028b99ec31893c544c4df","unresolved":true,"context_lines":[{"line_number":7498,"context_line":""},{"line_number":7499,"context_line":"There are 1 command defined in the @var{rsl10} driver:"},{"line_number":7500,"context_line":""},{"line_number":7501,"context_line":"@deffn {Command} {rsl10_flash lock} key1 key2 key3 key4"},{"line_number":7502,"context_line":"Writes @var{key1 key2 key3 key4} words to @var{0x81044 0x81048 0x8104c"},{"line_number":7503,"context_line":"0x8050}. Locks debug port by writing @var{0x4C6F634B} to @var{0x81040}."},{"line_number":7504,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"44d034b6_c318f448","line":7501,"updated":"2022-08-15 16:01:38.000000000","message":"We use to prefix the commands with the name of the flash driver.\nWith driver named \"rsl10\", this should not be \"rsl10_flash ...\", but\n@deffn {Command} {rsl10 lock} key1 key2 key3 key4","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"e49edf7bb17f5c61ac88b1d751e88a125467cc04","unresolved":false,"context_lines":[{"line_number":7498,"context_line":""},{"line_number":7499,"context_line":"There are 1 command defined in the @var{rsl10} driver:"},{"line_number":7500,"context_line":""},{"line_number":7501,"context_line":"@deffn {Command} {rsl10_flash lock} key1 key2 key3 key4"},{"line_number":7502,"context_line":"Writes @var{key1 key2 key3 key4} words to @var{0x81044 0x81048 0x8104c"},{"line_number":7503,"context_line":"0x8050}. Locks debug port by writing @var{0x4C6F634B} to @var{0x81040}."},{"line_number":7504,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"11c28934_3e1485bd","line":7501,"in_reply_to":"44d034b6_c318f448","updated":"2022-08-15 22:08:52.000000000","message":"Done","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ce24fde0b37b56975db028b99ec31893c544c4df","unresolved":true,"context_lines":[{"line_number":7502,"context_line":"Writes @var{key1 key2 key3 key4} words to @var{0x81044 0x81048 0x8104c"},{"line_number":7503,"context_line":"0x8050}. Locks debug port by writing @var{0x4C6F634B} to @var{0x81040}."},{"line_number":7504,"context_line":""},{"line_number":7505,"context_line":"To unlock use the @command{rsl10_unlock key1 key2 key3 key4} command."},{"line_number":7506,"context_line":"@end deffn"},{"line_number":7507,"context_line":"@end deffn"},{"line_number":7508,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"7223f0fb_db18135e","line":7505,"updated":"2022-08-15 16:01:38.000000000","message":"the command \"rsl10 unlock\" should be documented too, but actually it is not present in the code!?!","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8d80c57696fe8e089d7d587c9bad88973a40d777","unresolved":false,"context_lines":[{"line_number":7502,"context_line":"Writes @var{key1 key2 key3 key4} words to @var{0x81044 0x81048 0x8104c"},{"line_number":7503,"context_line":"0x8050}. Locks debug port by writing @var{0x4C6F634B} to @var{0x81040}."},{"line_number":7504,"context_line":""},{"line_number":7505,"context_line":"To unlock use the @command{rsl10_unlock key1 key2 key3 key4} command."},{"line_number":7506,"context_line":"@end deffn"},{"line_number":7507,"context_line":"@end deffn"},{"line_number":7508,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"0a4e8f98_13eeaa8a","line":7505,"in_reply_to":"3960a06c_1ea1365f","updated":"2022-08-17 23:34:00.000000000","message":"Ack","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"e49edf7bb17f5c61ac88b1d751e88a125467cc04","unresolved":true,"context_lines":[{"line_number":7502,"context_line":"Writes @var{key1 key2 key3 key4} words to @var{0x81044 0x81048 0x8104c"},{"line_number":7503,"context_line":"0x8050}. Locks debug port by writing @var{0x4C6F634B} to @var{0x81040}."},{"line_number":7504,"context_line":""},{"line_number":7505,"context_line":"To unlock use the @command{rsl10_unlock key1 key2 key3 key4} command."},{"line_number":7506,"context_line":"@end deffn"},{"line_number":7507,"context_line":"@end deffn"},{"line_number":7508,"context_line":""}],"source_content_type":"text/x-texinfo","patch_set":10,"id":"3960a06c_1ea1365f","line":7505,"in_reply_to":"7223f0fb_db18135e","updated":"2022-08-15 22:08:52.000000000","message":"Yes you are right, I used high level tcl function in target/rsl10.cfg, to unlock device, which is called rsl10_unlock.\nI\u0027ll look into API for calling DAP/AP read/writes, and will implement it besides lock function for consistency. Until then, there\u0027s rsl10_unlock.\nFor rsl10_unlock I took inspiration from target/nrf52.cfg nrf52_recover function.","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"}],"src/flash/nor/rsl10.c":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ce24fde0b37b56975db028b99ec31893c544c4df","unresolved":true,"context_lines":[{"line_number":5,"context_line":" *   toms.sturmanis@gmail.com                                              *"},{"line_number":6,"context_line":" ***************************************************************************/"},{"line_number":7,"context_line":""},{"line_number":8,"context_line":"#include \u003cstdint.h\u003e"},{"line_number":9,"context_line":"#ifdef HAVE_CONFIG_H"},{"line_number":10,"context_line":"#include \"config.h\""},{"line_number":11,"context_line":"#endif"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"01bf55f1_f739af6d","line":8,"updated":"2022-08-15 16:01:38.000000000","message":"the include of \"config.h\" must be the very first one in every file.c\nPlease move \u003cstdint.h\u003e after \"config.h\"","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"e49edf7bb17f5c61ac88b1d751e88a125467cc04","unresolved":false,"context_lines":[{"line_number":5,"context_line":" *   toms.sturmanis@gmail.com                                              *"},{"line_number":6,"context_line":" ***************************************************************************/"},{"line_number":7,"context_line":""},{"line_number":8,"context_line":"#include \u003cstdint.h\u003e"},{"line_number":9,"context_line":"#ifdef HAVE_CONFIG_H"},{"line_number":10,"context_line":"#include \"config.h\""},{"line_number":11,"context_line":"#endif"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"7b88cf29_44e3f7d6","line":8,"in_reply_to":"01bf55f1_f739af6d","updated":"2022-08-15 22:08:52.000000000","message":"Done","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":100,"context_line":"\tstruct target *target;"},{"line_number":101,"context_line":""},{"line_number":102,"context_line":"\tunsigned int flash_size_kb;"},{"line_number":103,"context_line":"\tunsigned int ram_size_kb;"},{"line_number":104,"context_line":"};"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"static bool rsl10_bank_is_probed(const struct flash_bank *bank)"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"5fc9162c_69522b61","line":103,"range":{"start_line":103,"start_character":14,"end_line":103,"end_character":25},"updated":"2022-08-16 10:51:06.000000000","message":"Just a copy-pasta from nrf5.c? Remove","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":100,"context_line":"\tstruct target *target;"},{"line_number":101,"context_line":""},{"line_number":102,"context_line":"\tunsigned int flash_size_kb;"},{"line_number":103,"context_line":"\tunsigned int ram_size_kb;"},{"line_number":104,"context_line":"};"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"static bool rsl10_bank_is_probed(const struct flash_bank *bank)"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"81c4d348_751a4cae","line":103,"range":{"start_line":103,"start_character":14,"end_line":103,"end_character":25},"in_reply_to":"5fc9162c_69522b61","updated":"2022-08-16 23:47:37.000000000","message":"Done","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":137,"context_line":""},{"line_number":138,"context_line":"\tint res;"},{"line_number":139,"context_line":"\tuint32_t status;"},{"line_number":140,"context_line":"\tuint32_t parts \u003d bank-\u003enum_sectors / 3;"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"\tres \u003d target_read_u32(bank-\u003etarget, RSL10_FLASH_REG_IF_STATUS, \u0026status);"},{"line_number":143,"context_line":"\tif (res !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"2c51e4ff_bb8b6572","line":140,"range":{"start_line":140,"start_character":10,"end_line":140,"end_character":15},"updated":"2022-08-16 10:51:06.000000000","message":"3 part protection scheme should be implemented using bank-\u003eprot_blocks\nSee e.g. stm32f1x.c driver or grep prot_block src/flash/nor/*.c","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8590cdf18661e4bf85f2ada03dd87739cc645fc5","unresolved":false,"context_lines":[{"line_number":137,"context_line":""},{"line_number":138,"context_line":"\tint res;"},{"line_number":139,"context_line":"\tuint32_t status;"},{"line_number":140,"context_line":"\tuint32_t parts \u003d bank-\u003enum_sectors / 3;"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"\tres \u003d target_read_u32(bank-\u003etarget, RSL10_FLASH_REG_IF_STATUS, \u0026status);"},{"line_number":143,"context_line":"\tif (res !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"0876ebab_bdf2d0a4","line":140,"range":{"start_line":140,"start_character":10,"end_line":140,"end_character":15},"in_reply_to":"2c51e4ff_bb8b6572","updated":"2022-08-17 23:33:15.000000000","message":"Done","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":349,"context_line":"\tuint32_t cmd \u003d 0;"},{"line_number":350,"context_line":"\tres          \u003d target_read_u32(target, RSL10_ROM_CMD_ERASE_SECTOR, \u0026cmd);"},{"line_number":351,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":352,"context_line":"\t\tgoto clear_algorithm;"},{"line_number":353,"context_line":"\tbuf_set_u32(reg_params[1].value, 0, 32, cmd);"},{"line_number":354,"context_line":""},{"line_number":355,"context_line":"\tres \u003d target_run_algorithm("}],"source_content_type":"text/x-csrc","patch_set":12,"id":"546cbaa2_067de8e4","line":352,"range":{"start_line":352,"start_character":7,"end_line":352,"end_character":22},"updated":"2022-08-16 10:51:06.000000000","message":"Memory leak of reg_params","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":349,"context_line":"\tuint32_t cmd \u003d 0;"},{"line_number":350,"context_line":"\tres          \u003d target_read_u32(target, RSL10_ROM_CMD_ERASE_SECTOR, \u0026cmd);"},{"line_number":351,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":352,"context_line":"\t\tgoto clear_algorithm;"},{"line_number":353,"context_line":"\tbuf_set_u32(reg_params[1].value, 0, 32, cmd);"},{"line_number":354,"context_line":""},{"line_number":355,"context_line":"\tres \u003d target_run_algorithm("}],"source_content_type":"text/x-csrc","patch_set":12,"id":"91c6547e_d74127fc","line":352,"range":{"start_line":352,"start_character":7,"end_line":352,"end_character":22},"in_reply_to":"546cbaa2_067de8e4","updated":"2022-08-16 23:47:37.000000000","message":"Done","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":376,"context_line":""},{"line_number":377,"context_line":"\tif (bytes \u003d\u003d 4) {"},{"line_number":378,"context_line":"\t\tuint32_t data \u003d 0;"},{"line_number":379,"context_line":"\t\tmemcpy(\u0026data, buffer, 4);"},{"line_number":380,"context_line":"\t\tLOG_INFO(\"Writing 0x%\" PRIx32 \" to flash address\u003d0x%\" PRIx32 \" bytes\u003d0x%\" PRIx32, data, address, bytes);"},{"line_number":381,"context_line":"\t} else"},{"line_number":382,"context_line":"\t\tLOG_INFO(\"Writing buffer to flash address\u003d0x%\" PRIx32 \" bytes\u003d0x%\" PRIx32, address, bytes);"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"cbc585d0_18ea0332","line":379,"range":{"start_line":379,"start_character":10,"end_line":379,"end_character":14},"updated":"2022-08-16 10:51:06.000000000","message":"Endianess!\nWhy special logging for 4 byte write?","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":376,"context_line":""},{"line_number":377,"context_line":"\tif (bytes \u003d\u003d 4) {"},{"line_number":378,"context_line":"\t\tuint32_t data \u003d 0;"},{"line_number":379,"context_line":"\t\tmemcpy(\u0026data, buffer, 4);"},{"line_number":380,"context_line":"\t\tLOG_INFO(\"Writing 0x%\" PRIx32 \" to flash address\u003d0x%\" PRIx32 \" bytes\u003d0x%\" PRIx32, data, address, bytes);"},{"line_number":381,"context_line":"\t} else"},{"line_number":382,"context_line":"\t\tLOG_INFO(\"Writing buffer to flash address\u003d0x%\" PRIx32 \" bytes\u003d0x%\" PRIx32, address, bytes);"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"a047eb77_b5d8a6b2","line":379,"range":{"start_line":379,"start_character":10,"end_line":379,"end_character":14},"in_reply_to":"cbc585d0_18ea0332","updated":"2022-08-16 23:47:37.000000000","message":"I was using *flash fillw addr data 1*, and wanted to see single word writes to exact addresses in log.\nProbably should remove it, or just change to LOG_DEBUG.\nChanged to LOG_DEBUG for now.\nFor endianess i use buf_get_u32(), is that correct?","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":379,"context_line":"\t\tmemcpy(\u0026data, buffer, 4);"},{"line_number":380,"context_line":"\t\tLOG_INFO(\"Writing 0x%\" PRIx32 \" to flash address\u003d0x%\" PRIx32 \" bytes\u003d0x%\" PRIx32, data, address, bytes);"},{"line_number":381,"context_line":"\t} else"},{"line_number":382,"context_line":"\t\tLOG_INFO(\"Writing buffer to flash address\u003d0x%\" PRIx32 \" bytes\u003d0x%\" PRIx32, address, bytes);"},{"line_number":383,"context_line":""},{"line_number":384,"context_line":"\tstatic const uint8_t rsl10_rom_launcher_code[] \u003d {"},{"line_number":385,"context_line":"#include \"../../../contrib/loaders/flash/rsl10/rom_launcher.inc\""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"52af8a8a_a56f55ed","line":382,"range":{"start_line":382,"start_character":6,"end_line":382,"end_character":10},"updated":"2022-08-16 10:51:06.000000000","message":"Too verbose, LOG_DEBUG is enough.","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":379,"context_line":"\t\tmemcpy(\u0026data, buffer, 4);"},{"line_number":380,"context_line":"\t\tLOG_INFO(\"Writing 0x%\" PRIx32 \" to flash address\u003d0x%\" PRIx32 \" bytes\u003d0x%\" PRIx32, data, address, bytes);"},{"line_number":381,"context_line":"\t} else"},{"line_number":382,"context_line":"\t\tLOG_INFO(\"Writing buffer to flash address\u003d0x%\" PRIx32 \" bytes\u003d0x%\" PRIx32, address, bytes);"},{"line_number":383,"context_line":""},{"line_number":384,"context_line":"\tstatic const uint8_t rsl10_rom_launcher_code[] \u003d {"},{"line_number":385,"context_line":"#include \"../../../contrib/loaders/flash/rsl10/rom_launcher.inc\""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"b45c37c6_921bfa69","line":382,"range":{"start_line":382,"start_character":6,"end_line":382,"end_character":10},"in_reply_to":"52af8a8a_a56f55ed","updated":"2022-08-16 23:47:37.000000000","message":"Done","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":389,"context_line":""},{"line_number":390,"context_line":"\t/* allocate working area with flash programming code */"},{"line_number":391,"context_line":"\tif (target_alloc_working_area(target, sizeof(rsl10_rom_launcher_code), \u0026write_algorithm) !\u003d ERROR_OK) {"},{"line_number":392,"context_line":"\t\tLOG_WARNING(\"no working area available, no fallback, just exit!!!\");"},{"line_number":393,"context_line":""},{"line_number":394,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":395,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"44f92106_fe0a4119","line":392,"range":{"start_line":392,"start_character":6,"end_line":392,"end_character":13},"updated":"2022-08-16 10:51:06.000000000","message":"LOG_ERROR then!\nMake the text more meaningful to the user, this describes a developers thought process.","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":389,"context_line":""},{"line_number":390,"context_line":"\t/* allocate working area with flash programming code */"},{"line_number":391,"context_line":"\tif (target_alloc_working_area(target, sizeof(rsl10_rom_launcher_code), \u0026write_algorithm) !\u003d ERROR_OK) {"},{"line_number":392,"context_line":"\t\tLOG_WARNING(\"no working area available, no fallback, just exit!!!\");"},{"line_number":393,"context_line":""},{"line_number":394,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":395,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"55aa3f5a_21ee78c0","line":392,"range":{"start_line":392,"start_character":6,"end_line":392,"end_character":13},"in_reply_to":"44f92106_fe0a4119","updated":"2022-08-16 23:47:37.000000000","message":"Done","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":399,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":400,"context_line":"\t\tgoto free_algorithm;"},{"line_number":401,"context_line":""},{"line_number":402,"context_line":"#define MAX_SIZE 0x1800"},{"line_number":403,"context_line":"\t/* memory buffer */"},{"line_number":404,"context_line":"\tuint32_t buffer_size \u003d MAX_SIZE;"},{"line_number":405,"context_line":"\tstruct working_area *source;"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"941eabdb_66e8081a","line":402,"range":{"start_line":402,"start_character":0,"end_line":402,"end_character":23},"updated":"2022-08-16 10:51:06.000000000","message":"Is it ROM algo limit?\nIf so move it near to RSL10_ROM_CMD_WRITE_BUFFER definition and prepend with RSL10_ROM_CMD_WRITE_BUFFER_","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":399,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":400,"context_line":"\t\tgoto free_algorithm;"},{"line_number":401,"context_line":""},{"line_number":402,"context_line":"#define MAX_SIZE 0x1800"},{"line_number":403,"context_line":"\t/* memory buffer */"},{"line_number":404,"context_line":"\tuint32_t buffer_size \u003d MAX_SIZE;"},{"line_number":405,"context_line":"\tstruct working_area *source;"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"148c3e8d_8e22fd10","line":402,"range":{"start_line":402,"start_character":0,"end_line":402,"end_character":23},"in_reply_to":"941eabdb_66e8081a","updated":"2022-08-16 23:47:37.000000000","message":"From my tests, 8160 bytes seems to be ROM algo limit. I don\u0027t understand yet why it fails, when it\u0027s above that.","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":403,"context_line":"\t/* memory buffer */"},{"line_number":404,"context_line":"\tuint32_t buffer_size \u003d MAX_SIZE;"},{"line_number":405,"context_line":"\tstruct working_area *source;"},{"line_number":406,"context_line":"\twhile (target_alloc_working_area(target, buffer_size, \u0026source) !\u003d ERROR_OK) {"},{"line_number":407,"context_line":"\t\tbuffer_size /\u003d 2;"},{"line_number":408,"context_line":"\t\tbuffer_size \u0026\u003d ~3UL; /* Make sure it\u0027s 4 byte aligned */"},{"line_number":409,"context_line":"\t\tif (buffer_size \u003c\u003d 256) {"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"4fc2fb19_57c27241","line":406,"range":{"start_line":406,"start_character":1,"end_line":406,"end_character":6},"updated":"2022-08-16 10:51:06.000000000","message":"Don\u0027t use size iterating cycle, we have target_get_working_area_avail()","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":403,"context_line":"\t/* memory buffer */"},{"line_number":404,"context_line":"\tuint32_t buffer_size \u003d MAX_SIZE;"},{"line_number":405,"context_line":"\tstruct working_area *source;"},{"line_number":406,"context_line":"\twhile (target_alloc_working_area(target, buffer_size, \u0026source) !\u003d ERROR_OK) {"},{"line_number":407,"context_line":"\t\tbuffer_size /\u003d 2;"},{"line_number":408,"context_line":"\t\tbuffer_size \u0026\u003d ~3UL; /* Make sure it\u0027s 4 byte aligned */"},{"line_number":409,"context_line":"\t\tif (buffer_size \u003c\u003d 256) {"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"075d33ba_abbc8851","line":406,"range":{"start_line":406,"start_character":1,"end_line":406,"end_character":6},"in_reply_to":"4fc2fb19_57c27241","updated":"2022-08-16 23:47:37.000000000","message":"Done","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":433,"context_line":"\tbool fix_address         \u003d false;"},{"line_number":434,"context_line":"\tuint32_t fix_data        \u003d 0;"},{"line_number":435,"context_line":""},{"line_number":436,"context_line":"\t/* if address is not double word aligned, align and send one more word */"},{"line_number":437,"context_line":"\tif (address % 8 !\u003d 0) {"},{"line_number":438,"context_line":"\t\taddress -\u003d 4;"},{"line_number":439,"context_line":"\t\tbytes +\u003d 4;"},{"line_number":440,"context_line":"\t\tfix_address \u003d true;"},{"line_number":441,"context_line":"\t}"},{"line_number":442,"context_line":""},{"line_number":443,"context_line":"\tres \u003d target_read_u32(target, RSL10_ROM_CMD_WRITE_BUFFER, \u0026cmd);"},{"line_number":444,"context_line":"\tif (res !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"5c5d0d54_089ceadc","line":441,"range":{"start_line":436,"start_character":1,"end_line":441,"end_character":2},"updated":"2022-08-16 10:51:06.000000000","message":"Just setting bank-\u003ewrite_start_alignment and bank-\u003ewrite_end_alignment\nto 8 doesn\u0027t work?","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":433,"context_line":"\tbool fix_address         \u003d false;"},{"line_number":434,"context_line":"\tuint32_t fix_data        \u003d 0;"},{"line_number":435,"context_line":""},{"line_number":436,"context_line":"\t/* if address is not double word aligned, align and send one more word */"},{"line_number":437,"context_line":"\tif (address % 8 !\u003d 0) {"},{"line_number":438,"context_line":"\t\taddress -\u003d 4;"},{"line_number":439,"context_line":"\t\tbytes +\u003d 4;"},{"line_number":440,"context_line":"\t\tfix_address \u003d true;"},{"line_number":441,"context_line":"\t}"},{"line_number":442,"context_line":""},{"line_number":443,"context_line":"\tres \u003d target_read_u32(target, RSL10_ROM_CMD_WRITE_BUFFER, \u0026cmd);"},{"line_number":444,"context_line":"\tif (res !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"354f21ea_f9c86c46","line":441,"range":{"start_line":436,"start_character":1,"end_line":441,"end_character":2},"in_reply_to":"5c5d0d54_089ceadc","updated":"2022-08-16 23:47:37.000000000","message":"Didn\u0027t know about those. Set both alignments to 8, and it seems to work for all my cases. Removed unnecesery(now) checks and fixes.","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":446,"context_line":""},{"line_number":447,"context_line":"\twhile (sent_bytes \u003c bytes) {"},{"line_number":448,"context_line":"\t\tremaining_bytes \u003d bytes - sent_bytes;"},{"line_number":449,"context_line":"\t\tbytes_to_send   \u003d remaining_bytes \u003e\u003d MAX_SIZE ? MAX_SIZE : remaining_bytes;"},{"line_number":450,"context_line":""},{"line_number":451,"context_line":"\t\tif (fix_address) {"},{"line_number":452,"context_line":"\t\t\t/* if address wastn\u0027t word aligned, read word from aligned address,"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"d278fe4e_2b3930f4","line":449,"range":{"start_line":449,"start_character":39,"end_line":449,"end_character":58},"updated":"2022-08-16 10:51:06.000000000","message":"source-\u003esize? Working area could be smaller than MAX_SIZE!","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":446,"context_line":""},{"line_number":447,"context_line":"\twhile (sent_bytes \u003c bytes) {"},{"line_number":448,"context_line":"\t\tremaining_bytes \u003d bytes - sent_bytes;"},{"line_number":449,"context_line":"\t\tbytes_to_send   \u003d remaining_bytes \u003e\u003d MAX_SIZE ? MAX_SIZE : remaining_bytes;"},{"line_number":450,"context_line":""},{"line_number":451,"context_line":"\t\tif (fix_address) {"},{"line_number":452,"context_line":"\t\t\t/* if address wastn\u0027t word aligned, read word from aligned address,"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"9ae29391_f57d397b","line":449,"range":{"start_line":449,"start_character":39,"end_line":449,"end_character":58},"in_reply_to":"d278fe4e_2b3930f4","updated":"2022-08-16 23:47:37.000000000","message":"Using set buffer_size, instead of MAX_SIZE.","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":459,"context_line":"\t\t\tif (res !\u003d ERROR_OK)"},{"line_number":460,"context_line":"\t\t\t\tgoto free_everything;"},{"line_number":461,"context_line":""},{"line_number":462,"context_line":"\t\t\tres \u003d target_write_buffer(target, source-\u003eaddress, 4, (uint8_t *)\u0026fix_data);"},{"line_number":463,"context_line":"\t\t\tif (res !\u003d ERROR_OK)"},{"line_number":464,"context_line":"\t\t\t\tgoto free_everything;"},{"line_number":465,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"b56ce99f_7917580a","line":462,"range":{"start_line":462,"start_character":57,"end_line":462,"end_character":77},"updated":"2022-08-16 10:51:06.000000000","message":"Endianess!\nUse either target_read_u32/write_u32() or target_read_buffer/write_buffer(). Do not mismatch them!","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":459,"context_line":"\t\t\tif (res !\u003d ERROR_OK)"},{"line_number":460,"context_line":"\t\t\t\tgoto free_everything;"},{"line_number":461,"context_line":""},{"line_number":462,"context_line":"\t\t\tres \u003d target_write_buffer(target, source-\u003eaddress, 4, (uint8_t *)\u0026fix_data);"},{"line_number":463,"context_line":"\t\t\tif (res !\u003d ERROR_OK)"},{"line_number":464,"context_line":"\t\t\t\tgoto free_everything;"},{"line_number":465,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"ef6ded44_87e39e56","line":462,"range":{"start_line":462,"start_character":57,"end_line":462,"end_character":77},"in_reply_to":"b56ce99f_7917580a","updated":"2022-08-16 23:47:37.000000000","message":"Done","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":502,"context_line":"\t\tbuf_set_u32(reg_params[3].value, 0, 32, cmd);"},{"line_number":503,"context_line":""},{"line_number":504,"context_line":"\t\tres \u003d target_run_algorithm("},{"line_number":505,"context_line":"\t\t\ttarget, 0, NULL, 4, reg_params, write_algorithm-\u003eaddress,"},{"line_number":506,"context_line":"\t\t\twrite_algorithm-\u003eaddress + sizeof(rsl10_rom_launcher_code) - 2, 1000, \u0026armv7m_info"},{"line_number":507,"context_line":"\t\t);"},{"line_number":508,"context_line":"\t\tif (res !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"9c5d868f_f61b48a1","line":505,"range":{"start_line":505,"start_character":20,"end_line":505,"end_character":21},"updated":"2022-08-16 10:51:06.000000000","message":"ARRAY_SIZE(reg_params)","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":502,"context_line":"\t\tbuf_set_u32(reg_params[3].value, 0, 32, cmd);"},{"line_number":503,"context_line":""},{"line_number":504,"context_line":"\t\tres \u003d target_run_algorithm("},{"line_number":505,"context_line":"\t\t\ttarget, 0, NULL, 4, reg_params, write_algorithm-\u003eaddress,"},{"line_number":506,"context_line":"\t\t\twrite_algorithm-\u003eaddress + sizeof(rsl10_rom_launcher_code) - 2, 1000, \u0026armv7m_info"},{"line_number":507,"context_line":"\t\t);"},{"line_number":508,"context_line":"\t\tif (res !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"07fc295d_8db62958","line":505,"range":{"start_line":505,"start_character":20,"end_line":505,"end_character":21},"in_reply_to":"9c5d868f_f61b48a1","updated":"2022-08-16 23:47:37.000000000","message":"Done","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":510,"context_line":""},{"line_number":511,"context_line":"\t\tint algo_ret \u003d buf_get_u32(reg_params[0].value, 0, 32);"},{"line_number":512,"context_line":"\t\tif (algo_ret !\u003d RSL10_FLASH_ERR_NONE)"},{"line_number":513,"context_line":"\t\t\tLOG_ERROR(\"RSL10 WRITE ERROR: \u0027%s\u0027 (%d)\", rsl10_error(algo_ret), algo_ret);"},{"line_number":514,"context_line":""},{"line_number":515,"context_line":"\t\tsent_bytes +\u003d bytes_to_send;"},{"line_number":516,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"00e8e9ea_7bae98da","line":513,"range":{"start_line":513,"start_character":3,"end_line":513,"end_character":12},"updated":"2022-08-16 10:51:06.000000000","message":"Flash write error is just logged and write loop continues and finishes with ERROR_OK?","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":510,"context_line":""},{"line_number":511,"context_line":"\t\tint algo_ret \u003d buf_get_u32(reg_params[0].value, 0, 32);"},{"line_number":512,"context_line":"\t\tif (algo_ret !\u003d RSL10_FLASH_ERR_NONE)"},{"line_number":513,"context_line":"\t\t\tLOG_ERROR(\"RSL10 WRITE ERROR: \u0027%s\u0027 (%d)\", rsl10_error(algo_ret), algo_ret);"},{"line_number":514,"context_line":""},{"line_number":515,"context_line":"\t\tsent_bytes +\u003d bytes_to_send;"},{"line_number":516,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"8b6751af_96e68a42","line":513,"range":{"start_line":513,"start_character":3,"end_line":513,"end_character":12},"in_reply_to":"00e8e9ea_7bae98da","updated":"2022-08-16 23:47:37.000000000","message":"Yes, it should stop, and report correct error. Right now it prints correct error message, and returns generic ERROR_FLASH_OPERATION_FAILED in write function, or ERROR_FLASH_SECTOR_NOT_ERASED in erase function.","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":538,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":539,"context_line":"\t\treturn res;"},{"line_number":540,"context_line":""},{"line_number":541,"context_line":"\tres \u003d rsl10_protect_check(bank);"},{"line_number":542,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":543,"context_line":"\t\treturn res;"},{"line_number":544,"context_line":""},{"line_number":545,"context_line":"\tfor (unsigned int sector \u003d 0; sector \u003c bank-\u003enum_sectors; sector++) {"},{"line_number":546,"context_line":"\t\tstruct flash_sector *bs \u003d \u0026bank-\u003esectors[sector];"},{"line_number":547,"context_line":""},{"line_number":548,"context_line":"\t\tif ((offset \u003c (bs-\u003eoffset + bs-\u003esize)) \u0026\u0026 ((offset + count - 1) \u003e\u003d bs-\u003eoffset) \u0026\u0026 bs-\u003eis_protected \u003d\u003d 1) {"},{"line_number":549,"context_line":"\t\t\tLOG_ERROR(\"Write refused, sector %d is protected\", sector);"},{"line_number":550,"context_line":"\t\t\treturn ERROR_FLASH_PROTECTED;"},{"line_number":551,"context_line":"\t\t}"},{"line_number":552,"context_line":"\t}"},{"line_number":553,"context_line":""},{"line_number":554,"context_line":"\tres \u003d rsl10_ll_flash_write(chip, bank-\u003ebase + offset, buffer, count);"},{"line_number":555,"context_line":"\tif (res !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"c12c9ecb_17771292","line":552,"range":{"start_line":541,"start_character":1,"end_line":552,"end_character":2},"updated":"2022-08-16 10:51:06.000000000","message":"Is it really needed or just copied from nrf5.c?","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":538,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":539,"context_line":"\t\treturn res;"},{"line_number":540,"context_line":""},{"line_number":541,"context_line":"\tres \u003d rsl10_protect_check(bank);"},{"line_number":542,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":543,"context_line":"\t\treturn res;"},{"line_number":544,"context_line":""},{"line_number":545,"context_line":"\tfor (unsigned int sector \u003d 0; sector \u003c bank-\u003enum_sectors; sector++) {"},{"line_number":546,"context_line":"\t\tstruct flash_sector *bs \u003d \u0026bank-\u003esectors[sector];"},{"line_number":547,"context_line":""},{"line_number":548,"context_line":"\t\tif ((offset \u003c (bs-\u003eoffset + bs-\u003esize)) \u0026\u0026 ((offset + count - 1) \u003e\u003d bs-\u003eoffset) \u0026\u0026 bs-\u003eis_protected \u003d\u003d 1) {"},{"line_number":549,"context_line":"\t\t\tLOG_ERROR(\"Write refused, sector %d is protected\", sector);"},{"line_number":550,"context_line":"\t\t\treturn ERROR_FLASH_PROTECTED;"},{"line_number":551,"context_line":"\t\t}"},{"line_number":552,"context_line":"\t}"},{"line_number":553,"context_line":""},{"line_number":554,"context_line":"\tres \u003d rsl10_ll_flash_write(chip, bank-\u003ebase + offset, buffer, count);"},{"line_number":555,"context_line":"\tif (res !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"3d315013_2563dade","line":552,"range":{"start_line":541,"start_character":1,"end_line":552,"end_character":2},"in_reply_to":"c12c9ecb_17771292","updated":"2022-08-16 23:47:37.000000000","message":"Write enable/protect check is done inside ROM algo function, so it\u0027s redundant here. Removed.","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":697,"context_line":"\tint res;"},{"line_number":698,"context_line":"\tstruct flash_bank *bank;"},{"line_number":699,"context_line":""},{"line_number":700,"context_line":"\tres \u003d get_flash_bank_by_num(3, \u0026bank);"},{"line_number":701,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":702,"context_line":"\t\tgoto clean;"},{"line_number":703,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"beafded4_5f210a89","line":700,"range":{"start_line":700,"start_character":7,"end_line":700,"end_character":28},"updated":"2022-08-16 10:51:06.000000000","message":"Not likely with this device, but user can connect and configure more than one device and then get_flash_bank_by_num() doesn\u0027t do what expected.\nAlso a modification of cfg file could break this.","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":697,"context_line":"\tint res;"},{"line_number":698,"context_line":"\tstruct flash_bank *bank;"},{"line_number":699,"context_line":""},{"line_number":700,"context_line":"\tres \u003d get_flash_bank_by_num(3, \u0026bank);"},{"line_number":701,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":702,"context_line":"\t\tgoto clean;"},{"line_number":703,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"c250496c_9a8adf24","line":700,"range":{"start_line":700,"start_character":7,"end_line":700,"end_character":28},"in_reply_to":"beafded4_5f210a89","updated":"2022-08-16 23:47:37.000000000","message":"Using get_flash_bank_by_addr(...,RSL10_FLASH_ADDRESS_NVR3,...) now.","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7b41c7d98cba42e6a3dc33eb7b4a8db2c6ad7394","unresolved":true,"context_lines":[{"line_number":705,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":706,"context_line":"\t\tgoto clean;"},{"line_number":707,"context_line":""},{"line_number":708,"context_line":"\tres \u003d rsl10_write(bank, (uint8_t *)buffer, 0x40, 5 * 4);"},{"line_number":709,"context_line":"\tif (res !\u003d ERROR_OK) {"},{"line_number":710,"context_line":"\t\t/* erase sector, if write fails, otherwise it can lock debug with wrong keys */"},{"line_number":711,"context_line":"\t\tres \u003d rsl10_erase(bank, 0, 0);"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"81329616_e7d63e78","line":708,"range":{"start_line":708,"start_character":25,"end_line":708,"end_character":42},"updated":"2022-08-16 10:51:06.000000000","message":"Endianess error (when the host is big endian)","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"4ebae145bf51a49512d0b84d24cb8fb66cce5d15","unresolved":false,"context_lines":[{"line_number":705,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":706,"context_line":"\t\tgoto clean;"},{"line_number":707,"context_line":""},{"line_number":708,"context_line":"\tres \u003d rsl10_write(bank, (uint8_t *)buffer, 0x40, 5 * 4);"},{"line_number":709,"context_line":"\tif (res !\u003d ERROR_OK) {"},{"line_number":710,"context_line":"\t\t/* erase sector, if write fails, otherwise it can lock debug with wrong keys */"},{"line_number":711,"context_line":"\t\tres \u003d rsl10_erase(bank, 0, 0);"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"6819be9e_aacfafe1","line":708,"range":{"start_line":708,"start_character":25,"end_line":708,"end_character":42},"in_reply_to":"81329616_e7d63e78","updated":"2022-08-16 23:47:37.000000000","message":"For endianess I use target_buffer_set_u32 and target_buffer_set_u32_array. Is that correct?","commit_id":"42f7380cd8837b2a4ba57c0b6e20d4396c8f75b6"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"08c59b8da6f91edb8619417a33cbce7dc0ec5452","unresolved":true,"context_lines":[{"line_number":58,"context_line":"#define RSL10_ROM_CMD_ERASE_SECTOR    0x44"},{"line_number":59,"context_line":"#define RSL10_ROM_CMD_ERASE_ALL       0x48"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"/* ROM function WRITE_BUFFER doesn\u0027t seem to work, with larger buffers, why? */"},{"line_number":62,"context_line":"#define RSL10_ROM_CMD_WRITE_BUFFER_MAX_SIZE 8160"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"enum rsl10_flash_status {"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"661bdb94_515a2e04","line":61,"range":{"start_line":61,"start_character":72,"end_line":61,"end_character":75},"updated":"2022-08-17 08:11:08.000000000","message":"Just an idea: ROM algo is called as a subroutine. Does it use stack internally?\nIf so we would need another working area for the stack and set reg_param \"sp\" to its end. Otherwise ROM algo uses stack leftover from stopped flash app and it may collide with algo buffer.","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":58,"context_line":"#define RSL10_ROM_CMD_ERASE_SECTOR    0x44"},{"line_number":59,"context_line":"#define RSL10_ROM_CMD_ERASE_ALL       0x48"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"/* ROM function WRITE_BUFFER doesn\u0027t seem to work, with larger buffers, why? */"},{"line_number":62,"context_line":"#define RSL10_ROM_CMD_WRITE_BUFFER_MAX_SIZE 8160"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"enum rsl10_flash_status {"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"208ba982_cb044f4e","line":61,"range":{"start_line":61,"start_character":72,"end_line":61,"end_character":75},"in_reply_to":"661bdb94_515a2e04","updated":"2022-08-25 11:35:24.000000000","message":"2) SP is set to 0x20002000, before calling ROM algo, and I had set as workarea 0x20000000. So they overlapped when I used buffer with size more than 8192(0x2000).\nFrom datasheet: \n  Program RAM: 4*0x2000 @ 0x200000   (I use it as workarea now)\n  Data RAM:    3*0x2000 @ 0x20000000 (I used it as workarea before, when failed)","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"f1f30409885d985fa4313ce1f9a0c90271841de5","unresolved":true,"context_lines":[{"line_number":95,"context_line":"const struct flash_driver rsl10_flash;"},{"line_number":96,"context_line":""},{"line_number":97,"context_line":"struct rsl10_info {"},{"line_number":98,"context_line":"\tuint32_t refcount;"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"\tstruct rsl10_bank {"},{"line_number":101,"context_line":"\t\tstruct rsl10_info *chip;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"c53c302d_68ad0133","line":98,"range":{"start_line":98,"start_character":1,"end_line":98,"end_character":9},"updated":"2022-08-17 08:24:58.000000000","message":"unsigned int","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8590cdf18661e4bf85f2ada03dd87739cc645fc5","unresolved":false,"context_lines":[{"line_number":95,"context_line":"const struct flash_driver rsl10_flash;"},{"line_number":96,"context_line":""},{"line_number":97,"context_line":"struct rsl10_info {"},{"line_number":98,"context_line":"\tuint32_t refcount;"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"\tstruct rsl10_bank {"},{"line_number":101,"context_line":"\t\tstruct rsl10_info *chip;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"48047b6b_3a154a48","line":98,"range":{"start_line":98,"start_character":1,"end_line":98,"end_character":9},"in_reply_to":"c53c302d_68ad0133","updated":"2022-08-17 23:33:15.000000000","message":"Done","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"08c59b8da6f91edb8619417a33cbce7dc0ec5452","unresolved":true,"context_lines":[{"line_number":361,"context_line":"\t\ttarget, 0, NULL, ARRAY_SIZE(reg_params), reg_params, write_algorithm-\u003eaddress,"},{"line_number":362,"context_line":"\t\twrite_algorithm-\u003eaddress + sizeof(rsl10_rom_launcher_code) - 2, 1000, \u0026armv7m_info"},{"line_number":363,"context_line":"\t);"},{"line_number":364,"context_line":"\tint algo_ret \u003d buf_get_u32(reg_params[0].value, 0, 32);"},{"line_number":365,"context_line":"\tif (algo_ret !\u003d RSL10_FLASH_ERR_NONE) {"},{"line_number":366,"context_line":"\t\tLOG_ERROR(\"RSL10 ERASE ERROR: \u0027%s\u0027 (%d)\", rsl10_error(algo_ret), algo_ret);"},{"line_number":367,"context_line":"\t\tres \u003d ERROR_FLASH_SECTOR_NOT_ERASED;"},{"line_number":368,"context_line":"\t}"},{"line_number":369,"context_line":""},{"line_number":370,"context_line":"free_reg_params:"},{"line_number":371,"context_line":"\tfor (unsigned int i \u003d 0; i \u003c ARRAY_SIZE(reg_params); i++)"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"0e6cb7a6_6aac8c0a","line":368,"range":{"start_line":364,"start_character":1,"end_line":368,"end_character":2},"updated":"2022-08-17 08:11:08.000000000","message":"The algo return value is invalid if target_run_algorithm() fails. Please test only if res \u003d\u003d ERROR_OK","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8590cdf18661e4bf85f2ada03dd87739cc645fc5","unresolved":false,"context_lines":[{"line_number":361,"context_line":"\t\ttarget, 0, NULL, ARRAY_SIZE(reg_params), reg_params, write_algorithm-\u003eaddress,"},{"line_number":362,"context_line":"\t\twrite_algorithm-\u003eaddress + sizeof(rsl10_rom_launcher_code) - 2, 1000, \u0026armv7m_info"},{"line_number":363,"context_line":"\t);"},{"line_number":364,"context_line":"\tint algo_ret \u003d buf_get_u32(reg_params[0].value, 0, 32);"},{"line_number":365,"context_line":"\tif (algo_ret !\u003d RSL10_FLASH_ERR_NONE) {"},{"line_number":366,"context_line":"\t\tLOG_ERROR(\"RSL10 ERASE ERROR: \u0027%s\u0027 (%d)\", rsl10_error(algo_ret), algo_ret);"},{"line_number":367,"context_line":"\t\tres \u003d ERROR_FLASH_SECTOR_NOT_ERASED;"},{"line_number":368,"context_line":"\t}"},{"line_number":369,"context_line":""},{"line_number":370,"context_line":"free_reg_params:"},{"line_number":371,"context_line":"\tfor (unsigned int i \u003d 0; i \u003c ARRAY_SIZE(reg_params); i++)"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"b85d00f9_d46e2958","line":368,"range":{"start_line":364,"start_character":1,"end_line":368,"end_character":2},"in_reply_to":"0e6cb7a6_6aac8c0a","updated":"2022-08-17 23:33:15.000000000","message":"Done","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"08c59b8da6f91edb8619417a33cbce7dc0ec5452","unresolved":true,"context_lines":[{"line_number":406,"context_line":""},{"line_number":407,"context_line":"\t/* memory buffer */"},{"line_number":408,"context_line":"\tuint32_t buffer_avail \u003d target_get_working_area_avail(target);"},{"line_number":409,"context_line":"\tuint32_t buffer_size \u003d"},{"line_number":410,"context_line":"\t\tRSL10_ROM_CMD_WRITE_BUFFER_MAX_SIZE \u003c\u003d buffer_avail ? RSL10_ROM_CMD_WRITE_BUFFER_MAX_SIZE : buffer_avail;"},{"line_number":411,"context_line":"\tstruct working_area *source;"},{"line_number":412,"context_line":"\tres \u003d target_alloc_working_area(target, buffer_size, \u0026source);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"ec1f9348_e0b62ed0","line":409,"range":{"start_line":409,"start_character":10,"end_line":409,"end_character":22},"updated":"2022-08-17 08:11:08.000000000","message":"You may need to round down buffer_size to multiple of 8\nnot to break the required flash write alignment.\n\nBTW: You may use MIN/MAX macros.","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8590cdf18661e4bf85f2ada03dd87739cc645fc5","unresolved":false,"context_lines":[{"line_number":406,"context_line":""},{"line_number":407,"context_line":"\t/* memory buffer */"},{"line_number":408,"context_line":"\tuint32_t buffer_avail \u003d target_get_working_area_avail(target);"},{"line_number":409,"context_line":"\tuint32_t buffer_size \u003d"},{"line_number":410,"context_line":"\t\tRSL10_ROM_CMD_WRITE_BUFFER_MAX_SIZE \u003c\u003d buffer_avail ? RSL10_ROM_CMD_WRITE_BUFFER_MAX_SIZE : buffer_avail;"},{"line_number":411,"context_line":"\tstruct working_area *source;"},{"line_number":412,"context_line":"\tres \u003d target_alloc_working_area(target, buffer_size, \u0026source);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"c89d7e96_ec718e4c","line":409,"range":{"start_line":409,"start_character":10,"end_line":409,"end_character":22},"in_reply_to":"ec1f9348_e0b62ed0","updated":"2022-08-17 23:33:15.000000000","message":"Done","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"08c59b8da6f91edb8619417a33cbce7dc0ec5452","unresolved":true,"context_lines":[{"line_number":509,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":510,"context_line":"\t\treturn res;"},{"line_number":511,"context_line":""},{"line_number":512,"context_line":"\tres \u003d rsl10_protect_check(bank);"},{"line_number":513,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":514,"context_line":"\t\treturn res;"},{"line_number":515,"context_line":""},{"line_number":516,"context_line":"\tfor (unsigned int sector \u003d first; sector \u003c\u003d last; sector++) {"},{"line_number":517,"context_line":"\t\tstruct flash_sector *bs \u003d \u0026bank-\u003esectors[sector];"},{"line_number":518,"context_line":""},{"line_number":519,"context_line":"\t\tif (bs-\u003eis_protected \u003d\u003d 1) {"},{"line_number":520,"context_line":"\t\t\tLOG_ERROR(\"Erase refused, sector %d is protected\", sector);"},{"line_number":521,"context_line":"\t\t\treturn ERROR_FLASH_PROTECTED;"},{"line_number":522,"context_line":"\t\t}"},{"line_number":523,"context_line":"\t}"},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"\tfor (uint32_t i \u003d first; i \u003c\u003d last; i++)"},{"line_number":526,"context_line":"\t\trsl10_ll_flash_erase(chip, bank-\u003ebase + i * 0x800);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"4d7ee5f5_66d3b38a","line":523,"range":{"start_line":512,"start_character":1,"end_line":523,"end_character":2},"updated":"2022-08-17 08:11:08.000000000","message":"If ROM erase algo returns a meaningful error in case of write protected flash, not necessary to test in driver","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8590cdf18661e4bf85f2ada03dd87739cc645fc5","unresolved":false,"context_lines":[{"line_number":509,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":510,"context_line":"\t\treturn res;"},{"line_number":511,"context_line":""},{"line_number":512,"context_line":"\tres \u003d rsl10_protect_check(bank);"},{"line_number":513,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":514,"context_line":"\t\treturn res;"},{"line_number":515,"context_line":""},{"line_number":516,"context_line":"\tfor (unsigned int sector \u003d first; sector \u003c\u003d last; sector++) {"},{"line_number":517,"context_line":"\t\tstruct flash_sector *bs \u003d \u0026bank-\u003esectors[sector];"},{"line_number":518,"context_line":""},{"line_number":519,"context_line":"\t\tif (bs-\u003eis_protected \u003d\u003d 1) {"},{"line_number":520,"context_line":"\t\t\tLOG_ERROR(\"Erase refused, sector %d is protected\", sector);"},{"line_number":521,"context_line":"\t\t\treturn ERROR_FLASH_PROTECTED;"},{"line_number":522,"context_line":"\t\t}"},{"line_number":523,"context_line":"\t}"},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"\tfor (uint32_t i \u003d first; i \u003c\u003d last; i++)"},{"line_number":526,"context_line":"\t\trsl10_ll_flash_erase(chip, bank-\u003ebase + i * 0x800);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"6276de29_452e68cb","line":523,"range":{"start_line":512,"start_character":1,"end_line":523,"end_character":2},"in_reply_to":"4d7ee5f5_66d3b38a","updated":"2022-08-17 23:33:15.000000000","message":"ROM erase algo asumes that calling application has disabled protection, so it has to be checked in driver.","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"f1f30409885d985fa4313ce1f9a0c90271841de5","unresolved":true,"context_lines":[{"line_number":522,"context_line":"\t\t}"},{"line_number":523,"context_line":"\t}"},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"\tfor (uint32_t i \u003d first; i \u003c\u003d last; i++)"},{"line_number":526,"context_line":"\t\trsl10_ll_flash_erase(chip, bank-\u003ebase + i * 0x800);"},{"line_number":527,"context_line":""},{"line_number":528,"context_line":"\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"39c1bdc1_5799ad82","line":525,"range":{"start_line":525,"start_character":6,"end_line":525,"end_character":14},"updated":"2022-08-17 08:24:58.000000000","message":"unsigned int","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8590cdf18661e4bf85f2ada03dd87739cc645fc5","unresolved":false,"context_lines":[{"line_number":522,"context_line":"\t\t}"},{"line_number":523,"context_line":"\t}"},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"\tfor (uint32_t i \u003d first; i \u003c\u003d last; i++)"},{"line_number":526,"context_line":"\t\trsl10_ll_flash_erase(chip, bank-\u003ebase + i * 0x800);"},{"line_number":527,"context_line":""},{"line_number":528,"context_line":"\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"47099cb1_b822a7dd","line":525,"range":{"start_line":525,"start_character":6,"end_line":525,"end_character":14},"in_reply_to":"39c1bdc1_5799ad82","updated":"2022-08-17 23:33:15.000000000","message":"Done","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"08c59b8da6f91edb8619417a33cbce7dc0ec5452","unresolved":true,"context_lines":[{"line_number":614,"context_line":"\tnbank-\u003echip                 \u003d chip;"},{"line_number":615,"context_line":"\tnbank-\u003eprobed               \u003d false;"},{"line_number":616,"context_line":"\tbank-\u003edriver_priv           \u003d nbank;"},{"line_number":617,"context_line":"\tbank-\u003ewrite_start_alignment \u003d bank-\u003ewrite_end_alignment \u003d 4;"},{"line_number":618,"context_line":""},{"line_number":619,"context_line":"\treturn ERROR_OK;"},{"line_number":620,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"2174bbf0_8649a7c3","line":617,"range":{"start_line":617,"start_character":1,"end_line":617,"end_character":60},"updated":"2022-08-17 08:11:08.000000000","message":"Perhaps useless as set to 8 in probe","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8590cdf18661e4bf85f2ada03dd87739cc645fc5","unresolved":false,"context_lines":[{"line_number":614,"context_line":"\tnbank-\u003echip                 \u003d chip;"},{"line_number":615,"context_line":"\tnbank-\u003eprobed               \u003d false;"},{"line_number":616,"context_line":"\tbank-\u003edriver_priv           \u003d nbank;"},{"line_number":617,"context_line":"\tbank-\u003ewrite_start_alignment \u003d bank-\u003ewrite_end_alignment \u003d 4;"},{"line_number":618,"context_line":""},{"line_number":619,"context_line":"\treturn ERROR_OK;"},{"line_number":620,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"04b6d9ba_3f819b9b","line":617,"range":{"start_line":617,"start_character":1,"end_line":617,"end_character":60},"in_reply_to":"2174bbf0_8649a7c3","updated":"2022-08-17 23:33:15.000000000","message":"Done","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"08c59b8da6f91edb8619417a33cbce7dc0ec5452","unresolved":true,"context_lines":[{"line_number":637,"context_line":"\t\tgoto free_buffer_u32;"},{"line_number":638,"context_line":""},{"line_number":639,"context_line":"\tLOG_INFO(\"Keys used: %s %s %s %s\", CMD_ARGV[0], CMD_ARGV[1], CMD_ARGV[2], CMD_ARGV[3]);"},{"line_number":640,"context_line":"\ttarget_buffer_set_u32(target, (uint8_t *)\u0026buffer_u32[0], RSL10_KEY_DEBUG_LOCK);"},{"line_number":641,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], buffer_u32[1]);"},{"line_number":642,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], buffer_u32[2]);"},{"line_number":643,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], buffer_u32[3]);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"aa85bf6a_1a664271","line":640,"range":{"start_line":640,"start_character":1,"end_line":640,"end_character":22},"updated":"2022-08-17 08:11:08.000000000","message":"RSL10_KEY_DEBUG_LOCK endianess conversion is now doubled 😊\n(here and in target_buffer_set_u32_array())\n\nI think that we need not to bother with malloc for such short buffers.\nWhat about something like:\n uint32_t user_key[4];\n COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], user_key[0]);\n ...\n COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], user_key[3]);\n\n uint8_t write_buffer[6*4];\n target_buffer_set_u32(target, write_buffer, RSL10_KEY_DEBUG_LOCK);\n target_buffer_set_u32_array(target, \u0026write_buffer[4], 4, user_key);\n // pad the end to 64-bit word boundary\n memset(\u0026write_buffer[5*4], bank-\u003edefault_padded_value, 4);\n\n retval \u003d rsl10_write(bank, write_buffer, RSL10_NVR3_USER_KEY_OFFSET, sizeof(write_buffer));","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8590cdf18661e4bf85f2ada03dd87739cc645fc5","unresolved":false,"context_lines":[{"line_number":637,"context_line":"\t\tgoto free_buffer_u32;"},{"line_number":638,"context_line":""},{"line_number":639,"context_line":"\tLOG_INFO(\"Keys used: %s %s %s %s\", CMD_ARGV[0], CMD_ARGV[1], CMD_ARGV[2], CMD_ARGV[3]);"},{"line_number":640,"context_line":"\ttarget_buffer_set_u32(target, (uint8_t *)\u0026buffer_u32[0], RSL10_KEY_DEBUG_LOCK);"},{"line_number":641,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], buffer_u32[1]);"},{"line_number":642,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], buffer_u32[2]);"},{"line_number":643,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], buffer_u32[3]);"}],"source_content_type":"text/x-csrc","patch_set":13,"id":"775f0bbd_f8c27ad5","line":640,"range":{"start_line":640,"start_character":1,"end_line":640,"end_character":22},"in_reply_to":"aa85bf6a_1a664271","updated":"2022-08-17 23:33:15.000000000","message":"Done","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fdc60973f1b75c37c3c7e6952a4a18a8e1957aa0","unresolved":true,"context_lines":[{"line_number":299,"context_line":"\tbank-\u003esectors \u003d alloc_block_array(0, flash_page_size, bank-\u003enum_sectors);"},{"line_number":300,"context_line":"\tif (!bank-\u003esectors)"},{"line_number":301,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"\tbank-\u003enum_prot_blocks \u003d num_prot_blocks;"},{"line_number":304,"context_line":"\tbank-\u003eprot_blocks     \u003d alloc_block_array(0, flash_page_size, bank-\u003enum_prot_blocks);"},{"line_number":305,"context_line":"\tif (!bank-\u003eprot_blocks)"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"0cdcaba2_8c430d59","line":302,"updated":"2022-08-18 20:34:41.000000000","message":"To prevent memory leak during re-probing\n free(bank-\u003eprot_blocks)","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"cff0fd0bf949f2fa84502afe46364ccbb7d3fc16","unresolved":false,"context_lines":[{"line_number":299,"context_line":"\tbank-\u003esectors \u003d alloc_block_array(0, flash_page_size, bank-\u003enum_sectors);"},{"line_number":300,"context_line":"\tif (!bank-\u003esectors)"},{"line_number":301,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"\tbank-\u003enum_prot_blocks \u003d num_prot_blocks;"},{"line_number":304,"context_line":"\tbank-\u003eprot_blocks     \u003d alloc_block_array(0, flash_page_size, bank-\u003enum_prot_blocks);"},{"line_number":305,"context_line":"\tif (!bank-\u003eprot_blocks)"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"06f39b77_ab5825bf","line":302,"in_reply_to":"0cdcaba2_8c430d59","updated":"2022-08-20 23:25:47.000000000","message":"Done","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fdc60973f1b75c37c3c7e6952a4a18a8e1957aa0","unresolved":true,"context_lines":[{"line_number":300,"context_line":"\tif (!bank-\u003esectors)"},{"line_number":301,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"\tbank-\u003enum_prot_blocks \u003d num_prot_blocks;"},{"line_number":304,"context_line":"\tbank-\u003eprot_blocks     \u003d alloc_block_array(0, flash_page_size, bank-\u003enum_prot_blocks);"},{"line_number":305,"context_line":"\tif (!bank-\u003eprot_blocks)"},{"line_number":306,"context_line":"\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"131baddc_ff383ef1","line":303,"updated":"2022-08-18 20:34:41.000000000","message":"Probably no point in allocating zero size array for NVR1, 2, 3\ncall alloc only if num_prot_blocks \u003e 0 and just set bank-\u003eprot_blocks to NULL if zero.","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"cff0fd0bf949f2fa84502afe46364ccbb7d3fc16","unresolved":false,"context_lines":[{"line_number":300,"context_line":"\tif (!bank-\u003esectors)"},{"line_number":301,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"\tbank-\u003enum_prot_blocks \u003d num_prot_blocks;"},{"line_number":304,"context_line":"\tbank-\u003eprot_blocks     \u003d alloc_block_array(0, flash_page_size, bank-\u003enum_prot_blocks);"},{"line_number":305,"context_line":"\tif (!bank-\u003eprot_blocks)"},{"line_number":306,"context_line":"\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"5ad62e0d_8f6e55ce","line":303,"in_reply_to":"131baddc_ff383ef1","updated":"2022-08-20 23:25:47.000000000","message":"Done","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fdc60973f1b75c37c3c7e6952a4a18a8e1957aa0","unresolved":true,"context_lines":[{"line_number":301,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"\tbank-\u003enum_prot_blocks \u003d num_prot_blocks;"},{"line_number":304,"context_line":"\tbank-\u003eprot_blocks     \u003d alloc_block_array(0, flash_page_size, bank-\u003enum_prot_blocks);"},{"line_number":305,"context_line":"\tif (!bank-\u003eprot_blocks)"},{"line_number":306,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":307,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":15,"id":"296bb08e_b7e41e0e","line":304,"range":{"start_line":304,"start_character":46,"end_line":304,"end_character":61},"updated":"2022-08-18 20:34:41.000000000","message":"If I understand correctly the protection geometry, the protection block size should be\n bank-\u003enum_sectors / 3 * flash_page_size","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"cff0fd0bf949f2fa84502afe46364ccbb7d3fc16","unresolved":false,"context_lines":[{"line_number":301,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"\tbank-\u003enum_prot_blocks \u003d num_prot_blocks;"},{"line_number":304,"context_line":"\tbank-\u003eprot_blocks     \u003d alloc_block_array(0, flash_page_size, bank-\u003enum_prot_blocks);"},{"line_number":305,"context_line":"\tif (!bank-\u003eprot_blocks)"},{"line_number":306,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":307,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":15,"id":"8f3ec3ad_3475cc74","line":304,"range":{"start_line":304,"start_character":46,"end_line":304,"end_character":61},"in_reply_to":"296bb08e_b7e41e0e","updated":"2022-08-20 23:25:47.000000000","message":"Not sure how large block should be allocated. Used Your approach.","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fdc60973f1b75c37c3c7e6952a4a18a8e1957aa0","unresolved":true,"context_lines":[{"line_number":515,"context_line":"\tfor (unsigned int sector \u003d first; sector \u003c\u003d last; sector++) {"},{"line_number":516,"context_line":"\t\tstruct flash_sector *bs \u003d \u0026bank-\u003esectors[sector];"},{"line_number":517,"context_line":""},{"line_number":518,"context_line":"\t\tif (bs-\u003eis_protected \u003d\u003d 1) {"},{"line_number":519,"context_line":"\t\t\tLOG_ERROR(\"Erase refused, sector %d is protected\", sector);"},{"line_number":520,"context_line":"\t\t\treturn ERROR_FLASH_PROTECTED;"},{"line_number":521,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"2e3a9433_20e023e9","line":518,"range":{"start_line":518,"start_character":6,"end_line":518,"end_character":22},"updated":"2022-08-18 20:34:41.000000000","message":"Unfortunately the last change starts using bank-\u003eprot_blocks so the is_protected info is no more available in sector array!\nPlease try without checking, the conversion of sector index to prot_block index would complicate the code.","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"cff0fd0bf949f2fa84502afe46364ccbb7d3fc16","unresolved":false,"context_lines":[{"line_number":515,"context_line":"\tfor (unsigned int sector \u003d first; sector \u003c\u003d last; sector++) {"},{"line_number":516,"context_line":"\t\tstruct flash_sector *bs \u003d \u0026bank-\u003esectors[sector];"},{"line_number":517,"context_line":""},{"line_number":518,"context_line":"\t\tif (bs-\u003eis_protected \u003d\u003d 1) {"},{"line_number":519,"context_line":"\t\t\tLOG_ERROR(\"Erase refused, sector %d is protected\", sector);"},{"line_number":520,"context_line":"\t\t\treturn ERROR_FLASH_PROTECTED;"},{"line_number":521,"context_line":"\t\t}"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"4f4d2ad4_f6cad4e2","line":518,"range":{"start_line":518,"start_character":6,"end_line":518,"end_character":22},"in_reply_to":"2e3a9433_20e023e9","updated":"2022-08-20 23:25:47.000000000","message":"Actually ROM algo checks if protect is set or not, because it returns correct error, if protected. After carefull investigation of provided source code of ROM algo, y write protect is checked. No need to check here, removed.","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fdc60973f1b75c37c3c7e6952a4a18a8e1957aa0","unresolved":true,"context_lines":[{"line_number":686,"context_line":""},{"line_number":687,"context_line":"\tap-\u003ecsw_default \u003d 0x23000000;"},{"line_number":688,"context_line":""},{"line_number":689,"context_line":"\tretval \u003d dap_queue_ap_write(ap, 0, 0x23000052);"},{"line_number":690,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":691,"context_line":"\t\tgoto cleanup;"},{"line_number":692,"context_line":""},{"line_number":693,"context_line":"\tretval \u003d dap_queue_ap_write(ap, 4, 0x400000F0);"},{"line_number":694,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":695,"context_line":"\t\tgoto cleanup;"},{"line_number":696,"context_line":""},{"line_number":697,"context_line":"\tuint32_t user_key[4];"},{"line_number":698,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], user_key[0]);"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"4d4e2bff_867c8527","line":695,"range":{"start_line":689,"start_character":1,"end_line":695,"end_character":15},"updated":"2022-08-18 20:34:41.000000000","message":"If possible we should use arm_adi_v5.c layer for MEM-AP operations.\nSee below.","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"cff0fd0bf949f2fa84502afe46364ccbb7d3fc16","unresolved":false,"context_lines":[{"line_number":686,"context_line":""},{"line_number":687,"context_line":"\tap-\u003ecsw_default \u003d 0x23000000;"},{"line_number":688,"context_line":""},{"line_number":689,"context_line":"\tretval \u003d dap_queue_ap_write(ap, 0, 0x23000052);"},{"line_number":690,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":691,"context_line":"\t\tgoto cleanup;"},{"line_number":692,"context_line":""},{"line_number":693,"context_line":"\tretval \u003d dap_queue_ap_write(ap, 4, 0x400000F0);"},{"line_number":694,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":695,"context_line":"\t\tgoto cleanup;"},{"line_number":696,"context_line":""},{"line_number":697,"context_line":"\tuint32_t user_key[4];"},{"line_number":698,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], user_key[0]);"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"4fbad41f_4f0b7b19","line":695,"range":{"start_line":689,"start_character":1,"end_line":695,"end_character":15},"in_reply_to":"4d4e2bff_867c8527","updated":"2022-08-20 23:25:47.000000000","message":"Done","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fdc60973f1b75c37c3c7e6952a4a18a8e1957aa0","unresolved":true,"context_lines":[{"line_number":700,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], user_key[2]);"},{"line_number":701,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], user_key[3]);"},{"line_number":702,"context_line":"\tfor (unsigned int i \u003d 0; i \u003c 4; i++) {"},{"line_number":703,"context_line":"\t\tretval \u003d dap_queue_ap_write(ap, 12, user_key[i]);"},{"line_number":704,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":705,"context_line":"\t\t\tgoto cleanup;"},{"line_number":706,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"6ad3e9d7_d094e4f7","line":703,"range":{"start_line":703,"start_character":11,"end_line":703,"end_character":29},"updated":"2022-08-18 20:34:41.000000000","message":"Did you try\n mem_ap_write_u32(ap, addr, key[i]);\n addr +\u003d 4;\n\n?\nIt should work without explicit preparatory CSW and TAR writes, arm_adi_v5.c layer handles it for you. Just banking (BD0..BD3) is used instead of TAR auto-increment.\n\nIf the device insist on TAR auto-inc or you prefer, then prepare a buffer in target endianess and then write:\n uint8_t write_buffer[4 * 4];\n target_buffer_set_u32_array(target, write_buffer, 4, user_key);\n mem_ap_write_buf(ap, write_buffer, 4, 4, RSL10_UNLOCK_KEY_ADDR);\n\nmem_ap_write_buf() is synchronous, no dap_run() required afterwards.","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"cff0fd0bf949f2fa84502afe46364ccbb7d3fc16","unresolved":false,"context_lines":[{"line_number":700,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], user_key[2]);"},{"line_number":701,"context_line":"\tCOMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], user_key[3]);"},{"line_number":702,"context_line":"\tfor (unsigned int i \u003d 0; i \u003c 4; i++) {"},{"line_number":703,"context_line":"\t\tretval \u003d dap_queue_ap_write(ap, 12, user_key[i]);"},{"line_number":704,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":705,"context_line":"\t\t\tgoto cleanup;"},{"line_number":706,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"854e384f_307a94d0","line":703,"range":{"start_line":703,"start_character":11,"end_line":703,"end_character":29},"in_reply_to":"6ad3e9d7_d094e4f7","updated":"2022-08-20 23:25:47.000000000","message":"I tried mem_ap_write_u32(); addr +\u003d 4, and it didn\u0027t work.\nSecond variant with buffer, and mem_ap_write_buf(), worked like a charm. \nMuch cleaner, and no need for cleanups, etc. Thanks.","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fdc60973f1b75c37c3c7e6952a4a18a8e1957aa0","unresolved":true,"context_lines":[{"line_number":712,"context_line":"\tuint32_t key;"},{"line_number":713,"context_line":"\tretval \u003d mem_ap_read_atomic_u32(ap, RSL10_FLASH_ADDRESS_LOCK_INFO_SETTING, \u0026key);"},{"line_number":714,"context_line":"\tLOG_INFO(\"mem read: 0x%08\" PRIx32, key);"},{"line_number":715,"context_line":""},{"line_number":716,"context_line":"\tif (key \u003d\u003d RSL10_KEY_DEBUG_LOCK) {"},{"line_number":717,"context_line":"\t\tretval \u003d command_run_line(CMD_CTX, \"reset init\");"},{"line_number":718,"context_line":"\t\tif (retval !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"ff4c2432_c27dfc4f","line":715,"updated":"2022-08-18 20:34:41.000000000","message":"Could ap cleanup take place here?\nMaybe too early, if csw setting is needed for SYSRESETREQ ?","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"cff0fd0bf949f2fa84502afe46364ccbb7d3fc16","unresolved":false,"context_lines":[{"line_number":712,"context_line":"\tuint32_t key;"},{"line_number":713,"context_line":"\tretval \u003d mem_ap_read_atomic_u32(ap, RSL10_FLASH_ADDRESS_LOCK_INFO_SETTING, \u0026key);"},{"line_number":714,"context_line":"\tLOG_INFO(\"mem read: 0x%08\" PRIx32, key);"},{"line_number":715,"context_line":""},{"line_number":716,"context_line":"\tif (key \u003d\u003d RSL10_KEY_DEBUG_LOCK) {"},{"line_number":717,"context_line":"\t\tretval \u003d command_run_line(CMD_CTX, \"reset init\");"},{"line_number":718,"context_line":"\t\tif (retval !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"585956f2_740ac225","line":715,"in_reply_to":"ff4c2432_c27dfc4f","updated":"2022-08-20 23:25:47.000000000","message":"Done","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fdc60973f1b75c37c3c7e6952a4a18a8e1957aa0","unresolved":true,"context_lines":[{"line_number":721,"context_line":"\t\tstruct flash_bank *bank;"},{"line_number":722,"context_line":"\t\tretval \u003d get_flash_bank_by_addr(target, RSL10_FLASH_ADDRESS_NVR3, true, \u0026bank);"},{"line_number":723,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":724,"context_line":"\t\t\treturn retval;"},{"line_number":725,"context_line":""},{"line_number":726,"context_line":"\t\tretval \u003d rsl10_protect(bank, false, 0, 0);"},{"line_number":727,"context_line":"\t\tif (retval !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"f9ca5d35_81b96706","line":724,"range":{"start_line":724,"start_character":3,"end_line":724,"end_character":16},"updated":"2022-08-18 20:34:41.000000000","message":"cleanup?","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"cff0fd0bf949f2fa84502afe46364ccbb7d3fc16","unresolved":false,"context_lines":[{"line_number":721,"context_line":"\t\tstruct flash_bank *bank;"},{"line_number":722,"context_line":"\t\tretval \u003d get_flash_bank_by_addr(target, RSL10_FLASH_ADDRESS_NVR3, true, \u0026bank);"},{"line_number":723,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":724,"context_line":"\t\t\treturn retval;"},{"line_number":725,"context_line":""},{"line_number":726,"context_line":"\t\tretval \u003d rsl10_protect(bank, false, 0, 0);"},{"line_number":727,"context_line":"\t\tif (retval !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"24e3be86_a0c72cb1","line":724,"range":{"start_line":724,"start_character":3,"end_line":724,"end_character":16},"in_reply_to":"f9ca5d35_81b96706","updated":"2022-08-20 23:25:47.000000000","message":"Done","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fdc60973f1b75c37c3c7e6952a4a18a8e1957aa0","unresolved":true,"context_lines":[{"line_number":725,"context_line":""},{"line_number":726,"context_line":"\t\tretval \u003d rsl10_protect(bank, false, 0, 0);"},{"line_number":727,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":728,"context_line":"\t\t\treturn retval;"},{"line_number":729,"context_line":""},{"line_number":730,"context_line":"\t\tuint8_t write_buffer[8];"},{"line_number":731,"context_line":"\t\ttarget_buffer_set_u32(target, write_buffer, 0x1);"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"bcda4093_8a39aad6","line":728,"range":{"start_line":728,"start_character":3,"end_line":728,"end_character":16},"updated":"2022-08-18 20:34:41.000000000","message":"cleanup?","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"cff0fd0bf949f2fa84502afe46364ccbb7d3fc16","unresolved":false,"context_lines":[{"line_number":725,"context_line":""},{"line_number":726,"context_line":"\t\tretval \u003d rsl10_protect(bank, false, 0, 0);"},{"line_number":727,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":728,"context_line":"\t\t\treturn retval;"},{"line_number":729,"context_line":""},{"line_number":730,"context_line":"\t\tuint8_t write_buffer[8];"},{"line_number":731,"context_line":"\t\ttarget_buffer_set_u32(target, write_buffer, 0x1);"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"90b67b0b_e1597ec8","line":728,"range":{"start_line":728,"start_character":3,"end_line":728,"end_character":16},"in_reply_to":"bcda4093_8a39aad6","updated":"2022-08-20 23:25:47.000000000","message":"Done","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"fdc60973f1b75c37c3c7e6952a4a18a8e1957aa0","unresolved":true,"context_lines":[{"line_number":732,"context_line":"\t\t/* pad the end to 64-bit word boundary */"},{"line_number":733,"context_line":"\t\tmemset(\u0026write_buffer[4], bank-\u003edefault_padded_value, 4);"},{"line_number":734,"context_line":""},{"line_number":735,"context_line":"\t\tretval \u003d rsl10_write(bank, write_buffer, RSL10_NVR3_USER_KEY_OFFSET, sizeof(write_buffer));"},{"line_number":736,"context_line":"\t\t/* let it fail, because sector is not erased, maybe just erase all? */"},{"line_number":737,"context_line":"\t\tretval \u003d ERROR_OK;"},{"line_number":738,"context_line":"\t} else"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"80eed8e1_8f73b05b","line":735,"range":{"start_line":735,"start_character":2,"end_line":735,"end_character":11},"updated":"2022-08-18 20:34:41.000000000","message":"Do not assign retval, it could generate warning in some compilers.\nWe usually use\n (void)rsl10_write()\n\nto emphasize the return value is intentionally discarded.","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"cff0fd0bf949f2fa84502afe46364ccbb7d3fc16","unresolved":false,"context_lines":[{"line_number":732,"context_line":"\t\t/* pad the end to 64-bit word boundary */"},{"line_number":733,"context_line":"\t\tmemset(\u0026write_buffer[4], bank-\u003edefault_padded_value, 4);"},{"line_number":734,"context_line":""},{"line_number":735,"context_line":"\t\tretval \u003d rsl10_write(bank, write_buffer, RSL10_NVR3_USER_KEY_OFFSET, sizeof(write_buffer));"},{"line_number":736,"context_line":"\t\t/* let it fail, because sector is not erased, maybe just erase all? */"},{"line_number":737,"context_line":"\t\tretval \u003d ERROR_OK;"},{"line_number":738,"context_line":"\t} else"}],"source_content_type":"text/x-csrc","patch_set":15,"id":"cd90e622_309db206","line":735,"range":{"start_line":735,"start_character":2,"end_line":735,"end_character":11},"in_reply_to":"80eed8e1_8f73b05b","updated":"2022-08-20 23:25:47.000000000","message":"Done","commit_id":"01a4a863687a8cfe46b447edf818503a14a8f299"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":5,"context_line":" *   toms.sturmanis@gmail.com                                              *"},{"line_number":6,"context_line":" ***************************************************************************/"},{"line_number":7,"context_line":""},{"line_number":8,"context_line":"#include \"target/target.h\""},{"line_number":9,"context_line":"#ifdef HAVE_CONFIG_H"},{"line_number":10,"context_line":"#include \"config.h\""},{"line_number":11,"context_line":"#endif"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"e06c62a0_42ac003a","line":8,"updated":"2022-08-22 13:51:02.000000000","message":"please move this #include \"target/target.h\" __after__\n#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":5,"context_line":" *   toms.sturmanis@gmail.com                                              *"},{"line_number":6,"context_line":" ***************************************************************************/"},{"line_number":7,"context_line":""},{"line_number":8,"context_line":"#include \"target/target.h\""},{"line_number":9,"context_line":"#ifdef HAVE_CONFIG_H"},{"line_number":10,"context_line":"#include \"config.h\""},{"line_number":11,"context_line":"#endif"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"ad647bdd_90346c6a","line":8,"in_reply_to":"e06c62a0_42ac003a","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":252,"context_line":"static int rsl10_check_device(struct flash_bank *bank)"},{"line_number":253,"context_line":"{"},{"line_number":254,"context_line":"\tuint32_t configid;"},{"line_number":255,"context_line":"\tint res;"},{"line_number":256,"context_line":"\tres \u003d target_read_u32(bank-\u003etarget, RSL10_REG_ID, \u0026configid);"},{"line_number":257,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":258,"context_line":"\t\treturn res;"},{"line_number":259,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"4a4c0e18_01810528","line":256,"range":{"start_line":255,"start_character":1,"end_line":256,"end_character":26},"updated":"2022-08-22 13:51:02.000000000","message":"in the same line:\n int res \u003d ...","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":252,"context_line":"static int rsl10_check_device(struct flash_bank *bank)"},{"line_number":253,"context_line":"{"},{"line_number":254,"context_line":"\tuint32_t configid;"},{"line_number":255,"context_line":"\tint res;"},{"line_number":256,"context_line":"\tres \u003d target_read_u32(bank-\u003etarget, RSL10_REG_ID, \u0026configid);"},{"line_number":257,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":258,"context_line":"\t\treturn res;"},{"line_number":259,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"c7e1c461_13b6133e","line":256,"range":{"start_line":255,"start_character":1,"end_line":256,"end_character":26},"in_reply_to":"4a4c0e18_01810528","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":270,"context_line":"\tstruct rsl10_bank *nbank \u003d bank-\u003edriver_priv;"},{"line_number":271,"context_line":"\tstruct rsl10_info *chip  \u003d nbank-\u003echip;"},{"line_number":272,"context_line":""},{"line_number":273,"context_line":"\tres \u003d rsl10_check_device(bank);"},{"line_number":274,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":275,"context_line":"\t\treturn res;"},{"line_number":276,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"cffaf5c7_b4ccc3a7","line":273,"updated":"2022-08-22 13:51:02.000000000","message":"in the same line\n int res \u003d ...","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":270,"context_line":"\tstruct rsl10_bank *nbank \u003d bank-\u003edriver_priv;"},{"line_number":271,"context_line":"\tstruct rsl10_info *chip  \u003d nbank-\u003echip;"},{"line_number":272,"context_line":""},{"line_number":273,"context_line":"\tres \u003d rsl10_check_device(bank);"},{"line_number":274,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":275,"context_line":"\t\treturn res;"},{"line_number":276,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"fc181f23_d8f893b6","line":273,"in_reply_to":"cffaf5c7_b4ccc3a7","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":335,"context_line":"{"},{"line_number":336,"context_line":"\tstruct target *target \u003d chip-\u003etarget;"},{"line_number":337,"context_line":"\tstruct working_area *write_algorithm;"},{"line_number":338,"context_line":"\tint res \u003d ERROR_OK;"},{"line_number":339,"context_line":""},{"line_number":340,"context_line":"\tstatic const uint8_t rsl10_rom_launcher_code[] \u003d {"},{"line_number":341,"context_line":"#include \"../../../contrib/loaders/flash/rsl10/rom_launcher.inc\""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"377d45bd_0863f894","line":338,"updated":"2022-08-22 13:51:02.000000000","message":"no need to initialize res","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":335,"context_line":"{"},{"line_number":336,"context_line":"\tstruct target *target \u003d chip-\u003etarget;"},{"line_number":337,"context_line":"\tstruct working_area *write_algorithm;"},{"line_number":338,"context_line":"\tint res \u003d ERROR_OK;"},{"line_number":339,"context_line":""},{"line_number":340,"context_line":"\tstatic const uint8_t rsl10_rom_launcher_code[] \u003d {"},{"line_number":341,"context_line":"#include \"../../../contrib/loaders/flash/rsl10/rom_launcher.inc\""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"7c9150ce_6b79946c","line":338,"in_reply_to":"377d45bd_0863f894","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":343,"context_line":""},{"line_number":344,"context_line":"\tLOG_DEBUG(\"erasing buffer flash address\u003d0x%\" PRIx32, address);"},{"line_number":345,"context_line":""},{"line_number":346,"context_line":"\tif (target_alloc_working_area(target, sizeof(rsl10_rom_launcher_code), \u0026write_algorithm) !\u003d ERROR_OK) {"},{"line_number":347,"context_line":"\t\tLOG_ERROR(\"Current working area 0x%x is too small! Increase working area size!\", target-\u003eworking_area_size);"},{"line_number":348,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":349,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"5e533eeb_96c1b2f9","line":346,"range":{"start_line":346,"start_character":7,"end_line":346,"end_character":8},"updated":"2022-08-22 13:51:02.000000000","message":"please use:\n retval \u003d target_alloc_working_area(...);\n it (res !\u003d ERROR_OK) {","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":343,"context_line":""},{"line_number":344,"context_line":"\tLOG_DEBUG(\"erasing buffer flash address\u003d0x%\" PRIx32, address);"},{"line_number":345,"context_line":""},{"line_number":346,"context_line":"\tif (target_alloc_working_area(target, sizeof(rsl10_rom_launcher_code), \u0026write_algorithm) !\u003d ERROR_OK) {"},{"line_number":347,"context_line":"\t\tLOG_ERROR(\"Current working area 0x%x is too small! Increase working area size!\", target-\u003eworking_area_size);"},{"line_number":348,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":349,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"a9f4f17d_6c4af622","line":346,"range":{"start_line":346,"start_character":7,"end_line":346,"end_character":8},"in_reply_to":"5e533eeb_96c1b2f9","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":394,"context_line":"{"},{"line_number":395,"context_line":"\tstruct target *target \u003d chip-\u003etarget;"},{"line_number":396,"context_line":"\tstruct working_area *write_algorithm;"},{"line_number":397,"context_line":"\tint res \u003d ERROR_OK;"},{"line_number":398,"context_line":""},{"line_number":399,"context_line":"\tif (bytes \u003d\u003d 8) {"},{"line_number":400,"context_line":"\t\tuint32_t data;"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"b52d4b5a_9a79b675","line":397,"updated":"2022-08-22 13:51:02.000000000","message":"no need to initialize res","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":394,"context_line":"{"},{"line_number":395,"context_line":"\tstruct target *target \u003d chip-\u003etarget;"},{"line_number":396,"context_line":"\tstruct working_area *write_algorithm;"},{"line_number":397,"context_line":"\tint res \u003d ERROR_OK;"},{"line_number":398,"context_line":""},{"line_number":399,"context_line":"\tif (bytes \u003d\u003d 8) {"},{"line_number":400,"context_line":"\t\tuint32_t data;"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"1286b302_6d57830c","line":397,"in_reply_to":"b52d4b5a_9a79b675","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":408,"context_line":"\t};"},{"line_number":409,"context_line":""},{"line_number":410,"context_line":"\t/* allocate working area with flash programming code */"},{"line_number":411,"context_line":"\tif (target_alloc_working_area(target, sizeof(rsl10_rom_launcher_code), \u0026write_algorithm) !\u003d ERROR_OK) {"},{"line_number":412,"context_line":"\t\tLOG_ERROR(\"Current working area 0x%x is too small! Increase working area size!\", target-\u003eworking_area_size);"},{"line_number":413,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":414,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"f3533794_87a47685","line":411,"updated":"2022-08-22 13:51:02.000000000","message":"please use:\n retval \u003d target_alloc_working_area(...);\n it (res !\u003d ERROR_OK) {","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":408,"context_line":"\t};"},{"line_number":409,"context_line":""},{"line_number":410,"context_line":"\t/* allocate working area with flash programming code */"},{"line_number":411,"context_line":"\tif (target_alloc_working_area(target, sizeof(rsl10_rom_launcher_code), \u0026write_algorithm) !\u003d ERROR_OK) {"},{"line_number":412,"context_line":"\t\tLOG_ERROR(\"Current working area 0x%x is too small! Increase working area size!\", target-\u003eworking_area_size);"},{"line_number":413,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":414,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"9c2a89ce_d00053df","line":411,"in_reply_to":"f3533794_87a47685","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":510,"context_line":"\t};"},{"line_number":511,"context_line":""},{"line_number":512,"context_line":"\t/* flash write code */"},{"line_number":513,"context_line":"\tif (target_alloc_working_area(target, sizeof(rsl10_flash_write_code), \u0026write_algorithm) !\u003d ERROR_OK) {"},{"line_number":514,"context_line":"\t\tLOG_WARNING(\"no working area available, can\u0027t do block memory writes\");"},{"line_number":515,"context_line":"\t\treturn ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":516,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"55ad71ba_90a4df56","line":513,"updated":"2022-08-22 13:51:02.000000000","message":"please use\n retval \u003d target_alloc_working_area(...);\n if (retval !\u003d ERROR_OK) {","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":510,"context_line":"\t};"},{"line_number":511,"context_line":""},{"line_number":512,"context_line":"\t/* flash write code */"},{"line_number":513,"context_line":"\tif (target_alloc_working_area(target, sizeof(rsl10_flash_write_code), \u0026write_algorithm) !\u003d ERROR_OK) {"},{"line_number":514,"context_line":"\t\tLOG_WARNING(\"no working area available, can\u0027t do block memory writes\");"},{"line_number":515,"context_line":"\t\treturn ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":516,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"c45a45df_67e254d4","line":513,"in_reply_to":"55ad71ba_90a4df56","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":559,"context_line":"\tarmv7m_info.common_magic \u003d ARMV7M_COMMON_MAGIC;"},{"line_number":560,"context_line":"\tarmv7m_info.core_mode    \u003d ARM_MODE_THREAD;"},{"line_number":561,"context_line":""},{"line_number":562,"context_line":"\tint sector_count;"},{"line_number":563,"context_line":"\tif (count % FLASH_SECTOR_SIZE \u003d\u003d 0)"},{"line_number":564,"context_line":"\t\tsector_count \u003d count / FLASH_SECTOR_SIZE;"},{"line_number":565,"context_line":"\telse"},{"line_number":566,"context_line":"\t\t/* FIXME: this seems to be the problem, for heap-buffer-overflow?? */"},{"line_number":567,"context_line":"\t\tsector_count \u003d (count / FLASH_SECTOR_SIZE) + 1;"},{"line_number":568,"context_line":""},{"line_number":569,"context_line":"\tLOG_DEBUG(\"dwords_count: %\" PRIu32 \", count: %\" PRIu32, count, sector_count);"},{"line_number":570,"context_line":"\tretval \u003d target_run_flash_async_algorithm("}],"source_content_type":"text/x-csrc","patch_set":16,"id":"fc9c5381_38402ef0","line":567,"range":{"start_line":562,"start_character":1,"end_line":567,"end_character":49},"updated":"2022-08-22 13:51:02.000000000","message":"There are helpers, plus the type required by target_run_flash_async_algorithm() is uint32_t:\nuint32_t sector_count \u003d DIV_ROUND_UP(count, FLASH_SECTOR_SIZE);","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":559,"context_line":"\tarmv7m_info.common_magic \u003d ARMV7M_COMMON_MAGIC;"},{"line_number":560,"context_line":"\tarmv7m_info.core_mode    \u003d ARM_MODE_THREAD;"},{"line_number":561,"context_line":""},{"line_number":562,"context_line":"\tint sector_count;"},{"line_number":563,"context_line":"\tif (count % FLASH_SECTOR_SIZE \u003d\u003d 0)"},{"line_number":564,"context_line":"\t\tsector_count \u003d count / FLASH_SECTOR_SIZE;"},{"line_number":565,"context_line":"\telse"},{"line_number":566,"context_line":"\t\t/* FIXME: this seems to be the problem, for heap-buffer-overflow?? */"},{"line_number":567,"context_line":"\t\tsector_count \u003d (count / FLASH_SECTOR_SIZE) + 1;"},{"line_number":568,"context_line":""},{"line_number":569,"context_line":"\tLOG_DEBUG(\"dwords_count: %\" PRIu32 \", count: %\" PRIu32, count, sector_count);"},{"line_number":570,"context_line":"\tretval \u003d target_run_flash_async_algorithm("}],"source_content_type":"text/x-csrc","patch_set":16,"id":"3741d559_3bf40187","line":567,"range":{"start_line":562,"start_character":1,"end_line":567,"end_character":49},"in_reply_to":"954bcefc_f59b86ce","updated":"2022-08-25 11:35:24.000000000","message":"Tomas is right, and I understand now why there\u0027s heap-overflow. Async algo reads past its provided data buffer. Thanks.\n\nI\u0027ll fix those things in other update, where I\u0027ll include async algo. Right now I\u0027ll remove everything considering async algo, with patchset 18, and focus on merging existing approach.","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"82e0e1e817b075d8f53bd7027140e1c809cca520","unresolved":true,"context_lines":[{"line_number":559,"context_line":"\tarmv7m_info.common_magic \u003d ARMV7M_COMMON_MAGIC;"},{"line_number":560,"context_line":"\tarmv7m_info.core_mode    \u003d ARM_MODE_THREAD;"},{"line_number":561,"context_line":""},{"line_number":562,"context_line":"\tint sector_count;"},{"line_number":563,"context_line":"\tif (count % FLASH_SECTOR_SIZE \u003d\u003d 0)"},{"line_number":564,"context_line":"\t\tsector_count \u003d count / FLASH_SECTOR_SIZE;"},{"line_number":565,"context_line":"\telse"},{"line_number":566,"context_line":"\t\t/* FIXME: this seems to be the problem, for heap-buffer-overflow?? */"},{"line_number":567,"context_line":"\t\tsector_count \u003d (count / FLASH_SECTOR_SIZE) + 1;"},{"line_number":568,"context_line":""},{"line_number":569,"context_line":"\tLOG_DEBUG(\"dwords_count: %\" PRIu32 \", count: %\" PRIu32, count, sector_count);"},{"line_number":570,"context_line":"\tretval \u003d target_run_flash_async_algorithm("}],"source_content_type":"text/x-csrc","patch_set":16,"id":"954bcefc_f59b86ce","line":567,"range":{"start_line":562,"start_character":1,"end_line":567,"end_character":49},"in_reply_to":"fc9c5381_38402ef0","updated":"2022-08-22 19:20:04.000000000","message":"Unfortunately any round up or increase of sector count is not acceptable here.\nAs the comment @ line 566 suggests, we have \u0027count\u0027 bytes long \u0027buffer\u0027 and we cannot request target_run_flash_async_algorithm() to read more.","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":591,"context_line":"static int rsl10_mass_erase(struct target *target)"},{"line_number":592,"context_line":"{"},{"line_number":593,"context_line":"\tstruct working_area *write_algorithm;"},{"line_number":594,"context_line":"\tint retval \u003d ERROR_OK;"},{"line_number":595,"context_line":""},{"line_number":596,"context_line":"\tstatic const uint8_t rsl10_rom_launcher_code[] \u003d {"},{"line_number":597,"context_line":"#include \"../../../contrib/loaders/flash/rsl10/rom_launcher.inc\""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"e31c8918_f6c39f81","line":594,"updated":"2022-08-22 13:51:02.000000000","message":"no need to initialize retval","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":591,"context_line":"static int rsl10_mass_erase(struct target *target)"},{"line_number":592,"context_line":"{"},{"line_number":593,"context_line":"\tstruct working_area *write_algorithm;"},{"line_number":594,"context_line":"\tint retval \u003d ERROR_OK;"},{"line_number":595,"context_line":""},{"line_number":596,"context_line":"\tstatic const uint8_t rsl10_rom_launcher_code[] \u003d {"},{"line_number":597,"context_line":"#include \"../../../contrib/loaders/flash/rsl10/rom_launcher.inc\""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"7172e57f_b76ee770","line":594,"in_reply_to":"e31c8918_f6c39f81","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":597,"context_line":"#include \"../../../contrib/loaders/flash/rsl10/rom_launcher.inc\""},{"line_number":598,"context_line":"\t};"},{"line_number":599,"context_line":""},{"line_number":600,"context_line":"\tif (target_alloc_working_area(target, sizeof(rsl10_rom_launcher_code), \u0026write_algorithm) !\u003d ERROR_OK) {"},{"line_number":601,"context_line":"\t\tLOG_ERROR(\"Current working area 0x%x is too small! Increase working area size!\", target-\u003eworking_area_size);"},{"line_number":602,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":603,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"6e51f294_fbc4c591","line":600,"updated":"2022-08-22 13:51:02.000000000","message":"please use:\n retval \u003d target_alloc_working_area(...);\n if (retval !\u003d ERROR_OK) {","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":597,"context_line":"#include \"../../../contrib/loaders/flash/rsl10/rom_launcher.inc\""},{"line_number":598,"context_line":"\t};"},{"line_number":599,"context_line":""},{"line_number":600,"context_line":"\tif (target_alloc_working_area(target, sizeof(rsl10_rom_launcher_code), \u0026write_algorithm) !\u003d ERROR_OK) {"},{"line_number":601,"context_line":"\t\tLOG_ERROR(\"Current working area 0x%x is too small! Increase working area size!\", target-\u003eworking_area_size);"},{"line_number":602,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":603,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"bf1b3239_8f07c2b3","line":600,"in_reply_to":"6e51f294_fbc4c591","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":648,"context_line":"\tstruct rsl10_info *chip;"},{"line_number":649,"context_line":"\tint retval;"},{"line_number":650,"context_line":""},{"line_number":651,"context_line":"\tretval \u003d rsl10_get_probed_chip_if_halted(bank, \u0026chip);"},{"line_number":652,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":653,"context_line":"\t\treturn retval;"},{"line_number":654,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"dce61018_864a6250","line":651,"updated":"2022-08-22 13:51:02.000000000","message":"in the same line\n int retval \u003d rsl10_get...","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":648,"context_line":"\tstruct rsl10_info *chip;"},{"line_number":649,"context_line":"\tint retval;"},{"line_number":650,"context_line":""},{"line_number":651,"context_line":"\tretval \u003d rsl10_get_probed_chip_if_halted(bank, \u0026chip);"},{"line_number":652,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":653,"context_line":"\t\treturn retval;"},{"line_number":654,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"a9391814_83e2e139","line":651,"in_reply_to":"dce61018_864a6250","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":662,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":663,"context_line":"\t\tLOG_ERROR(\"ERROR: async flash failed, trying regular flash\");"},{"line_number":664,"context_line":""},{"line_number":665,"context_line":"\tretval \u003d rsl10_ll_flash_write(chip, bank-\u003ebase + offset, buffer, count);"},{"line_number":666,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":667,"context_line":"\t\treturn retval;"},{"line_number":668,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"b401f28f_0b61c299","line":665,"updated":"2022-08-22 13:51:02.000000000","message":"directly:\n return rsl10_ll_flash_write(...);","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":662,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":663,"context_line":"\t\tLOG_ERROR(\"ERROR: async flash failed, trying regular flash\");"},{"line_number":664,"context_line":""},{"line_number":665,"context_line":"\tretval \u003d rsl10_ll_flash_write(chip, bank-\u003ebase + offset, buffer, count);"},{"line_number":666,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":667,"context_line":"\t\treturn retval;"},{"line_number":668,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"0d2fa18d_e8ff7ac4","line":665,"in_reply_to":"b401f28f_0b61c299","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":675,"context_line":"\tint retval;"},{"line_number":676,"context_line":"\tstruct rsl10_info *chip;"},{"line_number":677,"context_line":""},{"line_number":678,"context_line":"\tretval \u003d rsl10_get_probed_chip_if_halted(bank, \u0026chip);"},{"line_number":679,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":680,"context_line":"\t\treturn retval;"},{"line_number":681,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"443f07eb_8bc13927","line":678,"updated":"2022-08-22 13:51:02.000000000","message":"int retval \u003d rsl10_get_probed_chip_if_halted(..);","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":675,"context_line":"\tint retval;"},{"line_number":676,"context_line":"\tstruct rsl10_info *chip;"},{"line_number":677,"context_line":""},{"line_number":678,"context_line":"\tretval \u003d rsl10_get_probed_chip_if_halted(bank, \u0026chip);"},{"line_number":679,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":680,"context_line":"\t\treturn retval;"},{"line_number":681,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"6cd8c7f2_863cc886","line":678,"in_reply_to":"443f07eb_8bc13927","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":783,"context_line":"\tint retval;"},{"line_number":784,"context_line":"\tstruct target *target \u003d get_current_target(CMD_CTX);"},{"line_number":785,"context_line":""},{"line_number":786,"context_line":"\tif (CMD_ARGC \u003c 4)"},{"line_number":787,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":788,"context_line":""},{"line_number":789,"context_line":"\tstruct flash_bank *bank;"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"67d48389_e307cfe0","line":786,"updated":"2022-08-22 13:51:02.000000000","message":"This command requires exactly 4 arguments:\n if (CMD_ARGC !\u003d 4)\n   return ERROR_COMMAND_SYNTAX_ERROR;","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":783,"context_line":"\tint retval;"},{"line_number":784,"context_line":"\tstruct target *target \u003d get_current_target(CMD_CTX);"},{"line_number":785,"context_line":""},{"line_number":786,"context_line":"\tif (CMD_ARGC \u003c 4)"},{"line_number":787,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":788,"context_line":""},{"line_number":789,"context_line":"\tstruct flash_bank *bank;"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"0f9cc5a2_810498d7","line":786,"in_reply_to":"67d48389_e307cfe0","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":787,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":788,"context_line":""},{"line_number":789,"context_line":"\tstruct flash_bank *bank;"},{"line_number":790,"context_line":"\tretval \u003d get_flash_bank_by_addr(target, RSL10_FLASH_ADDRESS_NVR3, true, \u0026bank);"},{"line_number":791,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":792,"context_line":"\t\treturn retval;"},{"line_number":793,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"2fd4d13f_13e44034","line":790,"updated":"2022-08-22 13:51:02.000000000","message":"int retval \u003d get_flash_bank_by_addr(..);","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":787,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":788,"context_line":""},{"line_number":789,"context_line":"\tstruct flash_bank *bank;"},{"line_number":790,"context_line":"\tretval \u003d get_flash_bank_by_addr(target, RSL10_FLASH_ADDRESS_NVR3, true, \u0026bank);"},{"line_number":791,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":792,"context_line":"\t\treturn retval;"},{"line_number":793,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"be877ef5_2856cfaa","line":790,"in_reply_to":"2fd4d13f_13e44034","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"82e0e1e817b075d8f53bd7027140e1c809cca520","unresolved":true,"context_lines":[{"line_number":832,"context_line":"}"},{"line_number":833,"context_line":""},{"line_number":834,"context_line":"COMMAND_HANDLER(rsl10_unlock_command)"},{"line_number":835,"context_line":""},{"line_number":836,"context_line":"{"},{"line_number":837,"context_line":"\tint retval;"},{"line_number":838,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"e0893838_60ebe74d","line":835,"updated":"2022-08-22 19:20:04.000000000","message":"Remove empty line","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":832,"context_line":"}"},{"line_number":833,"context_line":""},{"line_number":834,"context_line":"COMMAND_HANDLER(rsl10_unlock_command)"},{"line_number":835,"context_line":""},{"line_number":836,"context_line":"{"},{"line_number":837,"context_line":"\tint retval;"},{"line_number":838,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"aed640a7_f8c0a349","line":835,"in_reply_to":"e0893838_60ebe74d","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":836,"context_line":"{"},{"line_number":837,"context_line":"\tint retval;"},{"line_number":838,"context_line":""},{"line_number":839,"context_line":"\tif (CMD_ARGC \u003c 4)"},{"line_number":840,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":841,"context_line":""},{"line_number":842,"context_line":"\tstruct target *target            \u003d get_current_target(CMD_CTX);"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"ad96fa1b_266d5ae9","line":839,"updated":"2022-08-22 13:51:02.000000000","message":"same here\n if (CMD_ARGC !\u003d 4)","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":836,"context_line":"{"},{"line_number":837,"context_line":"\tint retval;"},{"line_number":838,"context_line":""},{"line_number":839,"context_line":"\tif (CMD_ARGC \u003c 4)"},{"line_number":840,"context_line":"\t\treturn ERROR_COMMAND_SYNTAX_ERROR;"},{"line_number":841,"context_line":""},{"line_number":842,"context_line":"\tstruct target *target            \u003d get_current_target(CMD_CTX);"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"b6d47f1c_ac524208","line":839,"in_reply_to":"ad96fa1b_266d5ae9","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":853,"context_line":""},{"line_number":854,"context_line":"\tuint8_t write_buffer1[4 * 4];"},{"line_number":855,"context_line":"\ttarget_buffer_set_u32_array(target, write_buffer1, 4, user_key);"},{"line_number":856,"context_line":"\tmem_ap_write_buf(ap, write_buffer1, 4, 4, RSL10_FLASH_REG_DEBUG_UNLOCK_KEY1);"},{"line_number":857,"context_line":""},{"line_number":858,"context_line":"\tdap_put_ap(ap);"},{"line_number":859,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"00eac4d7_fdd2b51b","line":856,"updated":"2022-08-22 13:51:02.000000000","message":"no check on returned value?","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":853,"context_line":""},{"line_number":854,"context_line":"\tuint8_t write_buffer1[4 * 4];"},{"line_number":855,"context_line":"\ttarget_buffer_set_u32_array(target, write_buffer1, 4, user_key);"},{"line_number":856,"context_line":"\tmem_ap_write_buf(ap, write_buffer1, 4, 4, RSL10_FLASH_REG_DEBUG_UNLOCK_KEY1);"},{"line_number":857,"context_line":""},{"line_number":858,"context_line":"\tdap_put_ap(ap);"},{"line_number":859,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":16,"id":"cc2a1f43_2e124558","line":856,"in_reply_to":"00eac4d7_fdd2b51b","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":897,"context_line":"{"},{"line_number":898,"context_line":"\tint retval;"},{"line_number":899,"context_line":"\tstruct target *target \u003d get_current_target(CMD_CTX);"},{"line_number":900,"context_line":""},{"line_number":901,"context_line":"\tretval \u003d rsl10_mass_erase(target);"},{"line_number":902,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":903,"context_line":"\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"8ee76121_af8b5ced","line":900,"updated":"2022-08-22 13:51:02.000000000","message":"Please add\n if (CMD_ARGC)\n   return ERROR_COMMAND_SYNTAX_ERROR;","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":897,"context_line":"{"},{"line_number":898,"context_line":"\tint retval;"},{"line_number":899,"context_line":"\tstruct target *target \u003d get_current_target(CMD_CTX);"},{"line_number":900,"context_line":""},{"line_number":901,"context_line":"\tretval \u003d rsl10_mass_erase(target);"},{"line_number":902,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":903,"context_line":"\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"c7554d45_5d74c77d","line":900,"in_reply_to":"8ee76121_af8b5ced","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":908,"context_line":"\t\t\t \"****** ....... ******\\n\""},{"line_number":909,"context_line":"\t);"},{"line_number":910,"context_line":""},{"line_number":911,"context_line":"\treturn retval;"},{"line_number":912,"context_line":"}"},{"line_number":913,"context_line":""},{"line_number":914,"context_line":"static const struct command_registration rsl10_exec_command_handlers[] \u003d {"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"e087c4b3_9810ccad","line":911,"updated":"2022-08-22 13:51:02.000000000","message":"return ERROR_OK;","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":908,"context_line":"\t\t\t \"****** ....... ******\\n\""},{"line_number":909,"context_line":"\t);"},{"line_number":910,"context_line":""},{"line_number":911,"context_line":"\treturn retval;"},{"line_number":912,"context_line":"}"},{"line_number":913,"context_line":""},{"line_number":914,"context_line":"static const struct command_registration rsl10_exec_command_handlers[] \u003d {"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"910d43e8_634d22ba","line":911,"in_reply_to":"e087c4b3_9810ccad","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"060b1dae64f4318114a87df642aa5734fbca9821","unresolved":true,"context_lines":[{"line_number":949,"context_line":"\t.name               \u003d \"rsl10\","},{"line_number":950,"context_line":"\t.commands           \u003d rsl10_command_handlers,"},{"line_number":951,"context_line":"\t.flash_bank_command \u003d rsl10_flash_bank_command,"},{"line_number":952,"context_line":"\t/* .info\t\t\t\u003d nrf5_info, */"},{"line_number":953,"context_line":"\t.erase            \u003d rsl10_erase,"},{"line_number":954,"context_line":"\t.protect          \u003d rsl10_protect,"},{"line_number":955,"context_line":"\t.write            \u003d rsl10_write,"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"1937640d_c73adf41","line":952,"updated":"2022-08-22 13:51:02.000000000","message":"what is this comment for?","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"bbf99d40cb67136d043ebd2c5939b9786d811506","unresolved":false,"context_lines":[{"line_number":949,"context_line":"\t.name               \u003d \"rsl10\","},{"line_number":950,"context_line":"\t.commands           \u003d rsl10_command_handlers,"},{"line_number":951,"context_line":"\t.flash_bank_command \u003d rsl10_flash_bank_command,"},{"line_number":952,"context_line":"\t/* .info\t\t\t\u003d nrf5_info, */"},{"line_number":953,"context_line":"\t.erase            \u003d rsl10_erase,"},{"line_number":954,"context_line":"\t.protect          \u003d rsl10_protect,"},{"line_number":955,"context_line":"\t.write            \u003d rsl10_write,"}],"source_content_type":"text/x-csrc","patch_set":16,"id":"b7ee4e43_c1066085","line":952,"in_reply_to":"1937640d_c73adf41","updated":"2022-08-25 11:35:24.000000000","message":"Done","commit_id":"28f600fa70c5e20cf40429fd607f068c70d4228c"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"555c427681eedd8067b0ced9c0d2a63ef6cc4d61","unresolved":true,"context_lines":[{"line_number":254,"context_line":"\t\treturn retval;"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"\tif (configid !\u003d RSL10_ID) {"},{"line_number":257,"context_line":"\t\tLOG_ERROR(\"This is not supported(RSL10) device, use other flash driver!!!\");"},{"line_number":258,"context_line":"\t\treturn ERROR_TARGET_INVALID;"},{"line_number":259,"context_line":"\t}"},{"line_number":260,"context_line":"\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"5eec314c_ee5141c8","line":257,"range":{"start_line":257,"start_character":34,"end_line":257,"end_character":35},"updated":"2022-09-01 12:00:22.000000000","message":"Space before ( ?","commit_id":"507e67ae28a89978ace58bf114392567339ad3ee"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"9fc29cc296db72a30b08a322793ad77f480cf59b","unresolved":false,"context_lines":[{"line_number":254,"context_line":"\t\treturn retval;"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"\tif (configid !\u003d RSL10_ID) {"},{"line_number":257,"context_line":"\t\tLOG_ERROR(\"This is not supported(RSL10) device, use other flash driver!!!\");"},{"line_number":258,"context_line":"\t\treturn ERROR_TARGET_INVALID;"},{"line_number":259,"context_line":"\t}"},{"line_number":260,"context_line":"\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"b6c51feb_d3e3e252","line":257,"range":{"start_line":257,"start_character":34,"end_line":257,"end_character":35},"in_reply_to":"5eec314c_ee5141c8","updated":"2022-09-03 21:17:11.000000000","message":"Done","commit_id":"507e67ae28a89978ace58bf114392567339ad3ee"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"555c427681eedd8067b0ced9c0d2a63ef6cc4d61","unresolved":true,"context_lines":[{"line_number":703,"context_line":"\t}"},{"line_number":704,"context_line":""},{"line_number":705,"context_line":"\tcommand_print("},{"line_number":706,"context_line":"\t\tCMD, \"****** WARNING ******\\n\u0027\""},{"line_number":707,"context_line":"\t\t\t \"rsl10 device has been successfully prepared to lock.\\n\""},{"line_number":708,"context_line":"\t\t\t \"Debug port is locked after restart.\\n\""},{"line_number":709,"context_line":"\t\t\t \"Unlock with \u0027rsl10_unlock key0 key1 key2 key3\u0027\\n\""}],"source_content_type":"text/x-csrc","patch_set":19,"id":"2b8c741e_2283aa82","line":706,"range":{"start_line":706,"start_character":31,"end_line":706,"end_character":32},"updated":"2022-09-01 12:00:22.000000000","message":"Probably unwanted apostrophe.","commit_id":"507e67ae28a89978ace58bf114392567339ad3ee"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"9fc29cc296db72a30b08a322793ad77f480cf59b","unresolved":false,"context_lines":[{"line_number":703,"context_line":"\t}"},{"line_number":704,"context_line":""},{"line_number":705,"context_line":"\tcommand_print("},{"line_number":706,"context_line":"\t\tCMD, \"****** WARNING ******\\n\u0027\""},{"line_number":707,"context_line":"\t\t\t \"rsl10 device has been successfully prepared to lock.\\n\""},{"line_number":708,"context_line":"\t\t\t \"Debug port is locked after restart.\\n\""},{"line_number":709,"context_line":"\t\t\t \"Unlock with \u0027rsl10_unlock key0 key1 key2 key3\u0027\\n\""}],"source_content_type":"text/x-csrc","patch_set":19,"id":"41f8398f_7b7e87b1","line":706,"range":{"start_line":706,"start_character":31,"end_line":706,"end_character":32},"in_reply_to":"2b8c741e_2283aa82","updated":"2022-09-03 21:17:11.000000000","message":"Done","commit_id":"507e67ae28a89978ace58bf114392567339ad3ee"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"555c427681eedd8067b0ced9c0d2a63ef6cc4d61","unresolved":true,"context_lines":[{"line_number":767,"context_line":"\t\t(void)rsl10_write(bank, write_buffer2, RSL10_NVR3_USER_KEY_OFFSET, sizeof(write_buffer2));"},{"line_number":768,"context_line":""},{"line_number":769,"context_line":"\t\tcommand_print("},{"line_number":770,"context_line":"\t\t\tCMD, \"****** WARNING ******\\n\u0027\""},{"line_number":771,"context_line":"\t\t\t\t \"Debug port is unlocked.\\n\""},{"line_number":772,"context_line":"\t\t\t\t \"****** ....... ******\\n\""},{"line_number":773,"context_line":"\t\t);"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"de0fc80c_ca157bc5","line":770,"range":{"start_line":770,"start_character":9,"end_line":770,"end_character":33},"updated":"2022-09-01 12:00:22.000000000","message":"Consider removing the frame and warning title. Otherwise remove the apostrophe.","commit_id":"507e67ae28a89978ace58bf114392567339ad3ee"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"9fc29cc296db72a30b08a322793ad77f480cf59b","unresolved":false,"context_lines":[{"line_number":767,"context_line":"\t\t(void)rsl10_write(bank, write_buffer2, RSL10_NVR3_USER_KEY_OFFSET, sizeof(write_buffer2));"},{"line_number":768,"context_line":""},{"line_number":769,"context_line":"\t\tcommand_print("},{"line_number":770,"context_line":"\t\t\tCMD, \"****** WARNING ******\\n\u0027\""},{"line_number":771,"context_line":"\t\t\t\t \"Debug port is unlocked.\\n\""},{"line_number":772,"context_line":"\t\t\t\t \"****** ....... ******\\n\""},{"line_number":773,"context_line":"\t\t);"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"0b8cb333_2c0c1730","line":770,"range":{"start_line":770,"start_character":9,"end_line":770,"end_character":33},"in_reply_to":"de0fc80c_ca157bc5","updated":"2022-09-03 21:17:11.000000000","message":"Done","commit_id":"507e67ae28a89978ace58bf114392567339ad3ee"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"555c427681eedd8067b0ced9c0d2a63ef6cc4d61","unresolved":true,"context_lines":[{"line_number":788,"context_line":"\t\treturn retval;"},{"line_number":789,"context_line":""},{"line_number":790,"context_line":"\tcommand_print("},{"line_number":791,"context_line":"\t\tCMD, \"****** WARNING ******\\n\u0027\""},{"line_number":792,"context_line":"\t\t\t \"Mass erase was succesfull!\\n\""},{"line_number":793,"context_line":"\t\t\t \"****** ....... ******\\n\""},{"line_number":794,"context_line":"\t);"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"8f0354d6_9a029098","line":791,"range":{"start_line":791,"start_character":8,"end_line":791,"end_character":32},"updated":"2022-09-01 12:00:22.000000000","message":"Consider removing the frame and warning title. Otherwise remove the apostrophe.","commit_id":"507e67ae28a89978ace58bf114392567339ad3ee"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"9fc29cc296db72a30b08a322793ad77f480cf59b","unresolved":false,"context_lines":[{"line_number":788,"context_line":"\t\treturn retval;"},{"line_number":789,"context_line":""},{"line_number":790,"context_line":"\tcommand_print("},{"line_number":791,"context_line":"\t\tCMD, \"****** WARNING ******\\n\u0027\""},{"line_number":792,"context_line":"\t\t\t \"Mass erase was succesfull!\\n\""},{"line_number":793,"context_line":"\t\t\t \"****** ....... ******\\n\""},{"line_number":794,"context_line":"\t);"}],"source_content_type":"text/x-csrc","patch_set":19,"id":"ace5493f_caa7fa32","line":791,"range":{"start_line":791,"start_character":8,"end_line":791,"end_character":32},"in_reply_to":"8f0354d6_9a029098","updated":"2022-09-03 21:17:11.000000000","message":"Done","commit_id":"507e67ae28a89978ace58bf114392567339ad3ee"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"07776b55b292a663cb612dad074a24bd4329abb7","unresolved":true,"context_lines":[{"line_number":334,"context_line":"\tstruct working_area *write_algorithm;"},{"line_number":335,"context_line":""},{"line_number":336,"context_line":"\tstatic const uint8_t rsl10_rom_launcher_code[] \u003d {"},{"line_number":337,"context_line":"#include \"../../../contrib/loaders/flash/rsl10/rom_launcher.inc\""},{"line_number":338,"context_line":"\t};"},{"line_number":339,"context_line":""},{"line_number":340,"context_line":"\tLOG_DEBUG(\"erasing buffer flash address\u003d0x%\" PRIx32, address);"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"4c04f91e_dd8319f3","line":337,"updated":"2022-09-04 21:31:46.000000000","message":"This is a very short array, does not occupy too much space, but it\u0027s instantiated 3 times, here, in rsl10_ll_flash_write() and in rsl10_mass_erase().\nActually, being it \u0027static const\u0027, the compiler should optimize it and keep only one instance.\nWould it make sense to put its declaration outside the functions and explicitly share it?","commit_id":"f0912e6b21ed4470b4c91d3905a2df9fbcb89e87"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"ee171d6d9cd6a3738fac5b3329f14d8c6a7c63ec","unresolved":false,"context_lines":[{"line_number":334,"context_line":"\tstruct working_area *write_algorithm;"},{"line_number":335,"context_line":""},{"line_number":336,"context_line":"\tstatic const uint8_t rsl10_rom_launcher_code[] \u003d {"},{"line_number":337,"context_line":"#include \"../../../contrib/loaders/flash/rsl10/rom_launcher.inc\""},{"line_number":338,"context_line":"\t};"},{"line_number":339,"context_line":""},{"line_number":340,"context_line":"\tLOG_DEBUG(\"erasing buffer flash address\u003d0x%\" PRIx32, address);"}],"source_content_type":"text/x-csrc","patch_set":20,"id":"49abc23a_c0d5a7a0","line":337,"in_reply_to":"4c04f91e_dd8319f3","updated":"2022-09-06 17:06:42.000000000","message":"I agree. I removed redundant code, and made it explicit, that same asm code is used to launch functions from ROM.","commit_id":"f0912e6b21ed4470b4c91d3905a2df9fbcb89e87"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"0efdecb743aac1046447f8fc675b19df9ef0f243","unresolved":true,"context_lines":[{"line_number":746,"context_line":"\tdap_put_ap(ap);"},{"line_number":747,"context_line":""},{"line_number":748,"context_line":"\tuint32_t key;"},{"line_number":749,"context_line":"\tretval \u003d mem_ap_read_atomic_u32(ap, RSL10_FLASH_ADDRESS_LOCK_INFO_SETTING, \u0026key);"},{"line_number":750,"context_line":"\tLOG_INFO(\"mem read: 0x%08\" PRIx32, key);"},{"line_number":751,"context_line":""},{"line_number":752,"context_line":"\tif (key \u003d\u003d RSL10_KEY_DEBUG_LOCK) {"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"f57ccd85_47e384db","line":749,"updated":"2022-09-14 08:37:43.000000000","message":"the value assigned to retval is never used. This causes clang to issue a warning\nhttps://build.openocd.org/job/openocd-clang/1112/clang/new/\nThe value \u0027key\u0027 is relevant for the following code, so I this here you should check the value and stop execution if !\u003d ERROR_OK\nCould you please propose the fix in a new patch? While I can do it, I cannot test this driver.","commit_id":"ca52cfb2b34d684d10e9c91eeb2c6a66a1448b9f"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"a2faa30870a7b1e5117c6206cd72ff95fc411035","unresolved":false,"context_lines":[{"line_number":746,"context_line":"\tdap_put_ap(ap);"},{"line_number":747,"context_line":""},{"line_number":748,"context_line":"\tuint32_t key;"},{"line_number":749,"context_line":"\tretval \u003d mem_ap_read_atomic_u32(ap, RSL10_FLASH_ADDRESS_LOCK_INFO_SETTING, \u0026key);"},{"line_number":750,"context_line":"\tLOG_INFO(\"mem read: 0x%08\" PRIx32, key);"},{"line_number":751,"context_line":""},{"line_number":752,"context_line":"\tif (key \u003d\u003d RSL10_KEY_DEBUG_LOCK) {"}],"source_content_type":"text/x-csrc","patch_set":22,"id":"afc0e19d_bfedf46a","line":749,"in_reply_to":"f57ccd85_47e384db","updated":"2022-09-14 12:27:17.000000000","message":"Created new patch https://review.openocd.org/c/openocd/+/7194 , to fix this issue.","commit_id":"ca52cfb2b34d684d10e9c91eeb2c6a66a1448b9f"}],"src/flash/nor/rsl10.h":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ce24fde0b37b56975db028b99ec31893c544c4df","unresolved":true,"context_lines":[{"line_number":6,"context_line":" ***************************************************************************/"},{"line_number":7,"context_line":""},{"line_number":8,"context_line":"#ifndef RSL10_H_"},{"line_number":9,"context_line":"#define RSL10_H_"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"#define BIT(n) (1UL \u003c\u003c (n))"},{"line_number":12,"context_line":"#define WRITE_U32(reg, value)                                                  \\"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"a58d18a3_19d89c70","line":9,"updated":"2022-08-15 16:01:38.000000000","message":"this file is only used by rsl10.c\nCan the content of this file moved directly inside rsl10.c?\nOther files in src/flash/nor/ have the same problem, I plan to drop several file .h in the future.","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"e49edf7bb17f5c61ac88b1d751e88a125467cc04","unresolved":false,"context_lines":[{"line_number":6,"context_line":" ***************************************************************************/"},{"line_number":7,"context_line":""},{"line_number":8,"context_line":"#ifndef RSL10_H_"},{"line_number":9,"context_line":"#define RSL10_H_"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"#define BIT(n) (1UL \u003c\u003c (n))"},{"line_number":12,"context_line":"#define WRITE_U32(reg, value)                                                  \\"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"1ed1d723_f9cd27ee","line":9,"in_reply_to":"a58d18a3_19d89c70","updated":"2022-08-15 22:08:52.000000000","message":"Done","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ce24fde0b37b56975db028b99ec31893c544c4df","unresolved":true,"context_lines":[{"line_number":8,"context_line":"#ifndef RSL10_H_"},{"line_number":9,"context_line":"#define RSL10_H_"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"#define BIT(n) (1UL \u003c\u003c (n))"},{"line_number":12,"context_line":"#define WRITE_U32(reg, value)                                                  \\"},{"line_number":13,"context_line":"\tdo {                                                                       \\"},{"line_number":14,"context_line":"\t\tres \u003d target_write_u32(bank-\u003etarget, reg, value);                      \\"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"424efabf_2f6e5b8c","line":11,"updated":"2022-08-15 16:01:38.000000000","message":"We already have this macro in \u003chelper/bits.h\u003e","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"e49edf7bb17f5c61ac88b1d751e88a125467cc04","unresolved":false,"context_lines":[{"line_number":8,"context_line":"#ifndef RSL10_H_"},{"line_number":9,"context_line":"#define RSL10_H_"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"#define BIT(n) (1UL \u003c\u003c (n))"},{"line_number":12,"context_line":"#define WRITE_U32(reg, value)                                                  \\"},{"line_number":13,"context_line":"\tdo {                                                                       \\"},{"line_number":14,"context_line":"\t\tres \u003d target_write_u32(bank-\u003etarget, reg, value);                      \\"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"b8df2394_32541a66","line":11,"in_reply_to":"424efabf_2f6e5b8c","updated":"2022-08-15 22:08:52.000000000","message":"Done","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ce24fde0b37b56975db028b99ec31893c544c4df","unresolved":true,"context_lines":[{"line_number":9,"context_line":"#define RSL10_H_"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"#define BIT(n) (1UL \u003c\u003c (n))"},{"line_number":12,"context_line":"#define WRITE_U32(reg, value)                                                  \\"},{"line_number":13,"context_line":"\tdo {                                                                       \\"},{"line_number":14,"context_line":"\t\tres \u003d target_write_u32(bank-\u003etarget, reg, value);                      \\"},{"line_number":15,"context_line":"\t\tif (res !\u003d ERROR_OK)                                                   \\"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"0abe84a8_c829aee4","line":12,"updated":"2022-08-15 16:01:38.000000000","message":"I\u0027m not really in favor of using these macros WRITE_U32(), READ_U32() and OK().\nCan be useful if you analyze the code on a tiny display, but in general they make the code less readable.\nAnyway, I will not force you to inline the code, if you prefer keeping it in this way","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"e49edf7bb17f5c61ac88b1d751e88a125467cc04","unresolved":false,"context_lines":[{"line_number":9,"context_line":"#define RSL10_H_"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"#define BIT(n) (1UL \u003c\u003c (n))"},{"line_number":12,"context_line":"#define WRITE_U32(reg, value)                                                  \\"},{"line_number":13,"context_line":"\tdo {                                                                       \\"},{"line_number":14,"context_line":"\t\tres \u003d target_write_u32(bank-\u003etarget, reg, value);                      \\"},{"line_number":15,"context_line":"\t\tif (res !\u003d ERROR_OK)                                                   \\"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"939fa595_afea225d","line":12,"in_reply_to":"0abe84a8_c829aee4","updated":"2022-08-15 22:08:52.000000000","message":"Done","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ce24fde0b37b56975db028b99ec31893c544c4df","unresolved":true,"context_lines":[{"line_number":30,"context_line":"\t\t\treturn res;                                                        \\"},{"line_number":31,"context_line":"\t} while (0)"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"enum rsl10_flash_addresses {"},{"line_number":34,"context_line":"\tRSL10_FLASH_MAIN_ADDRESS \u003d 0x00100000,"},{"line_number":35,"context_line":"\tRSL10_FLASH_NVR1_ADDRESS \u003d 0x00080000,"},{"line_number":36,"context_line":"\tRSL10_FLASH_NVR2_ADDRESS \u003d 0x00080800,"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"b7871540_837d1ce7","line":33,"updated":"2022-08-15 16:01:38.000000000","message":"Is there any reason for using enum here and below?\nUsually enum is used as specific type passed to or returned from functions, so we \"could\" check if the value is out-of the list of possibilities of the enum.\nBut in rsl10.c I do not see such use cases.\nCan all these enum be converted in #define ?\nMaybe also rename them for functionality:\nRSL10_FLASH_ADDRESS_{MAIN,NVR[1-4]}\nRSL10_FLASH_REG_{MAIN_WRITE_UNLOCK,MAIN_CTRL,...} plus the bits should be better as \u003creg-name\u003e_\u003cbit_name\u003e, e.g. RSL10_FLASH_REG_NVR1_W_ENABLE\nRSL10_FLASH_KEY_{MAIN,NVR}\nRSL10_ROM_CMD_{WRITE_WORD_PAIR,WRITE_BUFFER,...}","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"e49edf7bb17f5c61ac88b1d751e88a125467cc04","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\t\t\treturn res;                                                        \\"},{"line_number":31,"context_line":"\t} while (0)"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"enum rsl10_flash_addresses {"},{"line_number":34,"context_line":"\tRSL10_FLASH_MAIN_ADDRESS \u003d 0x00100000,"},{"line_number":35,"context_line":"\tRSL10_FLASH_NVR1_ADDRESS \u003d 0x00080000,"},{"line_number":36,"context_line":"\tRSL10_FLASH_NVR2_ADDRESS \u003d 0x00080800,"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"76675658_cd18fc0f","line":33,"in_reply_to":"b7871540_837d1ce7","updated":"2022-08-15 22:08:52.000000000","message":"Done","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ce24fde0b37b56975db028b99ec31893c544c4df","unresolved":true,"context_lines":[{"line_number":80,"context_line":"\tRSL10_ROM_ERASE_ALL       \u003d 0x48,"},{"line_number":81,"context_line":"};"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"enum rsl10_flash_status {"},{"line_number":84,"context_line":"\tRSL10_FLASH_ERR_NONE              \u003d 0x0,"},{"line_number":85,"context_line":"\tRSL10_FLASH_ERR_GENERAL_FAILURE   \u003d 0x1,"},{"line_number":86,"context_line":"\tRSL10_FLASH_ERR_WRITE_NOT_ENABLED \u003d 0x2,"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"4a0cd3dc_a1529b80","line":83,"updated":"2022-08-15 16:01:38.000000000","message":"This could be an enum, because it\u0027s returned by the ROM code.\nBut your code only uses the first, the other are unused.\nI suggest you to keep the enum, add a last item \"RSL10_FLASH_MAX_ERR_CODES\" with a comment /* must be the last one */, define\n static const char *rsl10_error_list[] \u003d {\n   [RSL10_FLASH_ERR_GENERAL_FAILURE] \u003d \"general failure\",\n   [RSL10_FLASH_ERR_WRITE_NOT_ENABLED] \u003d \"write not enabled\",\n   ...\n };\n\ncreate a decoding function\n const char *rsl10_error(enum rsl10_flash_status x)\n {\n   if (x \u003e\u003d RSL10_FLASH_MAX_ERR_CODES || !rsl10_error_list[x])\n     return \"unknown\";\n   return rsl10_error_list[x];\n }\n\nand in the code replace\n LOG_ERROR(\"RSL10 ERASE ERROR: %d\", algo_ret);\n LOG_ERROR(\"RSL10 WRITE ERROR: %d\", algo_ret);\n\nwith\n LOG_ERROR(\"RSL10 ERASE ERROR: \u0027%s\u0027 (%d)\", rsl10_error(algo_ret), algo_ret);","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"e49edf7bb17f5c61ac88b1d751e88a125467cc04","unresolved":false,"context_lines":[{"line_number":80,"context_line":"\tRSL10_ROM_ERASE_ALL       \u003d 0x48,"},{"line_number":81,"context_line":"};"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"enum rsl10_flash_status {"},{"line_number":84,"context_line":"\tRSL10_FLASH_ERR_NONE              \u003d 0x0,"},{"line_number":85,"context_line":"\tRSL10_FLASH_ERR_GENERAL_FAILURE   \u003d 0x1,"},{"line_number":86,"context_line":"\tRSL10_FLASH_ERR_WRITE_NOT_ENABLED \u003d 0x2,"}],"source_content_type":"text/x-csrc","patch_set":10,"id":"9eccd2d2_ba685e3e","line":83,"in_reply_to":"4a0cd3dc_a1529b80","updated":"2022-08-15 22:08:52.000000000","message":"Done","commit_id":"cb3b7b25035e321062ce153fb76340460213c126"}],"tcl/target/rsl10.cfg":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"08c59b8da6f91edb8619417a33cbce7dc0ec5452","unresolved":true,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"$_TARGETNAME configure -event examine-fail rsl10_lock_warning"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"proc rsl10_lock_warning {} {"},{"line_number":43,"context_line":"    echo \"****** WARNING ******\""},{"line_number":44,"context_line":"    echo \"RSL10 device probably has lock engaged.\""},{"line_number":45,"context_line":"    echo \"Debug access is denied.\""}],"source_content_type":"text/x-ttcn-cfg","patch_set":13,"id":"5f9c283f_a4c646ef","line":42,"range":{"start_line":42,"start_character":5,"end_line":42,"end_character":24},"updated":"2022-08-17 08:11:08.000000000","message":"Would not be possible to detect the locked device and suppress the warning if examine failed for other reason? If the real reason is e.g. bad connection, the message could be misleading.\nAt least the IDR testing as used in nrf52.cfg nrf52_recover could eliminate broken connection.","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8590cdf18661e4bf85f2ada03dd87739cc645fc5","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"$_TARGETNAME configure -event examine-fail rsl10_lock_warning"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"proc rsl10_lock_warning {} {"},{"line_number":43,"context_line":"    echo \"****** WARNING ******\""},{"line_number":44,"context_line":"    echo \"RSL10 device probably has lock engaged.\""},{"line_number":45,"context_line":"    echo \"Debug access is denied.\""}],"source_content_type":"text/x-ttcn-cfg","patch_set":13,"id":"a65f64f9_8383fcaf","line":42,"range":{"start_line":42,"start_character":5,"end_line":42,"end_character":24},"in_reply_to":"5f9c283f_a4c646ef","updated":"2022-08-17 23:33:15.000000000","message":"Done","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"08c59b8da6f91edb8619417a33cbce7dc0ec5452","unresolved":true,"context_lines":[{"line_number":49,"context_line":"    poll off"},{"line_number":50,"context_line":"}"},{"line_number":51,"context_line":""},{"line_number":52,"context_line":"proc rsl10_unlock {p0 p1 p2 p3} {"},{"line_number":53,"context_line":"    set target [target current]"},{"line_number":54,"context_line":"    set dap [$target cget -dap]"},{"line_number":55,"context_line":"    poll off"}],"source_content_type":"text/x-ttcn-cfg","patch_set":13,"id":"63949c4a_e0e3ecd1","line":52,"range":{"start_line":52,"start_character":5,"end_line":52,"end_character":18},"updated":"2022-08-17 08:11:08.000000000","message":"It could be possible to implement unlock in .c driver.\n\nUnfortunately the current OpenOCD code blocks target_read/write_xxx()\noperations until the target is successfully examined. So the driver\nshould use low level mem_ap_write_u32() with dap_run() or mem_ap_write_buf()\nto poke the key into the locked device.\n\nThe Tcl implementation is not nice but for this purpose seems acceptable. Just please add comment about non-default bits set in CSW. Also the next op should be commented as memory write @ 0x400000f0 with addr auto incr.","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8590cdf18661e4bf85f2ada03dd87739cc645fc5","unresolved":false,"context_lines":[{"line_number":49,"context_line":"    poll off"},{"line_number":50,"context_line":"}"},{"line_number":51,"context_line":""},{"line_number":52,"context_line":"proc rsl10_unlock {p0 p1 p2 p3} {"},{"line_number":53,"context_line":"    set target [target current]"},{"line_number":54,"context_line":"    set dap [$target cget -dap]"},{"line_number":55,"context_line":"    poll off"}],"source_content_type":"text/x-ttcn-cfg","patch_set":13,"id":"25d9146a_de00e291","line":52,"range":{"start_line":52,"start_character":5,"end_line":52,"end_character":18},"in_reply_to":"63949c4a_e0e3ecd1","updated":"2022-08-17 23:33:15.000000000","message":"Removed rsl10_unlock from target/rsl10.cfg, and implemented exact same sequence in rsl10.c flash driver, as function rsl10_unlock_command.","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"08c59b8da6f91edb8619417a33cbce7dc0ec5452","unresolved":true,"context_lines":[{"line_number":66,"context_line":"    $dap apreg 0 12 $p3"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    $dap apreg 0 12"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    # restore debug"},{"line_number":71,"context_line":"    reset init"},{"line_number":72,"context_line":"    flash protect 3 0 0 off"}],"source_content_type":"text/x-ttcn-cfg","patch_set":13,"id":"699e524b_4d44b23a","line":69,"updated":"2022-08-17 08:11:08.000000000","message":"Shouldn\u0027t we restore default apcsw here?\n $dap apcsw default","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"},{"author":{"_account_id":1002019,"name":"Toms Stūrmanis","email":"toms.sturmanis@gmail.com","username":"danoms"},"change_message_id":"8590cdf18661e4bf85f2ada03dd87739cc645fc5","unresolved":false,"context_lines":[{"line_number":66,"context_line":"    $dap apreg 0 12 $p3"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    $dap apreg 0 12"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    # restore debug"},{"line_number":71,"context_line":"    reset init"},{"line_number":72,"context_line":"    flash protect 3 0 0 off"}],"source_content_type":"text/x-ttcn-cfg","patch_set":13,"id":"a222ff21_0ef973c6","line":69,"in_reply_to":"699e524b_4d44b23a","updated":"2022-08-17 23:33:15.000000000","message":"Done","commit_id":"467e6ae26d79b0a86125601d098150c2850d59c2"}]}
