How to import gcc-arm project to segger studio

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • How to import gcc-arm project to segger studio

      Hi,
      I am evaluating the Firmware on this github repo and my nrf52832. It uses NordicSDK and an ARMGCC makefile.
      At the moment I am compiling it using the makefile, however I would like to import this project to Segger Embedded Studio, in order to be able to use the debugger.
      Could you give some advice on how to do this?
      Thanks!
    • Hello,

      Thank you for your inquiry.
      There is no automatic importer for makefiles so you would need to set a Embedded Studio project up manually.
      First create a new project and select your target device.
      Now create folders to place your files in.
      ES uses virtual folders so you can create any topology. We suggest replicating the actual topology of the project for easier maintenance.
      Next add all project files. You can also drag and drop them.
      Add user include paths for your .h files etc.
      Depending on the complexity of the project it could already build at this point.
      If not add the missing parts e.g. libraries, scripts, macros, definitions etc. etc.

      Best regards,
      Nino
      Please read the forum rules before posting: Forum Rules

      Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support contact us per e-mail.
      Alternatively our support ticketing system can be used as well: segger.com/ticket/
    • New

      Hi,

      Thanks for the reply. I am trying to do it manually but have some doubts (I am not very familiar with either makefiles or segger studio, sorry if I am asking very obvious questions). Here are some questions:

      1. There are a lot of .c src files that my makefile includes that belong to nordic SDK. I provide a list below. Do I have to add these by hand? or is there an easier to include the full nordic SDK? I can't figure out how the nordic examples do it. (../../ is the root folder of the SDK)
        ../../modules/nrfx/mdk/gcc_startup_nrf52.S
        ../../external/freertos/portable/GCC/nrf52/port.c
        ../../external/freertos/source/tasks.c ../../external/freertos/source/croutine.c ../../external/freertos/source/event_groups.c ../../external/freertos/source/list.c ../../external/freertos/source/queue.c ../../external/freertos/source/stream_buffer.c ../../external/freertos/source/timers.c ../../external/freertos/source/portable/MemMang/heap_1.c ../../external/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c ../../external/freertos/portable/CMSIS/nrf52/port_cmsis.c ../../external/fprintf/nrf_fprintf.c ../../external/fprintf/nrf_fprintf_format.c ../../components/ble/ble_link_ctx_manager/ble_link_ctx_manager.c ../../modules/nrfx/drivers/src/nrfx_uart.c ../../modules/nrfx/drivers/src/nrfx_uarte.c ../../modules/nrfx/drivers/src/nrfx_clock.c ../../modules/nrfx/drivers/src/nrfx_twim.c ../../modules/nrfx/drivers/src/nrfx_gpiote.c ../../modules/nrfx/drivers/src/nrfx_spim.c ../../modules/nrfx/drivers/src/prs/nrfx_prs.c ../../components/ble/peer_manager/pm_mutex.c ../../components/ble/peer_manager/peer_id.c ../../components/ble/peer_manager/pm_buffer.c ../../components/ble/peer_manager/security_dispatcher.c ../../components/ble/peer_manager/security_manager.c ../../components/ble/peer_manager/peer_data_storage.c ../../components/ble/peer_manager/peer_database.c ../../components/ble/peer_manager/gatts_cache_manager.c ../../components/ble/peer_manager/gatt_cache_manager.c ../../components/ble/peer_manager/id_manager.c ../../components/ble/peer_manager/peer_manager.c ../../components/ble/common/ble_srv_common.c ../../RUI/Source/main.c ../../components/libraries/experimental_log/src/nrf_log_frontend.c ../../components/libraries/experimental_log/src/nrf_log_backend_rtt.c ../../components/libraries/experimental_log/src/nrf_log_backend_uart.c ../../components/libraries/experimental_log/src/nrf_log_backend_serial.c ../../components/libraries/experimental_log/src/nrf_log_str_formatter.c ../../components/ble/common/ble_advdata.c ../../components/libraries/experimental_section_vars/nrf_section_iter.c ../../components/libraries/strerror/nrf_strerror.c ../../components/libraries/fstorage/nrf_fstorage_sd.c ../../components/libraries/util/app_error_weak.c ../../components/libraries/util/app_error.c ../../components/libraries/fifo/app_fifo.c ../../components/libraries/balloc/nrf_balloc.c ../../components/libraries/util/app_util_platform.c ../../components/libraries/fstorage/nrf_fstorage.c ../../components/libraries/atomic/nrf_atomic.c ../../components/libraries/atomic_flags/nrf_atflags.c ../../components/libraries/experimental_memobj/nrf_memobj.c ../../components/libraries/atomic_fifo/nrf_atfifo.c ../../components/libraries/bsp/bsp.c ../../components/boards/boards.c ../../components/ble/nrf_ble_gatt/nrf_ble_gatt.c ../../components/libraries/timer/app_timer_freertos.c ../../components/softdevice/common/nrf_sdh_freertos.c ../../components/softdevice/common/nrf_sdh.c ../../components/softdevice/common/nrf_sdh_soc.c ../../components/softdevice/common/nrf_sdh_ble.c ../../components/ble/common/ble_conn_params.c ../../components/ble/ble_services/ble_nus/ble_nus.c ../../components/libraries/experimental_log/src/nrf_log_default_backends.c ../../integration/nrfx/legacy/nrf_drv_clock.c ../../integration/nrfx/legacy/nrf_drv_power.c ../../integration/nrfx/legacy/nrf_drv_spi.c ../../integration/nrfx/legacy/nrf_drv_swi.c ../../integration/nrfx/legacy/nrf_drv_twi.c ../../integration/nrfx/legacy/nrf_drv_uart.c ../../modules/nrfx/hal/nrf_nvmc.c ../../components/libraries/bsp/bsp_btn_ble.c ../../components/libraries/fds/fds.c ../../components/ble/ble_advertising/ble_advertising.c ../../components/ble/common/ble_conn_state.c ../../external/segger_rtt/SEGGER_RTT.c ../../external/segger_rtt/SEGGER_RTT_Syscalls_GCC.c ../../external/segger_rtt/SEGGER_RTT_printf.c ../../RUI/Source/app/test_task.c ../../RUI/Source/board/board_basic.c ../../RUI/Source/board/itracker_basic.c ../../components/libraries/uart/app_uart_fifo.c ../../RUI/Source/external/utilities.c ../../RUI/Source/hal/hal_gpio.c ../../RUI/Source/hal/hal_i2c.c ../../RUI/Source/hal/hal_spi.c ../../RUI/Source/hal/hal_uart.c ../../components/boards/boards.c ../../components/libraries/util/app_error.c ../../components/libraries/util/app_error_handler_gcc.c ../../components/libraries/util/app_error_weak.c ../../components/libraries/util/app_util_platform.c ../../components/libraries/util/nrf_assert.c ../../components/libraries/strerror/nrf_strerror.c

      2. In case of having to add these files by hang, a good approach would be to create the folders in the project explorer view of SES, then right click each folder-> Add existing files and browse the corresponding files ?
      3. The include folders need to be added in Project Options (Common)->Preprocessor->User include directories. Correct me if I'm wrong
      4. My makefile includes a .lib file (../../RUI/Source/external/micro-ecc/micro_ecc_lib_nrf52.lib) . What is the best way to add it?
      5. After doing the below steps, the last step would be to add the required #define macros to my code
      6. There are some flags I do not understand very well and wonder wether I should do something with themCFLAGS += -DBOARD_PCA10040
        CFLAGS += -DDEBUG
        CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
        CFLAGS += -DSOFTDEVICE_PRESENT
        CFLAGS += -DNRF52
        CFLAGS += -DS132
        CFLAGS += -DSWI_DISABLE0
        CFLAGS += -DNRF_SD_BLE_API_VERSION=5
        CFLAGS += -DNRF52832_XXAA
        CFLAGS += -DNRF52_PAN_74
        CFLAGS += -mcpu=cortex-m4
        CFLAGS += -mthumb -mabi=aapcs
        CFLAGS += -Wall
        CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
        # keep every function in a separate section, this allows linker to discard unused ones
        CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
        CFLAGS += -fno-builtin -fshort-enums


        # C++ flags common to all targets
        CXXFLAGS += $(OPT)


        # Assembler flags common to all targets
        ASMFLAGS += -g3
        ASMFLAGS += -mcpu=cortex-m4
        ASMFLAGS += -mthumb -mabi=aapcs
        ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
        ASMFLAGS += -DBOARD_PCA10040
        ASMFLAGS += -DBSP_DEFINES_ONLY
        ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
        ASMFLAGS += -DFLOAT_ABI_HARD
        ASMFLAGS += -DNRF52
        ASMFLAGS += -DNRF52832_XXAA
        ASMFLAGS += -DNRF52_PAN_74
        ASMFLAGS += -DSOFTDEVICE_PRESENT
        ASMFLAGS += -DS132
        ASMFLAGS += -DNRF_SD_BLE_API_VERSION=5
        # Linker flags
        LDFLAGS += $(OPT)
        LDFLAGS += -mthumb -mabi=aapcs -L$(SDK_ROOT)/modules/nrfx/mdk -T$(LINKER_SCRIPT)
        LDFLAGS += -mcpu=cortex-m4
        LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
        # let linker dump unused sections
        LDFLAGS += -Wl,--gc-sections
        # use newlib in nano version
        LDFLAGS += --specs=nano.specs


        nrf52832_xxaa: CFLAGS += -D__HEAP_SIZE=8192
        nrf52832_xxaa: CFLAGS += -D__STACK_SIZE=8192
        nrf52832_xxaa: ASMFLAGS += -D__HEAP_SIZE=8192
        nrf52832_xxaa: ASMFLAGS += -D__STACK_SIZE=8192


        # Add standard libraries at the very end of the linker input, after all objects
        # that may need symbols provided by these libraries.
        LIB_FILES += -lc -lnosys -lm



      Thanks!
    • New

      I tried doing all of that and still get some compilation issues, which I don't know how to fix.
      Hopefully someone can help:

      Rebuilding ‘RUI_ses’ from solution ‘RUI_ses’ in configuration ‘Debug’
      Compiling ‘main.c’
      app_util_platform.h
      FreeRTOSConfig.h
      FreeRTOS.h
      main.c
      #error "Device must be defined. See nrf.h."
      FreeRTOS.h
      main.c
      #error "This port requires __NVIC_PRIO_BITS to be defined"
      portmacro_cmsis.h
      portmacro.h
      portable.h
      FreeRTOS.h
      main.c
      implicit declaration of function '__REV' [-Wimplicit-function-declaration]
      portmacro.h
      portable.h
      FreeRTOS.h
      main.c
      unknown type name '__STATIC_INLINE'; did you mean '__INLINE'?
      expected '=', ',', ';', 'asm' or '__attribute__' before 'ulPortRaiseBASEPRI'
      ble.h
      ble_advdata.h
      main.c
      unknown type name '__STATIC_INLINE'; did you mean '__INLINE'?
      expected '=', ',', ';', 'asm' or '__attribute__' before 'sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter'
      unknown type name '__STATIC_INLINE'; did you mean '__INLINE'?
      expected '=', ',', ';', 'asm' or '__attribute__' before 'sd_ble_gattc_evt_char_val_by_uuid_read_rsp_iter'
      main.c
      ble_link_ctx_manager.h: No such file or directory
      Compiling ‘SEGGER_RTT.c’
      Compiling ‘SEGGER_RTT_Syscalls_SES.c’
      Assembling ‘Cortex_M_Startup.s’
      Assembling ‘HardFaultHandler.S’
      Build failed
    • New

      Hello,

      Please understand that we can't put more time into checking your custom setup, as this leaves the scope of assistance we can give through the forum.
      As your project is based on the Nordic SDK we recommend using the latest SDK and one of the ready Embedded Studio example projects.
      For example in \examples\ble_central\ble_app_blinky_c\pca10040\s132\ses you can find the Embedded Studio project for the blinky project.
      You can use this as baseline for your additional files and add them to it.

      Should you still run into compiling issues we recommend the following troubleshooting article:
      wiki.segger.com/SEGGER_Embedded_Studio#Troubleshooting


      For further Nordic related SDK questions we suggest getting in contact with Nordic support as they have created the Nordic Embedded Studio examples ans should be able to assist you further.


      Best regards,

      Nino
      Please read the forum rules before posting: Forum Rules

      Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support contact us per e-mail.
      Alternatively our support ticketing system can be used as well: segger.com/ticket/