)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ddaa3b8de2f030deaa9bec70dcd36376748babbd","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"172a9834_c7ff3cdc","updated":"2023-07-09 13:17:08.000000000","message":"I did not completed the review, just looked around for the build error","commit_id":"ccb7b5e2cf71a45aa42ddf04727d33a6e3101755"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"9b3430f730c10bb2a3045cb7cfd1cae085252f8e","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":5,"id":"85f3d9bd_8be8e6d8","updated":"2023-07-12 07:52:29.000000000","message":"Scan-build clean with the current PS5","commit_id":"e45f0a73a2d8fd3927f79641d30ec0f53da05b9a"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"193ddb4bd52176d2c31ee1ae38b57dab406a03b1","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"3fbe6164_53ba5925","updated":"2023-08-31 10:58:48.000000000","message":"Hi @Antonio, Is there any available time slot to continue reviewing this patch?","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"eabceded69c79bfc56b4fe1921158d8e265c2ffe","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":6,"id":"d70f0baf_d6a7f3cb","updated":"2023-09-10 16:03:36.000000000","message":"Only few minor remarks to be addressed. For the rest, it looks ok!","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"5c824916c814adcfb4250181391c5ef5733c5d6b","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":7,"id":"232ee117_afc48bff","updated":"2023-09-10 18:25:06.000000000","message":"Thank you Antonio","commit_id":"241db21698c9c72331a8b161288e452b86116b16"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":8,"id":"d54a5d86_72351fff","updated":"2023-11-27 15:04:41.000000000","message":"minor comments... looks good overall.  thanks, @erhan","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"70f5f645c161773cd970ba03e2e25ba9476a26a6","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":8,"id":"60a54142_fa9a123b","updated":"2023-11-25 18:47:18.000000000","message":"thanks","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"706ba821_66da07d4","updated":"2023-11-28 17:00:56.000000000","message":"Hi @Ian, I can see your interest to use algorithm library to run a code on the target. I tried to add references that you can check. If you need more clarification, I suggest to follow the function calls in the PS 7761 and 7766. They have basic use cases for both external and onboard algorithm run functions.","commit_id":"e00e9cec4f9eb366e77847f598fb29d372a27543"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7773ca8e2de625125018b6dd2d858b7453183a59","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"31ac3878_b1ec18df","updated":"2023-11-29 20:11:50.000000000","message":"Looks almost good, except couple of trivial namespace violations.","commit_id":"e00e9cec4f9eb366e77847f598fb29d372a27543"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"b9969e1dc06e278c5aa25c86d92d702eaade8112","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"8ed06149_74f8768e","updated":"2023-11-28 18:10:26.000000000","message":"Looks good; thanks for the updates Erhan.  +1 for me...","commit_id":"e00e9cec4f9eb366e77847f598fb29d372a27543"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"9cf03d9fb6d94e9fda62c0b50d36d5dbfc800b43","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":10,"id":"ea7fc79e_2e4752e9","updated":"2023-11-30 06:37:46.000000000","message":"Thanks","commit_id":"16af2eb073f4493ee167c1c36d1e10777e86f91a"}],"src/target/espressif/esp_algorithm.c":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ddaa3b8de2f030deaa9bec70dcd36376748babbd","unresolved":true,"context_lines":[{"line_number":99,"context_line":"\t\t\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":100,"context_line":"\t\t\t\t\tgoto _cleanup;"},{"line_number":101,"context_line":"\t\t\t\t}"},{"line_number":102,"context_line":"\t\t\t\tmem_handles[i] \u003d (void *)((long)alloc_run.ret_code);"},{"line_number":103,"context_line":"\t\t\t\trun-\u003emem_args.params[i].address \u003d alloc_run.ret_code;"},{"line_number":104,"context_line":"\t\t\t}"},{"line_number":105,"context_line":"\t\t\tif (usr_param_num !\u003d UINT_MAX) /* if we need update some register param with mem param value */"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"4f8520ae_0ca60bff","line":102,"updated":"2023-07-09 13:17:08.000000000","message":"build fails here.\nYou take a uint32_t, cast is to long (that can be either 32 or 64 bits) then cast it again to a pointer (that again can be either 32 or 64 bits).\nThe specific compiler in Jenkins has 32 bit long and 64 bit pointer, then the error.\nBut, apart for this, what are you going to do here?\nDepending on \u0027image\u0027, mem_handles[i] changes type and meaning:\nIn line 78 mem_handles[i] are initialized to the \u0027struct working_area *\u0027 returned by target_alloc_working_area().\nHere you use a value returned by the algorithm running on target.\n\nCan you refactor this code to use two separate path?\n static int algorithm_run()\n {\n   common_init;\n   if (image)\n     return algorithm_run_image();\n   else\n     return algorithm_run_stub();\n }\n static int algorithm_run_image()\n {\n   prepare_image();\n   common_code();\n   cleanup_image();\n }\n static int algorithm_run_stub()\n {\n   prepare_stub();\n   common_code();\n   cleanup_stub();\n }\n static int common_code()\n {\n }","commit_id":"3673a8a6bbe23f8fc00961451e8570223ad874db"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"4b9f6ecd2affaf39cec583bd1b9d922d503b9aa4","unresolved":false,"context_lines":[{"line_number":99,"context_line":"\t\t\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":100,"context_line":"\t\t\t\t\tgoto _cleanup;"},{"line_number":101,"context_line":"\t\t\t\t}"},{"line_number":102,"context_line":"\t\t\t\tmem_handles[i] \u003d (void *)((long)alloc_run.ret_code);"},{"line_number":103,"context_line":"\t\t\t\trun-\u003emem_args.params[i].address \u003d alloc_run.ret_code;"},{"line_number":104,"context_line":"\t\t\t}"},{"line_number":105,"context_line":"\t\t\tif (usr_param_num !\u003d UINT_MAX) /* if we need update some register param with mem param value */"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"c488c0fb_242ea9b2","line":102,"in_reply_to":"4f8520ae_0ca60bff","updated":"2023-07-10 14:19:03.000000000","message":"Antonio, I did some cleanup and removed unused lines. Also applied your suggestion. Please have a look again.","commit_id":"3673a8a6bbe23f8fc00961451e8570223ad874db"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ddaa3b8de2f030deaa9bec70dcd36376748babbd","unresolved":true,"context_lines":[{"line_number":198,"context_line":"\t/* Put extra bytes to the beginning with padding */"},{"line_number":199,"context_line":"\tsize_t remaining \u003d length % 4;"},{"line_number":200,"context_line":"\tif (remaining \u003e 0) {"},{"line_number":201,"context_line":"\t\tmemset(dest, 0xFF, 4);"},{"line_number":202,"context_line":"\t\tfor (i \u003d 0; i \u003c remaining; i++)"},{"line_number":203,"context_line":"\t\t\tdest[i] \u003d src[length - remaining + i];"},{"line_number":204,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"3583f4d4_1b8d32f2","line":201,"updated":"2023-07-09 13:17:08.000000000","message":"memset(dest + remaining, 0xff, 4 - remaining);","commit_id":"3673a8a6bbe23f8fc00961451e8570223ad874db"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"bc61549bfd4205545b1ae64a113fae12382736e1","unresolved":false,"context_lines":[{"line_number":198,"context_line":"\t/* Put extra bytes to the beginning with padding */"},{"line_number":199,"context_line":"\tsize_t remaining \u003d length % 4;"},{"line_number":200,"context_line":"\tif (remaining \u003e 0) {"},{"line_number":201,"context_line":"\t\tmemset(dest, 0xFF, 4);"},{"line_number":202,"context_line":"\t\tfor (i \u003d 0; i \u003c remaining; i++)"},{"line_number":203,"context_line":"\t\t\tdest[i] \u003d src[length - remaining + i];"},{"line_number":204,"context_line":"\t}"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"119f1fa8_4df1640d","line":201,"in_reply_to":"3583f4d4_1b8d32f2","updated":"2023-07-10 10:24:26.000000000","message":"Done","commit_id":"3673a8a6bbe23f8fc00961451e8570223ad874db"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ddaa3b8de2f030deaa9bec70dcd36376748babbd","unresolved":true,"context_lines":[{"line_number":204,"context_line":"\t}"},{"line_number":205,"context_line":""},{"line_number":206,"context_line":"\tfor (i \u003d remaining; i \u003c length - remaining; i +\u003d 4) {"},{"line_number":207,"context_line":"\t\tdest[i + 0] \u003d src[length - i - 4];"},{"line_number":208,"context_line":"\t\tdest[i + 1] \u003d src[length - i - 3];"},{"line_number":209,"context_line":"\t\tdest[i + 2] \u003d src[length - i - 2];"},{"line_number":210,"context_line":"\t\tdest[i + 3] \u003d src[length - i - 1];"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"0f7116ee_6cebb6e1","line":207,"updated":"2023-07-09 13:17:08.000000000","message":"if I understand correctly, when (remaining \u003e 0) the first assignment overwrites the padding, which is not what you want.","commit_id":"3673a8a6bbe23f8fc00961451e8570223ad874db"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"bc61549bfd4205545b1ae64a113fae12382736e1","unresolved":false,"context_lines":[{"line_number":204,"context_line":"\t}"},{"line_number":205,"context_line":""},{"line_number":206,"context_line":"\tfor (i \u003d remaining; i \u003c length - remaining; i +\u003d 4) {"},{"line_number":207,"context_line":"\t\tdest[i + 0] \u003d src[length - i - 4];"},{"line_number":208,"context_line":"\t\tdest[i + 1] \u003d src[length - i - 3];"},{"line_number":209,"context_line":"\t\tdest[i + 2] \u003d src[length - i - 2];"},{"line_number":210,"context_line":"\t\tdest[i + 3] \u003d src[length - i - 1];"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"8aaa58f8_68d41ef9","line":207,"in_reply_to":"0f7116ee_6cebb6e1","updated":"2023-07-10 10:24:26.000000000","message":"Fixed. You can see the tests here. https://godbolt.org/z/eMdb5r966","commit_id":"3673a8a6bbe23f8fc00961451e8570223ad874db"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"eabceded69c79bfc56b4fe1921158d8e265c2ffe","unresolved":true,"context_lines":[{"line_number":14,"context_line":"#include \u003ctarget/target.h\u003e"},{"line_number":15,"context_line":"#include \"esp_algorithm.h\""},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"#define ALGO_ALGORITHM_EXIT_TMO    40000\t/* ms */"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"static int algorithm_read_stub_logs(struct target *target, struct algorithm_stub *stub)"},{"line_number":20,"context_line":"{"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"e058c083_7b73b2b3","line":17,"updated":"2023-09-10 16:03:36.000000000","message":"also here, what about DEFAULT_ALGORITHM_TIMEOUT_MS ?","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"5c824916c814adcfb4250181391c5ef5733c5d6b","unresolved":false,"context_lines":[{"line_number":14,"context_line":"#include \u003ctarget/target.h\u003e"},{"line_number":15,"context_line":"#include \"esp_algorithm.h\""},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"#define ALGO_ALGORITHM_EXIT_TMO    40000\t/* ms */"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"static int algorithm_read_stub_logs(struct target *target, struct algorithm_stub *stub)"},{"line_number":20,"context_line":"{"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"0744aab6_aa39452a","line":17,"in_reply_to":"e058c083_7b73b2b3","updated":"2023-09-10 18:25:06.000000000","message":"Done","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"eabceded69c79bfc56b4fe1921158d8e265c2ffe","unresolved":true,"context_lines":[{"line_number":33,"context_line":"\tuint8_t *log_buff \u003d calloc(1, len);"},{"line_number":34,"context_line":"\tif (!log_buff) {"},{"line_number":35,"context_line":"\t\tLOG_ERROR(\"Failed to allocate memory for the stub log (%d)!\", retval);"},{"line_number":36,"context_line":"\t\treturn retval;"},{"line_number":37,"context_line":"\t}"},{"line_number":38,"context_line":"\tretval \u003d target_read_memory(target, stub-\u003elog_buff_addr + 4, 1, len, log_buff);"},{"line_number":39,"context_line":"\tif (retval \u003d\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"68d69225_707a2d46","line":36,"updated":"2023-09-10 16:03:36.000000000","message":"retval is ERROR_OK. On calloc() fail, force the return ERROR_FAIL;\nFix also the LOG_ above","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"5c824916c814adcfb4250181391c5ef5733c5d6b","unresolved":false,"context_lines":[{"line_number":33,"context_line":"\tuint8_t *log_buff \u003d calloc(1, len);"},{"line_number":34,"context_line":"\tif (!log_buff) {"},{"line_number":35,"context_line":"\t\tLOG_ERROR(\"Failed to allocate memory for the stub log (%d)!\", retval);"},{"line_number":36,"context_line":"\t\treturn retval;"},{"line_number":37,"context_line":"\t}"},{"line_number":38,"context_line":"\tretval \u003d target_read_memory(target, stub-\u003elog_buff_addr + 4, 1, len, log_buff);"},{"line_number":39,"context_line":"\tif (retval \u003d\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"aa1b7c8a_29281771","line":36,"in_reply_to":"68d69225_707a2d46","updated":"2023-09-10 18:25:06.000000000","message":"Done","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"eabceded69c79bfc56b4fe1921158d8e265c2ffe","unresolved":true,"context_lines":[{"line_number":44,"context_line":""},{"line_number":45,"context_line":"static int algorithm_run_image(struct target *target, struct algorithm_run_data *run, uint32_t num_args, va_list ap)"},{"line_number":46,"context_line":"{"},{"line_number":47,"context_line":"\tvoid **mem_handles \u003d NULL;"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"\tint retval \u003d run-\u003ehw-\u003ealgo_init(target, run, num_args, ap);"},{"line_number":50,"context_line":"\tif (retval !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"def4e2e2_caff1db1","line":47,"updated":"2023-09-10 16:03:36.000000000","message":"You have the type; no need to used void.\nstruct working_area **mem_handles \u003d NULL;","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"5c824916c814adcfb4250181391c5ef5733c5d6b","unresolved":false,"context_lines":[{"line_number":44,"context_line":""},{"line_number":45,"context_line":"static int algorithm_run_image(struct target *target, struct algorithm_run_data *run, uint32_t num_args, va_list ap)"},{"line_number":46,"context_line":"{"},{"line_number":47,"context_line":"\tvoid **mem_handles \u003d NULL;"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"\tint retval \u003d run-\u003ehw-\u003ealgo_init(target, run, num_args, ap);"},{"line_number":50,"context_line":"\tif (retval !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"c4eca4a8_f5c5c5de","line":47,"in_reply_to":"def4e2e2_caff1db1","updated":"2023-09-10 18:25:06.000000000","message":"Done","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"eabceded69c79bfc56b4fe1921158d8e265c2ffe","unresolved":true,"context_lines":[{"line_number":52,"context_line":""},{"line_number":53,"context_line":"\t/* allocate memory arguments and fill respective reg params */"},{"line_number":54,"context_line":"\tif (run-\u003emem_args.count \u003e 0) {"},{"line_number":55,"context_line":"\t\tmem_handles \u003d calloc(run-\u003emem_args.count, sizeof(void *));"},{"line_number":56,"context_line":"\t\tif (!mem_handles) {"},{"line_number":57,"context_line":"\t\t\tLOG_ERROR(\"Failed to alloc target mem handles!\");"},{"line_number":58,"context_line":"\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"1505e167_fc65d651","line":55,"updated":"2023-09-10 16:03:36.000000000","message":"mem_handles \u003d calloc(..., sizeof(*mem_handles));","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"5c824916c814adcfb4250181391c5ef5733c5d6b","unresolved":false,"context_lines":[{"line_number":52,"context_line":""},{"line_number":53,"context_line":"\t/* allocate memory arguments and fill respective reg params */"},{"line_number":54,"context_line":"\tif (run-\u003emem_args.count \u003e 0) {"},{"line_number":55,"context_line":"\t\tmem_handles \u003d calloc(run-\u003emem_args.count, sizeof(void *));"},{"line_number":56,"context_line":"\t\tif (!mem_handles) {"},{"line_number":57,"context_line":"\t\t\tLOG_ERROR(\"Failed to alloc target mem handles!\");"},{"line_number":58,"context_line":"\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"e4e9df7f_e379e71b","line":55,"in_reply_to":"1505e167_fc65d651","updated":"2023-09-10 18:25:06.000000000","message":"Done","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"eabceded69c79bfc56b4fe1921158d8e265c2ffe","unresolved":true,"context_lines":[{"line_number":55,"context_line":"\t\tmem_handles \u003d calloc(run-\u003emem_args.count, sizeof(void *));"},{"line_number":56,"context_line":"\t\tif (!mem_handles) {"},{"line_number":57,"context_line":"\t\t\tLOG_ERROR(\"Failed to alloc target mem handles!\");"},{"line_number":58,"context_line":"\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":59,"context_line":"\t\t\tgoto _cleanup;"},{"line_number":60,"context_line":"\t\t}"},{"line_number":61,"context_line":"\t\t/* alloc memory args target buffers */"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"22bd6a6a_32eb43e0","line":58,"updated":"2023-09-10 16:03:36.000000000","message":"this is a calloc() failure on host memory, not on a target resource. ERROR_FAIL","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"5c824916c814adcfb4250181391c5ef5733c5d6b","unresolved":false,"context_lines":[{"line_number":55,"context_line":"\t\tmem_handles \u003d calloc(run-\u003emem_args.count, sizeof(void *));"},{"line_number":56,"context_line":"\t\tif (!mem_handles) {"},{"line_number":57,"context_line":"\t\t\tLOG_ERROR(\"Failed to alloc target mem handles!\");"},{"line_number":58,"context_line":"\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":59,"context_line":"\t\t\tgoto _cleanup;"},{"line_number":60,"context_line":"\t\t}"},{"line_number":61,"context_line":"\t\t/* alloc memory args target buffers */"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"397d0419_a4cece58","line":58,"in_reply_to":"22bd6a6a_32eb43e0","updated":"2023-09-10 18:25:06.000000000","message":"Done","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"eabceded69c79bfc56b4fe1921158d8e265c2ffe","unresolved":true,"context_lines":[{"line_number":149,"context_line":"\tuint32_t num_args,"},{"line_number":150,"context_line":"\tva_list ap)"},{"line_number":151,"context_line":"{"},{"line_number":152,"context_line":"\tvoid **mem_handles \u003d NULL;"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":"\tint retval \u003d run-\u003ehw-\u003ealgo_init(target, run, num_args, ap);"},{"line_number":155,"context_line":"\tif (retval !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"59683459_7fe2cc22","line":152,"updated":"2023-09-10 16:03:36.000000000","message":"variable unused! Can be dropped with the free() below?","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"5c824916c814adcfb4250181391c5ef5733c5d6b","unresolved":false,"context_lines":[{"line_number":149,"context_line":"\tuint32_t num_args,"},{"line_number":150,"context_line":"\tva_list ap)"},{"line_number":151,"context_line":"{"},{"line_number":152,"context_line":"\tvoid **mem_handles \u003d NULL;"},{"line_number":153,"context_line":""},{"line_number":154,"context_line":"\tint retval \u003d run-\u003ehw-\u003ealgo_init(target, run, num_args, ap);"},{"line_number":155,"context_line":"\tif (retval !\u003d ERROR_OK)"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"7f3dc229_16a9aa96","line":152,"in_reply_to":"59683459_7fe2cc22","updated":"2023-09-10 18:25:06.000000000","message":"Done","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"eabceded69c79bfc56b4fe1921158d8e265c2ffe","unresolved":true,"context_lines":[{"line_number":506,"context_line":""},{"line_number":507,"context_line":"\tif (tramp_sz \u003e run-\u003eon_board.code_buf_size) {"},{"line_number":508,"context_line":"\t\tLOG_ERROR(\"Stub tramp size %u bytes exceeds target buf size %d bytes!\","},{"line_number":509,"context_line":"\t\t\t(uint32_t)tramp_sz, run-\u003eon_board.code_buf_size);"},{"line_number":510,"context_line":"\t\treturn ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":511,"context_line":"\t}"},{"line_number":512,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"08d9b8f0_683b9717","line":509,"updated":"2023-09-10 16:03:36.000000000","message":"tramp_sz is of type size_t, use %zu instead of the cast (that is also incorrect as it would require PRIu32!)","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"5c824916c814adcfb4250181391c5ef5733c5d6b","unresolved":false,"context_lines":[{"line_number":506,"context_line":""},{"line_number":507,"context_line":"\tif (tramp_sz \u003e run-\u003eon_board.code_buf_size) {"},{"line_number":508,"context_line":"\t\tLOG_ERROR(\"Stub tramp size %u bytes exceeds target buf size %d bytes!\","},{"line_number":509,"context_line":"\t\t\t(uint32_t)tramp_sz, run-\u003eon_board.code_buf_size);"},{"line_number":510,"context_line":"\t\treturn ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":511,"context_line":"\t}"},{"line_number":512,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":6,"id":"b2f45883_12a7d01f","line":509,"in_reply_to":"08d9b8f0_683b9717","updated":"2023-09-10 18:25:06.000000000","message":"Done","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":46,"context_line":"{"},{"line_number":47,"context_line":"\tstruct working_area **mem_handles \u003d NULL;"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"\tint retval \u003d run-\u003ehw-\u003ealgo_init(target, run, num_args, ap);"},{"line_number":50,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":51,"context_line":"\t\treturn retval;"},{"line_number":52,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":8,"id":"81403d0d_32223d93","line":49,"updated":"2023-11-27 15:04:41.000000000","message":"if run is checked for non-null by the caller, run-\u003ehw should also be checked here or there?","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":46,"context_line":"{"},{"line_number":47,"context_line":"\tstruct working_area **mem_handles \u003d NULL;"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"\tint retval \u003d run-\u003ehw-\u003ealgo_init(target, run, num_args, ap);"},{"line_number":50,"context_line":"\tif (retval !\u003d ERROR_OK)"},{"line_number":51,"context_line":"\t\treturn retval;"},{"line_number":52,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":8,"id":"972c76aa_3fb370dd","line":49,"in_reply_to":"81403d0d_32223d93","updated":"2023-11-28 17:00:56.000000000","message":"Done","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":162,"context_line":"\t\trun-\u003estub.ainfo);"},{"line_number":163,"context_line":"\tif (retval !\u003d ERROR_OK) {"},{"line_number":164,"context_line":"\t\tLOG_ERROR(\"Failed to start algorithm (%d)!\", retval);"},{"line_number":165,"context_line":"\t\tgoto _cleanup;"},{"line_number":166,"context_line":"\t}"},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"\tuint32_t timeout_ms \u003d 0;\t/* do not wait if \u0027usr_func\u0027 returned error */"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"75b88b78_bbe72645","line":165,"updated":"2023-11-27 15:04:41.000000000","message":"consider different naming of the 2 _cleanup symbols","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":true,"context_lines":[{"line_number":162,"context_line":"\t\trun-\u003estub.ainfo);"},{"line_number":163,"context_line":"\tif (retval !\u003d ERROR_OK) {"},{"line_number":164,"context_line":"\t\tLOG_ERROR(\"Failed to start algorithm (%d)!\", retval);"},{"line_number":165,"context_line":"\t\tgoto _cleanup;"},{"line_number":166,"context_line":"\t}"},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"\tuint32_t timeout_ms \u003d 0;\t/* do not wait if \u0027usr_func\u0027 returned error */"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"aae114cf_1447593f","line":165,"in_reply_to":"75b88b78_bbe72645","updated":"2023-11-28 17:00:56.000000000","message":"Can I ask the reason? Labels have a function scope.","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"b9969e1dc06e278c5aa25c86d92d702eaade8112","unresolved":false,"context_lines":[{"line_number":162,"context_line":"\t\trun-\u003estub.ainfo);"},{"line_number":163,"context_line":"\tif (retval !\u003d ERROR_OK) {"},{"line_number":164,"context_line":"\t\tLOG_ERROR(\"Failed to start algorithm (%d)!\", retval);"},{"line_number":165,"context_line":"\t\tgoto _cleanup;"},{"line_number":166,"context_line":"\t}"},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"\tuint32_t timeout_ms \u003d 0;\t/* do not wait if \u0027usr_func\u0027 returned error */"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"dbf95689_aca27c1b","line":165,"in_reply_to":"aae114cf_1447593f","updated":"2023-11-28 18:10:26.000000000","message":"just readability.  no worries.","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":246,"context_line":"\t\t\t\treturn retval;"},{"line_number":247,"context_line":"\t\t\t}"},{"line_number":248,"context_line":"\t\t} else {"},{"line_number":249,"context_line":"\t\t\tretval \u003d target_write_buffer(target, section-\u003ebase_address + sec_wr, size_read, buf);"},{"line_number":250,"context_line":"\t\t\tif (retval !\u003d ERROR_OK) {"},{"line_number":251,"context_line":"\t\t\t\tLOG_ERROR(\"Failed to write stub section!\");"},{"line_number":252,"context_line":"\t\t\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"c352eae3_a411e551","line":249,"updated":"2023-11-27 15:04:41.000000000","message":"why does the target write address change depending on whether it\u0027s reversed or not?  perhaps a comment here would be helpful","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":246,"context_line":"\t\t\t\treturn retval;"},{"line_number":247,"context_line":"\t\t\t}"},{"line_number":248,"context_line":"\t\t} else {"},{"line_number":249,"context_line":"\t\t\tretval \u003d target_write_buffer(target, section-\u003ebase_address + sec_wr, size_read, buf);"},{"line_number":250,"context_line":"\t\t\tif (retval !\u003d ERROR_OK) {"},{"line_number":251,"context_line":"\t\t\t\tLOG_ERROR(\"Failed to write stub section!\");"},{"line_number":252,"context_line":"\t\t\t\treturn retval;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"3d7bcf29_7ab4f1e6","line":249,"in_reply_to":"c352eae3_a411e551","updated":"2023-11-28 17:00:56.000000000","message":"Done","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":272,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":273,"context_line":"\t}"},{"line_number":274,"context_line":""},{"line_number":275,"context_line":"\tif (run-\u003ehw-\u003estub_tramp_get) {"},{"line_number":276,"context_line":"\t\ttramp \u003d run-\u003ehw-\u003estub_tramp_get(target, \u0026tramp_sz);"},{"line_number":277,"context_line":"\t\tif (!tramp)"},{"line_number":278,"context_line":"\t\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"f31f166e_9737be19","line":275,"updated":"2023-11-27 15:04:41.000000000","message":"extern function should check run is non-null","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":272,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":273,"context_line":"\t}"},{"line_number":274,"context_line":""},{"line_number":275,"context_line":"\tif (run-\u003ehw-\u003estub_tramp_get) {"},{"line_number":276,"context_line":"\t\ttramp \u003d run-\u003ehw-\u003estub_tramp_get(target, \u0026tramp_sz);"},{"line_number":277,"context_line":"\t\tif (!tramp)"},{"line_number":278,"context_line":"\t\t\treturn ERROR_FAIL;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"90278bd4_41b0f035","line":275,"in_reply_to":"f31f166e_9737be19","updated":"2023-11-28 17:00:56.000000000","message":"Done","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":411,"context_line":"\t\t\tLOG_DEBUG(\"DATA sec size %\" PRIu32 \" -\u003e %\" PRIu32, section-\u003esize, data_sec_sz);"},{"line_number":412,"context_line":"\t\t\tuint32_t bss_sec_sz \u003d ALIGN_UP(run-\u003eimage.bss_size, 4);"},{"line_number":413,"context_line":"\t\t\tLOG_DEBUG(\"BSS sec size %\" PRIu32 \" -\u003e %\" PRIu32, run-\u003eimage.bss_size, bss_sec_sz);"},{"line_number":414,"context_line":"\t\t\tif (target_alloc_working_area(target, data_sec_sz + bss_sec_sz, \u0026run-\u003estub.data) !\u003d ERROR_OK) {"},{"line_number":415,"context_line":"\t\t\t\tLOG_ERROR(\"no working area available, can\u0027t alloc space for stub data!\");"},{"line_number":416,"context_line":"\t\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":417,"context_line":"\t\t\t\tgoto _on_error;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"daf92893_49cb4c7f","line":414,"updated":"2023-11-27 15:04:41.000000000","message":"check alloc_working_area first?","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":411,"context_line":"\t\t\tLOG_DEBUG(\"DATA sec size %\" PRIu32 \" -\u003e %\" PRIu32, section-\u003esize, data_sec_sz);"},{"line_number":412,"context_line":"\t\t\tuint32_t bss_sec_sz \u003d ALIGN_UP(run-\u003eimage.bss_size, 4);"},{"line_number":413,"context_line":"\t\t\tLOG_DEBUG(\"BSS sec size %\" PRIu32 \" -\u003e %\" PRIu32, run-\u003eimage.bss_size, bss_sec_sz);"},{"line_number":414,"context_line":"\t\t\tif (target_alloc_working_area(target, data_sec_sz + bss_sec_sz, \u0026run-\u003estub.data) !\u003d ERROR_OK) {"},{"line_number":415,"context_line":"\t\t\t\tLOG_ERROR(\"no working area available, can\u0027t alloc space for stub data!\");"},{"line_number":416,"context_line":"\t\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":417,"context_line":"\t\t\t\tgoto _on_error;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"209e5aef_c41b8190","line":414,"in_reply_to":"daf92893_49cb4c7f","updated":"2023-11-28 17:00:56.000000000","message":"No need to check for data, we will allocate in any case. But I changed the flag name for better readability.","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":438,"context_line":"\t/* stack */"},{"line_number":439,"context_line":"\tif (run-\u003estub.stack_addr \u003d\u003d 0 \u0026\u0026 run-\u003estack_size \u003e 0) {"},{"line_number":440,"context_line":"\t\t/* allocate stack in data working area */"},{"line_number":441,"context_line":"\t\tif (target_alloc_working_area(target, run-\u003estack_size, \u0026run-\u003estub.stack) !\u003d ERROR_OK) {"},{"line_number":442,"context_line":"\t\t\tLOG_ERROR(\"no working area available, can\u0027t alloc stub stack!\");"},{"line_number":443,"context_line":"\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":444,"context_line":"\t\t\tgoto _on_error;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"79833b2c_c591dfdd","line":441,"updated":"2023-11-27 15:04:41.000000000","message":"check alloc_working_area first?","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":438,"context_line":"\t/* stack */"},{"line_number":439,"context_line":"\tif (run-\u003estub.stack_addr \u003d\u003d 0 \u0026\u0026 run-\u003estack_size \u003e 0) {"},{"line_number":440,"context_line":"\t\t/* allocate stack in data working area */"},{"line_number":441,"context_line":"\t\tif (target_alloc_working_area(target, run-\u003estack_size, \u0026run-\u003estub.stack) !\u003d ERROR_OK) {"},{"line_number":442,"context_line":"\t\t\tLOG_ERROR(\"no working area available, can\u0027t alloc stub stack!\");"},{"line_number":443,"context_line":"\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":444,"context_line":"\t\t\tgoto _on_error;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"2f5181b8_48f2813e","line":441,"in_reply_to":"79833b2c_c591dfdd","updated":"2023-11-28 17:00:56.000000000","message":"Same as above","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":476,"context_line":"\tuint32_t num_args,"},{"line_number":477,"context_line":"\tva_list ap)"},{"line_number":478,"context_line":"{"},{"line_number":479,"context_line":"\tif (!run-\u003eimage.image.start_address_set || run-\u003eimage.image.start_address \u003d\u003d 0)"},{"line_number":480,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":481,"context_line":""},{"line_number":482,"context_line":"\treturn algorithm_run_image(target, run, num_args, ap);"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"8f662cc8_a0a5233b","line":479,"updated":"2023-11-27 15:04:41.000000000","message":"since this is an external function, should probably check run is non-null","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":476,"context_line":"\tuint32_t num_args,"},{"line_number":477,"context_line":"\tva_list ap)"},{"line_number":478,"context_line":"{"},{"line_number":479,"context_line":"\tif (!run-\u003eimage.image.start_address_set || run-\u003eimage.image.start_address \u003d\u003d 0)"},{"line_number":480,"context_line":"\t\treturn ERROR_FAIL;"},{"line_number":481,"context_line":""},{"line_number":482,"context_line":"\treturn algorithm_run_image(target, run, num_args, ap);"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"97a553a1_63a549c5","line":479,"in_reply_to":"8f662cc8_a0a5233b","updated":"2023-11-28 17:00:56.000000000","message":"Done","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":536,"context_line":""},{"line_number":537,"context_line":"int algorithm_unload_onboard_func(struct target *target, struct algorithm_run_data *run)"},{"line_number":538,"context_line":"{"},{"line_number":539,"context_line":"\treturn ERROR_OK;"},{"line_number":540,"context_line":"}"},{"line_number":541,"context_line":""},{"line_number":542,"context_line":"int algorithm_exec_onboard_func_va(struct target *target,"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"4a163aa0_a0f3a43b","line":539,"updated":"2023-11-27 15:04:41.000000000","message":"does this need to restore any memory/registers?","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":536,"context_line":""},{"line_number":537,"context_line":"int algorithm_unload_onboard_func(struct target *target, struct algorithm_run_data *run)"},{"line_number":538,"context_line":"{"},{"line_number":539,"context_line":"\treturn ERROR_OK;"},{"line_number":540,"context_line":"}"},{"line_number":541,"context_line":""},{"line_number":542,"context_line":"int algorithm_exec_onboard_func_va(struct target *target,"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"ba37b9eb_9f7b6ff1","line":539,"in_reply_to":"4a163aa0_a0f3a43b","updated":"2023-11-28 17:00:56.000000000","message":"No. On-board code execution does not need to allocate target memory for stub code and data.","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7773ca8e2de625125018b6dd2d858b7453183a59","unresolved":true,"context_lines":[{"line_number":283,"context_line":"\treturn ERROR_OK;"},{"line_number":284,"context_line":"}"},{"line_number":285,"context_line":""},{"line_number":286,"context_line":"int algorithm_load_func_image(struct target *target, struct algorithm_run_data *run)"},{"line_number":287,"context_line":"{"},{"line_number":288,"context_line":"\tint retval;"},{"line_number":289,"context_line":"\tsize_t tramp_sz \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":9,"id":"0a092685_de60e5fa","line":286,"updated":"2023-11-29 20:11:50.000000000","message":"Namespace: esp specific public function should be prefixed esp_\n(more functions follow)\n\nI\u0027d like algo load from image on other targets too, could we think about more general implementation? (either before merging esp support or rework it afterwards)","commit_id":"e00e9cec4f9eb366e77847f598fb29d372a27543"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"186ecada4c3b62d85af0cafaf8986a0ce162b318","unresolved":false,"context_lines":[{"line_number":283,"context_line":"\treturn ERROR_OK;"},{"line_number":284,"context_line":"}"},{"line_number":285,"context_line":""},{"line_number":286,"context_line":"int algorithm_load_func_image(struct target *target, struct algorithm_run_data *run)"},{"line_number":287,"context_line":"{"},{"line_number":288,"context_line":"\tint retval;"},{"line_number":289,"context_line":"\tsize_t tramp_sz \u003d 0;"}],"source_content_type":"text/x-csrc","patch_set":9,"id":"262a4f6a_4adf76d2","line":286,"in_reply_to":"0a092685_de60e5fa","updated":"2023-11-29 22:07:44.000000000","message":"I changed all \"algorithm_\" names as \"esp_algorithm_\"\n\nSure, we can generalize it. I prefer to rework later on.","commit_id":"e00e9cec4f9eb366e77847f598fb29d372a27543"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7773ca8e2de625125018b6dd2d858b7453183a59","unresolved":true,"context_lines":[{"line_number":438,"context_line":"\t\t\tLOG_DEBUG(\"DATA sec size %\" PRIu32 \" -\u003e %\" PRIu32, section-\u003esize, data_sec_sz);"},{"line_number":439,"context_line":"\t\t\tuint32_t bss_sec_sz \u003d ALIGN_UP(run-\u003eimage.bss_size, 4);"},{"line_number":440,"context_line":"\t\t\tLOG_DEBUG(\"BSS sec size %\" PRIu32 \" -\u003e %\" PRIu32, run-\u003eimage.bss_size, bss_sec_sz);"},{"line_number":441,"context_line":"\t\t\tif (target_alloc_working_area(target, data_sec_sz + bss_sec_sz, \u0026run-\u003estub.data) !\u003d ERROR_OK) {"},{"line_number":442,"context_line":"\t\t\t\tLOG_ERROR(\"no working area available, can\u0027t alloc space for stub data!\");"},{"line_number":443,"context_line":"\t\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":444,"context_line":"\t\t\t\tgoto _on_error;"}],"source_content_type":"text/x-csrc","patch_set":9,"id":"7125e7b7_a0399ed7","line":441,"updated":"2023-11-29 20:11:50.000000000","message":"Just for my understanding: the code relies on the same address (case of base_address !\u003d 0) of data section in elf and allocated working area? Perhaps a short comment would be nice.\n\nWe should add support of alloc working area at requested address to OpenOCD...","commit_id":"e00e9cec4f9eb366e77847f598fb29d372a27543"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"186ecada4c3b62d85af0cafaf8986a0ce162b318","unresolved":false,"context_lines":[{"line_number":438,"context_line":"\t\t\tLOG_DEBUG(\"DATA sec size %\" PRIu32 \" -\u003e %\" PRIu32, section-\u003esize, data_sec_sz);"},{"line_number":439,"context_line":"\t\t\tuint32_t bss_sec_sz \u003d ALIGN_UP(run-\u003eimage.bss_size, 4);"},{"line_number":440,"context_line":"\t\t\tLOG_DEBUG(\"BSS sec size %\" PRIu32 \" -\u003e %\" PRIu32, run-\u003eimage.bss_size, bss_sec_sz);"},{"line_number":441,"context_line":"\t\t\tif (target_alloc_working_area(target, data_sec_sz + bss_sec_sz, \u0026run-\u003estub.data) !\u003d ERROR_OK) {"},{"line_number":442,"context_line":"\t\t\t\tLOG_ERROR(\"no working area available, can\u0027t alloc space for stub data!\");"},{"line_number":443,"context_line":"\t\t\t\tretval \u003d ERROR_TARGET_RESOURCE_NOT_AVAILABLE;"},{"line_number":444,"context_line":"\t\t\t\tgoto _on_error;"}],"source_content_type":"text/x-csrc","patch_set":9,"id":"ec865694_83f19cd2","line":441,"in_reply_to":"7125e7b7_a0399ed7","updated":"2023-11-29 22:07:44.000000000","message":"Yes exactly. Added some explanations for the function.","commit_id":"e00e9cec4f9eb366e77847f598fb29d372a27543"}],"src/target/espressif/esp_algorithm.h":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"eabceded69c79bfc56b4fe1921158d8e265c2ffe","unresolved":true,"context_lines":[{"line_number":142,"context_line":"\tstruct working_area *code;"},{"line_number":143,"context_line":"\t/** Working area for data segment. */"},{"line_number":144,"context_line":"\tstruct working_area *data;"},{"line_number":145,"context_line":"\t/** Working area for tramploline. */"},{"line_number":146,"context_line":"\tstruct working_area *tramp;"},{"line_number":147,"context_line":"\t/** Working area for padding between code and data area. */"},{"line_number":148,"context_line":"\tstruct working_area *padding;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"2032fddf_031545ad","line":145,"updated":"2023-09-10 16:03:36.000000000","message":"typo s/tramploline/trampoline/","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"5c824916c814adcfb4250181391c5ef5733c5d6b","unresolved":false,"context_lines":[{"line_number":142,"context_line":"\tstruct working_area *code;"},{"line_number":143,"context_line":"\t/** Working area for data segment. */"},{"line_number":144,"context_line":"\tstruct working_area *data;"},{"line_number":145,"context_line":"\t/** Working area for tramploline. */"},{"line_number":146,"context_line":"\tstruct working_area *tramp;"},{"line_number":147,"context_line":"\t/** Working area for padding between code and data area. */"},{"line_number":148,"context_line":"\tstruct working_area *padding;"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"955e4430_df262769","line":145,"in_reply_to":"2032fddf_031545ad","updated":"2023-09-10 18:25:06.000000000","message":"Done","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"eabceded69c79bfc56b4fe1921158d8e265c2ffe","unresolved":true,"context_lines":[{"line_number":250,"context_line":" */"},{"line_number":251,"context_line":"struct algorithm_run_data {"},{"line_number":252,"context_line":"\t/** Algorithm completion timeout in ms. If 0, default value will be used */"},{"line_number":253,"context_line":"\tuint32_t tmo;"},{"line_number":254,"context_line":"\t/** Algorithm stack size. */"},{"line_number":255,"context_line":"\tuint32_t stack_size;"},{"line_number":256,"context_line":"\t/** Algorithm register arguments. */"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"a77deb37_9fe87e43","line":253,"updated":"2023-09-10 16:03:36.000000000","message":"maybe a more explicit name \u0027timeout_ms\u0027 would help a human code reader.","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"5c824916c814adcfb4250181391c5ef5733c5d6b","unresolved":false,"context_lines":[{"line_number":250,"context_line":" */"},{"line_number":251,"context_line":"struct algorithm_run_data {"},{"line_number":252,"context_line":"\t/** Algorithm completion timeout in ms. If 0, default value will be used */"},{"line_number":253,"context_line":"\tuint32_t tmo;"},{"line_number":254,"context_line":"\t/** Algorithm stack size. */"},{"line_number":255,"context_line":"\tuint32_t stack_size;"},{"line_number":256,"context_line":"\t/** Algorithm register arguments. */"}],"source_content_type":"text/x-csrc","patch_set":6,"id":"b6e26a67_63d0c134","line":253,"in_reply_to":"a77deb37_9fe87e43","updated":"2023-09-10 18:25:06.000000000","message":"Done","commit_id":"17c6ed6153787a4ed5a6ca9b94e5de39edc7df38"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":45,"context_line":" * There are two options to run code on target under OpenOCD control:"},{"line_number":46,"context_line":" * - Run externally compiled stub code."},{"line_number":47,"context_line":" * - Run onboard pre-compiled code. @note For ESP chips debug stubs must be enabled in target code @see ESP IDF docs."},{"line_number":48,"context_line":" * The main difference between the execution of external stub code and target built-in functions is that"},{"line_number":49,"context_line":" * in the latter case working areas can not be used to allocate target memory for code and data because they can overlap"},{"line_number":50,"context_line":" * with code and data involved in onboard function execution. For example, if memory allocated in the working area"},{"line_number":51,"context_line":" * for the stub stack will overlap with some on-board data used by the stub the stack will get overwritten."},{"line_number":52,"context_line":" * The same stands for allocations in target code space."},{"line_number":53,"context_line":" *"},{"line_number":54,"context_line":" * External Code Execution"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"40a7b131_d6185240","line":51,"range":{"start_line":48,"start_character":0,"end_line":51,"end_character":107},"updated":"2023-11-27 15:04:41.000000000","message":"I\u0027m not quite sure how to read this comment...  are working areas completely usable by the latter case, or are they usable but only for allocating non-code/non-data target memory (i.e. heap/stack/other)?","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":45,"context_line":" * There are two options to run code on target under OpenOCD control:"},{"line_number":46,"context_line":" * - Run externally compiled stub code."},{"line_number":47,"context_line":" * - Run onboard pre-compiled code. @note For ESP chips debug stubs must be enabled in target code @see ESP IDF docs."},{"line_number":48,"context_line":" * The main difference between the execution of external stub code and target built-in functions is that"},{"line_number":49,"context_line":" * in the latter case working areas can not be used to allocate target memory for code and data because they can overlap"},{"line_number":50,"context_line":" * with code and data involved in onboard function execution. For example, if memory allocated in the working area"},{"line_number":51,"context_line":" * for the stub stack will overlap with some on-board data used by the stub the stack will get overwritten."},{"line_number":52,"context_line":" * The same stands for allocations in target code space."},{"line_number":53,"context_line":" *"},{"line_number":54,"context_line":" * External Code Execution"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"88868501_19315a46","line":51,"range":{"start_line":48,"start_character":0,"end_line":51,"end_character":107},"in_reply_to":"40a7b131_d6185240","updated":"2023-11-28 17:00:56.000000000","message":"Actually, we wanted to say do not use working areas in the latter case. Because you will not need, since there is a code and data already there and you will just set the PC to the target function and run it. For the OpenOCD trampoline code, memory is statically allocated and guaranteed not to override. (we use working areas if we need to store/restore the memory region)\n\nMore details; https://github.com/espressif/esp-idf/blob/master/components/esp_system/debug_stubs.c#L15","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":55,"context_line":" * -----------------------"},{"line_number":56,"context_line":" * To run external code on the target user should use algorithm_run_func_image()."},{"line_number":57,"context_line":" * In this case all necessary memory (code/data) is allocated in working areas that have fixed configuration"},{"line_number":58,"context_line":" * defined in target TCL file. Stub code is actually a standalone program, so all its segments must have known"},{"line_number":59,"context_line":" * addresses due to position-dependent code nature. So stub must be linked in such a way that its code segment"},{"line_number":60,"context_line":" * starts at the beginning of the working area for code space defined in TCL. The same restriction must be applied"},{"line_number":61,"context_line":" * to stub\u0027s data segment and base addresses of working area for data space. @see ESP stub flasher LD scripts."}],"source_content_type":"text/x-csrc","patch_set":8,"id":"da9b2c29_bc875781","line":58,"updated":"2023-11-27 15:04:41.000000000","message":"if stub code is a standalone program, does that imply it must be an ELF file?  or is it an objcopy\u0027ed binary?","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":55,"context_line":" * -----------------------"},{"line_number":56,"context_line":" * To run external code on the target user should use algorithm_run_func_image()."},{"line_number":57,"context_line":" * In this case all necessary memory (code/data) is allocated in working areas that have fixed configuration"},{"line_number":58,"context_line":" * defined in target TCL file. Stub code is actually a standalone program, so all its segments must have known"},{"line_number":59,"context_line":" * addresses due to position-dependent code nature. So stub must be linked in such a way that its code segment"},{"line_number":60,"context_line":" * starts at the beginning of the working area for code space defined in TCL. The same restriction must be applied"},{"line_number":61,"context_line":" * to stub\u0027s data segment and base addresses of working area for data space. @see ESP stub flasher LD scripts."}],"source_content_type":"text/x-csrc","patch_set":8,"id":"d9c3745c_e48c6588","line":58,"in_reply_to":"da9b2c29_bc875781","updated":"2023-11-28 17:00:56.000000000","message":"Yes, it is elf file and we extract the .text and .data sections into binary file with objcopy. \n\nPlease refer to `stub_common.mk` in our fork.","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":61,"context_line":" * to stub\u0027s data segment and base addresses of working area for data space. @see ESP stub flasher LD scripts."},{"line_number":62,"context_line":" * Also in order to simplify memory allocation BSS section must follow the DATA section in the stub image."},{"line_number":63,"context_line":" * The size of the BSS section must be specified in the bss_size field of struct algorithm_image."},{"line_number":64,"context_line":" * Sample stub memory map is shown below."},{"line_number":65,"context_line":" *  ___________________________________________"},{"line_number":66,"context_line":" * | data space working area start             |"},{"line_number":67,"context_line":" * |                                           |"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"cb498129_8d3f5c8c","line":64,"updated":"2023-11-27 15:04:41.000000000","message":"is there an LSP or some example code you can point people to for reference?  or is that already in the ESP-IDF docs?","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":61,"context_line":" * to stub\u0027s data segment and base addresses of working area for data space. @see ESP stub flasher LD scripts."},{"line_number":62,"context_line":" * Also in order to simplify memory allocation BSS section must follow the DATA section in the stub image."},{"line_number":63,"context_line":" * The size of the BSS section must be specified in the bss_size field of struct algorithm_image."},{"line_number":64,"context_line":" * Sample stub memory map is shown below."},{"line_number":65,"context_line":" *  ___________________________________________"},{"line_number":66,"context_line":" * | data space working area start             |"},{"line_number":67,"context_line":" * |                                           |"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"862214da_a804e2cc","line":64,"in_reply_to":"cb498129_8d3f5c8c","updated":"2023-11-28 17:00:56.000000000","message":"Please check here https://github.com/espressif/openocd-esp32/tree/master/contrib/loaders/flash/esp","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":118,"context_line":"\tstruct image image;"},{"line_number":119,"context_line":"\t/** BSS section size. */"},{"line_number":120,"context_line":"\tuint32_t bss_size;"},{"line_number":121,"context_line":"\t/** IRAM start address in the linker script */"},{"line_number":122,"context_line":"\tuint32_t iram_org;"},{"line_number":123,"context_line":"\t/** Total reserved IRAM size */"},{"line_number":124,"context_line":"\tuint32_t iram_len;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"c0687f44_fd34b68e","line":121,"updated":"2023-11-27 15:04:41.000000000","message":"are IRAM/DRAM use required?  or can system memory / DDR be used?  apologies that i don\u0027t know the ESP configuration layouts, just general xtensa knowledge...","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":118,"context_line":"\tstruct image image;"},{"line_number":119,"context_line":"\t/** BSS section size. */"},{"line_number":120,"context_line":"\tuint32_t bss_size;"},{"line_number":121,"context_line":"\t/** IRAM start address in the linker script */"},{"line_number":122,"context_line":"\tuint32_t iram_org;"},{"line_number":123,"context_line":"\t/** Total reserved IRAM size */"},{"line_number":124,"context_line":"\tuint32_t iram_len;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"9de187bc_e15939e2","line":121,"in_reply_to":"c0687f44_fd34b68e","updated":"2023-11-28 17:00:56.000000000","message":"I think yes you can use system memory / DDR. please refer here which can be similar your use case. https://github.com/espressif/openocd-esp32/blob/master/contrib/loaders/flash/esp/esp32c6/stub.ld\n\nWe have one virtual memory address for both IRAM/DRAM.","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":140,"context_line":"\ttarget_addr_t entry;"},{"line_number":141,"context_line":"\t/** Working area for code segment. */"},{"line_number":142,"context_line":"\tstruct working_area *code;"},{"line_number":143,"context_line":"\t/** Working area for data segment. */"},{"line_number":144,"context_line":"\tstruct working_area *data;"},{"line_number":145,"context_line":"\t/** Working area for trampoline. */"},{"line_number":146,"context_line":"\tstruct working_area *tramp;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"00d2bd58_fde70af0","line":143,"updated":"2023-11-27 15:04:41.000000000","message":"do you guarantee there aren\u0027t other segments, or that they are consecutive (e.g. .rodata, .rtos.data, etc.)?  apologies if i missed that in the comments above.","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":140,"context_line":"\ttarget_addr_t entry;"},{"line_number":141,"context_line":"\t/** Working area for code segment. */"},{"line_number":142,"context_line":"\tstruct working_area *code;"},{"line_number":143,"context_line":"\t/** Working area for data segment. */"},{"line_number":144,"context_line":"\tstruct working_area *data;"},{"line_number":145,"context_line":"\t/** Working area for trampoline. */"},{"line_number":146,"context_line":"\tstruct working_area *tramp;"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"83b45e4b_ba1456cf","line":143,"in_reply_to":"00d2bd58_fde70af0","updated":"2023-11-28 17:00:56.000000000","message":"Please refer here. https://github.com/espressif/openocd-esp32/blob/master/contrib/loaders/flash/esp/stub_common.ld","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":298,"context_line":"\tuint32_t num_args,"},{"line_number":299,"context_line":"\tva_list ap);"},{"line_number":300,"context_line":""},{"line_number":301,"context_line":"static inline int algorithm_exec_func_image(struct target *target,"},{"line_number":302,"context_line":"\tstruct algorithm_run_data *run,"},{"line_number":303,"context_line":"\tuint32_t num_args,"},{"line_number":304,"context_line":"\t...)"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"3e0c493e_93514300","line":301,"updated":"2023-11-27 15:04:41.000000000","message":"could you add a @brief description for this function as well?  it appears to be a helper function for algorithm_run_func_image(), but since their names are so similar, that might be helpful, or perhaps a comment that it should not be called directly?","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":298,"context_line":"\tuint32_t num_args,"},{"line_number":299,"context_line":"\tva_list ap);"},{"line_number":300,"context_line":""},{"line_number":301,"context_line":"static inline int algorithm_exec_func_image(struct target *target,"},{"line_number":302,"context_line":"\tstruct algorithm_run_data *run,"},{"line_number":303,"context_line":"\tuint32_t num_args,"},{"line_number":304,"context_line":"\t...)"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"79da094b_b77c28c6","line":301,"in_reply_to":"3e0c493e_93514300","updated":"2023-11-28 17:00:56.000000000","message":"Thanks for pointing out. Looks like we don\u0027t use it now and will not in the future. So I removed it.","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001982,"name":"Ian Thompson","email":"ianst@cadence.com","username":"ianstcdns"},"change_message_id":"1f3b36bb1fee7f933237e6e8f46ea03b2646a01c","unresolved":true,"context_lines":[{"line_number":391,"context_line":"\treturn retval;"},{"line_number":392,"context_line":"}"},{"line_number":393,"context_line":""},{"line_number":394,"context_line":"static inline void algorithm_user_arg_set_uint(struct algorithm_run_data *run,"},{"line_number":395,"context_line":"\tint arg_num,"},{"line_number":396,"context_line":"\tuint64_t val)"},{"line_number":397,"context_line":"{"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"3ec1411c_9dfdc357","line":394,"updated":"2023-11-27 15:04:41.000000000","message":"would be nice to have @brief descriptions for set/get arg functions too","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"ac922f5700e215bc08b63720f20b499f08a610a2","unresolved":false,"context_lines":[{"line_number":391,"context_line":"\treturn retval;"},{"line_number":392,"context_line":"}"},{"line_number":393,"context_line":""},{"line_number":394,"context_line":"static inline void algorithm_user_arg_set_uint(struct algorithm_run_data *run,"},{"line_number":395,"context_line":"\tint arg_num,"},{"line_number":396,"context_line":"\tuint64_t val)"},{"line_number":397,"context_line":"{"}],"source_content_type":"text/x-csrc","patch_set":8,"id":"5d33d1b9_de329b9a","line":394,"in_reply_to":"3ec1411c_9dfdc357","updated":"2023-11-28 17:00:56.000000000","message":"OpenOCD can pass the arguments to the stub main code by registers or memory. This function sets the value of the initiated register argument with init_reg_param func. Basically it is shortcut for buf_set_u32 or buf_set_u64.","commit_id":"c492dbe694f22d2c0dedb06578e2e24b9b11d807"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7773ca8e2de625125018b6dd2d858b7453183a59","unresolved":true,"context_lines":[{"line_number":113,"context_line":" * Algorithm image data."},{"line_number":114,"context_line":" * Helper struct to work with algorithms consisting of code and data segments."},{"line_number":115,"context_line":" */"},{"line_number":116,"context_line":"struct algorithm_image {"},{"line_number":117,"context_line":"\t/** Image. */"},{"line_number":118,"context_line":"\tstruct image image;"},{"line_number":119,"context_line":"\t/** BSS section size. */"}],"source_content_type":"text/x-csrc","patch_set":9,"id":"2beae960_5e21e52a","line":116,"updated":"2023-11-29 20:11:50.000000000","message":"Namespace: esp_ prefix?\n\nMore structs follow","commit_id":"e00e9cec4f9eb366e77847f598fb29d372a27543"},{"author":{"_account_id":1001964,"name":"Erhan Kurubas","display_name":"Erhan Kurubas","email":"erhan.kurubas@espressif.com","username":"erhankur"},"change_message_id":"186ecada4c3b62d85af0cafaf8986a0ce162b318","unresolved":false,"context_lines":[{"line_number":113,"context_line":" * Algorithm image data."},{"line_number":114,"context_line":" * Helper struct to work with algorithms consisting of code and data segments."},{"line_number":115,"context_line":" */"},{"line_number":116,"context_line":"struct algorithm_image {"},{"line_number":117,"context_line":"\t/** Image. */"},{"line_number":118,"context_line":"\tstruct image image;"},{"line_number":119,"context_line":"\t/** BSS section size. */"}],"source_content_type":"text/x-csrc","patch_set":9,"id":"efdfb802_b100462d","line":116,"in_reply_to":"2beae960_5e21e52a","updated":"2023-11-29 22:07:44.000000000","message":"Done","commit_id":"e00e9cec4f9eb366e77847f598fb29d372a27543"}]}
