<?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>Building with cli and RTT on SDK14</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41603/building-with-cli-and-rtt-on-sdk14</link><description>I am working with the peripheral/flash_fds in SDK14. I need to adapt it to use RTT instead of uart 
 I have made the obvious changes to switch from uart to RTT, eg substituting rtt/nrf_cli_rtt.c for uart/nrf_cli_uart.c 
 However, when I build it (with</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Dec 2018 09:33:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41603/building-with-cli-and-rtt-on-sdk14" /><item><title>RE: Building with cli and RTT on SDK14</title><link>https://devzone.nordicsemi.com/thread/162617?ContentTypeID=1</link><pubDate>Thu, 20 Dec 2018 09:33:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3df2d59-0689-4505-9ce3-272d58398e53</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;Thx again&amp;nbsp;&lt;span&gt;J&amp;oslash;rgen&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;That gave me what I needed and it&amp;#39;s working via RTT so I can familiarise before writing it into my application.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the revised code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define CLI_EXAMPLE_LOG_QUEUE_SIZE  (4)
#if NRF_CLI_UART_ENABLED
NRF_CLI_UART_DEF(cli_uart, 0, 64, 16);
NRF_CLI_DEF(m_cli_uart, &amp;quot;fds example:~$ &amp;quot;, &amp;amp;cli_uart.transport, &amp;#39;\r&amp;#39;, 4);
#else
NRF_CLI_RTT_DEF(m_cli_rtt_transport);
NRF_CLI_DEF(m_cli_rtt, &amp;quot;rtt_cli:~$ &amp;quot;, &amp;amp;m_cli_rtt_transport.transport, &amp;#39;\n&amp;#39;, CLI_EXAMPLE_LOG_QUEUE_SIZE);
#endif

/* Defined in main.c */
extern char const * fds_err_str[];

void cli_init(void)
{
	
#if NRF_CLI_UART_ENABLED
    nrf_drv_uart_config_t uart_config = NRF_DRV_UART_DEFAULT_CONFIG;
    uart_config.pseltxd               = TX_PIN_NUMBER;
    uart_config.pselrxd               = RX_PIN_NUMBER;
    uart_config.hwfc                  = NRF_UART_HWFC_DISABLED;
    ret_code_t rc = nrf_cli_init(&amp;amp;m_cli_uart, &amp;amp;uart_config, true, true, NRF_LOG_SEVERITY_INFO);
    APP_ERROR_CHECK(rc);
#else		
    ret_code_t rc = nrf_cli_init(&amp;amp;m_cli_rtt, NULL, true, true, NRF_LOG_SEVERITY_INFO);
    APP_ERROR_CHECK(rc);
#endif
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Remaining issues were&amp;nbsp;that my Mac terminal got configured in a permanent way&lt;/p&gt;
&lt;p&gt;&amp;nbsp; .. fixed by disabling&amp;nbsp;NRF_CLI_VT100_COLORS_ENABLED but then overridden when fds_init() called.&lt;/p&gt;
&lt;p&gt;.. also&amp;nbsp;that the terminal input echos twice.&amp;nbsp; This is not really a problem for my purposes but if I wanted to use cli in a real app it would be.&amp;nbsp;&amp;nbsp;This seems to be something to do with VT100-style initialisation that does not make sense in an RTT context.&amp;nbsp; I can see the field in&amp;nbsp;&lt;span class="s1"&gt;nrf_cli_flag_t but can&amp;#39;t find who&amp;#39;s setting it.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Building with cli and RTT on SDK14</title><link>https://devzone.nordicsemi.com/thread/162436?ContentTypeID=1</link><pubDate>Wed, 19 Dec 2018 09:04:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26e373d0-86a4-4026-9533-1690ee15a6b6</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Yes, you are correct. You need to initialize RTT backend as well if that is not included in the example.&lt;/p&gt;
&lt;p&gt;There are (at least) two examples in SDK 15.2.0 showing initialization and usage of RTT backend for CLI:&lt;/p&gt;
&lt;p&gt;nRF5_SDK_15.2.0_9412b96\examples\ble_central_and_peripheral\experimental\ble_app_interactive&lt;br /&gt;nRF5_SDK_15.2.0_9412b96\examples\peripheral\experimental_cli_libuarte&lt;/p&gt;
&lt;p&gt;I would not expect there to be any significant changes in the way this is done between SDK 14.2 and SDK 15.2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Building with cli and RTT on SDK14</title><link>https://devzone.nordicsemi.com/thread/162113?ContentTypeID=1</link><pubDate>Mon, 17 Dec 2018 14:42:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ef53699-59a8-49fe-88b8-9524a2d8799a</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;J&amp;oslash;rgen&lt;/span&gt;,&lt;/p&gt;
&lt;p&gt;I get that the supplied cli.c is not suited to use with RTT&lt;/p&gt;
&lt;p&gt;However, I think that there is a need to do more than comment out uart references because cli_init, cli_start and cli_process probably need some equivalent code.&lt;/p&gt;
&lt;p&gt;The code changes are probably something like this:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#if NRF_CLI_UART_ENABLED
NRF_CLI_UART_DEF(cli_uart, 0, 64, 16);
NRF_CLI_DEF(m_cli_uart, &amp;quot;fds example:~$ &amp;quot;, &amp;amp;cli_uart.transport, &amp;#39;\r&amp;#39;, 4);
#else
NRF_CLI_RTT_DEF(cli_rtt);
NRF_CLI_DEF(m_cli_rtt, &amp;quot;fds example:~$ &amp;quot;, &amp;amp;cli_rtt.transport, &amp;#39;\r&amp;#39;, 4);
#endif

/* Defined in main.c */
extern char const * fds_err_str[];

void cli_init(void)
{
#if NRF_CLI_UART_ENABLED
    nrf_drv_uart_config_t uart_config = NRF_DRV_UART_DEFAULT_CONFIG;
    uart_config.pseltxd               = TX_PIN_NUMBER;
    uart_config.pselrxd               = RX_PIN_NUMBER;
    uart_config.hwfc                  = NRF_UART_HWFC_DISABLED;

    ret_code_t rc = nrf_cli_init(&amp;amp;m_cli_uart, &amp;amp;uart_config, true, true, NRF_LOG_SEVERITY_INFO);
    APP_ERROR_CHECK(rc);
#else
	rtt_config = 0; // a bad guess
    ret_code_t rc = nrf_cli_init(&amp;amp;m_cli_rtt, &amp;amp;rtt_config, true, true, NRF_LOG_SEVERITY_INFO);
    APP_ERROR_CHECK(rc);
#endif
}


void cli_start(void)
{
#if NRF_CLI_UART_ENABLED
  ret_code_t rc = nrf_cli_start(&amp;amp;m_cli_uart);
#else
  ret_code_t rc = nrf_cli_start(&amp;amp;m_cli_rtt);
#endif		
    APP_ERROR_CHECK(rc);
}


void cli_process(void)
{
#if NRF_CLI_UART_ENABLED
    nrf_cli_process(&amp;amp;m_cli_uart);
#else
    nrf_cli_process(&amp;amp;m_cli_rtt);
#endif
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;However, despite looking at nrf_cli_rtt.h I did not figure out how to set the second parameter of&amp;nbsp;nrf_cli_init(), amongst other things.&lt;/p&gt;
&lt;p&gt;It would be really helpful if there was an example somewhere.&lt;/p&gt;
&lt;p&gt;BR Paul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Building with cli and RTT on SDK14</title><link>https://devzone.nordicsemi.com/thread/162071?ContentTypeID=1</link><pubDate>Mon, 17 Dec 2018 12:43:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac16f5f5-1370-46b2-b307-d5985c733606</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Like I tried to explain in my previous comment, the cli.c file is not part of the nrf_cli library. It is an example specific source file that is used to initialize the CLI library in that specific example. If you do not want to use UART CLI backend in that example, you need to remove/comment out the initialization of UART CLI backend from the example source file.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Building with cli and RTT on SDK14</title><link>https://devzone.nordicsemi.com/thread/161931?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 18:18:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e28e095c-dc0e-481d-9c6c-7e8e71040b47</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;Now I have a fresh copy of 14.2.0&lt;/p&gt;
&lt;p&gt;Unmodified, flash_fds builds OK&lt;/p&gt;
&lt;p&gt;However, when I switch to RTT I get the same errors reported above.&lt;/p&gt;
&lt;p&gt;The question is still: &amp;quot;why is cli.c referencing uart stuff?&amp;quot;&lt;/p&gt;
&lt;p&gt;BR Paul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Building with cli and RTT on SDK14</title><link>https://devzone.nordicsemi.com/thread/161924?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 16:35:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8ee77c0-ddd0-4bc4-a515-57e9dcb773d3</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;Oh. I thought I had 14 and it does include flash_fds.&amp;nbsp; Maybe I mislabelled it.&lt;br /&gt;To be sure I am going to download 14.2.0 and try again.&lt;/p&gt;
&lt;p&gt;BR. Paul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Building with cli and RTT on SDK14</title><link>https://devzone.nordicsemi.com/thread/161906?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 15:09:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb67b267-be79-4967-afb1-52f2225f7f04</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Sorry, I misread your question. Which SDK version are you using? SDK 14.0.0 does not contain a flash_fds example. In SDK 14.2.0, there is such an example.&lt;/p&gt;
&lt;p&gt;The file cli.c is specific to this example. You will have to change the defines and inits in this file to switch CLI backend to RTT. You can reference the CLI example to see how to initialize RTT backend.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Building with cli and RTT on SDK14</title><link>https://devzone.nordicsemi.com/thread/161889?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 14:24:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77c5ccf1-09e9-4b26-ae68-1b5ab8b17589</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;Thx J&amp;oslash;rgen&lt;/p&gt;
&lt;p&gt;Because I need to use RTT I have set as follows:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;#ifndef NRF_CLI_UART_ENABLED&lt;br /&gt;#define NRF_CLI_UART_ENABLED 0&lt;br /&gt;#endif&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;#ifndef NRF_CLI_RTT_ENABLED&lt;br /&gt;#define NRF_CLI_RTT_ENABLED 1&lt;br /&gt;#endif&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;#ifndef NRF_CLI_RTT_TERMINAL_ID&lt;br /&gt;#define NRF_CLI_RTT_TERMINAL_ID 0&lt;br /&gt;#endif&lt;/p&gt;
&lt;p&gt;BR. Paul&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Building with cli and RTT on SDK14</title><link>https://devzone.nordicsemi.com/thread/161858?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 12:56:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1bb7b4a-5280-4e46-b10a-5188f4f30366</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Have you set the config&amp;nbsp;NRF_CLI_UART_ENABLED in your sdk_config.h file?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>