'NRF_CLI_CMD_BUFF_SIZE' undeclared here (not in a function); did you mean 'NRF_CLI_RX_BUFF_SIZE'?


I take the flash_fds example from nRF5_SDK_15.2.0_9412b96, but I am not going to use the CLI (command line interface) because I take the FLASH written, reading capability and doesn't use the CLI (does it mandatory for the example to work?). I didn't have the CLI part defines in the sdk_config.h so all the functions relate to not active (and I check it). but I still get the error for undefined NRF_CLI_CMD_BUFF_SIZE which not exist in the sdk_config.h but no one need it . What does it mean not in a function

I try to copy all the CLI defines to my sdk_config.h and do this #define NRF_CLI_ENABLED 0 and now I get this message error cannot find run section .cli_sorted_cmd_ptrs_run referenced in cli_sorted_cmd_ptrs which also don't use in an active functions. 

Who still need them and what can I do to get out of those errors?



  • Hi,

    It is not enough to disable CLI because other modules may youse it like queue or balloc. Henc you need to disable for instace: NRF_BALLOC_CLI_CMDS 0

    I've just successfully get rid of CLI module from: examples\peripheral\flash_fds\pca10056\blank\ses

    My steps:

    1. I've disabled all CLI related defines in sdk_config 

    2. I've removed cli.c from the example and moved 2 functions from cli.c to the main.c file: record_delete and record_delete_next.

    3. Inside function record_delete  I have replaced nrf_cli_fprintf with NRF_LOG_INFO.

    Errors you see cannot find run section .cli_sorted_cmd_ptrs_run referenced in cli_sorted_cmd_ptrs are related to linker sections reserved for CLI commands. It means that despite CLI is not used some modules are defining CLI commands (like Balloc).

  • Now after lots of playing with the SDK_config.h xml and the linker script I ended with 1 error cyclic memory section dependency with section .fs_data_run which can't solve also lot of answer with this error name I read.

    Now my sdk_config.h look like this 0741.sdk_config.h

    and xml like this 

    <!DOCTYPE Linker_Placement_File>
    <Root name="Flash Section Placement">
      <MemorySegment name="$(FLASH_NAME:FLASH)">
        <ProgramSection alignment="0x100" load="Yes" name=".vectors" start="$(FLASH_START:)" />
    	<ProgramSection alignment="4" keep="Yes" load="Yes" runin=".FS_RAM_run" name=".FS_RAM" />
        <ProgramSection alignment="4" load="Yes" name=".init" />
        <ProgramSection alignment="4" load="Yes" name=".init_rodata" />
        <ProgramSection alignment="4" load="Yes" name=".text" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".cli_command" inputsections="*(.cli_command*)" address_symbol="__start_cli_command" end_symbol="__stop_cli_command" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".pwr_mgmt_data" inputsections="*(SORT(.pwr_mgmt_data*))" address_symbol="__start_pwr_mgmt_data" end_symbol="__stop_pwr_mgmt_data" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".nrf_queue" inputsections="*(.nrf_queue*)" address_symbol="__start_nrf_queue" end_symbol="__stop_nrf_queue" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_const_data" inputsections="*(SORT(.log_const_data*))" address_symbol="__start_log_const_data" end_symbol="__stop_log_const_data" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_backends" inputsections="*(SORT(.log_backends*))" address_symbol="__start_log_backends" end_symbol="__stop_log_backends" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".nrf_balloc" inputsections="*(.nrf_balloc*)" address_symbol="__start_nrf_balloc" end_symbol="__stop_nrf_balloc" />
        <ProgramSection alignment="4" keep="Yes" load="No" name=".nrf_sections" address_symbol="__start_nrf_sections" />
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".cli_sorted_cmd_ptrs"  inputsections="*(.cli_sorted_cmd_ptrs*)" runin=".cli_sorted_cmd_ptrs_run"/>
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".fs_data"  inputsections="*(.fs_data*)" runin=".fs_data_run"/>
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_dynamic_data"  inputsections="*(SORT(.log_dynamic_data*))" runin=".log_dynamic_data_run"/>
        <ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_filter_data"  inputsections="*(SORT(.log_filter_data*))" runin=".log_filter_data_run"/>
        <ProgramSection alignment="4" load="Yes" name=".os" />
        <ProgramSection alignment="4" load="Yes" name=".dtors" />
        <ProgramSection alignment="4" load="Yes" name=".ctors" />
        <ProgramSection alignment="4" load="Yes" name=".rodata" />
        <ProgramSection alignment="4" load="Yes" name=".ARM.exidx" address_symbol="__exidx_start" end_symbol="__exidx_end" />
        <ProgramSection alignment="4" load="Yes" runin=".fast_run" name=".fast" />
        <ProgramSection alignment="4" load="Yes" runin=".data_run" name=".data" />
        <ProgramSection alignment="4" load="Yes" runin=".tdata_run" name=".tdata" />
      <MemorySegment name="$(RAM_NAME:RAM);SRAM">
        <ProgramSection alignment="0x100" load="No" name=".vectors_ram" start="$(RAM_START:$(SRAM_START:))" />
      	<ProgramSection alignment="4" load="No" keep="Yes" name=".fs_data_run" address_symbol="__start_fs_data" end_symbol="__stop_fs_data" />
    	<ProgramSection alignment="4" load="No" keep="Yes" name=".FS_RAM_run" address_symbol="__start_FS_RAM"  end_symbol="__stop_FS_RAM" />
    	<ProgramSection alignment="4" keep="Yes" load="No" name=".cli_sorted_cmd_ptrs_run" address_symbol="__start_cli_sorted_cmd_ptrs" end_symbol="__stop_cli_sorted_cmd_ptrs" />
        <ProgramSection alignment="4" load="No" name=".fast_run" />
        <ProgramSection alignment="4" load="No" name=".data_run" />
        <ProgramSection alignment="4" load="No" name=".bss" />
        <ProgramSection alignment="4" load="No" name=".tbss" />
        <ProgramSection alignment="4" load="No" name=".tdata_run" />
        <ProgramSection alignment="4" load="No" name=".non_init" />
        <ProgramSection alignment="4" size="__HEAPSIZE__" load="No" name=".heap" />
        <ProgramSection alignment="8" size="__STACKSIZE__" load="No" place_from_segment_end="Yes" name=".stack" />
        <ProgramSection alignment="8" size="__STACKSIZE_PROCESS__" load="No" name=".stack_process" />
      <MemorySegment name="$(FLASH2_NAME:FLASH2)">
        <ProgramSection alignment="4" load="Yes" name=".text2" />
        <ProgramSection alignment="4" load="Yes" name=".rodata2" />
        <ProgramSection alignment="4" load="Yes" runin=".data2_run" name=".data2" />
      <MemorySegment name="$(RAM2_NAME:RAM2)">
        <ProgramSection alignment="4" load="No" name=".data2_run" />
        <ProgramSection alignment="4" load="No" name=".bss2" />
        <ProgramSection alignment="4" load="No" name=".non_init2" />

    and the .id (I have 2 files I don't know who is the critical) nrf_common.ld 5810.nrf52_xxaa.ld nrf52_common.ld

    and the tumb 4722.thumb_crt0.s

    I just don't know which of them is response for which section or part in the code. 


  • Hi

    It shouldn't have been necessary to make changes in any .xml or .ld files. I suggest you return these to their original settings and only make the changes in sdk_config.h and main.c proposed by Jakub, as well as removing the cli.c file. This should be enough to get rid of the CLI-errors.  We will not be able to help you if you make changes to these other files.

    Best regards,