<?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>SWD Flash via J-Link on Feather nRF52840 Sense Erases Bootloader (Zephyr v3.0.0), No RTT Logs</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/121852/swd-flash-via-j-link-on-feather-nrf52840-sense-erases-bootloader-zephyr-v3-0-0-no-rtt-logs</link><description>Hello Nordic Team, 
 I am experiencing an issue when attempting to flash a Zephyr RTOS application (v3.0.0) to the Adafruit Feather nRF52840 Sense board using a J-Link debugger over the SWD pins on the board’s backside. 
 Current Setup: 
 
 
 Board: Adafruit</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 May 2025 13:50:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/121852/swd-flash-via-j-link-on-feather-nrf52840-sense-erases-bootloader-zephyr-v3-0-0-no-rtt-logs" /><item><title>RE: SWD Flash via J-Link on Feather nRF52840 Sense Erases Bootloader (Zephyr v3.0.0), No RTT Logs</title><link>https://devzone.nordicsemi.com/thread/537383?ContentTypeID=1</link><pubDate>Wed, 28 May 2025 13:50:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:634bf65d-260a-489f-857f-0bb288a912fc</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Anmol,&lt;/p&gt;
[quote user=""]Is there a recommended SWD flash sequence or Zephyr project configuration—particularly for Adafruit’s nRF52840 Sense—that will preserve the UF2 bootloader partition?[/quote]
&lt;p&gt;SWD and the nRF52840 are fundamentally the same regardless of board, so no special considerations are needed. If you want to keep a bootloader or anythign else out side of the image you are flashing, you need to program without an erase all. From VS Code, that means not pressing the icon to the right of the Flash action. And if programming using nrfutil device, use:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfutil device program --options chip_erase_mode=ERASE_RANGES_TOUCHED_BY_FIRMWARE --firmware merged.hex&lt;/pre&gt; (replace merged.hex with&amp;nbsp;the path to your hex file).&lt;/p&gt;
&lt;p&gt;That said, the problem here may not be directly related to flashing. The first thing that comes to mind, is that I wonder what boad you build the project for, and if the project is built to accomodate teh UF2 bootloader (so that you don&amp;#39;t have anythign starting at address 0)? If tha tis the case, you eithe rneed the UF2 bootlaoder in place, or you change the configuration to place the application (or anothe rbootloade) at addess 0. Can you check this first?&lt;/p&gt;
[quote user=""]Are there any Nordic-provided tools, scripts, or linker-script modifications to deploy a Zephyr v3.0.0 build from VS Code without overwriting the bootloader?[/quote]
&lt;p&gt;You can create board files that handle this, or add a static partitioning that places the application at a specific address. This is typically handled in the board fiels, and is for instance done for instance for nRF52840 Dongle (the latter has the old nRF5 SDK USB bootloader). See &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/116904/partitions-for-custom-boards-with-sdk-2-8-0-and-sysbuild"&gt;this thread&lt;/a&gt;.&lt;/p&gt;
[quote user=""]If SWD-based deployment cannot preserve the UF2 bootloader, can you suggest an alternative programming interface or streamlined workflow for Zephyr development on this board?[/quote]
&lt;p&gt;SWD should not be a problem, but the project you build must accomodate the existing bootlodaer if you want to keep it (it cannot overlap, and need to start where the existing bootloader expect the application to start). Moreover, I have no knowledge of the UF2 bootloader, but it may be that it needs some metadata so that you eithe need to generate that and also flash that, or that it will be easier to update via the bootloader to get that handled by the bootloader (again this is just speculations).&lt;/p&gt;
&lt;p&gt;PS: But if you intend to use SWD, perhaps there is no point in keeping the UF2 bootloader?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>