)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":4,"context_line":"Commit:     Anton D. Kachalov \u003cmouse@ya.ru\u003e"},{"line_number":5,"context_line":"CommitDate: 2022-12-18 18:20:04 +0100"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add support for Nordic nRF9160."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Original patch by Nguyen Hoan Hoang \u003chnhoan@i-syst.com\u003e"},{"line_number":10,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"8eac8523_804f0255","line":7,"updated":"2022-12-18 22:34:32.000000000","message":"Please change the first line as:\nflash: nor: add support for Nordic nRF9160","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"5fecda143463f0a32dfba91e8049d7be0c0bf9c0","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Anton D. Kachalov \u003cmouse@ya.ru\u003e"},{"line_number":5,"context_line":"CommitDate: 2022-12-18 18:20:04 +0100"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add support for Nordic nRF9160."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Original patch by Nguyen Hoan Hoang \u003chnhoan@i-syst.com\u003e"},{"line_number":10,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"fc863d91_444510ae","line":7,"in_reply_to":"8eac8523_804f0255","updated":"2022-12-19 22:24:20.000000000","message":"Done","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"}],"/PATCHSET_LEVEL":[{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"aa99e9d4f6c0b8b3cf1968444e54039da98922e9","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"985cf155_4d97ab90","updated":"2022-12-18 15:17:04.000000000","message":"This patch being adopted from https://sourceforge.net/p/openocd-nrf91/openocd/ci/master/tree/","commit_id":"d2d6c476a1673db293f27011d1fcaa4edfb6a415"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"3477546bd923c6978eee1ffc1b4e6809b845883a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"1acf2f66_5213443a","updated":"2022-12-18 15:47:45.000000000","message":"This patch being adopted from https://sourceforge.net/p/openocd-nrf91/openocd/ci/master/tree/","commit_id":"02ba2bf8a5cd4e4b3f0a5ec5e260b344caff53ce"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"3112d15f_e2f97010","updated":"2022-12-18 22:34:32.000000000","message":"Thanks for this patch.\nI\u0027m not expert on flash driver, so it would be better waiting for other reviewers.\nIn mean time, I have spotted something more general to be improved","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"51e5dce49bcff245c0ad1c8508758abd5b0a6a1d","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":8,"id":"e5a2175e_5d809302","updated":"2022-12-19 22:21:16.000000000","message":"The other problem that I have once migrated the code from 0.10.0 version to the current dev is that it stopped working properly:\n\n```\nError erasing flash with vFlashErase packet\nSWD DPIDR 0x6ba02477\nPolling target nrf9160.cpu failed, trying to reexamine\nSWD DPIDR 0x6ba02477\nExamination failed, GDB will be halted. Polling again in 100ms\nSWD DPIDR 0x6ba02477\nSWD DPIDR 0x6ba02477\nSWD DPIDR 0x6ba02477\nSWD DPIDR 0x6ba02477\nSWD DPIDR 0x6ba02477\n[nrf9160.cpu] AP write error, reset will not halt\nSWD DPIDR 0x6ba02477\n[nrf9160.cpu] DP initialisation failed\n```\n\nAnd in debugging log I have something like this:\n```\nDebug: 1539 398 jlink.c:2186 jlink_swd_run_queue(): SWD ack not OK: 2 WAIT\nError: 1540 398 arm_adi_v5.c:466 mem_ap_write(): Failed to write memory and, additionally, failed to find out where\nDebug: 1541 398 target.c:2723 target_write_u32(): failed: -5\nError: 1542 398 nrf91.c:182 nrf91_nvmc_read_only(): Failed to enable read-only operation\nError: 1543 398 core.c:36 flash_driver_erase(): failed erasing sectors 0 to 0\nDebug: 1544 398 target.c:1845 target_call_event_callbacks(): target event 25 (gdb-flash-erase-end) for core nrf9160.cpu\nDebug: 1545 398 gdb_server.c:407 gdb_log_outgoing_packet(): [nrf9160.cpu] sending packet: $E05#aa\nError: 1546 398 gdb_server.c:3336 gdb_v_packet(): flash_erase returned -5\n```\n\nThere was a significant amount of changes in arm_adi_v5.c and adi_v5_swd.c between versions.","commit_id":"8187e6fd1aba813cb8d40ead272b8c9e0c2ddf23"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"58362101d3ee1b75230e36910d370cdc80e63712","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":8,"id":"7e197244_ab053ac3","in_reply_to":"e5a2175e_5d809302","updated":"2022-12-26 19:13:12.000000000","message":"Was adapting another patch that combines nrf5x and nrf91 support.\nHave tested on nRF52840 and nRF9160 (Thingy91) and Circuitdojo-nrf9160. Both debugging and flashing as well as nRF52 series detection using generic \"nrf5\" driver instead of \"nrf52\".","commit_id":"8187e6fd1aba813cb8d40ead272b8c9e0c2ddf23"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"45acba5bf6addd18fc9e40d28286d9f0d0fb3303","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"d78c09e6_685ce1e2","updated":"2022-12-26 19:14:01.000000000","message":"I suppose, the \"nrf5.c\" should be renamed into \"nrfx.c\".","commit_id":"3be6e78b4605d133a1619e0152776565697dd628"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"6dd57b78810a5c0586b50de9fbbe49d4e54134a3","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":13,"id":"d8cf24c0_9022be32","updated":"2023-03-04 10:20:01.000000000","message":"Anton, sorry for the long delay on this\n\nYour patch-set 13 renames the file nrf5.c as nrfx.c\nThis makes much more difficult to review in gerrit what you have modified/improved.\nPlus, filename changes makes hard to follow git history when looking for some code historic.\nIt\u0027s preferable to keep the old filename, even when it starts covering other devices.\nWould you mind going back to previous filename?","commit_id":"19190be5743216f62c1aa363d3dd05c20add5965"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"6065a3c8d69e098542bc12888a53c512eb79c1a8","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":13,"id":"19eb4b5b_f53921b2","updated":"2023-01-21 20:38:04.000000000","message":"Any followup on this patch?","commit_id":"19190be5743216f62c1aa363d3dd05c20add5965"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"ea75a184bb9b4d9ae5431f208d272879b7f3d451","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":13,"id":"7f1d014b_4bfd2fc5","updated":"2023-03-03 13:33:21.000000000","message":"Gently ping","commit_id":"19190be5743216f62c1aa363d3dd05c20add5965"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"cc3f5b9be2bd87a16b7fef8a3ff1f8cb864232f4","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":13,"id":"0b9c0b73_8910d5f4","updated":"2023-12-29 12:31:51.000000000","message":"I wrote couple of comments to patchset 12 because patchset 13 does not allow comparison with the old nrf5 source","commit_id":"19190be5743216f62c1aa363d3dd05c20add5965"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"53a596a9592a56d919709df42a2b495419d33a73","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":13,"id":"5181584e_6bb73002","updated":"2024-06-24 05:21:15.000000000","message":"Should be abandoned as nRF9160 support is now merged as a part of nrf5 driver.\n8112: flash/nor/nrf5: add basic nRF53 and nRF91 support | https://review.openocd.org/c/openocd/+/8112\nand following ones in the relation chain","commit_id":"19190be5743216f62c1aa363d3dd05c20add5965"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"1a2144a78ebe925f1619e76aeffda06754722e07","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":13,"id":"bc3c487d_a74bd132","updated":"2023-12-27 18:26:08.000000000","message":"Some more problems:\n\nThis patch reverts following:\n7131: flash/nor/nrf5: don\u0027t misuse uint32_t for refcount | https://review.openocd.org/c/openocd/+/7131\n6163: flash/nor/nrf5: Fix data types and const correctness | https://review.openocd.org/c/openocd/+/6163\n5758: flash: fix typos and duplicated words | https://review.openocd.org/c/openocd/+/5758\n5348: flash/nor/nrf5: remove check for protected sector | https://review.openocd.org/c/openocd/+/5348\n4819: flash/nor/nrf5: remove useless page padding and UICR autoerase | https://review.openocd.org/c/openocd/+/4819\n\nand maybe others I missed.","commit_id":"19190be5743216f62c1aa363d3dd05c20add5965"},{"author":{"_account_id":1002220,"name":"Tomáš Beneš","email":"tomas@dronetag.cz","username":"optical-o"},"change_message_id":"6e6a8598d637d9700774c716f50e021908b025a2","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":13,"id":"dd91b1b5_a7e569e4","in_reply_to":"bc3c487d_a74bd132","updated":"2023-12-31 12:40:23.000000000","message":"I went through all of these and tried to reflect them into the current code. Will need to be checked by somebody who has access to the nrf51 platform.","commit_id":"19190be5743216f62c1aa363d3dd05c20add5965"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"f08a72a507ce10efc313e455b8e390a3997ecc87","unresolved":true,"context_lines":[],"source_content_type":"","patch_set":13,"id":"61ffd08d_d8cce8b7","in_reply_to":"d8cf24c0_9022be32","updated":"2023-03-04 12:23:53.000000000","message":"Antonio and Anton,\n\nI think that renaming a file could not impose a problem if\n git mv\n\nwere used. See 4209: nrf51: Rename to nrf5 | https://review.openocd.org/c/openocd/+/4209\n\nUnfortunately mainly after addressing Antonio\u0027s comments nrf5.c patch contains lot of changes absolutely not relevant to nRF9160 support.\nPlease split refactorization (renaming), the general nrf5 code changes and the new nRF9160 code.\n\nI\u0027m also strongly against overall renaming of all symbols with nrf5, nrf51 and nrf52 to nrfx.\nnrf51 is clue that this function, register or whatever is relevant to nRF51 series only, not nRF52 and probably not nRF9 either. This information is lost after renaming.\nYou may (or may not) rename nrf5 to nrfx where applicable for both nRF5 and nRF9 series.","commit_id":"19190be5743216f62c1aa363d3dd05c20add5965"}],"src/flash/nor/nrf5.c":[{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"cc3f5b9be2bd87a16b7fef8a3ff1f8cb864232f4","unresolved":true,"context_lines":[{"line_number":49,"context_line":""},{"line_number":50,"context_line":"#define REG_INDEX_MASK ((1 \u003c\u003c REG_INDEX_BITS) - 1)"},{"line_number":51,"context_line":""},{"line_number":52,"context_line":"#define FICR_ID (0 \u003c\u003c REG_INDEX_BITS)"},{"line_number":53,"context_line":"#define UICR_ID BIT(REG_INDEX_BITS)"},{"line_number":54,"context_line":"#define NVMC_ID (2 \u003c\u003c REG_INDEX_BITS)"},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"#define FICR_BASE FICR_ID"},{"line_number":57,"context_line":"#define UICR_BASE UICR_ID"},{"line_number":58,"context_line":"#define NVMC_BASE NVMC_ID"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"#define reg_index(r) ((r) \u0026 REG_INDEX_MASK)"},{"line_number":61,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"437c9d7f_c09d2c95","line":58,"range":{"start_line":52,"start_character":0,"end_line":58,"end_character":25},"updated":"2023-12-29 12:31:51.000000000","message":"Seems me useless, as the flash driver never uses ID part of register enum","commit_id":"775f992f2a41aae8973756a5c5d8a5081ac81b53"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"cc3f5b9be2bd87a16b7fef8a3ff1f8cb864232f4","unresolved":true,"context_lines":[{"line_number":234,"context_line":"\t[reg_index(NRFX_FICR_BLE_1MBIT3)]\t\u003d NRFX_UNIMPLEMENTED,"},{"line_number":235,"context_line":"\t[reg_index(NRFX_FICR_BLE_1MBIT4)]\t\u003d NRFX_UNIMPLEMENTED,"},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"\t[reg_index(NRFX_FICR_INFO_PART)]\t\u003d NRF9_FICR_REG(0x20c),"},{"line_number":238,"context_line":"\t[reg_index(NRFX_FICR_INFO_VARIANT)]\t\u003d NRF9_FICR_REG(0x210),"},{"line_number":239,"context_line":"\t[reg_index(NRFX_FICR_INFO_PACKAGE)]\t\u003d NRF9_FICR_REG(0x214),"},{"line_number":240,"context_line":"\t[reg_index(NRFX_FICR_INFO_RAM)]\t\t\u003d NRF9_FICR_REG(0x218),"},{"line_number":241,"context_line":"\t[reg_index(NRFX_FICR_INFO_FLASH)]\t\u003d NRF9_FICR_REG(0x21c),"},{"line_number":242,"context_line":"};"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"e04cf75f_f27c8a73","line":239,"range":{"start_line":237,"start_character":1,"end_line":239,"end_character":60},"updated":"2023-12-29 12:31:51.000000000","message":"The newest nRF9160 product spec (v2.1) dropped these registers!!!\nIt lists SIPINFO.PARTNO, SIPINFO.HWREVISION[n] and SIPINFO.VARIANT[n] instead\nat addresses 0x140+.\nThe vendor wants to complicate the chip detection as much as possible...","commit_id":"775f992f2a41aae8973756a5c5d8a5081ac81b53"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"cc3f5b9be2bd87a16b7fef8a3ff1f8cb864232f4","unresolved":true,"context_lines":[{"line_number":271,"context_line":"\treturn NRFX_UNIMPLEMENTED;"},{"line_number":272,"context_line":"}"},{"line_number":273,"context_line":""},{"line_number":274,"context_line":"enum nrfx_uicr_registers {"},{"line_number":275,"context_line":"\tNRFX_UICR_CLENR0 \u003d UICR_BASE,"},{"line_number":276,"context_line":"\tNRFX_UICR_RBPCONF,"},{"line_number":277,"context_line":"\tNRFX_UICR_XTALFREQ,"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"45d79fc2_cf6d83cc","line":274,"range":{"start_line":274,"start_character":5,"end_line":274,"end_character":25},"updated":"2023-12-29 12:31:51.000000000","message":"In UICR, there is not much common between different series.\nDoes general mapping make sense for sharing APPROTECT only between nRF52 and 53/91?","commit_id":"775f992f2a41aae8973756a5c5d8a5081ac81b53"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"cc3f5b9be2bd87a16b7fef8a3ff1f8cb864232f4","unresolved":true,"context_lines":[{"line_number":331,"context_line":"#define NRF5_NVMC_REG(offset) (NRF5_NVMC_BASE + (offset))"},{"line_number":332,"context_line":"#define NRF9_NVMC_REG(offset) (NRF9_NVMC_BASE + (offset))"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"enum nrfx_nvmc_registers {"},{"line_number":335,"context_line":"\tNRFX_NVMC_READY \u003d NVMC_BASE,"},{"line_number":336,"context_line":"\tNRFX_NVMC_CONFIG,"},{"line_number":337,"context_line":"\tNRFX_NVMC_ERASEPAGE,"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"7e19a7d0_a94484a8","line":334,"range":{"start_line":334,"start_character":5,"end_line":334,"end_character":25},"updated":"2023-12-29 12:31:51.000000000","message":"NVMC registers keep the same offsets in NVMC address range.\nJust the base of NVMC differs between nRF51/52 and nRF53/91.\nBut it going to be more complicated with Cortex-M33 secure/non secure modes handling as the NVMC is mapped twice - once as secure peripheral, second time as non secure. stm32l4x.c code shows that handling flash in both security modes is real hell.","commit_id":"775f992f2a41aae8973756a5c5d8a5081ac81b53"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"cc3f5b9be2bd87a16b7fef8a3ff1f8cb864232f4","unresolved":true,"context_lines":[{"line_number":581,"context_line":""},{"line_number":582,"context_line":"\t/* The driver fully autodetects nRF52 series devices by FICR INFO,"},{"line_number":583,"context_line":"\t * no need for nRF52xxx HWIDs in this table */"},{"line_number":584,"context_line":""},{"line_number":585,"context_line":"\t/* nRF52810 Devices */"},{"line_number":586,"context_line":"\tNRF52_DEVICE_DEF(0x0142, 52810, \"QFAA\", \"B0\",    192,\tNRFX_FEATURE_BPROT),"},{"line_number":587,"context_line":"\tNRF52_DEVICE_DEF(0x0143, 52810, \"QCAA\", \"C0\",    192,\tNRFX_FEATURE_BPROT),"},{"line_number":588,"context_line":""},{"line_number":589,"context_line":"\t/* nRF52832 Devices */"},{"line_number":590,"context_line":"\tNRF52_DEVICE_DEF(0x00C7, 52832, \"QFAA\", \"B0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":591,"context_line":"\tNRF52_DEVICE_DEF(0x0139, 52832, \"QFAA\", \"E0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":592,"context_line":"\tNRF52_DEVICE_DEF(0x00E3, 52832, \"CIAA\", \"B0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":593,"context_line":""},{"line_number":594,"context_line":"\t/* nRF52840 Devices */"},{"line_number":595,"context_line":"\tNRF52_DEVICE_DEF(0x0150, 52840, \"QIAA\", \"C0\",    1024, NRFX_FEATURE_ACL_PROT),"},{"line_number":596,"context_line":"\tNRF52_DEVICE_DEF(0x0164, 52840, \"0DAA\", \"CK\",    1024, NRFX_FEATURE_ACL_PROT),"},{"line_number":597,"context_line":""},{"line_number":598,"context_line":"\t/* nRF91xx Devices */"},{"line_number":599,"context_line":"\tNRF91_DEVICE_DEF(9120, \"0BAA\", \"QF\", 1024),"},{"line_number":600,"context_line":"};"},{"line_number":601,"context_line":""},{"line_number":602,"context_line":"struct nrfx_device_package {"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"c6028ab7_d3fc2561","line":599,"range":{"start_line":584,"start_character":0,"end_line":599,"end_character":44},"updated":"2023-12-29 12:31:51.000000000","message":"These changes are wrong. The table is needed just for old nRF51 chips (pre rev 3) which has no part number in FICR. No point in removing #if 0 (this part of table going to be dropped instead) and defining the NRF91_DEVICE_DEF is simply nonsense.","commit_id":"775f992f2a41aae8973756a5c5d8a5081ac81b53"},{"author":{"_account_id":1002220,"name":"Tomáš Beneš","email":"tomas@dronetag.cz","username":"optical-o"},"change_message_id":"50ccd4f35ef7605bfa3e94029240c1b80debe134","unresolved":true,"context_lines":[{"line_number":581,"context_line":""},{"line_number":582,"context_line":"\t/* The driver fully autodetects nRF52 series devices by FICR INFO,"},{"line_number":583,"context_line":"\t * no need for nRF52xxx HWIDs in this table */"},{"line_number":584,"context_line":""},{"line_number":585,"context_line":"\t/* nRF52810 Devices */"},{"line_number":586,"context_line":"\tNRF52_DEVICE_DEF(0x0142, 52810, \"QFAA\", \"B0\",    192,\tNRFX_FEATURE_BPROT),"},{"line_number":587,"context_line":"\tNRF52_DEVICE_DEF(0x0143, 52810, \"QCAA\", \"C0\",    192,\tNRFX_FEATURE_BPROT),"},{"line_number":588,"context_line":""},{"line_number":589,"context_line":"\t/* nRF52832 Devices */"},{"line_number":590,"context_line":"\tNRF52_DEVICE_DEF(0x00C7, 52832, \"QFAA\", \"B0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":591,"context_line":"\tNRF52_DEVICE_DEF(0x0139, 52832, \"QFAA\", \"E0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":592,"context_line":"\tNRF52_DEVICE_DEF(0x00E3, 52832, \"CIAA\", \"B0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":593,"context_line":""},{"line_number":594,"context_line":"\t/* nRF52840 Devices */"},{"line_number":595,"context_line":"\tNRF52_DEVICE_DEF(0x0150, 52840, \"QIAA\", \"C0\",    1024, NRFX_FEATURE_ACL_PROT),"},{"line_number":596,"context_line":"\tNRF52_DEVICE_DEF(0x0164, 52840, \"0DAA\", \"CK\",    1024, NRFX_FEATURE_ACL_PROT),"},{"line_number":597,"context_line":""},{"line_number":598,"context_line":"\t/* nRF91xx Devices */"},{"line_number":599,"context_line":"\tNRF91_DEVICE_DEF(9120, \"0BAA\", \"QF\", 1024),"},{"line_number":600,"context_line":"};"},{"line_number":601,"context_line":""},{"line_number":602,"context_line":"struct nrfx_device_package {"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"93675704_4043208b","line":599,"range":{"start_line":584,"start_character":0,"end_line":599,"end_character":44},"in_reply_to":"4247ee5e_0f19c37e","updated":"2023-12-31 14:00:53.000000000","message":"I have opened #8062 I will use it to start the work again. As you suggested.\n\nI will probably use for inspiration both #7404 and #7739.","commit_id":"775f992f2a41aae8973756a5c5d8a5081ac81b53"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"4ac432dc6ca5322cfcb961d618f475d70110e8bc","unresolved":true,"context_lines":[{"line_number":581,"context_line":""},{"line_number":582,"context_line":"\t/* The driver fully autodetects nRF52 series devices by FICR INFO,"},{"line_number":583,"context_line":"\t * no need for nRF52xxx HWIDs in this table */"},{"line_number":584,"context_line":""},{"line_number":585,"context_line":"\t/* nRF52810 Devices */"},{"line_number":586,"context_line":"\tNRF52_DEVICE_DEF(0x0142, 52810, \"QFAA\", \"B0\",    192,\tNRFX_FEATURE_BPROT),"},{"line_number":587,"context_line":"\tNRF52_DEVICE_DEF(0x0143, 52810, \"QCAA\", \"C0\",    192,\tNRFX_FEATURE_BPROT),"},{"line_number":588,"context_line":""},{"line_number":589,"context_line":"\t/* nRF52832 Devices */"},{"line_number":590,"context_line":"\tNRF52_DEVICE_DEF(0x00C7, 52832, \"QFAA\", \"B0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":591,"context_line":"\tNRF52_DEVICE_DEF(0x0139, 52832, \"QFAA\", \"E0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":592,"context_line":"\tNRF52_DEVICE_DEF(0x00E3, 52832, \"CIAA\", \"B0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":593,"context_line":""},{"line_number":594,"context_line":"\t/* nRF52840 Devices */"},{"line_number":595,"context_line":"\tNRF52_DEVICE_DEF(0x0150, 52840, \"QIAA\", \"C0\",    1024, NRFX_FEATURE_ACL_PROT),"},{"line_number":596,"context_line":"\tNRF52_DEVICE_DEF(0x0164, 52840, \"0DAA\", \"CK\",    1024, NRFX_FEATURE_ACL_PROT),"},{"line_number":597,"context_line":""},{"line_number":598,"context_line":"\t/* nRF91xx Devices */"},{"line_number":599,"context_line":"\tNRF91_DEVICE_DEF(9120, \"0BAA\", \"QF\", 1024),"},{"line_number":600,"context_line":"};"},{"line_number":601,"context_line":""},{"line_number":602,"context_line":"struct nrfx_device_package {"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"4247ee5e_0f19c37e","line":599,"range":{"start_line":584,"start_character":0,"end_line":599,"end_character":44},"in_reply_to":"6b7b4f79_d3e69881","updated":"2023-12-31 13:53:10.000000000","message":"Tomáši, considering missing code changes in #7404 and not quite useful full address mapping I would propose the following:\n\n- start over from git master nrf5.c code and use 7404 as inspiration only\n- introduce a struct with addresses of nvmc base, ficr base, uicr base, watchdog refresh, and ficr.info.part, codepagesize, codesize, eventually info.package and info.ram\n- add two fixed instances of map struct, one for nRF51/52 and the second for nRF53/91\n- add pointer to the struct to struct nrf5_info\n- successful probe sets the pointer to the proper map struct\n- the probe could easily autodetect all devices - nRF51/52 reads all zeros\nat area @ 0x00FF0000 (nRF53/91 FICR) - probe may try FICR @ 0x00FF0000\nfirst and if gets no meaningful part number then try FICR @ 0x10000000\n- add nvmc reg r/w helpers to use nvmc base plus register offset\n- add erase page branch for nRF53/91\n- use proper watchdog address for target_run_flash_async_algorithm()\n- for the moment ignore nrf5_handle_info_command - or just force error return in case of nRF53/91 - this is an old and seldom used code, mostly works with nRF51 only.\n\nIMO It should be enough for basic flash handling of nRF91. Seems me easier than re-applying all missing patches to #7404 code.\nI will assist with testing on nRF51/52 devices.\n\nPlease avoid renaming at all or split renaming from other code changes into a separate patch","commit_id":"775f992f2a41aae8973756a5c5d8a5081ac81b53"},{"author":{"_account_id":1002220,"name":"Tomáš Beneš","email":"tomas@dronetag.cz","username":"optical-o"},"change_message_id":"f09438e1dde0534bc036640411ea81235ff0bb35","unresolved":true,"context_lines":[{"line_number":581,"context_line":""},{"line_number":582,"context_line":"\t/* The driver fully autodetects nRF52 series devices by FICR INFO,"},{"line_number":583,"context_line":"\t * no need for nRF52xxx HWIDs in this table */"},{"line_number":584,"context_line":""},{"line_number":585,"context_line":"\t/* nRF52810 Devices */"},{"line_number":586,"context_line":"\tNRF52_DEVICE_DEF(0x0142, 52810, \"QFAA\", \"B0\",    192,\tNRFX_FEATURE_BPROT),"},{"line_number":587,"context_line":"\tNRF52_DEVICE_DEF(0x0143, 52810, \"QCAA\", \"C0\",    192,\tNRFX_FEATURE_BPROT),"},{"line_number":588,"context_line":""},{"line_number":589,"context_line":"\t/* nRF52832 Devices */"},{"line_number":590,"context_line":"\tNRF52_DEVICE_DEF(0x00C7, 52832, \"QFAA\", \"B0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":591,"context_line":"\tNRF52_DEVICE_DEF(0x0139, 52832, \"QFAA\", \"E0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":592,"context_line":"\tNRF52_DEVICE_DEF(0x00E3, 52832, \"CIAA\", \"B0\",    512,\tNRFX_FEATURE_BPROT),"},{"line_number":593,"context_line":""},{"line_number":594,"context_line":"\t/* nRF52840 Devices */"},{"line_number":595,"context_line":"\tNRF52_DEVICE_DEF(0x0150, 52840, \"QIAA\", \"C0\",    1024, NRFX_FEATURE_ACL_PROT),"},{"line_number":596,"context_line":"\tNRF52_DEVICE_DEF(0x0164, 52840, \"0DAA\", \"CK\",    1024, NRFX_FEATURE_ACL_PROT),"},{"line_number":597,"context_line":""},{"line_number":598,"context_line":"\t/* nRF91xx Devices */"},{"line_number":599,"context_line":"\tNRF91_DEVICE_DEF(9120, \"0BAA\", \"QF\", 1024),"},{"line_number":600,"context_line":"};"},{"line_number":601,"context_line":""},{"line_number":602,"context_line":"struct nrfx_device_package {"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"6b7b4f79_d3e69881","line":599,"range":{"start_line":584,"start_character":0,"end_line":599,"end_character":44},"in_reply_to":"c6028ab7_d3fc2561","updated":"2023-12-31 12:12:26.000000000","message":"I have looked at this and it is a little bit more complicated than it seems.\n\nThere are two passes through the table one to use chip-\u003ehwid to identify the spec structure. The second pass uses chip-\u003eficr_info.part, which is read from the ficr register.\n\nThe driver then subsequently uses the spec structure as the source of the information for legacy parts of the code. The newer code uses the FICR structure.  This probably needs to be somehow unified to be a little bit more readable.\n\nAdditionally, don\u0027t know whether nrfx_probe is always expected to probe the chip for the RAM/FLASH information even though it has multiple banks. So the chip might be already probed? Probably add all of the chip information into a single structure that will be clearly marked as probed and resolved. And then use it as the source of the information for subsequent operations.\n\nI will try to rework this area alone to make it more readable also I will revert the renaming of the nrf5.c -\u003e nrfx.c for now to make the changes more approachable.","commit_id":"775f992f2a41aae8973756a5c5d8a5081ac81b53"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"4ac432dc6ca5322cfcb961d618f475d70110e8bc","unresolved":true,"context_lines":[{"line_number":735,"context_line":"\tif (res !\u003d ERROR_OK)"},{"line_number":736,"context_line":"\t\tgoto error;"},{"line_number":737,"context_line":""},{"line_number":738,"context_line":"\tif (chip-\u003efamily !\u003d NRFX_FAMILY_91) {"},{"line_number":739,"context_line":"\t\tres \u003d nvmc_write(chip, erase_register, erase_value);"},{"line_number":740,"context_line":"\t\tif (res !\u003d ERROR_OK)"},{"line_number":741,"context_line":"\t\t\tgoto set_read_only;"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"303e366a_59e1c7a5","line":738,"updated":"2023-12-31 13:53:10.000000000","message":"Perhaps\n`|| !erase_addr`","commit_id":"775f992f2a41aae8973756a5c5d8a5081ac81b53"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"4ac432dc6ca5322cfcb961d618f475d70110e8bc","unresolved":true,"context_lines":[{"line_number":1315,"context_line":"{"},{"line_number":1316,"context_line":"\tLOG_DEBUG(\"Erasing all non-volatile memory\");"},{"line_number":1317,"context_line":"\treturn nrfx_nvmc_generic_erase(chip,"},{"line_number":1318,"context_line":"\t\t\t\t\t0,"},{"line_number":1319,"context_line":"\t\t\t\t\tNRFX_NVMC_ERASEALL,"},{"line_number":1320,"context_line":"\t\t\t\t\t0x00000001);"},{"line_number":1321,"context_line":"}"}],"source_content_type":"text/x-csrc","patch_set":12,"id":"f5ac1f11_f7274850","line":1318,"range":{"start_line":1318,"start_character":5,"end_line":1318,"end_character":7},"updated":"2023-12-31 13:53:10.000000000","message":"Does not work","commit_id":"775f992f2a41aae8973756a5c5d8a5081ac81b53"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"4ac432dc6ca5322cfcb961d618f475d70110e8bc","unresolved":true,"context_lines":[{"line_number":1354,"context_line":"\t\t}"},{"line_number":1355,"context_line":""},{"line_number":1356,"context_line":"\t\tres \u003d nrfx_nvmc_generic_erase(chip,"},{"line_number":1357,"context_line":"\t\t\t\t\t\t   0,"},{"line_number":1358,"context_line":"\t\t\t\t\t\t   NRFX_NVMC_ERASEUICR,"},{"line_number":1359,"context_line":"\t\t\t\t\t\t   0x00000001);"},{"line_number":1360,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":12,"id":"f8c73e39_0fd293b8","line":1357,"range":{"start_line":1357,"start_character":9,"end_line":1357,"end_character":11},"updated":"2023-12-31 13:53:10.000000000","message":"Does not work, nRF53/91 needs ERASEAL","commit_id":"775f992f2a41aae8973756a5c5d8a5081ac81b53"}],"src/flash/nor/nrf91.c":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":16,"context_line":" *                                                                         *"},{"line_number":17,"context_line":" *   You should have received a copy of the GNU General Public License     *"},{"line_number":18,"context_line":" *   along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e. *"},{"line_number":19,"context_line":" ***************************************************************************/"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"#ifdef HAVE_CONFIG_H"},{"line_number":22,"context_line":"#include \"config.h\""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"46b4cfe1_059bf7c3","line":19,"updated":"2022-12-18 22:34:32.000000000","message":"please remove all the GPL license text and left only the copyright:\n /***************************************************************************\n  *   Copyright (C) 2020 I-SYST inc.                                        *\n  *   hnhoan@i-syst.com                                                     *\n  ***************************************************************************/","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":false,"context_lines":[{"line_number":16,"context_line":" *                                                                         *"},{"line_number":17,"context_line":" *   You should have received a copy of the GNU General Public License     *"},{"line_number":18,"context_line":" *   along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e. *"},{"line_number":19,"context_line":" ***************************************************************************/"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"#ifdef HAVE_CONFIG_H"},{"line_number":22,"context_line":"#include \"config.h\""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"6141fc1a_421983b4","line":19,"in_reply_to":"46b4cfe1_059bf7c3","updated":"2022-12-19 22:14:56.000000000","message":"Done","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":30,"context_line":""},{"line_number":31,"context_line":"#define NRF91_FLASH_BASE\t\t\t\t0x00000000"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"// Factory Information Configuration Registers"},{"line_number":34,"context_line":"#define NRF91_FICR_BASE\t\t\t\t0x00ff0000"},{"line_number":35,"context_line":"#define NRF91_FICR_DEVICEID0\t\t(NRF91_FICR_BASE + 0x204)"},{"line_number":36,"context_line":"#define NRF91_FICR_DEVICEID1\t\t(NRF91_FICR_BASE + 0x208)"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"566432e6_3669c1fb","line":33,"updated":"2022-12-18 22:34:32.000000000","message":"please change this comment and the other as\n/* xxxx */","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":false,"context_lines":[{"line_number":30,"context_line":""},{"line_number":31,"context_line":"#define NRF91_FLASH_BASE\t\t\t\t0x00000000"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"// Factory Information Configuration Registers"},{"line_number":34,"context_line":"#define NRF91_FICR_BASE\t\t\t\t0x00ff0000"},{"line_number":35,"context_line":"#define NRF91_FICR_DEVICEID0\t\t(NRF91_FICR_BASE + 0x204)"},{"line_number":36,"context_line":"#define NRF91_FICR_DEVICEID1\t\t(NRF91_FICR_BASE + 0x208)"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"2945b3fc_30b5bde8","line":33,"in_reply_to":"566432e6_3669c1fb","updated":"2022-12-19 22:14:56.000000000","message":"Done","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":62,"context_line":"#define NRF91_NVMC_CONFIG_WEN\t\t1"},{"line_number":63,"context_line":"#define NRF91_NVMC_CONFIG_EEN\t\t2"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"#pragma pack(push, 4)"},{"line_number":66,"context_line":"typedef struct nrf_ficr_info {"},{"line_number":67,"context_line":"\tuint64_t id;"},{"line_number":68,"context_line":"\tuint32_t part;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"dd8ccd8b_2dc3b1cf","line":65,"updated":"2022-12-18 22:34:32.000000000","message":"I see below in nrf91_read_ficr_info() that you read this struct directly from the target, so you use pragma to properly pack the struct and get the data in the correct place.\nBut you have missed that host PC and target CPU can have different endianess.\nSo you _must_ convert the data from target in data for host.\nRemove this and next pragma.\nI will continue in nrf91_read_ficr_info().","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":false,"context_lines":[{"line_number":62,"context_line":"#define NRF91_NVMC_CONFIG_WEN\t\t1"},{"line_number":63,"context_line":"#define NRF91_NVMC_CONFIG_EEN\t\t2"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"#pragma pack(push, 4)"},{"line_number":66,"context_line":"typedef struct nrf_ficr_info {"},{"line_number":67,"context_line":"\tuint64_t id;"},{"line_number":68,"context_line":"\tuint32_t part;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"f1274f22_5f1e88c0","line":65,"in_reply_to":"dd8ccd8b_2dc3b1cf","updated":"2022-12-19 22:14:56.000000000","message":"Done","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":63,"context_line":"#define NRF91_NVMC_CONFIG_EEN\t\t2"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"#pragma pack(push, 4)"},{"line_number":66,"context_line":"typedef struct nrf_ficr_info {"},{"line_number":67,"context_line":"\tuint64_t id;"},{"line_number":68,"context_line":"\tuint32_t part;"},{"line_number":69,"context_line":"\tuint32_t variant;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"358afbdf_dcd2387b","line":66,"updated":"2022-12-18 22:34:32.000000000","message":"Please, no new typedef.\nUse \u0027struct nrf_ficr_info\u0027","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":false,"context_lines":[{"line_number":63,"context_line":"#define NRF91_NVMC_CONFIG_EEN\t\t2"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"#pragma pack(push, 4)"},{"line_number":66,"context_line":"typedef struct nrf_ficr_info {"},{"line_number":67,"context_line":"\tuint64_t id;"},{"line_number":68,"context_line":"\tuint32_t part;"},{"line_number":69,"context_line":"\tuint32_t variant;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"cbfd8b50_036c72a6","line":66,"in_reply_to":"358afbdf_dcd2387b","updated":"2022-12-19 22:14:56.000000000","message":"Done","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":76,"context_line":"} nrf_ficr_info_t;"},{"line_number":77,"context_line":"#pragma pack(pop)"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"typedef struct nrf91_chip {"},{"line_number":80,"context_line":"\tuint32_t refcount;"},{"line_number":81,"context_line":"\tbool probed;"},{"line_number":82,"context_line":"\tbool ficr_info_valid;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"cbddbfd2_89549497","line":79,"updated":"2022-12-18 22:34:32.000000000","message":"no new typedef, use \u0027struct nrf91_chip\u0027","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":false,"context_lines":[{"line_number":76,"context_line":"} nrf_ficr_info_t;"},{"line_number":77,"context_line":"#pragma pack(pop)"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"typedef struct nrf91_chip {"},{"line_number":80,"context_line":"\tuint32_t refcount;"},{"line_number":81,"context_line":"\tbool probed;"},{"line_number":82,"context_line":"\tbool ficr_info_valid;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"9a1ec080_dd890d30","line":79,"in_reply_to":"cbddbfd2_89549497","updated":"2022-12-19 22:14:56.000000000","message":"Done","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":112,"context_line":"{"},{"line_number":113,"context_line":"\tuint32_t ready;"},{"line_number":114,"context_line":"\tint res;"},{"line_number":115,"context_line":"\tint timeout_ms \u003d 340;"},{"line_number":116,"context_line":"\tint64_t ts_start \u003d timeval_ms();"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"\tdo {"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"0898b985_b41ed18f","line":115,"updated":"2022-12-18 22:34:32.000000000","message":"please add a comment to justify this value 340. Is it taken from some ref manual?","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":true,"context_lines":[{"line_number":112,"context_line":"{"},{"line_number":113,"context_line":"\tuint32_t ready;"},{"line_number":114,"context_line":"\tint res;"},{"line_number":115,"context_line":"\tint timeout_ms \u003d 340;"},{"line_number":116,"context_line":"\tint64_t ts_start \u003d timeval_ms();"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"\tdo {"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"417da391_f127dc7b","line":115,"in_reply_to":"0898b985_b41ed18f","updated":"2022-12-19 22:14:56.000000000","message":"From the datasheet (https://infocenter.nordicsemi.com/pdf/nan_041.pdf):\n\nNVMC — Non-volatile memory controller – has detailed specifications about timing for write/erase operations. For example, it takes 43 µs (max) to write one word in flash and it takes 173 ms (max) to erase all flash. \n\nSeems like 340 ms is a roughly a double value of the erase all operation. Perhaps, we should specify per operation wait timeout as argument regarding from where we call nrf91_wait_for_nvmc?\n\nThis timeout value (as well as 0x00000001) was derived from nrf5.c. There are many common functions including code style formatting, asserts and so on.","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"5fecda143463f0a32dfba91e8049d7be0c0bf9c0","unresolved":false,"context_lines":[{"line_number":112,"context_line":"{"},{"line_number":113,"context_line":"\tuint32_t ready;"},{"line_number":114,"context_line":"\tint res;"},{"line_number":115,"context_line":"\tint timeout_ms \u003d 340;"},{"line_number":116,"context_line":"\tint64_t ts_start \u003d timeval_ms();"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"\tdo {"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"a4a410f9_13dd2d19","line":115,"in_reply_to":"417da391_f127dc7b","updated":"2022-12-19 22:24:20.000000000","message":"Actually, those constants came from nrf5.c","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":120,"context_line":"\t\tif (res !\u003d ERROR_OK)"},{"line_number":121,"context_line":"\t\t\treturn res;"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"\t\tif (ready \u003d\u003d 0x00000001)"},{"line_number":124,"context_line":"\t\t\treturn ERROR_OK;"},{"line_number":125,"context_line":""},{"line_number":126,"context_line":"\t\tkeep_alive();"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"e3dd0bad_a5bb4f84","line":123,"updated":"2022-12-18 22:34:32.000000000","message":"can you define a macro for this 0x00000001 ?","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":false,"context_lines":[{"line_number":120,"context_line":"\t\tif (res !\u003d ERROR_OK)"},{"line_number":121,"context_line":"\t\t\treturn res;"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"\t\tif (ready \u003d\u003d 0x00000001)"},{"line_number":124,"context_line":"\t\t\treturn ERROR_OK;"},{"line_number":125,"context_line":""},{"line_number":126,"context_line":"\t\tkeep_alive();"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"5e19a267_e624989c","line":123,"in_reply_to":"e3dd0bad_a5bb4f84","updated":"2022-12-19 22:14:56.000000000","message":"Done","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":136,"context_line":"\tint res;"},{"line_number":137,"context_line":"\tres \u003d target_write_u32(chip-\u003etarget,"},{"line_number":138,"context_line":"\t\t\t       NRF91_NVMC_CONFIG,"},{"line_number":139,"context_line":"\t\t\t       NRF91_NVMC_CONFIG_EEN);//|NRF91_NVMC_CONFIG_WEN);"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"\tif (res !\u003d ERROR_OK) {"},{"line_number":142,"context_line":"\t\tLOG_ERROR(\"Failed to enable erase operation\");"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"5a0acab5_4cb59f55","line":139,"updated":"2022-12-18 22:34:32.000000000","message":"this part commented is .. what?\nMaybe you can add a comment\n/* TODO: do we need to set NRF91_NVMC_CONFIG_WEN too ? */","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":false,"context_lines":[{"line_number":136,"context_line":"\tint res;"},{"line_number":137,"context_line":"\tres \u003d target_write_u32(chip-\u003etarget,"},{"line_number":138,"context_line":"\t\t\t       NRF91_NVMC_CONFIG,"},{"line_number":139,"context_line":"\t\t\t       NRF91_NVMC_CONFIG_EEN);//|NRF91_NVMC_CONFIG_WEN);"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"\tif (res !\u003d ERROR_OK) {"},{"line_number":142,"context_line":"\t\tLOG_ERROR(\"Failed to enable erase operation\");"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"77567ec9_51c9e3e7","line":139,"in_reply_to":"5a0acab5_4cb59f55","updated":"2022-12-19 22:14:56.000000000","message":"Found in the datasheet:\n\nBefore a write can be performed, the NVMC must be enabled for writing in CONFIG.WEN. Similarly, before an erase can be performed, the NVMC must be enabled for erasing in CONFIG.EEN, see CONFIG on page 32. The user must make sure that writing and erasing are not enabled at the same time. Failing to do so may result in unpredictable behavior.\n\nMeans that both bits cannot be set the same time. Removing the commented value.","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":157,"context_line":"static int nrf91_nvmc_write_enable(nrf91_chip_t *chip)"},{"line_number":158,"context_line":"{"},{"line_number":159,"context_line":"\tint res;"},{"line_number":160,"context_line":"\tres \u003d target_write_u32(chip-\u003etarget,"},{"line_number":161,"context_line":"\t\t\t       NRF91_NVMC_CONFIG,"},{"line_number":162,"context_line":"\t\t\t       NRF91_NVMC_CONFIG_WEN);"},{"line_number":163,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"f0b2264e_1cb57af3","line":160,"updated":"2022-12-18 22:34:32.000000000","message":"please use directly\nint res \u003d target_write_u32(...\nalso in the rest of the code","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":false,"context_lines":[{"line_number":157,"context_line":"static int nrf91_nvmc_write_enable(nrf91_chip_t *chip)"},{"line_number":158,"context_line":"{"},{"line_number":159,"context_line":"\tint res;"},{"line_number":160,"context_line":"\tres \u003d target_write_u32(chip-\u003etarget,"},{"line_number":161,"context_line":"\t\t\t       NRF91_NVMC_CONFIG,"},{"line_number":162,"context_line":"\t\t\t       NRF91_NVMC_CONFIG_WEN);"},{"line_number":163,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"454044f9_7e5aa2cc","line":160,"in_reply_to":"f0b2264e_1cb57af3","updated":"2022-12-19 22:14:56.000000000","message":"Done","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":245,"context_line":""},{"line_number":246,"context_line":"\tchip-\u003eficr_info_valid \u003d false;"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"\tres \u003d target_read_buffer(chip-\u003etarget, NRF91_FICR_DEVICEID0, sizeof(nrf_ficr_info_t), (uint8_t *)\u0026ficr);"},{"line_number":249,"context_line":"\tif (res !\u003d ERROR_OK) {"},{"line_number":250,"context_line":"\t\tLOG_INFO(\"Couldn\u0027t read FICR INFO registers\");"},{"line_number":251,"context_line":"\t\treturn res;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"ef147800_e7fa6b49","line":248,"updated":"2022-12-18 22:34:32.000000000","message":"you need to define a buffer:\nuint8_t buf[40];\nthen\nres \u003d target_read_buffer(chip-\u003etarget, NRF91_FICR_DEVICEID0, sizeof(buf), buf);","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":false,"context_lines":[{"line_number":245,"context_line":""},{"line_number":246,"context_line":"\tchip-\u003eficr_info_valid \u003d false;"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"\tres \u003d target_read_buffer(chip-\u003etarget, NRF91_FICR_DEVICEID0, sizeof(nrf_ficr_info_t), (uint8_t *)\u0026ficr);"},{"line_number":249,"context_line":"\tif (res !\u003d ERROR_OK) {"},{"line_number":250,"context_line":"\t\tLOG_INFO(\"Couldn\u0027t read FICR INFO registers\");"},{"line_number":251,"context_line":"\t\treturn res;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"958d29d5_0e82660f","line":248,"in_reply_to":"ef147800_e7fa6b49","updated":"2022-12-19 22:14:56.000000000","message":"Done","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":250,"context_line":"\t\tLOG_INFO(\"Couldn\u0027t read FICR INFO registers\");"},{"line_number":251,"context_line":"\t\treturn res;"},{"line_number":252,"context_line":"\t}"},{"line_number":253,"context_line":""},{"line_number":254,"context_line":"\tif (ficr.part !\u003d 0x9160 \u0026\u0026 ficr.part !\u003d 0x9120) {"},{"line_number":255,"context_line":"\t\tLOG_INFO(\"Wrong device %X\", ficr.part);"},{"line_number":256,"context_line":"\t\tres \u003d target_read_u32(chip-\u003etarget, NRF91_FICR_INFO_PART, \u0026ficr.part);"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"f994a0f2_1c21dd7e","line":253,"updated":"2022-12-18 22:34:32.000000000","message":"and here you need to copy the data in struct nrf_ficr_info, taking care of endianness:\nficr.id      \u003d target_buffer_get_u64(chip-\u003etarget, buf);\nficr.part    \u003d target_buffer_get_u32(chip-\u003etarget, buf + 8);\nficr.variant \u003d target_buffer_get_u32(chip-\u003etarget, buf + 12);\n...","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":false,"context_lines":[{"line_number":250,"context_line":"\t\tLOG_INFO(\"Couldn\u0027t read FICR INFO registers\");"},{"line_number":251,"context_line":"\t\treturn res;"},{"line_number":252,"context_line":"\t}"},{"line_number":253,"context_line":""},{"line_number":254,"context_line":"\tif (ficr.part !\u003d 0x9160 \u0026\u0026 ficr.part !\u003d 0x9120) {"},{"line_number":255,"context_line":"\t\tLOG_INFO(\"Wrong device %X\", ficr.part);"},{"line_number":256,"context_line":"\t\tres \u003d target_read_u32(chip-\u003etarget, NRF91_FICR_INFO_PART, \u0026ficr.part);"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"0fc8e2b9_b92a7d19","line":253,"in_reply_to":"f994a0f2_1c21dd7e","updated":"2022-12-19 22:14:56.000000000","message":"Done","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"a85914ff76c2de482256db1ad0e71d929b24e835","unresolved":true,"context_lines":[{"line_number":388,"context_line":"\tif (!chip)"},{"line_number":389,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":390,"context_line":""},{"line_number":391,"context_line":"\tassert(offset % 4 \u003d\u003d 0);"},{"line_number":392,"context_line":"\tassert(count % 4 \u003d\u003d 0);"},{"line_number":393,"context_line":""},{"line_number":394,"context_line":"\tres \u003d nrf91_nvmc_write_enable(chip);"},{"line_number":395,"context_line":"\tif (res !\u003d ERROR_OK) {"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"475d855e_554df494","line":392,"range":{"start_line":391,"start_character":1,"end_line":392,"end_character":10},"updated":"2022-12-18 22:34:32.000000000","message":"I want to remove all the assert().\nWould it work if here we change this to:\n if (!IS_ALIGNED(offset, 4) || !IS_ALIGNED(count, 4))\n   return ERROR_FAIL;\n\nThere are other assert() below...","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1002097,"name":"Anton D. Kachalov","display_name":"mouse","email":"mouse@ya.ru","username":"ya-mouse"},"change_message_id":"44d4cf7c9bcc14118add298ce443819ed14b4c45","unresolved":false,"context_lines":[{"line_number":388,"context_line":"\tif (!chip)"},{"line_number":389,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":390,"context_line":""},{"line_number":391,"context_line":"\tassert(offset % 4 \u003d\u003d 0);"},{"line_number":392,"context_line":"\tassert(count % 4 \u003d\u003d 0);"},{"line_number":393,"context_line":""},{"line_number":394,"context_line":"\tres \u003d nrf91_nvmc_write_enable(chip);"},{"line_number":395,"context_line":"\tif (res !\u003d ERROR_OK) {"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"d09bd740_f3411d2d","line":392,"range":{"start_line":391,"start_character":1,"end_line":392,"end_character":10},"in_reply_to":"475d855e_554df494","updated":"2022-12-19 22:14:56.000000000","message":"Done","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"e539de259e782cd298a657bbce5db70e009ec07d","unresolved":true,"context_lines":[{"line_number":388,"context_line":"\tif (!chip)"},{"line_number":389,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":390,"context_line":""},{"line_number":391,"context_line":"\tassert(offset % 4 \u003d\u003d 0);"},{"line_number":392,"context_line":"\tassert(count % 4 \u003d\u003d 0);"},{"line_number":393,"context_line":""},{"line_number":394,"context_line":"\tres \u003d nrf91_nvmc_write_enable(chip);"},{"line_number":395,"context_line":"\tif (res !\u003d ERROR_OK) {"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"35c175fe_98102b6e","line":392,"range":{"start_line":391,"start_character":1,"end_line":392,"end_character":10},"in_reply_to":"d09bd740_f3411d2d","updated":"2022-12-27 14:13:26.000000000","message":"Antonio,\n\ndo you intend to fight against all asserts?\nIMO it\u0027s not a good idea, a correctly used assert() is a good debugging tool!\nIf you want to enforce such policy, first submit a patch to https://openocd.org/doc/doxygen/html/stylec.html with good reasons why we should not use this part of ISO C99 Standard.\n\nTo be specific to this part of code:\nThe flash infrastructure ensures the correct offset and count because of setting\nbank-\u003ewrite_start_alignment \u003d 4;\nbank-\u003ewrite_end_alignment \u003d 4;\n\nIn the original code we just check if it worked. If not, the developer immediately knows what is wrong.\nIn the code you proposed we get uselessly general \"error writing to flash at address ...\" and no clue what really happened.","commit_id":"58527f67c702de6dd4ff453ee6ef97edda3cdb72"}]}
