This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF51422 Segger ES 4.30b example

Hi,

I converted ble_app_beacon example to Segger Embedded Studio (using version 4.30b), as per the instructions in the link https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_gsg_ses%2FUG%2Fgsg%2Fimport_ses.html and the project file is given blow:

<!DOCTYPE CrossStudio_Project_File>
<solution Name="ble_app_beacon_pca10028_s130" target="8" version="2">
  <project Name="ble_app_beacon_pca10028_s130">
    <configuration
      Name="Common"
      arm_architecture="v6M"
      arm_core_type="Cortex-M0"
      arm_endian="Little"
      arm_fpu_type=""
      arm_linker_variant="SEGGER"
      arm_simulator_memory_simulation_parameter="RX 00000000,00040000,FFFFFFFF;RWX 20000000,00008000,CDCDCDCD"
      arm_target_device_name="nRF51422_xxAC"
      arm_target_interface_type="SWD"
      debug_start_from_entry_point_symbol="No"
      debug_target_connection="J-Link"
      link_linker_script_file="$(StudioDir)/samples/SEGGER_Flash.icf"
      linker_section_placements_segments="FLASH1 RX 0x00000000 0x00040000;RAM1 RWX 0x20000000 0x00008000"
      project_directory=""
      project_type="Executable" />
    <folder Name="Internal Files">
      <file file_name="$(StudioDir)/samples/SEGGER_THUMB_Startup.s" />
      <file file_name="../../../../../../components/toolchain/embedded_studio/ses_nrf51_startup.s" />
      <file file_name="../../../../../../components/toolchain/system_nrf51422.c" />
    </folder>
    <configuration
      CMSIS_CORE="Yes"
      Name="nrf51422_xxac"
      arm_linker_variant="GNU"
      c_preprocessor_definitions=";BLE_STACK_SUPPORT_REQD;NRF51422;BOARD_PCA10028;NRF_SD_BLE_API_VERSION=2;S130;NRF51;SOFTDEVICE_PRESENT;SWI_DISABLE0"
      c_user_include_directories="../../../../../../components/device;../../../config/ble_app_beacon_pca10028_s130;../../../config;../../../../../../components;../../../../../../components/ble/ble_advertising;../../../../../../components/ble/ble_dtm;../../../../../../components/ble/ble_racp;../../../../../../components/ble/ble_services/ble_ancs_c;../../../../../../components/ble/ble_services/ble_ans_c;../../../../../../components/ble/ble_services/ble_bas;../../../../../../components/ble/ble_services/ble_bas_c;../../../../../../components/ble/ble_services/ble_cscs;../../../../../../components/ble/ble_services/ble_cts_c;../../../../../../components/ble/ble_services/ble_dfu;../../../../../../components/ble/ble_services/ble_dis;../../../../../../components/ble/ble_services/ble_gls;../../../../../../components/ble/ble_services/ble_hids;../../../../../../components/ble/ble_services/ble_hrs;../../../../../../components/ble/ble_services/ble_hrs_c;../../../../../../components/ble/ble_services/ble_hts;../../../../../../components/ble/ble_services/ble_ias;../../../../../../components/ble/ble_services/ble_ias_c;../../../../../../components/ble/ble_services/ble_lbs;../../../../../../components/ble/ble_services/ble_lbs_c;../../../../../../components/ble/ble_services/ble_lls;../../../../../../components/ble/ble_services/ble_nus;../../../../../../components/ble/ble_services/ble_nus_c;../../../../../../components/ble/ble_services/ble_rscs;../../../../../../components/ble/ble_services/ble_rscs_c;../../../../../../components/ble/ble_services/ble_tps;../../../../../../components/ble/common;../../../../../../components/ble/nrf_ble_qwr;../../../../../../components/ble/peer_manager;../../../../../../components/boards;../../../../../../components/drivers_nrf/adc;../../../../../../components/drivers_nrf/clock;../../../../../../components/drivers_nrf/common;../../../../../../components/drivers_nrf/comp;../../../../../../components/drivers_nrf/delay;../../../../../../components/drivers_nrf/gpiote;../../../../../../components/drivers_nrf/hal;../../../../../../components/drivers_nrf/i2s;../../../../../../components/drivers_nrf/lpcomp;../../../../../../components/drivers_nrf/pdm;../../../../../../components/drivers_nrf/power;../../../../../../components/drivers_nrf/ppi;../../../../../../components/drivers_nrf/pwm;../../../../../../components/drivers_nrf/qdec;../../../../../../components/drivers_nrf/rng;../../../../../../components/drivers_nrf/rtc;../../../../../../components/drivers_nrf/saadc;../../../../../../components/drivers_nrf/spi_master;../../../../../../components/drivers_nrf/spi_slave;../../../../../../components/drivers_nrf/swi;../../../../../../components/drivers_nrf/timer;../../../../../../components/drivers_nrf/twi_master;../../../../../../components/drivers_nrf/twis_slave;../../../../../../components/drivers_nrf/uart;../../../../../../components/drivers_nrf/usbd;../../../../../../components/drivers_nrf/wdt;../../../../../../components/libraries/bsp;../../../../../../components/libraries/button;../../../../../../components/libraries/crc16;../../../../../../components/libraries/crc32;../../../../../../components/libraries/csense;../../../../../../components/libraries/csense_drv;../../../../../../components/libraries/experimental_section_vars;../../../../../../components/libraries/fds;../../../../../../components/libraries/fstorage;../../../../../../components/libraries/gpiote;../../../../../../components/libraries/hardfault;../../../../../../components/libraries/hci;../../../../../../components/libraries/led_softblink;../../../../../../components/libraries/log;../../../../../../components/libraries/log/src;../../../../../../components/libraries/low_power_pwm;../../../../../../components/libraries/mem_manager;../../../../../../components/libraries/pwm;../../../../../../components/libraries/queue;../../../../../../components/libraries/scheduler;../../../../../../components/libraries/slip;../../../../../../components/libraries/timer;../../../../../../components/libraries/twi;../../../../../../components/libraries/uart;../../../../../../components/libraries/usbd;../../../../../../components/libraries/usbd/class/audio;../../../../../../components/libraries/usbd/class/cdc;../../../../../../components/libraries/usbd/class/cdc/acm;../../../../../../components/libraries/usbd/class/hid;../../../../../../components/libraries/usbd/class/hid/generic;../../../../../../components/libraries/usbd/class/hid/kbd;../../../../../../components/libraries/usbd/class/hid/mouse;../../../../../../components/libraries/usbd/class/msc;../../../../../../components/libraries/usbd/config;../../../../../../components/libraries/util;../../../../../../components/softdevice/common/softdevice_handler;../../../../../../components/softdevice/s130/headers;../../../../../../components/softdevice/s130/headers/nrf51;../../../../../../components/toolchain;../../../../../../external/segger_rtt;../config" />
    <folder Name="Application">
      <file file_name="../../../main.c" />
      <file file_name="../config/sdk_config.h" />
    </folder>
    <folder Name="Board Definition">
      <file file_name="../../../../../../components/boards/boards.c" />
    </folder>
    <folder Name="Board Support">
      <file file_name="../../../../../../components/libraries/bsp/bsp.c" />
      <file file_name="../../../../../../components/libraries/bsp/bsp_nfc.c" />
    </folder>
    <folder Name="nRF_BLE">
      <file file_name="../../../../../../components/ble/common/ble_advdata.c" />
      <file file_name="../../../../../../components/ble/common/ble_conn_params.c" />
      <file file_name="../../../../../../components/ble/common/ble_srv_common.c" />
    </folder>
    <folder Name="nRF_Drivers">
      <file file_name="../../../../../../components/drivers_nrf/clock/nrf_drv_clock.c" />
      <file file_name="../../../../../../components/drivers_nrf/common/nrf_drv_common.c" />
      <file file_name="../../../../../../components/drivers_nrf/gpiote/nrf_drv_gpiote.c" />
      <file file_name="../../../../../../components/drivers_nrf/uart/nrf_drv_uart.c" />
    </folder>
    <folder Name="nRF_Libraries">
      <file file_name="../../../../../../components/libraries/button/app_button.c" />
      <file file_name="../../../../../../components/libraries/util/app_error.c" />
      <file file_name="../../../../../../components/libraries/util/app_error_weak.c" />
      <file file_name="../../../../../../components/libraries/timer/app_timer.c" />
      <file file_name="../../../../../../components/libraries/util/app_util_platform.c" />
      <file file_name="../../../../../../components/libraries/hardfault/hardfault_implementation.c" />
      <file file_name="../../../../../../components/libraries/util/nrf_assert.c" />
      <file file_name="../../../../../../components/libraries/util/sdk_errors.c" />
    </folder>
    <folder Name="nRF_Log">
      <file file_name="../../../../../../components/libraries/log/src/nrf_log_backend_serial.c" />
      <file file_name="../../../../../../components/libraries/log/src/nrf_log_frontend.c" />
    </folder>
    <folder Name="nRF_Segger_RTT">
      <file file_name="../../../../../../external/segger_rtt/RTT_Syscalls_KEIL.c" />
      <file file_name="../../../../../../external/segger_rtt/SEGGER_RTT.c" />
      <file file_name="../../../../../../external/segger_rtt/SEGGER_RTT_printf.c" />
    </folder>
    <folder Name="nRF_SoftDevice">
      <file file_name="../../../../../../components/softdevice/common/softdevice_handler/softdevice_handler.c" />
    </folder>
    <configuration
      Name="External Keil ARMCC"
      asm_additional_options="--cpu;"
      c_additional_options="--cpu;;--C99;-O3;--split_sections;-g"
      linker_additional_options="--cpu;" />
  </project>
  <configuration Name="Internal" hidden="Yes" />
  <configuration Name="nrf51422_xxac" inherited_configurations="Internal" />
</solution>

Every step was successful except the last two ("Right-click on your project in the Project Explorer and select Import Section Placement.") because I didn't get that option even though I changed the linker option to GNU (And also tried arm_linker_variant="GNU").

When compiled, I received lots or linker errors as shown below (I also tried after adding flash_placement.xml in the project file replacing the link_linker_script_file="$(StudioDir)/samples/SEGGER_Flash.icf".

Building ‘ble_app_beacon_pca10028_s130’ from solution ‘ble_app_beacon_pca10028_s130’ in configuration ‘nrf51422_xxac’
  Linking ble_app_beacon_pca10028_s130.elf
    Output/nrf51422_xxac/Exe/ble_app_beacon_pca10028_s130.elf section `.init' will not fit in region `UNPLACED_SECTIONS'
    region `UNPLACED_SECTIONS' overflowed by 18952 bytes
    Output/ble_app_beacon_pca10028_s130 nrf51422_xxac/Obj/SEGGER_THUMB_Startup.o: in function `exit':
    (.init+0x48): undefined reference to `__stack_end__'
    (.init+0x4c): undefined reference to `__SEGGER_init_table__'
    (.init+0x50): undefined reference to `__heap_start__'
    (.init+0x54): undefined reference to `__heap_end__'
    (.init+0x58): undefined reference to `__ctors_start__'
    (.init+0x5c): undefined reference to `__ctors_end__'
    Output/ble_app_beacon_pca10028_s130 nrf51422_xxac/Obj/ses_nrf51_startup.o: in function `_vectors':
    (.vectors+0x0): undefined reference to `__stack_end__'
    Output/ble_app_beacon_pca10028_s130 nrf51422_xxac/Obj/ses_nrf51_startup.o: in function `SystemInit':
    (.init+0x64): undefined reference to `__RAM_segment_end__'
    Output/ble_app_beacon_pca10028_s130 nrf51422_xxac/Obj/softdevice_handler.o: in function `softdevice_enable':
    softdevice_handler.c:(.text.softdevice_enable+0x28): undefined reference to `__data_start__'
Build failed

Is there any working project file with necessary startup files for SES version 4.30b? Or nrf51422 is no longer in production?

Parents
  • Hi

    I forgot to touch upon this in my initial reply, but the nRF51422 is definitely still in production, we just don't have support for it beyond SDK v.12.3. I think the example in Vidar's reply should work as long as you follow the instructions he added and use SES v.4.12 or similar. Is there a particular reason you need to use v.4.30b?

    I have requested for the blog post to be updated, but I can't guarantee that this will be prioritized any time soon.

    Best regards,

    Simon

  • I have solved the issue, the main reason was the linker placement segments are named differently in project file (created by converting Keil project) and flash_placement.xml file.

    linker_section_placements_segments="FLASH RX 0x00000000 0x00040000;RAM RWX 0x20000000 0x00008000"

    and also changed the start up files.

    <folder Name="Segger Startup Files">
          <file file_name="$(StudioDir)/source/thumb_crt0.s" />
    </folder>
    <folder Name="None">
      <file file_name="../../../../../../components/toolchain/ses/ses_startup_nrf_common.s" />
      <file file_name="../../../../../../components/toolchain/system_nrf51.c" />
      <file file_name="../../../../../../components/toolchain/ses/ses_startup_nrf51.s" />
    </folder>

    And finally

     debug_additional_load_file="../../../../../../components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex"
     debug_register_definition_file="../../../../../../svd/nrf51.svd"

Reply
  • I have solved the issue, the main reason was the linker placement segments are named differently in project file (created by converting Keil project) and flash_placement.xml file.

    linker_section_placements_segments="FLASH RX 0x00000000 0x00040000;RAM RWX 0x20000000 0x00008000"

    and also changed the start up files.

    <folder Name="Segger Startup Files">
          <file file_name="$(StudioDir)/source/thumb_crt0.s" />
    </folder>
    <folder Name="None">
      <file file_name="../../../../../../components/toolchain/ses/ses_startup_nrf_common.s" />
      <file file_name="../../../../../../components/toolchain/system_nrf51.c" />
      <file file_name="../../../../../../components/toolchain/ses/ses_startup_nrf51.s" />
    </folder>

    And finally

     debug_additional_load_file="../../../../../../components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex"
     debug_register_definition_file="../../../../../../svd/nrf51.svd"

Children
No Data
Related