<?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>Configure GPIO pin within MCUBoot</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/123188/configure-gpio-pin-within-mcuboot</link><description>We need to set a GPIO pin in MCUBoot to activate an external USB hub chip so the USB DFU will work. I would like to do this with code in our project rather than directly modifying the bootloader code in the NCS directories, so it stays in our version</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 28 Jul 2025 11:51:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/123188/configure-gpio-pin-within-mcuboot" /><item><title>RE: Configure GPIO pin within MCUBoot</title><link>https://devzone.nordicsemi.com/thread/543730?ContentTypeID=1</link><pubDate>Mon, 28 Jul 2025 11:51:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27c1e6b4-c51d-44b5-a651-0d89c47f0775</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;What happened that led you to that conclusion?&amp;nbsp;My test below works just fine.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/c348848_5F00_250728_5F00_01.zip"&gt;devzone.nordicsemi.com/.../c348848_5F00_250728_5F00_01.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configure GPIO pin within MCUBoot</title><link>https://devzone.nordicsemi.com/thread/543657?ContentTypeID=1</link><pubDate>Sat, 26 Jul 2025 06:21:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4f0aca1-9c32-45ac-a339-f0a8094d4e90</guid><dc:creator>Saxman58</dc:creator><description>&lt;p&gt;You are right, I didn&amp;#39;t have CONFIG_GPIO set in the mcuboot.conf, and once that was included the our_board.c file was compiled.&amp;nbsp; However, it&amp;nbsp;does not get linked with the mcuboot bootloader.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configure GPIO pin within MCUBoot</title><link>https://devzone.nordicsemi.com/thread/543643?ContentTypeID=1</link><pubDate>Fri, 25 Jul 2025 18:19:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:36b06af6-9e55-49d2-84f6-0f20766f6206</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;I think you likely haven&amp;#39;t enabled CONFIG_GPIO&amp;nbsp;for MCUboot yet, and so the CMake check failed, and the file wasn&amp;#39;t included.&lt;/p&gt;
&lt;p&gt;I ran a simple test, and&amp;nbsp;the file is included just fine even for a custom board.&amp;nbsp;You can&amp;nbsp;check it out here, see how the intentional error in our_board.c is going to cause a build failure.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/c348848_5F00_250725_5F00_01.zip"&gt;devzone.nordicsemi.com/.../c348848_5F00_250725_5F00_01.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configure GPIO pin within MCUBoot</title><link>https://devzone.nordicsemi.com/thread/543417?ContentTypeID=1</link><pubDate>Thu, 24 Jul 2025 04:15:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e4258be-41a4-46b9-a088-f923d732cbee</guid><dc:creator>Saxman58</dc:creator><description>&lt;p&gt;I was following Sigurd&amp;#39;s example to put the above files in the board folder (though his was in the NCS folders).&amp;nbsp; But it may make more sense to put the .c and make file in our project /child_image folder since that&amp;#39;s where the mcuboot.conf and mcuboot.overlay files are.&amp;nbsp; And the above code in our board .overlay file would probably make sense to put in mcuboot.overlay since that has all the devicetree info that is needed by the MCUBoot build.&lt;br /&gt;&lt;br /&gt;I tried that, but still don&amp;#39;t know how to get the build process to compile the our_board.c code and link it in with the rest of the MCUBoot build.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configure GPIO pin within MCUBoot</title><link>https://devzone.nordicsemi.com/thread/543414?ContentTypeID=1</link><pubDate>Thu, 24 Jul 2025 03:16:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd69c131-75a3-4803-ac19-0eb8c3ff1826</guid><dc:creator>Saxman58</dc:creator><description>&lt;p&gt;We are using NCS v2.6.1.&amp;nbsp; The relevant code in our board.overlay file (in our project /boards folder) is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
	hub_reset: hub-reset {
		compatible = &amp;quot;nordic,gpio-pins&amp;quot;;
		gpios = &amp;lt;&amp;amp;gpio1 9 GPIO_ACTIVE_HIGH&amp;gt;;
		status = &amp;quot;okay&amp;quot;;
	};
};

&amp;amp;gpio1 {
	status = &amp;quot;okay&amp;quot;;
};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The build configuration uses nrf7002dk_nrf5340_cpuapp as the board target, and then `boards/our_board.overlay` as the Base Devicetree overlays.&amp;nbsp; The overlay has a lot more customization for our application, but the above is all I need to access from the bootloader.&lt;br /&gt;&lt;br /&gt;Here is the our_board.c file with the code we want to add to the MCUBoot bootloader build, but not the main application:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/init.h&amp;gt;
#include &amp;lt;zephyr/drivers/gpio.h&amp;gt;
#include &amp;lt;zephyr/sys/printk.h&amp;gt;

#define HUB_RESET_NODE  DT_ALIAS(hub_reset)

#if DT_NODE_HAS_STATUS(HUB_RESET_NODE, okay)
#define HUB_RESET   DT_GPIO_LABEL(HUB_RESET_NODE, gpios)
#define PIN         DT_GPIO_PIN(HUB_RESET_NODE, gpios)
#define FLAGS       DT_GPIO_FLAGS(HUB_RESET_NODE, gpios)
#else
#error &amp;quot;Board doesn&amp;#39;t have a USB Hub Reset&amp;quot;
#define HUB_RESET   &amp;quot;&amp;quot;
#define PIN         0
#define FLAGS       0
#endif

static int board_init(void) {
    int err;
    printk(&amp;quot;board_init\n&amp;quot;);
    printk(&amp;quot;PIN %d\n&amp;quot;, PIN);

    static const struct device *hub_rst;
    hub_rst = device_get_binding(HUB_RESET);

    err = gpio_pin_configure(hub_rst, PIN, GPIO_OUTPUT_ACTIVE);
    printk(&amp;quot;gpio_pin_configure() returned: %d\n&amp;quot;, err);
    if (err &amp;lt; 0) {
        return 1;
    }

    err = gpio_pin_set(hub_rst, PIN, false);
    printk(&amp;quot;gpio_pin_set() returned: %d\n&amp;quot;, err);
    return 0;
}

SYS_INIT(board_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;And here is the CMakeLists file that I hoped would add this to the MCUBoot build:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(CONFIG_GPIO AND DEFINED CONFIG_MCUBOOT)
    zephyr_library()
    zephyr_library_sources(our_board.c)
endif()&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I put both of these in the project /boards folder, but the CMake system isn&amp;#39;t finding them.&amp;nbsp; That is the main problem, getting this to be included in the MCUBoot build.&lt;br /&gt;&lt;br /&gt;Glen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configure GPIO pin within MCUBoot</title><link>https://devzone.nordicsemi.com/thread/543400?ContentTypeID=1</link><pubDate>Wed, 23 Jul 2025 18:24:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66ded88b-5518-437e-a7fa-15e6f34f65c9</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Saxman58,&lt;/p&gt;
&lt;p&gt;What version of the nRF Connect SDK (NCS)&amp;nbsp;are you working with?&lt;/p&gt;
&lt;p&gt;If it is a NCS version with the new board hierarchy (nrf52840dk&lt;span style="background-color:rgba(255, 255, 0, 1);"&gt;/&lt;/span&gt;nrf52840 vs nrf52840dk&lt;span style="background-color:rgba(255, 255, 0, 1);"&gt;_&lt;/span&gt;nrf52840), do you have a minimal custom board files to help kickstart me? I don&amp;#39;t have one right now.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>