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

SDK for Mesh v1.0.0 with SES "invalid ASCII encoded byte:line 1"

I am trying to build and debug the Mesh v1.0.0 light-switch server example and getting a cryptic error when launching the debug.

My environment is Segger v3.30 on macOS. I picked up the SES .emProject and flash_placement.xml files from the examples/light_switch/server directory, but had to make several changes to the .emProject file.

When building I get a warning "cannot find entry symbol Reset_handler: defaulting to ..." but the build completes. When I thereafter initiate Debug>Go, the Output view shows "Preparing target for download" is completed and then there is a Segger GUI popup "invalid ASCII encoded byte:line 1"

Any suggestions on how to proceed would be welcome.

The top of my .emProject file shows the value of the 'linker_section_placement_macros', where the values were picked up from the .ld file in ..examples/light_switch/server/linker/nrf52832_xxAA_s132_5.0.0.ld

<!DOCTYPE CrossStudio_Project_File> <solution   Name="light_switch_server_nrf52832_xxAA_s132_5.0.0" target="8"   version="2">   <project Name="light_switch_server_nrf52832_xxAA_s132_5.0.0">
    <configuration
      Name="Common"
      arm_architecture="v7EM"
      arm_core_type="Cortex-M4"
      arm_endian="Little"
      arm_fp_abi="Hard"
      arm_fpu_type="FPv4-SP-D16"
      arm_linker_heap_size="1024"
      arm_linker_process_stack_size="0"
      arm_linker_stack_size="2048"
      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_interface_type="SWD"
      c_preprocessor_definitions="NO_VTOR_CONFIG;NRF52;NRF52_SERIES;NRF52832;NRF52832_XXAA;S132;SOFTDEVICE_PRESENT;SD_BLE_API_VERSION=5;NRF_SD_BLE_API_VERSION=5;BOARD_PCA10040;CONFIG_GPIO_AS_PINRESET"
      c_user_include_directories="include;../include;../..;../../common/include;../../../external/nRF5_SDK_14.2.0_17b948a/components/drivers_nrf/delay;../../../models/simple_on_off/include;../../../models/config/include;../../../models/health/include;../../../mesh/access/api;../../../mesh/access/include;../../../mesh/prov/api;../../../mesh/prov/include;../../../external/nRF5_SDK_14.2.0_17b948a/components/boards;../../../external/nRF5_SDK_14.2.0_17b948a/components/drivers_nrf/hal;../../../external/nRF5_SDK_14.2.0_17b948a/components/libraries/util;../../../external/softdevice/s132_5.0.0/s132_nrf52_5.0.0_API/include;../../../external/softdevice/s132_5.0.0/s132_nrf52_5.0.0_API/include/nrf52;../../../mesh/core/api;../../../external/nRF5_SDK_14.2.0_17b948a/components/device;../../../external/nRF5_SDK_14.2.0_17b948a/components/toolchain;../../../external/nRF5_SDK_14.2.0_17b948a/components/toolchain/cmsis/include;../../../external/nRF5_SDK_14.2.0_17b948a/components/toolchain/gcc;../../../external/nRF5_SDK_14.2.0_17b948a/components/toolchain/dsp/GCC;../../../external/rtt/include;../../../mesh/core/include;../../../mesh/dfu/api;../../../mesh/dfu/include;../../../mesh/prov/api;../../../mesh/prov/include;../../../mesh/bearer/api;../../../mesh/bearer/include;../../../external/micro-ecc;../../../mesh/core/include;"
      debug_additional_load_file="$(ProjectDir)/../../../external/softdevice/s132_5.0.0/s132_nrf52_5.0.0_softdevice.hex"
      debug_start_from_entry_point_symbol="No"
      debug_target_connection="J-Link"
      linker_output_format="hex"
      linker_printf_width_precision_supported="No"
      linker_section_placement_file=""
      linker_section_placement_macros="FLASH_PH_START=0x0;FLASH_START=0x23000;FLASH_SIZE=0x55000;FLASH_PH_SIZE=0x80000;RAM_PH_START=0x20000000;RAM_PH_SIZE=0x10000;RAM_START=0x200031b0;RAM_SIZE=0xcb50"
      linker_section_placements_segments="FLASH RX 0x00000000 0x78000;RAM RWX 0x20000000 0xf000"
      project_directory=""
      project_type="Executable" />
    <folder Name="Application">
      <file file_name="src/main.c" />
      <file file_name="../../nrf_mesh_sdk.c" />
  • I don't have MacOS machine to test here, just curious why you need to modify the .emProject ? it doesn't work out of the box on MacOS? Do you have problem if you just Download the hex to flash ?

    Do you have the same problem in SDK v10.1 ? If you don't it worth to try comparing the 2 project files and see what could cause the problem.

  • @Hung: The .emProject file in the Mesh SDK had following issues: a) Referred to $(StudioDir)/targets/Cortex_M/flash_placement.xml, which in my case caused build/link errors. I imported and modified a flash_placement.xml file from the SDK 14.2 ble-app_hrs example b) The above flash_placement file required additional defines for the section_placement_macros ( PH) c) Had to add loading of Softdevice d) Property groups not set (should work anyways)

    I see the bundled file has different values for the FLASH_SIZE and RAM_SIZE. (I'll test changing these) Do these also always have to match the values in "linker_section_placements_segments"? Unclear what you mean "..Download the hex to flash" -I didn't see any pre-built light-server examples. I haven't tried running the same example in Mesh SDK v0.10.1 Alpha, but successfully ran several examples from SDK14.2. I see the bundled .emProject doesn't have "gcc_entry_point="Reset handler". Can I just remove this line?

  • I don't think taking the flash_placement.xml from an example in the nRF5 SDK is a good idea. Have you check what you have inside Segger folder in your computer ? It's where Segger embedded studio located. I attached here my file for your reference.

    FLASH start and size should be what define in the project linker setting.

    "Download hex" I mean to click Target -> Download light_switch... or you can use Jlink to flash the generated hex file.

    The entry point = reset_handler is set in the project in linker tab (in common setting).

    flash_placement.xml

  • The flash_placement file you attached above doesn't reserve space for the Softdevice (.reserved_flash) It also doesn't place many of the sections defined in nrf5_SDK_for_Mesh_v1.0.0_src/examples/light_switch/server/linker/nrf52832_xxAA_s132_5.0.0.ld Don't these name spaces need to match? (e.g. .cli_sorted_cmd_ptrs and .sdh_stack_observers)

    Finally when using the file you sent, it isn't clear to me where usage of .text2 and .data2 is defined. I do see the thumb_crt0.s file can initialize these secondary sections.

    I also took my queue from the Getting Started->Coexistance with other SDK documentation that suggests moving mesh stuff into SDK (14.2) example directory, rather than the reverse.

    In general, in the SDK 14.2, each example has a dedicated flash_placement.xml file that is co-located in same directory as the .emProject file. The Mesh SDK appears to be missing all this configuration-related info apart from looking inside the .ld file. Or am I missing something major about how the different parts hang together when Mesh stack is used?

    I get the same "invalid ASCII.." error when click Target->Download light_switch.

  • Mesh SDK and NRF5 SDK are not related. The guide to move mesh into the nRF5 SDK is only needed if you want to use the NRF5 SDK libraries or want to add mesh into your normal nRF5 SDK application.

    Mesh SDK is a stand alone SDK and it's has been tested thoroughly before released. The SES example should work out of the box. There should be something wrong here.

    I'm not 100% sure why these sections are included in the .ld file, but most likely they are not currently used in the Mesh application. If you have a look at the .ld file in the same folder but in the last SDK v0.10.1 you can find that it's pretty simple.

    Could you check if in the Output folder if you have the hex file ? Please try to use CMake and compile the example also. In my case here (and we haven't seen any report from other customer) , the example compiled out of the box (on a Windows 7 machine).

Related