{"id":5253,"date":"2023-01-25T15:58:29","date_gmt":"2023-01-25T14:58:29","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=5253"},"modified":"2023-01-25T16:33:07","modified_gmt":"2023-01-25T15:33:07","slug":"analyzing-esp32-exceptions","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/","title":{"rendered":"Analyzing ESP32 Exceptions"},"content":{"rendered":"<p>When your Arudino sketch is crashing it produces something as follows<\/p>\n<pre><code>13:45:41.992 -&gt; \n13:45:41.992 -&gt; Backtrace: 0x40083585:0x3ffb2690 0x400892ad:0x3ffb26b0 0x4008e2f1:0x3ffb26d0 0x400d1442:0x3ffb2800 0x400d2be1:0x3ffb2820\n13:45:41.992 -&gt; \n13:45:41.992 -&gt; \n13:45:41.992 -&gt; \n13:45:41.992 -&gt; \n13:45:41.992 -&gt; ELF file SHA256: 9868280367130d7a\n<\/code><\/pre>\n<p>It is vital to be able to analyse this backtrace and translate it to methods and file names.  In Arduino we could use the <a href=\"https:\/\/github.com\/me-no-dev\/EspExceptionDecoder\">EspExceptionDecoder<\/a> to do this.<\/p>\n<p>Unfortunately this is not supported by <strong>Arduino 2.0<\/strong>! No problem &#8211; I thought, so I just continue to use the old Arduino version. But when I moved my work to <strong>Linux<\/strong>, this functionality stopped to work as well!<\/p>\n<p>Now I was looking for some <strong>easy to use work-around<\/strong>. It turns out we can do this with <a href=\"https:\/\/gist.github.com\/sarfata\/a06d8aaff7697a742f885ef774a7df1d\">this python script<\/a>. I was not very happy with it because of all the necessary parameters so I decided create <a href=\"https:\/\/gist.github.com\/pschatzmann\/84361b313baa4479c9cbf2e3cea4c49a\">my own version<\/a> and to add the following improvements:<\/p>\n<ul>\n<li>Provide a global variable to set the <strong>toolchain_default path<\/strong><\/li>\n<li>Provide a global variable to set the <strong>elf_default path<\/strong><\/li>\n<li>Determine the <strong>elf file automatically<\/strong> by using the most recent elf file in the path defined above<\/li>\n<\/ul>\n<p>The values for the parameters above can be determined from the last entry in the log when you compile your Sketch in Arduino and these values might only change when you install an new esp32 version.<\/p>\n<p>I also did not like that the backtrace needed to be specified in a separate file, so I changed the logic, so that we can specify it directly on the command line.<\/p>\n<p>In order to install this Python script<\/p>\n<ol>\n<li><a href=\"https:\/\/gist.github.com\/pschatzmann\/84361b313baa4479c9cbf2e3cea4c49a\">Download the script<\/a> to the file esp32-stacktrace<\/li>\n<li>Update the <strong>global default variables<\/strong><\/li>\n<li>Make it <strong>executable<\/strong> (e.g. with chmod +x esp32-esp32-stacktrace<\/li>\n<li>Move it to a location on the <strong>search path<\/strong> (e.g. usr\/bin)<\/li>\n<\/ol>\n<p>Now you should be ready to use it by typing the following command in the terminal:<\/p>\n<pre><code>esp32-stacktrace \"0x40083585:0x3ffb2690 0x400892ad:0x3ffb26b0 0x4008e2f1:0x3ffb26d0 0x400d1442:0x3ffb2800 0x400d2be1:0x3ffb2820\"\n<\/code><\/pre>\n<p>This gives the following result<\/p>\n<pre><code>elf = \/home\/pschatzmann\/.var\/app\/cc.arduino.IDE2\/cache\/arduino-sketch-93C5D26949BAF1CE46343309937C5D93\/sketch_jan25a.ino.elf\n\nStack trace:\n\n     0x40083585:  panic_abort  at \/Users\/ficeto\/Desktop\/ESP32\/ESP32S2\/esp-idf-public\/components\/esp_system\/panic.c: line 402'\n     0x400892ad:  esp_system_abort  at \/Users\/ficeto\/Desktop\/ESP32\/ESP32S2\/esp-idf-public\/components\/esp_system\/esp_system.c: line 128'\n     0x4008e2f1:  __assert_func  at \/Users\/ficeto\/Desktop\/ESP32\/ESP32S2\/esp-idf-public\/components\/newlib\/assert.c: line 85'\n     0x400d1442:  loop()  at \/home\/pschatzmann\/.var\/app\/cc.arduino.IDE2\/cache\/.arduinoIDE-unsaved2023025-30-ox4b5b.v436\/sketch_jan25a\/sketch_jan25a.ino: line 10'\n     0x400d2be1:  loopTask(void*)  at \/home\/pschatzmann\/.arduino15\/packages\/esp32\/hardware\/esp32\/2.0.6\/cores\/esp32\/main.cpp: line 50'\n\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When your Arudino sketch is crashing it produces something as follows 13:45:41.992 -&gt; 13:45:41.992 -&gt; Backtrace: 0x40083585:0x3ffb2690 0x400892ad:0x3ffb26b0 0x4008e2f1:0x3ffb26d0 0x400d1442:0x3ffb2800 0x400d2be1:0x3ffb2820 13:45:41.992 -&gt; 13:45:41.992 -&gt; 13:45:41.992 -&gt; 13:45:41.992 -&gt; 13:45:41.992 -&gt; ELF file SHA256: 9868280367130d7a It is vital to be able to analyse this backtrace and translate it to methods [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[20,5],"tags":[],"class_list":["post-5253","post","type-post","status-publish","format-standard","hentry","category-arduino","category-infrastructure"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Analyzing ESP32 Exceptions - Phil Schatzmann<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Analyzing ESP32 Exceptions - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"When your Arudino sketch is crashing it produces something as follows 13:45:41.992 -&gt; 13:45:41.992 -&gt; Backtrace: 0x40083585:0x3ffb2690 0x400892ad:0x3ffb26b0 0x4008e2f1:0x3ffb26d0 0x400d1442:0x3ffb2800 0x400d2be1:0x3ffb2820 13:45:41.992 -&gt; 13:45:41.992 -&gt; 13:45:41.992 -&gt; 13:45:41.992 -&gt; 13:45:41.992 -&gt; ELF file SHA256: 9868280367130d7a It is vital to be able to analyse this backtrace and translate it to methods [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-25T14:58:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-25T15:33:07+00:00\" \/>\n<meta name=\"author\" content=\"pschatzmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pschatzmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2023\\\/01\\\/25\\\/analyzing-esp32-exceptions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2023\\\/01\\\/25\\\/analyzing-esp32-exceptions\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"Analyzing ESP32 Exceptions\",\"datePublished\":\"2023-01-25T14:58:29+00:00\",\"dateModified\":\"2023-01-25T15:33:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2023\\\/01\\\/25\\\/analyzing-esp32-exceptions\\\/\"},\"wordCount\":296,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"articleSection\":[\"Arduino\",\"Infrastructure\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2023\\\/01\\\/25\\\/analyzing-esp32-exceptions\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2023\\\/01\\\/25\\\/analyzing-esp32-exceptions\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2023\\\/01\\\/25\\\/analyzing-esp32-exceptions\\\/\",\"name\":\"Analyzing ESP32 Exceptions - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"datePublished\":\"2023-01-25T14:58:29+00:00\",\"dateModified\":\"2023-01-25T15:33:07+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2023\\\/01\\\/25\\\/analyzing-esp32-exceptions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2023\\\/01\\\/25\\\/analyzing-esp32-exceptions\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2023\\\/01\\\/25\\\/analyzing-esp32-exceptions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Analyzing ESP32 Exceptions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\",\"name\":\"Phil Schatzmann Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\",\"name\":\"pschatzmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"width\":305,\"height\":305,\"caption\":\"pschatzmann\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Analyzing ESP32 Exceptions - Phil Schatzmann","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/","og_locale":"en_US","og_type":"article","og_title":"Analyzing ESP32 Exceptions - Phil Schatzmann","og_description":"When your Arudino sketch is crashing it produces something as follows 13:45:41.992 -&gt; 13:45:41.992 -&gt; Backtrace: 0x40083585:0x3ffb2690 0x400892ad:0x3ffb26b0 0x4008e2f1:0x3ffb26d0 0x400d1442:0x3ffb2800 0x400d2be1:0x3ffb2820 13:45:41.992 -&gt; 13:45:41.992 -&gt; 13:45:41.992 -&gt; 13:45:41.992 -&gt; 13:45:41.992 -&gt; ELF file SHA256: 9868280367130d7a It is vital to be able to analyse this backtrace and translate it to methods [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/","og_site_name":"Phil Schatzmann","article_published_time":"2023-01-25T14:58:29+00:00","article_modified_time":"2023-01-25T15:33:07+00:00","author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"Analyzing ESP32 Exceptions","datePublished":"2023-01-25T14:58:29+00:00","dateModified":"2023-01-25T15:33:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/"},"wordCount":296,"commentCount":1,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"articleSection":["Arduino","Infrastructure"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/","url":"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/","name":"Analyzing ESP32 Exceptions - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"datePublished":"2023-01-25T14:58:29+00:00","dateModified":"2023-01-25T15:33:07+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2023\/01\/25\/analyzing-esp32-exceptions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"Analyzing ESP32 Exceptions"}]},{"@type":"WebSite","@id":"https:\/\/www.pschatzmann.ch\/home\/#website","url":"https:\/\/www.pschatzmann.ch\/home\/","name":"Phil Schatzmann Consulting","description":"","publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pschatzmann.ch\/home\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1","name":"pschatzmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","width":305,"height":305,"caption":"pschatzmann"},"logo":{"@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/5253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/comments?post=5253"}],"version-history":[{"count":14,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/5253\/revisions"}],"predecessor-version":[{"id":5267,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/5253\/revisions\/5267"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=5253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=5253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=5253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}