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

debug configuration on eclipse to run softdevice + application + bootloader?

Hello,

I am using Eclipse with ARM toolchain on ubuntu to buid my application with softdevice s132 api version 3.1.0. I managed to build on eclipse and merge softdevice hex with application with the help of nrfjprog and mergehex. I would really like to setup eclpse GDB debugger to perform line by line debuggging. But when I start the debug session it never hits main, and soon runs into infinite loop of the softdevice exception. As I have the *.out file with information only on my application related symbols, could this be the reason ? How do I configure debugger correctly? my Linker script is written as shown below to accomodate S132. Is there any other reason other that linker scripts that could cause this issue ?

This is my linker scripts :

PROJECT_NAME     := blinky_pca10040
TARGETS          := nrf52832_xxaa
OUTPUT_DIRECTORY := _build

SDK_ROOT := /home/name/nrf/sdk
PROJ_DIR := .

# NRF related
SDK_COMPONENTS := $(SDK_ROOT)/components
NRF_TOOLCHAIN  := $(SDK_COMPONENTS)/toolchain
NRF_SD     := $(SDK_COMPONENTS)/softdevice/s132
NRF_SD_TOOLCHAIN := $(NRF_SD)/toolchain
DEVICE_INCLUDES := $(SDK_COMPONENTS)/device
NRF_GCC := $(NRF_TOOLCHAIN)/gcc


$(OUTPUT_DIRECTORY)/nrf52832_xxaa.out: \
  LINKER_SCRIPT  := armgcc_s132_nrf52832_local.ld

# Include folders common to all targets
INC_FOLDERS += \
  $(PROJ_DIR)/inc \
  $(PROJ_DIR)/inc/board \
  $(SDK_ROOT)/components \
  $(SDK_ROOT)/components/boards \
  $(SDK_ROOT)/components/libraries/experimental_section_vars \
  $(SDK_ROOT)/components/libraries/balloc \
  $(SDK_ROOT)/components/libraries/bsp \
  $(SDK_ROOT)/components/toolchain/cmsis/include \
  $(SDK_ROOT)/components/libraries/util \
    $(NRF_TOOLCHAIN) \
    $(NRF_GCC) \
    $(NRF_SD)/headers \
    $(SDK_COMPONENTS)/device \
    $(NRF_TOOLCHAIN)/cmsis/include \
    $(SDK_COMPONENTS)/drivers_nrf/delay \
    $(SDK_COMPONENTS)/drivers_nrf/hal \
    $(SDK_COMPONENTS)/drivers_nrf/clock \
    $(SDK_COMPONENTS)/drivers_nrf/spi_master \
    $(SDK_COMPONENTS)/drivers_nrf/twi_master \
    $(SDK_COMPONENTS)/drivers_nrf/common \
    $(SDK_COMPONENTS)/drivers_nrf/uart \
    $(SDK_COMPONENTS)/drivers_nrf/rtc \
    $(SDK_COMPONENTS)/drivers_nrf/saadc \
    $(SDK_COMPONENTS)/drivers_nrf/gpiote \
    $(SDK_COMPONENTS)/libraries/util \
    $(SDK_COMPONENTS)/libraries/log \
    $(SDK_COMPONENTS)/libraries/log/src \
    $(SDK_COMPONENTS)/libraries/fifo \
    $(SDK_COMPONENTS)/libraries/timer \
    $(SDK_COMPONENTS)/libraries/fstorage \
    $(SDK_COMPONENTS)/libraries/fds \
    $(SDK_COMPONENTS)/libraries/crc16 \
    $(SDK_COMPONENTS)/libraries/experimental_section_vars \
    $(SDK_COMPONENTS)/ble/common \
    $(SDK_COMPONENTS)/ble/ble_advertising \
    $(SDK_COMPONENTS)/ble/ble_services \
    $(SDK_COMPONENTS)/ble/nrf_ble_gatt \
    $(SDK_COMPONENTS)/ble/peer_manager \
    $(SDK_COMPONENTS)/softdevice/common/softdevice_handler \
    $(SDK_COMPONENTS)/softdevice/s132/headers/nrf52 \
    $(SDK_COMPONENTS)/../external/segger_rtt \
    $(PROJ_DIR)/inc \
    $(PROJ_DIR)/inc/board \
    $(PROJ_DIR)/lib \
    $(PROJ_DIR)/lib/flash \
    $(PROJ_DIR)/src

# Source files common to all targets
SRC_FILES += \
  $(SDK_ROOT)/components/toolchain/gcc/gcc_startup_nrf52.S \
  $(PROJ_DIR)/src/main.c \
  $(SDK_ROOT)/components/boards/boards.c \
  $(SDK_ROOT)/components/drivers_nrf/uart/nrf_drv_uart.c \
  $(SDK_ROOT)/components/toolchain/system_nrf52.c \
    $(SDK_COMPONENTS)/drivers_nrf/saadc/nrf_drv_saadc.c \
    $(SDK_COMPONENTS)/drivers_nrf/hal/nrf_saadc.c \
    $(SDK_COMPONENTS)/drivers_nrf/clock/nrf_drv_clock.c \
    $(SDK_COMPONENTS)/drivers_nrf/gpiote/nrf_drv_gpiote.c \
    $(SDK_COMPONENTS)/drivers_nrf/common/nrf_drv_common.c \
    $(SDK_COMPONENTS)/drivers_nrf/rtc/nrf_drv_rtc.c \
    $(SDK_COMPONENTS)/drivers_nrf/spi_master/nrf_drv_spi.c \
    $(SDK_COMPONENTS)/drivers_nrf/twi_master/nrf_drv_twi.c \
    $(SDK_COMPONENTS)/libraries/fifo/app_fifo.c \
    $(SDK_COMPONENTS)/libraries/uart/retarget.c \
    $(SDK_COMPONENTS)/libraries/timer/app_timer.c \
    $(SDK_COMPONENTS)/libraries/fstorage/fstorage.c \
    $(SDK_COMPONENTS)/libraries/fds/fds.c \
    $(SDK_COMPONENTS)/libraries/crc16/crc16.c \
    $(SDK_COMPONENTS)/libraries/util/app_error.c \
    $(SDK_COMPONENTS)/libraries/util/nrf_assert.c \
    $(SDK_COMPONENTS)/libraries/util/nrf_assert.c \
    $(SDK_COMPONENTS)/libraries/log/src/nrf_log_frontend.c \
    $(SDK_COMPONENTS)/libraries/log/src/nrf_log_backend_serial.c \
    $(SDK_COMPONENTS)/libraries/util/app_util_platform.c \
    $(SDK_COMPONENTS)/libraries/util/sdk_errors.c \
    $(SDK_COMPONENTS)/libraries/util/sdk_mapped_flags.c \
    $(SDK_COMPONENTS)/ble/common/ble_conn_state.c \
    $(SDK_COMPONENTS)/ble/common/ble_conn_params.c \
    $(SDK_COMPONENTS)/ble/common/ble_srv_common.c \
    $(SDK_COMPONENTS)/ble/ble_advertising/ble_advertising.c \
    $(SDK_COMPONENTS)/ble/common/ble_advdata.c \
    $(SDK_COMPONENTS)/ble/ble_services/ble_nus/ble_nus.c \
    $(SDK_COMPONENTS)/ble/ble_services/ble_bas/ble_bas.c \
    $(SDK_COMPONENTS)/ble/ble_services/ble_dis/ble_dis.c \
    $(SDK_COMPONENTS)/ble/ble_services/ble_hrs/ble_hrs.c \
    $(SDK_COMPONENTS)/ble/peer_manager/peer_data.c \
    $(SDK_COMPONENTS)/ble/peer_manager/peer_data_storage.c \
    $(SDK_COMPONENTS)/ble/peer_manager/peer_database.c \
    $(SDK_COMPONENTS)/ble/peer_manager/peer_id.c \
    $(SDK_COMPONENTS)/ble/peer_manager/peer_manager.c \
    $(SDK_COMPONENTS)/ble/peer_manager/gatt_cache_manager.c \
    $(SDK_COMPONENTS)/ble/peer_manager/gatts_cache_manager.c \
    $(SDK_COMPONENTS)/ble/peer_manager/id_manager.c \
    $(SDK_COMPONENTS)/ble/peer_manager/pm_buffer.c \
    $(SDK_COMPONENTS)/ble/peer_manager/pm_mutex.c \
    $(SDK_COMPONENTS)/ble/peer_manager/security_dispatcher.c \
    $(SDK_COMPONENTS)/ble/peer_manager/security_manager.c \
    $(SDK_COMPONENTS)/softdevice/common/softdevice_handler/softdevice_handler.c \
    $(SDK_COMPONENTS)/../external/segger_rtt/SEGGER_RTT.c \
    $(SDK_COMPONENTS)/../external/segger_rtt/RTT_Syscalls_GCC.c \
    $(PROJ_DIR)/lib/deca_device_api/deca_device.c \
    $(PROJ_DIR)/lib/deca_device_api/deca_spi.c \
    $(PROJ_DIR)/lib/deca_device_api/deca_mutex.c \
    $(PROJ_DIR)/lib/deca_device_api/deca_params_init.c \
    $(PROJ_DIR)/lib/deca_device_api/dwt_timestamps.c \
    $(PROJ_DIR)/lib/flash/m25p16.c \
    $(PROJ_DIR)/lib/flash/nrf_int_flash.c \
    $(PROJ_DIR)/lib/i2cdev/I2Cdev.c \
    $(PROJ_DIR)/lib/ms5611/ms5611.c \
    $(PROJ_DIR)/lib/mpu9250/mpu9250.c \
    $(PROJ_DIR)/lib/mpu9250/inv_mpu.c \
    $(PROJ_DIR)/lib/mpu9250/inv_mpu_dmp_motion_driver.c \
    $(PROJ_DIR)/lib/uart/app_uart_fifo.c \
    $(PROJ_DIR)/lib/uart/uart.c \
    $(PROJ_DIR)/lib/twr/lps_twr.c \
    $(PROJ_DIR)/src/dw1000.c \
    $(PROJ_DIR)/lib/ble/ble_ctrl.c \
    $(PROJ_DIR)/lib/ble/ble_lps2.c \
    $(PROJ_DIR)/lib/ble/nrf_ble_gatt.c  #corrected version

# Libraries common to all targets
LIB_FILES += \

# Optimization flags
OPT = -g
# Uncomment the line below to enable link time optimization
#OPT += -flto

# C flags common to all targets
CFLAGS += $(OPT)
CFLAGS += -DBSP_DEFINES_ONLY
CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
CFLAGS += -DSOFTDEVICE_PRESENT
CFLAGS += -DNRF52
CFLAGS += -DS132
CFLAGS += -DNRF52832
CFLAGS += -DPROPERTIES
CFLAGS += -DCOMPILE_DEFINITIONS
CFLAGS += -DLPS2_V10
CFLAGS += -DDEBUG
CFLAGS += -DBLE_STACK_SUPPORT_REQD
CFLAGS += -DNRF_SD_BLE_API_VERSION=3
CFLAGS += -mcpu=cortex-m4
CFLAGS += -mthumb -mabi=aapcs
CFLAGS += --std=gnu99
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
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 += -g
ASMFLAGS += -mcpu=cortex-m4
ASMFLAGS += -mthumb -mabi=aapcs
ASMFLAGS += --std=gnu99
ASMFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
ASMFLAGS += -DBSP_DEFINES_ONLY
ASMFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
ASMFLAGS += -DSOFTDEVICE_PRESENT
ASMFLAGS += -DNRF52
ASMFLAGS += -DS132
ASMFLAGS += -DNRF52832
ASMFLAGS += -DPROPERTIES
ASMFLAGS += -DCOMPILE_DEFINITIONS
ASMFLAGS += -DLPS2_V10
ASMFLAGS += -DDEBUG
ASMFLAGS += -DNRF_SD_BLE_API_VERSION=3
ASMFLAGS += -DBLE_STACK_SUPPORT_REQD

# Linker flags
LDFLAGS += $(OPT)
LDFLAGS += -mthumb -mabi=aapcs -L$(NRF_GCC) -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

# 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


.PHONY: default help

# Default target - first one defined
default: nrf52832_xxaa

# Print all targets that can be built
help:
    @echo following targets are available:
    @echo        nrf52832_xxaa
    @echo        sdk_config - starting external tool for editing sdk_config.h
    @echo        flash      - flashing binary

TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc


include $(TEMPLATE_PATH)/Makefile.common

$(foreach target, $(TARGETS), $(call define_target, $(target)))

.PHONY: flash erase

# Flash the program
flash: $(OUTPUT_DIRECTORY)/nrf52832_xxaa.hex
    @echo Flashing: $<
    /home/sathya/Downloads/nRF5x-Command-Line-Tools_9_7_3_Linux-x86_64/nrfjprog -f nrf52 --program $< --sectorerase
    /home/sathya/Downloads/nRF5x-Command-Line-Tools_9_7_3_Linux-x86_64/nrfjprog -f nrf52 --reset

erase:
    /home/sathya/Downloads/nRF5x-Command-Line-Tools_9_7_3_Linux-x86_64/nrfjprog -f nrf52 --eraseall

SDK_CONFIG_FILE := /inc/sdk_config.h
CMSIS_CONFIG_TOOL := $(SDK_ROOT)/external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar
sdk_config:
    java -jar $(CMSIS_CONFIG_TOOL) $(SDK_CONFIG_FILE)

Parents
  • Sorry that was the makefile, this is the linker!

    /* Linker script to configure memory regions. */

    SEARCH_DIR(.)
    GROUP(-lgcc -lc -lnosys)

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x1f000, LENGTH = 0x61000
      RAM (rwx) :  ORIGIN = 0x20002128, LENGTH = 0xded8
    /** Location in UICR of NFC Pins register is stored. */
      UICR_NFCPINS(r) : ORIGIN = 0x1000120C, LENGTH = 0x04
    }

    SECTIONS
    {
      .fs_data :
      {
        PROVIDE(__start_fs_data = .);
        KEEP(*(.fs_data))
        PROVIDE(__stop_fs_data = .);
      } > RAM
      .pwr_mgmt_data :
      {
        PROVIDE(__start_pwr_mgmt_data = .);
        KEEP(*(.pwr_mgmt_data))
        PROVIDE(__stop_pwr_mgmt_data = .);
      } > RAM
      /* Write the bootloader address in UICR. */
      .uicrNfcPinsAddress :
      {
        KEEP(*(.uicrNfcPinsAddress))
      } > UICR_NFCPINS
    } INSERT AFTER .data;

    INCLUDE "nrf5x_common.ld"

Reply
  • Sorry that was the makefile, this is the linker!

    /* Linker script to configure memory regions. */

    SEARCH_DIR(.)
    GROUP(-lgcc -lc -lnosys)

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x1f000, LENGTH = 0x61000
      RAM (rwx) :  ORIGIN = 0x20002128, LENGTH = 0xded8
    /** Location in UICR of NFC Pins register is stored. */
      UICR_NFCPINS(r) : ORIGIN = 0x1000120C, LENGTH = 0x04
    }

    SECTIONS
    {
      .fs_data :
      {
        PROVIDE(__start_fs_data = .);
        KEEP(*(.fs_data))
        PROVIDE(__stop_fs_data = .);
      } > RAM
      .pwr_mgmt_data :
      {
        PROVIDE(__start_pwr_mgmt_data = .);
        KEEP(*(.pwr_mgmt_data))
        PROVIDE(__stop_pwr_mgmt_data = .);
      } > RAM
      /* Write the bootloader address in UICR. */
      .uicrNfcPinsAddress :
      {
        KEEP(*(.uicrNfcPinsAddress))
      } > UICR_NFCPINS
    } INSERT AFTER .data;

    INCLUDE "nrf5x_common.ld"

Children
No Data
Related