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

Errors after porting an application to an nRF52832-xxAB and SES

Hello,

I have developed an application for my NRF52 DK and I want to port it to an NRF52832-QFAB-R which has a reduced amount of storage. I have changed the parameter "Target Device" in the "Debugger" options to "nRF52832_xxAB" and rebuild the code, but I got some error messages:

There are some linker errors, obviously because the sections are outside of the memory. So I have changed "Linker->Memory Segments:

FLASH1 RX 0x00000000 0x00040000;RAM1 RWX 0x20000000 0x00008000

And "Linker->Section Placement Macros":

FLASH_PH_START=0x0
FLASH_PH_SIZE=0x40000
RAM_PH_START=0x20000000
RAM_PH_SIZE=0x8000
FLASH_START=0x26000
FLASH_SIZE=0x1a000
RAM_START=0x20002bd0
RAM_SIZE=0x5430

But the error still exists. What is missing here?

  • Hi,

    There are some strange things here. I assume you are using SDK 17.0.2 If so, FLASH1 should be FLASH. Other than that most things look good. You can see an working example by taking the ble_app_hrs example project (<SDK_17.0.2>\examples\ble_peripheral\ble_app_hrs\pca10040\s132\ses\ble_app_hrs_pca10040_s132.emProject) and modifying it like this:

    diff --git a/examples/ble_peripheral/ble_app_hrs/pca10040/s132/ses/ble_app_hrs_pca10040_s132.emProject b/examples/ble_peripheral/ble_app_hrs/pca10040/s132/ses/ble_app_hrs_pca10040_s132.emProject
    index 998f065..e102a5b 100644
    --- a/examples/ble_peripheral/ble_app_hrs/pca10040/s132/ses/ble_app_hrs_pca10040_s132.emProject
    +++ b/examples/ble_peripheral/ble_app_hrs/pca10040/s132/ses/ble_app_hrs_pca10040_s132.emProject
    @@ -13,10 +13,10 @@
           arm_linker_stack_size="8192"
           arm_linker_treat_warnings_as_errors="No"
           arm_simulator_memory_simulation_parameter="RWX 00000000,00100000,FFFFFFFF;RWX 20000000,00010000,CDCDCDCD"
    -      arm_target_device_name="nRF52832_xxAA"
    +      arm_target_device_name="nRF52832_xxAB"
           arm_target_interface_type="SWD"
           c_user_include_directories="../../../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_gatt;../../../../../../components/ble/nrf_ble_qwr;../../../../../../components/ble/peer_manager;../../../../../../components/boards;../../../../../../components/libraries/atomic;../../../../../../components/libraries/atomic_fifo;../../../../../../components/libraries/atomic_flags;../../../../../../components/libraries/balloc;../../../../../../components/libraries/bootloader/ble_dfu;../../../../../../components/libraries/bsp;../../../../../../components/libraries/button;../../../../../../components/libraries/cli;../../../../../../components/libraries/crc16;../../../../../../components/libraries/crc32;../../../../../../components/libraries/crypto;../../../../../../components/libraries/crypto/backend/cc310;../../../../../../components/libraries/crypto/backend/cc310_bl;../../../../../../components/libraries/crypto/backend/cifra;../../../../../../components/libraries/crypto/backend/mbedtls;../../../../../../components/libraries/crypto/backend/micro_ecc;../../../../../../components/libraries/crypto/backend/nrf_hw;../../../../../../components/libraries/crypto/backend/nrf_sw;../../../../../../components/libraries/crypto/backend/oberon;../../../../../../components/libraries/crypto/backend/optiga;../../../../../../components/libraries/csense;../../../../../../components/libraries/csense_drv;../../../../../../components/libraries/delay;../../../../../../components/libraries/ecc;../../../../../../components/libraries/experimental_section_vars;../../../../../../components/libraries/experimental_task_manager;../../../../../../components/libraries/fds;../../../../../../components/libraries/fstorage;../../../../../../components/libraries/gfx;../../../../../../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/memobj;../../../../../../components/libraries/mpu;../../../../../../components/libraries/mutex;../../../../../../components/libraries/pwm;../../../../../../components/libraries/pwr_mgmt;../../../../../../components/libraries/queue;../../../../../../components/libraries/ringbuf;../../../../../../components/libraries/scheduler;../../../../../../components/libraries/sdcard;../../../../../../components/libraries/sensorsim;../../../../../../components/libraries/slip;../../../../../../components/libraries/sortlist;../../../../../../components/libraries/spi_mngr;../../../../../../components/libraries/stack_guard;../../../../../../components/libraries/stack_info;../../../../../../components/libraries/strerror;../../../../../../components/libraries/svc;../../../../../../components/libraries/timer;../../../../../../components/libraries/twi_mngr;../../../../../../components/libraries/twi_sensor;../../../../../../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/util;../../../../../../components/nfc/ndef/conn_hand_parser;../../../../../../components/nfc/ndef/conn_hand_parser/ac_rec_parser;../../../../../../components/nfc/ndef/conn_hand_parser/ble_oob_advdata_parser;../../../../../../components/nfc/ndef/conn_hand_parser/le_oob_rec_parser;../../../../../../components/nfc/ndef/connection_handover/ac_rec;../../../../../../components/nfc/ndef/connection_handover/ble_oob_advdata;../../../../../../components/nfc/ndef/connection_handover/ble_pair_lib;../../../../../../components/nfc/ndef/connection_handover/ble_pair_msg;../../../../../../components/nfc/ndef/connection_handover/common;../../../../../../components/nfc/ndef/connection_handover/ep_oob_rec;../../../../../../components/nfc/ndef/connection_handover/hs_rec;../../../../../../components/nfc/ndef/connection_handover/le_oob_rec;../../../../../../components/nfc/ndef/generic/message;../../../../../../components/nfc/ndef/generic/record;../../../../../../components/nfc/ndef/launchapp;../../../../../../components/nfc/ndef/parser/message;../../../../../../components/nfc/ndef/parser/record;../../../../../../components/nfc/ndef/text;../../../../../../components/nfc/ndef/uri;../../../../../../components/nfc/platform;../../../../../../components/nfc/t2t_lib;../../../../../../components/nfc/t2t_parser;../../../../../../components/nfc/t4t_lib;../../../../../../components/nfc/t4t_parser/apdu;../../../../../../components/nfc/t4t_parser/cc_file;../../../../../../components/nfc/t4t_parser/hl_detection_procedure;../../../../../../components/nfc/t4t_parser/tlv;../../../../../../components/softdevice/common;../../../../../../components/softdevice/s132/headers;../../../../../../components/softdevice/s132/headers/nrf52;../../../../../../components/toolchain/cmsis/include;../../../../../../external/fprintf;../../../../../../external/mbedtls/include;../../../../../../external/nrf_cc310/include;../../../../../../external/nrf_oberon;../../../../../../external/nrf_oberon/include;../../../../../../external/nrf_tls/mbedtls/nrf_crypto/config;../../../../../../external/segger_rtt;../../../../../../external/utf_converter;../../../../../../integration/nrfx;../../../../../../integration/nrfx/legacy;../../../../../../modules/nrfx;../../../../../../modules/nrfx/drivers/include;../../../../../../modules/nrfx/hal;../../../../../../modules/nrfx/mdk;../config;"
    -      c_preprocessor_definitions="APP_TIMER_V2;APP_TIMER_V2_RTC1_ENABLED;BLE_STACK_SUPPORT_REQD;BOARD_PCA10040;CONFIG_GPIO_AS_PINRESET;FLOAT_ABI_HARD;INITIALIZE_USER_SECTIONS;MBEDTLS_CONFIG_FILE="nrf_crypto_mbedtls_config.h";NO_VTOR_CONFIG;NRF52;NRF52832_XXAA;NRF52_PAN_74;NRF_CRYPTO_MAX_INSTANCE_COUNT=1;NRF_SD_BLE_API_VERSION=7;S132;SOFTDEVICE_PRESENT;"
    +      c_preprocessor_definitions="APP_TIMER_V2;APP_TIMER_V2_RTC1_ENABLED;BLE_STACK_SUPPORT_REQD;BOARD_PCA10040;CONFIG_GPIO_AS_PINRESET;FLOAT_ABI_HARD;INITIALIZE_USER_SECTIONS;MBEDTLS_CONFIG_FILE="nrf_crypto_mbedtls_config.h";NO_VTOR_CONFIG;NRF52;NRF52832_XXAB;NRF52_PAN_74;NRF_CRYPTO_MAX_INSTANCE_COUNT=1;NRF_SD_BLE_API_VERSION=7;S132;SOFTDEVICE_PRESENT;"
           debug_target_connection="J-Link"
           gcc_entry_point="Reset_Handler"
           macros="CMSIS_CONFIG_TOOL=../../../../../../external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar"
    @@ -28,9 +28,9 @@
           linker_printf_fmt_level="long"
           linker_scanf_fmt_level="long"
           linker_section_placement_file="flash_placement.xml"
    -      linker_section_placement_macros="FLASH_PH_START=0x0;FLASH_PH_SIZE=0x80000;RAM_PH_START=0x20000000;RAM_PH_SIZE=0x10000;FLASH_START=0x26000;FLASH_SIZE=0x5a000;RAM_START=0x20002bd0;RAM_SIZE=0xd430"
    +      linker_section_placement_macros="FLASH_PH_START=0x0;FLASH_PH_SIZE=0x40000;RAM_PH_START=0x20000000;RAM_PH_SIZE=0x8000;FLASH_START=0x26000;FLASH_SIZE=0x1a000;RAM_START=0x20002bd0;RAM_SIZE=0x5430"
           
    -      linker_section_placements_segments="FLASH RX 0x0 0x80000;RAM1 RWX 0x20000000 0x10000"
    +      linker_section_placements_segments="FLASH RX 0x0 0x40000;RAM1 RWX 0x20000000 0x8000"
           project_directory=""
           project_type="Executable" />
           <folder Name="Segger Startup Files">
    

    You also need to reduce the size a bit, for instance by setting NRF_LOG_ENABLED to 0 in sdk_config.h.

  • Hey,

    thank you. This will solve the issue, but .rodata and .data are too large for the segment. Also, .heap overlaps with the .stack section, so I have to adjust it I think. Can you recommend a way to do this?

  • It is just a matter of getting the size down, you do not need to move anything. Do you use heap? If not, that can be set to 0. Do you need 8192 byte stack? If not, that can be reduced. And for .rodata and .data it is the same. You cannot get more space by moving around, you need to reduce the size if too big. So there is nothing you can do in flash_placement.xml about this.

  • Hey,

    I wonder why the code doesn´t fit into the flash because the code only requires 112,5k / 512k of the flash memory of the "AA" version, so half of the memory should be enough (I use Softdevice too).

  • Which SoftDevice are you using? If you are using S132 version 7.2.0 that is 152 kB. Adding a firmware of 112,5 kB on top it is more than the available flash of 256 kB, so it will not fit.

Related