<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all</link><description>Hi Nordic 
 I am working with nrf52840 and nrf52832 using ncs v2.8.0 
 I am trying to save coredump to flash according to instructions on this link - https://docs.nordicsemi.com/bundle/ncs-2.8.0/page/zephyr/services/debugging/coredump.html 
 
 I added</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 27 Oct 2025 11:43:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all" /><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/552465?ContentTypeID=1</link><pubDate>Mon, 27 Oct 2025 11:43:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d725a70-c159-4414-83f2-e674be33709e</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;well, feeling a little neglected here&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f643.svg" title="Upside down"&gt;&amp;#x1f643;&lt;/span&gt;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f937_2D00_1f3fb_2D00_200d_2D00_2642_2D00_fe0f.svg" title="man shrugging: light skin tone"&gt;&amp;#x1f937;&amp;#x1f3fb;&amp;#x200d;&amp;#x2642;&amp;#xfe0f;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;anyway things i figured out so far:&lt;/p&gt;
&lt;p&gt;1. what is saved to flash is actually a binary, but when using &amp;quot;&amp;nbsp;&lt;code&gt;nefjprog --memrd&lt;/code&gt;&amp;nbsp;&amp;quot; to read it and save to a file it is converted to ascci hex (this can also be varified by the size of the saved file which is larger then the actual flash partition). to save the binary from flash this commands can be used:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;JLinkExe -device nRF52840_xxAA -if swd -speed 4000 -autoconnect 1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;followed by :&amp;nbsp;&lt;code&gt;savebin coredump.bin,0xED000,0x8000&amp;nbsp;&lt;/code&gt;from within JLink.&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;following instruction for coredump debug,&amp;nbsp; here&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/latest/services/debugging/coredump.html#:~:text=Run%20the%20core%20dump%20serial%20log%20converter%3A"&gt;https://docs.zephyrproject.org/latest/services/debugging/coredump.html#:~:text=Run%20the%20core%20dump%20serial%20log%20converter%3A&lt;/a&gt;&amp;nbsp;or here&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.8.0/page/zephyr/services/debugging/coredump.html#:~:text=Run%20the%20core%20dump%20serial%20log%20converter%3A"&gt;https://docs.nordicsemi.com/bundle/ncs-2.8.0/page/zephyr/services/debugging/coredump.html#:~:text=Run%20the%20core%20dump%20serial%20log%20converter%3A&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;the py script&amp;nbsp;&lt;span&gt;coredump_serial_log_parser.py is designed to take a .log file (not sure where i get it, maybe by copying my rtt output remove the&amp;nbsp;timestamp and log file name etc. all the way to &amp;#39;#CD&amp;#39;&amp;nbsp;and save to a file&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f914.svg" title="Thinking"&gt;&amp;#x1f914;&lt;/span&gt;&amp;nbsp;) .. any way, since i know how to get a binary i don&amp;#39;t need this converter which is not really working with normal coredump cause normal coredump is missing the &amp;quot;BEGIN&amp;quot; bytes or the &amp;quot;#CD&amp;quot; and also contain a header before the CD initials &amp;#39;ZE&amp;#39; .. so ..i can take my binary coredump&amp;nbsp;parse&amp;nbsp;the first 4 words to the header, get the size of coredump and then saved this size of bytes from after the header .. the reason that the bin file should not contain the header is that&amp;nbsp;coredump_gdbserver.py calls for log_parser.py which expects to find &amp;#39;ZE&amp;#39; in the first line.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;p.s. in the CD saved to flash the bytes seems to be in reverse order from the way it seems&amp;nbsp;in the log prints in the rtt, i think it is just a matter of how the tools present the ascii cause the bin file without any reverse operation is read by the log_parser.py and &amp;#39;ZE&amp;#39; is found.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;so far this is what i got working and understood..&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/vibe"&gt;Vidar Berg&lt;/a&gt;&amp;nbsp;please correct me if i am wrong somewhere there.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;the issue i am&amp;nbsp;running this &amp;nbsp;&amp;quot;/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb build/zephyr/zephyr.elf&amp;quot; (instead of non existing&amp;nbsp;&lt;em&gt;&amp;lt;path to SDK&amp;gt;/x86_64-zephyr-elf/bin/x86_64-zephyr-elf-gdb ) and trying to connect, then i get this error&amp;nbsp;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;(gdb)  target remote localhost:1234
localhost:1234
: cannot resolve name: Servname not supported for ai_socktype
localhost:1234
: No such file or directory.
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;even though coredump_gdbserver.py is running on another terminal &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;any idea why ? update - seems like it was related to order of things server must run before opening the gdb client even if the attempt to conect inside gdb is after the server start running ..&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;are there more debug options other then &amp;quot;info registers&amp;quot; and &amp;quot;bt&amp;quot; in order to get more information on running threads and stack ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;i&amp;#39;ll mention that i am working with a coredump bin which is generated with normal building mechanism (&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_DEBUG_COREDUMP&lt;/span&gt;&lt;span&gt;&lt;span&gt;=y,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_DEBUG_COREDUMP_BACKEND_FLASH_PARTITION&lt;/span&gt;&lt;span&gt;&lt;span&gt;=y,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_THREADS&lt;/span&gt;&lt;span&gt;&lt;span&gt;=y,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_ASSERT&lt;/span&gt;&lt;span&gt;=n )&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;and i&amp;#39;ll also mention that it is&amp;nbsp;very strange to me that there is no clear tool or support for flash saved CD parsing / debugging&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;hope to read you soon&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;best regards&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Ziv&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/551891?ContentTypeID=1</link><pubDate>Mon, 20 Oct 2025 07:41:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7de1699-76c5-4e8f-a3f5-0d5abdc9a91f</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;hi Vidar&lt;/p&gt;
&lt;p&gt;well thanks for the patient and the sample&lt;/p&gt;
&lt;p&gt;i found the issue with the PR of coredump_backend_nrf_flash_partition.c that caused the data to be saved partially and managed to save CD to flash&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f917.svg" title="Hugging"&gt;&amp;#x1f917;&lt;/span&gt;.. however according to git i see this bug is already fixed (so i&amp;#39;ll keep searching for other opportunities&amp;nbsp;for me to contribute&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f643.svg" title="Upside down"&gt;&amp;#x1f643;&lt;/span&gt;&amp;nbsp;)&lt;/p&gt;
&lt;p&gt;basically it was this lines&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;for (uint32_t i = 0; i &amp;lt; size; i += sizeof(uint32_t)) {
		nrfx_nvmc_word_write(PARTITION_OFFSET + offset + i, UNALIGNED_GET(&amp;amp;data[i]));
	}
	
	data is uint8_t* type and jumping 4 bytes each time in the loop it losses 3 byts of data 
	so my solution and also in git was to cast it like so :
	
	nrfx_nvmc_word_write(PARTITION_OFFSET + offset + i, UNALIGNED_GET((const uint32_t *)&amp;amp;data[i]));&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;now i am a bit struggling with decoding of the coredump .. there are some python scripts in zephyr for that but they don&amp;#39;t seem to work so well for example i get this error when running coredump_gdbserver.py&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;python3 coredump_gdbserver.py /../app/build_b/app/zephyr/zephyr.elf /../coredump/coredump_flash.bin 
Traceback (most recent call last):
  File &amp;quot;/.../ncs/v2.8.0/zephyr/scripts/coredump/coredump_gdbserver.py&amp;quot;, line 14, in &amp;lt;module&amp;gt;
    from coredump_parser.elf_parser import CoredumpElfFile
  File &amp;quot;/.../ncs/v2.8.0/zephyr/scripts/coredump/coredump_parser/elf_parser.py&amp;quot;, line 10, in &amp;lt;module&amp;gt;
    import elftools
ModuleNotFoundError: No module named &amp;#39;elftools&amp;#39;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;update: the above can be solve by installing &amp;quot;pip install pyelftools&amp;quot; (there are still errors cause i am not using a log file but a saved bytes hex string like)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;is there&amp;nbsp;a script like coredump_serial_log_parser.py that accepts the flash saved&amp;nbsp;bytes&amp;nbsp;instead of a log file to make it binary or is there a way to save CD initially as binary (this can probably save space on flash and less data to transfer OTA)?&lt;/p&gt;
&lt;p&gt;another thing is big/little endien .. i notice that in the log the bytes are saved in this order &amp;#39; 5a450100&amp;#39; (taken from log example in &lt;a href="https://docs.zephyrproject.org/latest/services/debugging/coredump.html#:~:text=5a4501000100050000000000"&gt;https://docs.zephyrproject.org/latest/services/debugging/coredump.html#:~:text=5a4501000100050000000000&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;but in the file i read from flash they are saved like this 0002455A what is the correct way of byte order for it to be parsed ?&lt;/p&gt;
&lt;p&gt;i would actually like to have one script that does all (giving it the zephyr.elf and coredump and an output file) and it will output a human readable parsing of coredump .. wonder if there is something like that ??&amp;nbsp;&lt;/p&gt;
&lt;p&gt;p.s. if you like i can open the CD parsing questions on a new thread and close this one&amp;nbsp;&lt;/p&gt;
&lt;p&gt;hope to read you soon&amp;nbsp;&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Ziv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/551704?ContentTypeID=1</link><pubDate>Thu, 16 Oct 2025 12:38:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b66aa43-c2f8-4900-9602-a42d9a75dd72</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, if the coredump backend triggers a fault or an assertion program will crash again before&amp;nbsp;reaching your error handler. You can imagine what happens if the error handler calls something that triggers another error and keeps invoking itself.&amp;nbsp;But you should be able to catch faults occurring in the error handler if you debug your code in VS code. A cpu lockup in debug mode will not trigger a reset but instead halt the program:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1760616412247v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="ziv123"]2. i tried to add logs in&amp;nbsp;nrf/modules/memfault-firmware-sdk/memfault_flash_coredump_storage.c to follow how memfault saves the coredump but when memfault is on i do not get any logs, even when i add LOG_PANIC() i just get the first call to z_arm_fault and after that it resets so i am not even sure it gets to the call of&amp;nbsp;&lt;span&gt;k_sys_fatal_error_handler() and if not, then which crash api memfault use to overwrite and take control of the flow ?&amp;nbsp;&lt;/span&gt;[/quote]
&lt;p&gt;The logger will not work in the case of a cpu lockup so it is not possible to rely on logging in this case.&lt;/p&gt;
[quote user="ziv123"]seems like it is loggs latency and not an actual interrupt being called while coredump operation is on[/quote]
&lt;p&gt;When using LOG_MODE_DEFERRED logs are buffered and processed in the logger thread or when you call LOG_PANIC()&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;:&amp;nbsp;&lt;strong&gt;&lt;/strong&gt;adding a test sample&amp;nbsp;I created store the stack frame and error reason (you can add other things here too) from the error handler to ram in case you are interested. This is without CD and it will&amp;nbsp;therefore have a lower memory footprint.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/crash_5F00_save.zip"&gt;devzone.nordicsemi.com/.../crash_5F00_save.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/551568?ContentTypeID=1</link><pubDate>Wed, 15 Oct 2025 11:15:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bed51207-5c9e-4cdc-bf6e-3d48a3211273</guid><dc:creator>ziv123</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/551451"]Please post a code snippet showing how you have implemented this function.[/quote]
&lt;p&gt;i have managed to get it to overwrite, it basically overwrote before as well just it seems that i don&amp;#39;t always get to that function being called and this is what i tried to ask here :&lt;/p&gt;
[quote userid="90084" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/551393"]1. according to log ahead, it seems that z_arm_fault &lt;span&gt;precede&lt;/span&gt;&amp;nbsp;z_fatal_error() which calls for coredump() and only after that calls for&amp;nbsp; k_sys_fatal_error_handler()&amp;nbsp; .. so i don&amp;#39;t understand if memfault&amp;#39;s implementation is overwriting this function to handle the crash data collection, it is done after coredump so why does it not get stuck even when asserts are enabled .... is it related to&amp;nbsp; CONFIG_DEBUG_COREDUMP_BACKEND_OTHER though i don&amp;#39;t see it used in&amp;nbsp;coredump_backend_flash_partition.c ?&amp;nbsp; or if i want to get to that handler i need to CONFIG_DEBUG_COREDUMP=n&amp;nbsp; and only then i will get to this handler before system hults ? and in it i can call for the coredump save ? ?[/quote]
&lt;p&gt;2. i tried to add logs in&amp;nbsp;nrf/modules/memfault-firmware-sdk/memfault_flash_coredump_storage.c to follow how memfault saves the coredump but when memfault is on i do not get any logs, even when i add LOG_PANIC() i just get the first call to z_arm_fault and after that it resets so i am not even sure it gets to the call of&amp;nbsp;&lt;span&gt;k_sys_fatal_error_handler() and if not, then which crash api memfault use to overwrite and take control of the flow ?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;p.s.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/551451"]I expect all but zero latency interrupts to be masked at this point.[/quote]
&lt;p&gt;&lt;span&gt;seems like it is loggs latency and not an actual interrupt being called while coredump operation is on&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;hope to read you soon&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;best regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Ziv&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/551451?ContentTypeID=1</link><pubDate>Tue, 14 Oct 2025 13:54:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:346d434e-e112-41a6-89c7-d3890ef5eece</guid><dc:creator>Vidar Berg</dc:creator><description>[quote userid="90084" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/551393"]1. when i try to implement my&amp;nbsp; k_sys_fatal_error_handler() in my main it does not overwrite anything, i still get to zephyr error handling and my error handler is never called. what am i missing ?[/quote]
&lt;p&gt;Please post a code snippet showing how you have implemented this function. You can also check the zephyr.map file for your build to confirm if you were able to redefine the function.&lt;/p&gt;
[quote userid="90084" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/551393"]2. when working with assert enabled , according to the log at crash i am entering z_arm_fault() twice .. any idea why it is so ?&amp;nbsp;[/quote]
&lt;p&gt;As mentioned earlier, the CD flash backend is using semaphores (with timeouts) which will raise an assert when invoked from an interrupt context.&lt;/p&gt;
[quote userid="90084" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/551393"]3. when using the&amp;nbsp;coredump_backend_nrf_flash_partition.c&amp;nbsp;&amp;nbsp;(i added some prints in it) i see that in the middle of coredump work i get the print for the event of the button push (i put the crash at start of button push handler) this is strange i think .. any idea why it suddenly&amp;nbsp;pops ?&amp;nbsp;[/quote]
&lt;p&gt;I expect all but zero latency interrupts to be masked at this point.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/551393?ContentTypeID=1</link><pubDate>Tue, 14 Oct 2025 10:07:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ec0ff41-e8df-452e-8de3-36de5785cc0e</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;hi Vidar&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/550093"]You need to use&amp;nbsp;LOG_PANIC() to be able to flush the log buffer from the fault handler.&amp;nbsp;[/quote]
&lt;p&gt;thanks for the LOG_PANIC() it helped me follow what goes in a crash scenario but it brings this questions:&lt;/p&gt;
&lt;p&gt;1. according to log ahead, it seems that z_arm_fault &lt;span&gt;precede&lt;/span&gt;&amp;nbsp;z_fatal_error() which calls for coredump() and only after that calls for&amp;nbsp; k_sys_fatal_error_handler()&amp;nbsp; .. so i don&amp;#39;t understand if memfault&amp;#39;s implementation is overwriting this function to handle the crash data collection, it is done after coredump so why does it not get stuck even when asserts are enabled .... is it related to&amp;nbsp; CONFIG_DEBUG_COREDUMP_BACKEND_OTHER though i don&amp;#39;t see it used in&amp;nbsp;coredump_backend_flash_partition.c ?&amp;nbsp; or if i want to get to that handler i need to CONFIG_DEBUG_COREDUMP=n&amp;nbsp; and only then i will get to this handler before system hults ? and in it i can call for the coredump save ? ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2. when working with assert enabled , according to the log at crash i am entering z_arm_fault() twice .. any idea why it is so ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;this is the logs:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;with assert enable crash trigger by fault bus:
00&amp;gt; [00000006] &amp;lt;inf&amp;gt; AUGU_PUSH_B[00000007] &amp;lt;inf&amp;gt; os: In z_arm_fault
00&amp;gt; [00000007] &amp;lt;err&amp;gt; os: ***** BUS FAULT *****
00&amp;gt; [00000007] &amp;lt;err&amp;gt; os:   Imprecise data bus error
....
00&amp;gt; [00000007] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x000xxxx
00&amp;gt; [00000008] &amp;lt;err&amp;gt; os: in z_fatal_error
00&amp;gt; [00000008] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 26: Unknown error on CPU 0
00&amp;gt; [00000008] &amp;lt;err&amp;gt; os: Current thread: 0xFFFFFFFF (augu_work_q)
00&amp;gt; ASSERTION FAIL [((arch_is_in_isr() == 0) || ((timeout).ticks == (((k_timeout_t) {0})).ticks))] @ WEST_TOPDIR/zephyr/kernel/sem.c:136
00&amp;gt;   
00&amp;gt; [00000008] &amp;lt;inf&amp;gt; os: In z_arm_fault
00&amp;gt; [00000008] &amp;lt;err&amp;gt; os: ***** HARD FAULT *****
00&amp;gt; [00000008] &amp;lt;err&amp;gt; os:   Fault escalation (see below)
00&amp;gt; [00000008] &amp;lt;err&amp;gt; os: ARCH_EXCEPT with reason 4
00&amp;gt; 
00&amp;gt; [00000008] [1;31m&amp;lt;err&amp;gt; os: ....
00&amp;gt; [00000008] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x000XXXX
00&amp;gt; [00000008] &amp;lt;err&amp;gt; os: in z_fatal_error
00&amp;gt; [00000008] [1;31m&amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
00&amp;gt; [00000008] &amp;lt;err&amp;gt; os: Fault during interrupt handling
00&amp;gt; 
00&amp;gt; [00000008] &amp;lt;err&amp;gt; os: Current thread: 0xFFFFFFFF (augu_work_q)
00&amp;gt; ASSERTION FAIL [((arch_is_in_isr() == 0) || ((timeout).ticks == (((k_timeout_t) {0})).ticks))] @ WEST_TOPDIR/zephyr/kernel/sem.c:136
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;3. when using the&amp;nbsp;coredump_backend_nrf_flash_partition.c&amp;nbsp;&amp;nbsp;(i added some prints in it) i see that in the middle of coredump work i get the print for the event of the button push (i put the crash at start of button push handler) this is strange i think .. any idea why it suddenly&amp;nbsp;pops ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;4. when i use default coredump flow (&lt;span&gt;coredump_backend_flash_partition.c)&amp;nbsp;&lt;/span&gt;with CONFIG_ASSERT=n, and i try to crash with k_panic or k_oops, i still fail in saving coredump because of&amp;nbsp;a timeout error&amp;nbsp;at&amp;nbsp; stream_flash_init(..) .. so it seems like default coredump is only supported when&amp;nbsp;BUS FAULT errors (&amp;nbsp;ZEPHYR FATAL ERROR 26: Unknown error on CPU) .. this is an issue because when an end device&amp;nbsp; in the field get stuck on some scenario i want to reset it in that scenario immediately and not loos this device or waste&amp;nbsp;energy and time in&amp;nbsp;a watchdog feed mechanism .. is there a build in solution for handling dead end scenarios in the end device ? (obviously i want to know that the device failed and what happened before and how it got to this point this is why i need the coredump, usually those scenarios can be device fails to bond or some indication of memory corruption that happened) &amp;nbsp;&lt;/p&gt;
&lt;p&gt;5. i still haven&amp;#39;t figured out why data isn&amp;#39;t saved to flash properly in my use of&amp;nbsp;&lt;span&gt;coredump_backend_nrf_flash_partition.c adding prints in it i do see valid coredump values but for some reason it does not seem to be written to flash partition properly .. will update on that (i also took it to my app instead of using it from within ncs (this way i can keep ncs clean and it is easier if i need to modify the module)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;hope to read you soon&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;best regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Ziv&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/550289?ContentTypeID=1</link><pubDate>Wed, 01 Oct 2025 06:50:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6533739-d556-4ca2-858e-6cc634d63b59</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;You can find the end address of RAM programmatically using symbols generated by the partition manager in pm_config.h, for example,&amp;nbsp;PM_SRAM_PRIMARY_END_ADDRESS. Then use this as the start address when copying in the crash data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/550128?ContentTypeID=1</link><pubDate>Tue, 30 Sep 2025 10:22:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dca8ab56-07a4-4298-b289-06cadaa039c8</guid><dc:creator>Tudor B.</dc:creator><description>&lt;p&gt;Thank you for the explanation.&lt;/p&gt;
&lt;p&gt;Beyond the configuration:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;&amp;amp;sram0 {
   reg = &amp;lt;0x20000000 DT_SIZE_K(458752) - 150;
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;How would I set the variables in those 150 bytes that are reserved?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/550113?ContentTypeID=1</link><pubDate>Tue, 30 Sep 2025 09:05:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66b8697b-d54e-42d6-871e-3b7e8b953397</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The &amp;quot;missing&amp;quot; 64k is allocated to the shared RAM region and is used for communication with the network core.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1759222960679v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/550110?ContentTypeID=1</link><pubDate>Tue, 30 Sep 2025 08:51:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b5dd424-e10f-4c78-85b7-f946cec93d4c</guid><dc:creator>Tudor B.</dc:creator><description>&lt;p&gt;Sorry Ziv, it seems Vidar brought up a valid point.&lt;/p&gt;
&lt;p&gt;Going with your example Vidar, I would foresee something like:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;&amp;amp;sram0 {
   reg = &amp;lt;0x20000000 DT_SIZE_K(458752) - 150;
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This brings an interesting question: why don&amp;#39;t I have the full 512Kb RAM?&lt;/p&gt;
&lt;p&gt;I set the RAM config with 448Kb total since whatever configs I use, I get:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[650/650] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:      402024 B         3 MB     12.78%
             RAM:      190868 B       448 KB     41.61%
        IDT_LIST:          0 GB        32 KB      0.00%&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t have TFM or MCUBoot enabled. Since currently we&amp;#39;re using nrf5340dk and nrf7002dk Where are 64Kb disappearing to?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/550093?ContentTypeID=1</link><pubDate>Tue, 30 Sep 2025 07:06:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7555733-b2b9-47a9-baf0-66c0baec26e5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Thanks for the update&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/tudor-b_2e00_"&gt;Tudor B.&lt;/a&gt;&amp;nbsp;. I&amp;rsquo;m glad to see you got it working. Just want to add that the noinit section may become overwritten on startup if you include a bootloader.&amp;nbsp;A solution is to place the data at the end of RAM and reduce the RAM size in the sram0 devicetree node to ensure the area remains unallocated.&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;sram0 {
   reg = &amp;lt;0x20000000 DT_SIZE_K(&amp;lt;total ram size in kB) - &amp;lt;size of area you want to set aside for crash data&amp;gt;&amp;gt;;
};&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;[quote userid="90084" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/549986"]any idea what is the reason for that&amp;nbsp;?[/quote]
&lt;p&gt;Hard to say what&amp;#39;s causing this. I suggest you try this in a minimal sample in the latest SDK to see if you are able to reproduce the same.&amp;nbsp;&lt;/p&gt;
[quote userid="90084" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/549986"]plus, i would really appreciate if you can give some clarity on what i asked in prev message regarding the weak api that is not overwritten and about the order in which things are happening at crash and what about all the asserts in zephyr code if assert i[/quote]
&lt;p&gt;You need to use&amp;nbsp;LOG_PANIC() to be able to flush the log buffer from the fault handler.&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549986?ContentTypeID=1</link><pubDate>Mon, 29 Sep 2025 09:21:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a438489-c903-43e1-910a-1f2fa7657a05</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Vidar&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;took the approach of the merged solution you&amp;nbsp;found, for using nrf apis to collect the CD instead of zephyr&amp;#39;s, -&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/pull/21418/files#diff-fcf14c4b7b34fe7a11916195871ae66a59be87a395f28db73e345ebdc828085b"&gt;https://github.com/nrfconnect/sdk-nrf/pull/21418/files#diff-fcf14c4b7b34fe7a11916195871ae66a59be87a395f28db73e345ebdc828085b&lt;/a&gt;&amp;nbsp;and integrated it in my ncs ..&lt;/p&gt;
&lt;p&gt;it seems to be working fine with assertion and i get the crash log as expected&lt;/p&gt;
&lt;p&gt;but .. when i read the flash area where the CD was&amp;nbsp;saved i do not see what i expect - the initials 0x5a,0x45 are missing and the whole thing looks like it is missing some data .. in every 4 bytes it seems to be writing only one with a value and the rest are zeros&amp;nbsp;(the core dump i see when using memfault does not look like this)&lt;/p&gt;
&lt;p&gt;any idea what is the reason for that&amp;nbsp;?&lt;/p&gt;
&lt;p&gt;plus, i would really appreciate if you can give some clarity on what i asked in prev message regarding the weak api that is not overwritten and about the order in which things are happening at crash and what about all the asserts in zephyr code if assert is disabled &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f64f.svg" title="Pray"&gt;&amp;#x1f64f;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/tudor-b_2e00_"&gt;Tudor B.&lt;/a&gt;&amp;nbsp;i you were&amp;nbsp;successful, i think if you have&amp;nbsp;farther questions on the solution you adopt it might be better to open a new thread since we took different approaches for CD collection&amp;nbsp; &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f64f.svg" title="Pray"&gt;&amp;#x1f64f;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;hope to read you soon&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Ziv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549949?ContentTypeID=1</link><pubDate>Sun, 28 Sep 2025 17:09:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9bb927d-38ec-4c54-b9ff-94d57c250f83</guid><dc:creator>Tudor B.</dc:creator><description>&lt;p&gt;Hey Vidar.&lt;/p&gt;
&lt;p&gt;I finished implementing your proposal and in the end it worked like a charm!&amp;nbsp;The implementation:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/arch/cpu.h&amp;gt;
#include &amp;lt;zephyr/sys/reboot.h&amp;gt;
#include &amp;lt;zephyr/fatal.h&amp;gt;

#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include &amp;lt;zephyr/logging/log.h&amp;gt;
#include &amp;lt;zephyr/logging/log_ctrl.h&amp;gt;
LOG_MODULE_REGISTER(aaa);

__noinit static struct arch_esf esf_keep;
__noinit static uint32_t esf_crc = 0;

extern void sys_arch_reboot(int type);

void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *esf)
{
    (void)irq_lock();

    // From Nordic DevZone example
	/* Store stack frame along with a checksum value to the __noinit section in RAM  */
    memcpy(&amp;amp;esf_keep, esf, sizeof(*esf));
    LOG_ERR(&amp;quot;AAA! Faulting instruction address (r15/pc): 0x%08x&amp;quot;, esf_keep.basic.pc);
    esf_crc = crc32_ieee((uint8_t *)&amp;amp;esf_keep, sizeof(esf_keep));

    // From fatal_error.c
	LOG_ERR(&amp;quot;Resetting system&amp;quot;);
	LOG_PANIC();
	sys_arch_reboot(0);

	CODE_UNREACHABLE;
}

// generate fault
static mp_obj_t mp_do_fault(void)
{
	*(uint32_t *) 0xFFFFFFFF = 1;
}
static MP_DEFINE_CONST_FUN_OBJ_0(mp_do_fault_obj, mp_do_fault);

// check fault and print stored stack frame
static mp_obj_t mp_check_val(void)
{
    // esf_crc =0;
	printk(&amp;quot;Stored CRC val is: ~%ld~ \r\n&amp;quot;, esf_crc);

    uint32_t computed_crc = crc32_ieee((uint8_t *)&amp;amp;esf_keep, sizeof(esf_keep));
    printk(&amp;quot;Computed CRC val is: ~%ld~ \r\n&amp;quot;, computed_crc);

    if (computed_crc == esf_crc) {
        printk(&amp;quot;Exception stack frame:\n\r&amp;quot;);
        printk(&amp;quot;r0/a1:  0x%08x  r1/a2:  0x%08x  r2/a3:  0x%08x\n\r&amp;quot;, esf_keep.basic.a1,
            esf_keep.basic.a2, esf_keep.basic.a3);
        printk(&amp;quot;r3/a4:  0x%08x r12/ip:  0x%08x r14/lr:  0x%08x\n\r&amp;quot;, esf_keep.basic.a4,
            esf_keep.basic.ip, esf_keep.basic.lr);
        printk(&amp;quot;xpsr:  0x%08x  pc: 0x%08x\n\r&amp;quot;, esf_keep.basic.xpsr, esf_keep.basic.pc);
        esf_crc = 0; // Invalidate CRC
    } else {
        printk(&amp;quot;CRC mismatch\n\r&amp;quot;);
    }

    return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_0(mp_check_val_obj, mp_check_val);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And&amp;nbsp;actually running it:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;*** Booting nRF Connect SDK v3.0.0-3bfc46578e42 ***
*** Using Zephyr OS v4.0.99-a0e545cb437a ***
MicroPython v1.24.0-preview.485.ge5af5faf8.dirty on 2025-09-28; zephyr-nrf5340dk with nrf5340
Type &amp;quot;help()&amp;quot; for more information.
&amp;gt;&amp;gt;&amp;gt;
&amp;gt;&amp;gt;&amp;gt;
&amp;gt;&amp;gt;&amp;gt; import aaa as a
&amp;gt;&amp;gt;&amp;gt;
&amp;gt;&amp;gt;&amp;gt;
&amp;gt;&amp;gt;&amp;gt; a.dofault()
[00:00:08.744,354] &amp;lt;err&amp;gt; os: ***** USAGE FAULT *****
[00:00:08.750,000] &amp;lt;err&amp;gt; os:   Unaligned memory access
[00:00:08.760,162] &amp;lt;err&amp;gt; os: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x00000001
[00:00:08.768,890] &amp;lt;err&amp;gt; os: r3/a4:  0xfffff000 r12/ip:  0x00041e43 r14/lr:  0x0002452d
[00:00:08.777,648] &amp;lt;err&amp;gt; os:  xpsr:  0x29100000
[00:00:08.782,928] &amp;lt;err&amp;gt; os: s[ 0]:  0x20004a28  s[ 1]:  0x00042e3b  s[ 2]:  0x00042e1f  s[ 3]:  0x20022088
[00:00:08.793,426] &amp;lt;err&amp;gt; os: s[ 4]:  0x0004f580  s[ 5]:  0x00000157  s[ 6]:  0x0004f4f8  s[ 7]:  0x00021477
[00:00:08.803,924] &amp;lt;err&amp;gt; os: s[ 8]:  0x0004f4f8  s[ 9]:  0x00000157  s[10]:  0x20022088  s[11]:  0x20006987
[00:00:08.814,422] &amp;lt;err&amp;gt; os: s[12]:  0x20022088  s[13]:  0x2000698b  s[14]:  0x0004e038  s[15]:  0x00041e51
[00:00:08.824,890] &amp;lt;err&amp;gt; os: fpscr:  0x20022088
[00:00:08.830,139] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x0002a0d8
[00:00:08.838,104] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 31: Unknown error on CPU 0
[00:00:08.846,069] &amp;lt;err&amp;gt; os: Current thread: 0x20001c10 (mp_main)
[00:00:08.852,905] &amp;lt;err&amp;gt; aaa: AAA! Faulting instruction address (r15/pc): 0x0002a0d8
*** Booting nRF Connect SDK v3.0.0-3bfc46578e42 ***
*** Using Zephyr OS v4.0.99-a0e545cb437a ***
MicroPython v1.24.0-preview.485.ge5af5faf8.dirty on 2025-09-28; zephyr-nrf5340dk with nrf5340
Type &amp;quot;help()&amp;quot; for more information.
&amp;gt;&amp;gt;&amp;gt;
&amp;gt;&amp;gt;&amp;gt;
&amp;gt;&amp;gt;&amp;gt; import aaa as a
&amp;gt;&amp;gt;&amp;gt;
&amp;gt;&amp;gt;&amp;gt;
&amp;gt;&amp;gt;&amp;gt; a.checkval()
Stored CRC val is: ~396985589~
Computed CRC val is: ~396985589~
Exception stack frame:
r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x00000001
r3/a4:  0xfffff000 r12/ip:  0x00041e43 r14/lr:  0x0002452d
xpsr:  0x29100000  pc: 0x0002a0d8&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Note that we&amp;#39;re using MicroPython in our project. But the relevant C code excerpts can be easily extracted.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549835?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2025 17:18:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8f09472-4739-4215-9c07-a646f5ee109d</guid><dc:creator>Tudor B.</dc:creator><description>&lt;p&gt;Well, what Vidar suggests is NOT using Coredump with RAM, but rather using some variables declared in the no_init area to save the crash log data in them and then to check them when you start up again.&lt;/p&gt;
[quote userid="90084" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/549820"]thanks, but our application is already using most of available RAM so giving some of it up just for saving crashes is not a valid option&amp;nbsp;[/quote]
&lt;p&gt;I get it. We&amp;#39;re also REALLY tight on RAM. We didn&amp;#39;t hit the limit yet, but I expect we will in the next few months/ soon. But that&amp;#39;s also the point! Enabling and using the Coredump feature costs you WAAAAY more ROM and RAM than simply doing his suggestion, which takes up ~70-80 bytes.&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f60e.svg" title="Sunglasses"&gt;&amp;#x1f60e;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/span&gt; this whole &amp;quot;RAM implementation&amp;quot; is based on the two variables that he mentioned in that 2 year old ticket:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;__noinit static z_arch_esf_t esf;
__noinit static uint32_t esf_crc;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I tried checking out &amp;quot;z_arch_esf_t&amp;quot; to see its size so I can get a rough estimate of the amount of RAM used. This led me down a small rabbit hole, which took me to:&amp;nbsp;&lt;a id="" href="https://docs.zephyrproject.org/latest/releases/migration-guide-3.7.html"&gt;https://docs.zephyrproject.org/latest/releases/migration-guide-3.7.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Where we find this phrase:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;Migration guide to Zephyr v3.7.0
This document describes the changes required when migrating your application from Zephyr v3.6.0 to Zephyr v3.7.0.

...

Kernel
All architectures are now required to define the new struct arch_esf, which describes the members of a stack frame. This new struct replaces the named struct z_arch_esf_t. (GitHub #73593)

The named struct z_arch_esf_t is now deprecated. Use struct arch_esf instead. (GitHub #73593)

The header file include/zephyr/arch/arch_interface.h has been moved from include/zephyr/sys/ into include/zephyr/arch/. Out-of-tree source files will need to update the include path. (GitHub #64987)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So those previous two lines turn into:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;__noinit static arch_esf esf;
__noinit static uint32_t esf_crc;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Keep in mind that we have NCS version 3.0.0,&amp;nbsp;in which Zephyr has version&amp;nbsp;v4.0.99-a0e545cb437a. You mentioned you&amp;#39;re using v2.8.0 and I&amp;#39;m not sure which Zephyr version comes with that version of the NCS. So you gotta check if your Zephyr is &amp;gt;= v3.7.0 for the above to apply.&lt;/p&gt;
&lt;p&gt;I doubt Coredump beats this given that the serial CLI logs it generates fill up a file with ~35kb of text.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549820?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2025 14:02:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67155664-09eb-4168-a83d-3b458dc20c7b</guid><dc:creator>ziv123</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/549783"]Please read my previous comments where I try to explain what the issue is[/quote]
&lt;p&gt;i read the issue here&amp;nbsp;&lt;a id="" href="https://github.com/zephyrproject-rtos/zephyr/issues/59116"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/59116&lt;/a&gt;&amp;nbsp;and&amp;nbsp;the solution here&amp;nbsp;&lt;a id="" href="https://github.com/nrfconnect/sdk-nrf/pull/21418"&gt;https://github.com/nrfconnect/sdk-nrf/pull/21418&lt;/a&gt;&amp;nbsp;(which i think i may try to integrate into my ncs v2.8.0) untill we will update to ncs v3.1.1)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;what i still don&amp;#39;t understand is&amp;nbsp;the order of things&amp;nbsp;:&lt;/p&gt;
&lt;p&gt;if i disable asserts then i see i am entering the&amp;nbsp; &amp;#39;z_arm_fault()&amp;#39; and&amp;nbsp;after that to &amp;#39;z_fatal_error()&amp;#39;&amp;nbsp; which inside it call for coredump() and then to k_sys_fatal_error_handler() so how come it can be overwriten if when i enable asserts i am not getting into z_arm_fault() or z_fatal_error() ? ..&lt;/p&gt;
&lt;p&gt;if i enable asserts and i am trying to use coredump even for logs (&lt;/p&gt;
&lt;div&gt;&lt;span&gt;CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING&amp;nbsp; or,&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_LINKER_RAM&lt;/div&gt;
&lt;p&gt;) and not for flash i just don&amp;#39;t see anything .. does the assertion trigger some hardware before zephyr apis can even act ? if so, why then when coredump is not configured then i do get into&amp;nbsp;&lt;span&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;z_arm_fault()&amp;#39;&amp;nbsp; and&amp;nbsp;&amp;nbsp;&amp;#39;z_fatal_error()&amp;#39;&amp;nbsp; when i have an assert and asserts are enabled ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;plus why if assert is enabled i don&amp;#39;t get to zephyr apis even if i crash it with k_panic(), for example ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;sorry for being a nag about this &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f64f.svg" title="Pray"&gt;&amp;#x1f64f;&lt;/span&gt; but i am really trying to understand the order of which things are happening when crash occurs &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f64f.svg" title="Pray"&gt;&amp;#x1f64f;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;p.s. inside zephyr and ncs there is also a vast use of asserts .. what happning in those asserts when assert is disabled are he checks just skipped ? is it a valid practice to have assert enabled just for &amp;quot;on table&amp;quot; development and have a build with no asserts for deployed devices ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;i tried to overwrite the crash with my own implementation of this :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *esf){
    LOG_ERR(&amp;quot;&amp;gt;&amp;gt;&amp;gt; HardFault trapped in app override!\n&amp;quot;);

    /* Option 1: loop forever (easy for breakpoints) */
    while (1) {
        __NOP();
    }
     
    /* Option 2: chain to Zephyr’s internal handler */
    // extern void z_arm_fault(uint32_t reason, const z_arch_esf_t *esf);
    // z_arm_fault(K_ERR_CPU_EXCEPTION, NULL);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;but i did not see that it is actually overwriting something .. i don&amp;#39;t see it&amp;#39;s prints and i do see that z_fatal_error prints&amp;nbsp;&lt;/p&gt;
[quote userid="145037" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/549788"]There is a special no_init area of the RAM[/quote]
&lt;p&gt;thanks, but our application is already using most of available RAM so giving some of it up just for saving crashes is not a valid option&amp;nbsp;&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Ziv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549788?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2025 10:34:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07d27b43-efc6-45da-ac6b-223d63a8ce87</guid><dc:creator>Tudor B.</dc:creator><description>&lt;p&gt;Hey Ziv.&lt;/p&gt;
&lt;p&gt;There is a special no_init area of the RAM which is persistent through a hot (soft) reset. Hot reset = reset command to the MCU; cold reset = complete power cycle. There is a CONFIG_ option for the system to do a hot reset in case of stack overflows/ hard faults -&amp;gt; the no_init area of the RAM is kept. &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f609.svg" title="Wink"&gt;&amp;#x1f609;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549785?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2025 10:21:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16dad6ad-72d6-4599-8903-afeaa1c748b4</guid><dc:creator>ziv123</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/549783"]tore relevant information to RAM from the&amp;nbsp;&lt;span&gt;k_sys_fatal_error_handler(). What you do with the RAM content on subsequent reboot is up to you. You can store it to flash, transfer it over BLE, etc.&lt;/span&gt;[/quote]
&lt;p&gt;i think there is something fundamental i am missing here .. as far as i know ,whatever i save in&amp;nbsp;RAM to some variable or whatever, is gone after reset, right ? . so, if i do not use logs and can only get info on the crash from the device via OTA, after it resets back to normal, then how saving things to RAM help me ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549783?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2025 09:17:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10028e51-aa4c-47af-9ab6-c9364d949652</guid><dc:creator>Vidar Berg</dc:creator><description>[quote userid="90084" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/549757"]we use assert a lot in our code and also zephyr uses it internally so this is why it is wird for me and also why i try to avoid it plus i don&amp;#39;t seem to be getting to[/quote]
&lt;p&gt;Please read my previous comments where I try to explain what the issue is. If you are going to have ASSERTs enabled you must use the flash storage backend introduced by the commit I linked.&lt;/p&gt;
[quote userid="90084" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/549757"]i can not use RAM for saving logs or CD since the devices in the field are configured with logs disabled and i need[/quote]
&lt;p&gt;My suggestion is to not use the CD functionality at all but rather store relevant information to RAM from the&amp;nbsp;&lt;span&gt;k_sys_fatal_error_handler(). What you do with the RAM content on subsequent reboot is up to you. You can store it to flash, transfer it over BLE, etc.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549758?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2025 06:59:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0613332-81c9-4d85-9581-9ac1bc1c01d0</guid><dc:creator>Tudor B.</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/vibe"&gt;Vidar Berg&lt;/a&gt;&amp;nbsp;Well, we save the CD, then we reset, we get the reset reason, check the ext flash for CD&amp;#39;s presence, save a correlated file with reset reason next to it. Something like:&lt;/p&gt;
&lt;p&gt;crash_nr_231_CD.txt&lt;/p&gt;
&lt;p&gt;crash_nr_231_reset_reason.txt&lt;/p&gt;
&lt;p&gt;This also brings another question: can we also save other things the moment the hard fault happens? Sensor states, total runtime, battery level, etc?&lt;/p&gt;
&lt;p&gt;But again, since you said that CD can&amp;#39;t really save to external -&amp;gt; should we simply override the implementation for&amp;nbsp;k_sys_fatal_error_handler() and disable CD completely?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/ziv123"&gt;ziv123&lt;/a&gt;&amp;nbsp;I didn&amp;#39;t not ignore your point ziv, but this ties in to my main question to Vidar: can CD write to external? Is CD extendable to be able to write to external and write custom data? If not, then the best course of action is to make the mechanism ourselves inside&amp;nbsp;k_sys_fatal_error_handler()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549757?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2025 06:58:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab9769cf-5da3-47e2-a9b7-61478c18b928</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;hi Vidar&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/549382"]What&amp;nbsp;is relevant&amp;nbsp;here is whether you have CONFIG_ASSERT enabled in your build not[/quote]
&lt;p&gt;we use assert a lot in our code and also zephyr uses it internally so this is why it is wird for me and also why i try to avoid it plus i don&amp;#39;t seem to be getting to the writing of CD to flash at the moment .. anyway i&amp;#39;ll try to run with it disabled and see&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;i can not use RAM for saving logs or CD since the devices in the field are configured with logs disabled and i need to know what happens there in a retrospective, after they reset and reconnected with a node&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;i don&amp;#39;t mind using the internal flash or the external (external will be more comfortable obviously but internal will work for now as well)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/549382"]You can simply&amp;nbsp;redefine the weakly&amp;nbsp;defined &lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/71f6840a1b1b802437848157968b45cf621d104a/include/zephyr/fatal.h#L68"&gt;k_sys_fatal_error_handler&lt;/a&gt;() function in your application[/quote]
&lt;p&gt;the api seems to have fatal error reason and exception context .. are those filled automatically ?&lt;/p&gt;
&lt;p&gt;just to be sure if i overwrite this api then i do not have to CONFIG_ASSERT=n ?&lt;/p&gt;
&lt;p&gt;p.s. this api seems to be called from inside z_fatal_error which i don&amp;#39;t thing i am getting into since i both don&amp;#39;t see its prints and putting a breakpoint at the beginning of it when debugging did not stop there&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549755?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2025 06:46:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d36de12d-3c86-406c-b5f0-2e83d1a1bc7a</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;i suggested this for you, before .. we use it in main when app re starts&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;uint32_t&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;reset_reason&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;nrf_power_resetreas_get&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;NRF_POWER&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549754?ContentTypeID=1</link><pubDate>Thu, 25 Sep 2025 06:43:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7101fcfa-3c85-474c-a65c-4817c3a63f20</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;As mentioned earlier, writing to external flash requires a custom bare metal SPI flash driver that does not rely on any Zephyr primitives and can operate from the&amp;nbsp;hardfault&amp;nbsp;interrupt context. For internal flash, we already have a driver, see the PR linked earlier.&amp;nbsp;&lt;/p&gt;
[quote userid="145037" url="~/f/nordic-q-a/124173/having-issues-with-saving-coredump-to-flash-or-at-all/549722"]For me, external is preferred since we&amp;#39;ll also want to save the reset reason and have it all in one place[/quote]
&lt;p&gt;I&amp;#39;m not sure what you have in mind here. How would you include the reset reason in the CD.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549722?ContentTypeID=1</link><pubDate>Wed, 24 Sep 2025 16:15:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff7a3be6-40c8-4ebb-9a8c-add9fc3d6b02</guid><dc:creator>Tudor B.</dc:creator><description>&lt;p&gt;Thank you for the hasty reply Vidar.&lt;/p&gt;
&lt;p&gt;Well, given your answer, could you provide us a minimal sample project with the necessary changes to be able to save the CD to the internal/ external flash? For me, external is preferred since we&amp;#39;ll also want to save the reset reason and have it all in one place. and I saw that the logging CD generates ~34kb of data. Dunno what Zhiv prefers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549720?ContentTypeID=1</link><pubDate>Wed, 24 Sep 2025 16:06:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73bb6366-1fd1-4291-bed2-d6ae6b0f1dec</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The r14/lr register will tell you were the call was made from. But yes, there&amp;nbsp;might of&amp;nbsp;be cases were even a minimal CD will provide relevant debug information&amp;nbsp;that&amp;#39;s not shown&amp;nbsp;in the&amp;nbsp;crash log.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: having issues with saving coredump to flash or at all</title><link>https://devzone.nordicsemi.com/thread/549716?ContentTypeID=1</link><pubDate>Wed, 24 Sep 2025 15:38:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17e0d416-cca1-4b4c-ab53-ca87f371c006</guid><dc:creator>Tudor B.</dc:creator><description>&lt;p&gt;Well, given a hypothetical scenario where we have a function &amp;quot;myFunc(int a)&amp;quot; and it&amp;#39;s used in 7 different files in our project and the crash log just says that &amp;quot;myFunc(int a)&amp;quot; is the Faulting instruction, with the crash log we can&amp;#39;t really figure out what caused the error, but given that the coredump provides a stack trace, we can.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>