<?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>How to add custom_target on NCS2.8.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116937/how-to-add-custom_target-on-ncs2-8-0</link><description>I work on NCS 2.8.0 
 I add follow to CMakeLists.txt 
 
 add_custom_target ( 
 my_release_file 
 echo AAAA BBBB CCCC 
 DEPENDS all 
 ) 
 
 when run &amp;quot;west build -b nrf54l15dk/nrf54l15/cpuapp -t my_release_file&amp;quot; 
 error occured. 
 
 Itry it on NCS 2.6.0</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Dec 2024 06:20:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116937/how-to-add-custom_target-on-ncs2-8-0" /><item><title>RE: How to add custom_target on NCS2.8.0</title><link>https://devzone.nordicsemi.com/thread/514833?ContentTypeID=1</link><pubDate>Fri, 13 Dec 2024 06:20:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6686223a-18b2-48ba-916c-580524d3e640</guid><dc:creator>loquat</dc:creator><description>&lt;p&gt;Oh, OK.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s perfect.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add custom_target on NCS2.8.0</title><link>https://devzone.nordicsemi.com/thread/514687?ContentTypeID=1</link><pubDate>Thu, 12 Dec 2024 10:07:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5ccfc5b-bd21-4418-8c97-55a655389372</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Okay, I think you need to put your custom target in the sysbuild.cmake file as well in your project as of NCS 2.8.0, as we moved to using sysbuild in NCS 2.8.0. Please see the sysbuild.cmake file from this sample for reference:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/main/samples/bluetooth/mesh/dfu/distributor/sysbuild.cmake"&gt;https://github.com/nrfconnect/sdk-nrf/blob/main/samples/bluetooth/mesh/dfu/distributor/sysbuild.cmake&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add custom_target on NCS2.8.0</title><link>https://devzone.nordicsemi.com/thread/514389?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2024 01:09:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5b0bd48-635e-4553-863f-5a627ba4260d</guid><dc:creator>loquat</dc:creator><description>&lt;p&gt;The error is follow.&lt;br /&gt;-----------------------------------------------------------------------&lt;br /&gt;-- west build: running target my_release_file&lt;br /&gt;ninja: error: unknown target &amp;#39;my_release_file&amp;#39;&lt;br /&gt;-----------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;What I ultimately want to do is do some post-processing to extract necessary information from the built zephyr.elf and output it to the log.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add custom_target on NCS2.8.0</title><link>https://devzone.nordicsemi.com/thread/513995?ContentTypeID=1</link><pubDate>Mon, 09 Dec 2024 11:31:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72071b92-8b80-4f59-b623-415026f8e54e</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Susheel is out of office for the time being, so I have been tasked with looking into this case. What kind of error is it that occurs on NCS 2.8.0 on your end? In NCS 2.7.0, Sysbuild was added, and that&amp;#39;s what&amp;#39;s built for by default. You can set the system build off at the bottom of the build config page in the VS Code extension.&amp;nbsp;&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/pastedimage1733743874225v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add custom_target on NCS2.8.0</title><link>https://devzone.nordicsemi.com/thread/513461?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2024 14:33:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee704658-2e3c-4e0e-a49e-297c482ba952</guid><dc:creator>loquat</dc:creator><description>&lt;p&gt;I too know that add_custom_target() works as expected in NCS2.6.0.&lt;br /&gt;The problem is that it doesn&amp;#39;t work in NCS2.8.0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add custom_target on NCS2.8.0</title><link>https://devzone.nordicsemi.com/thread/513350?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2024 08:05:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59267477-59cd-4c0e-9feb-2593a9b29a41</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I tested it for NCSv2.6.0 since you were using that&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add custom_target on NCS2.8.0</title><link>https://devzone.nordicsemi.com/thread/513349?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2024 08:04:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f9278dd-6e1e-4d4d-a9a6-ca6c3560dc9e</guid><dc:creator>loquat</dc:creator><description>&lt;p&gt;Will it work with NCS 2.8.0?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add custom_target on NCS2.8.0</title><link>https://devzone.nordicsemi.com/thread/513346?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2024 07:55:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b537f158-49ae-4f8a-8950-e9ecdd941898</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I have put the suggestion in&amp;nbsp;ncs\v2.6.1\zephyr\samples\basic\blinky\CMakeLists.txt&lt;br /&gt;&lt;br /&gt;And running the command west gives proper execution like below&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;E:\ncs\v2.6.1\zephyr\samples\basic\blinky&amp;gt; west build -t my_release_file -b nrf52840dk_nrf52840
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base (cached)).
-- Application: E:/ncs/v2.6.1/zephyr/samples/basic/blinky
-- CMake version: 3.21.0
-- Using NCS Toolchain 2.6.20240304.889616714482 for building. (C:/ncs/toolchains/cf2149caf2/cmake)
-- Cache files will be written to: E:/ncs/v2.6.1/zephyr/.cache
-- Zephyr version: 3.5.99 (E:/ncs/v2.6.1/zephyr)
-- Found west (found suitable version &amp;quot;1.2.0&amp;quot;, minimum required is &amp;quot;0.14.0&amp;quot;)
-- Board: nrf52840dk_nrf52840
-- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/cf2149caf2/opt/bin/dtc.exe (found suitable version &amp;quot;1.4.7&amp;quot;, minimum required is &amp;quot;1.4.6&amp;quot;) 
-- Found BOARD.dts: E:/ncs/v2.6.1/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: E:/ncs/v2.6.1/zephyr/samples/basic/blinky/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: E:/ncs/v2.6.1/zephyr/samples/basic/blinky/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: E:/ncs/v2.6.1/zephyr/samples/basic/blinky/build/zephyr/dts.cmake
Parsing E:/ncs/v2.6.1/zephyr/Kconfig
PS E:\ncs\v2.6.1\zephyr\samples\basic\blinky&amp;gt; west build -t my_release_file -b nrf52840dk_nrf52840
PS E:\ncs\v2.6.1\zephyr\samples\basic\blinky&amp;gt; west build -t my_release_file -b nrf52840dk_nrf52840
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: E:/ncs/v2.6.1/zephyr/samples/basic/blinky
-- CMake version: 3.21.0
-- Using NCS Toolchain 2.6.20240304.889616714482 for building. (C:/ncs/toolchains/cf2149caf2/cmake)
-- Found Python3: C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe (found suitable version &amp;quot;3.9.13&amp;quot;, minimum required is &amp;quot;3.8&amp;quot;) found components: Interpreter 
-- Cache files will be written to: E:/ncs/v2.6.1/zephyr/.cache
-- Zephyr version: 3.5.99 (E:/ncs/v2.6.1/zephyr)
-- Found west (found suitable version &amp;quot;1.2.0&amp;quot;, minimum required is &amp;quot;0.14.0&amp;quot;)
-- Board: nrf52840dk_nrf52840
-- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/cf2149caf2/opt/bin/dtc.exe (found suitable version &amp;quot;1.4.7&amp;quot;, minimum required is &amp;quot;1.4.6&amp;quot;) 
-- Found BOARD.dts: E:/ncs/v2.6.1/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: E:/ncs/v2.6.1/zephyr/samples/basic/blinky/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: E:/ncs/v2.6.1/zephyr/samples/basic/blinky/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: E:/ncs/v2.6.1/zephyr/samples/basic/blinky/build/zephyr/dts.cmake
Parsing E:/ncs/v2.6.1/zephyr/Kconfig
Loaded configuration &amp;#39;E:/ncs/v2.6.1/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig&amp;#39;     
Merged configuration &amp;#39;E:/ncs/v2.6.1/zephyr/samples/basic/blinky/prj.conf&amp;#39;
Configuration saved to &amp;#39;E:/ncs/v2.6.1/zephyr/samples/basic/blinky/build/zephyr/.config&amp;#39;
Kconfig header saved to &amp;#39;E:/ncs/v2.6.1/zephyr/samples/basic/blinky/build/zephyr/include/generated/autoconf.h&amp;#39;
-- Found GnuLd: c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version &amp;quot;2.38&amp;quot;) 
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
-- Configuring done
-- Generating done
-- Build files have been written to: E:/ncs/v2.6.1/zephyr/samples/basic/blinky/build
←[92m-- west build: running target my_release_file
[1/1] Generating custom release file
AAAA BBBB CCCC
PS E:\ncs\v2.6.1\zephyr\samples\basic\blinky&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;See in the end you have your custom comment out&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[1/1] Generating custom release file&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;AAAA BBBB CCCC&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Not sure how you are running your west, Did you have all the environment variables set correctly in your &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/92651/nrf-connect-how-to-build-from-command-line-after-doing-automatic-install"&gt;command line terminal&lt;/a&gt;? How are you doing that?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add custom_target on NCS2.8.0</title><link>https://devzone.nordicsemi.com/thread/513316?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2024 01:03:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae889ff0-46dd-4236-b664-58434498b6e1</guid><dc:creator>loquat</dc:creator><description>&lt;p&gt;I try it. (Add to the end of CMakeLists.txt. replace zephyr_elf to exist file)&lt;/p&gt;
&lt;p&gt;And run &amp;quot;west build -b nrf54l15dk/nrf54l15/cpuapp -t my_release_file&amp;quot;&lt;/p&gt;
&lt;p&gt;result is&lt;br /&gt;-- west build: running target my_release_file&lt;br /&gt;ninja: error: unknown target &amp;#39;my_release_file&amp;#39;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;What am I doing wrong?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add custom_target on NCS2.8.0</title><link>https://devzone.nordicsemi.com/thread/513168?ContentTypeID=1</link><pubDate>Tue, 03 Dec 2024 10:47:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:91c0551f-dcfb-46e6-b145-e3e2b991ab8b</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I think the cmake has changed in 2.8.0, try not use Depends all and instead of echo use command to start with something like below&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;add_custom_target(
    my_release_file ALL
    COMMAND echo &amp;quot;AAAA BBBB CCCC&amp;quot;
    COMMENT &amp;quot;Generating custom release file&amp;quot;
    DEPENDS zephyr_elf # Replace with an actual target if necessary
)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>