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

Extra flash when emulating 52810 (to allow debugging with Optimization=none)

I compiled and debugged the PCA10040e ANCS example (ie emulating the 52810 using the 52832) from SDK 15.3 - successfully. But I wanted to turn off code optimization to facilitate debugging. That seems to bring the solution over the flash size limit of the 52810.

How can I cheat and allow emulating the 52810 which (temporarily, for debugging) taking advantage of the 52832's larger flash ?

So after adding a debug configuration in the .emProject file via

<configuration Name="Debug"
c_preprocessor_definitions="DEBUG; DEBUG_NRF"
gcc_optimization_level="None"/>

I get ".text too large to fit in FLASH memory segment" during linking. So I tried to modify the 

linker_section_placement_macros="FLASH_PH_START=0x0;FLASH_PH_SIZE=0x38000;

and bumped the FLASH_PH_SIZE a little (from 0x30000). It will link now, but the J-Link reports a "Error reported. Failed to download application. Generic error." 

Any ideas ? How could I temporarily use more flash while emulating the 52810 ?

Thanks !

  • I think the easiest way might be to just use the pca10040 (without the 'e') configuration with the same source code. That said, I think you were pretty close to achieve this with your pca10040e project. In addition to increasing the FLASH_PH_SIZE you need to change the total flash size in your "linker_section_placements_segments" macro.

    The original setting from ble_app_ancs_c_pca10040e_112.emProject file

          linker_section_placements_segments="FLASH RX 0x0 0x30000;RAM RWX 0x20000000 0x6000"

    must be changed to:

          linker_section_placements_segments="FLASH RX 0x0 0x38000;RAM RWX 0x20000000 0x6000"

  • Vidar, I am still getting the "Error reported. Failed to download application. Generic error." when launching the debugger in SES.

  • It worked here, but I had to increase the address to 0x3A000 to be able to build without optimization. 

    linker_section_placement_macros="FLASH_PH_START=0x0;

    FLASH_PH_SIZE=0x3A000;

    RAM_PH_START=0x20000000;

    RAM_PH_SIZE=0x6000;

    FLASH_START=0x19000;

    FLASH_SIZE=0x26000;

    RAM_START=0x20001c18;

    RAM_SIZE=0x43e8"


    linker_section_placements_segments="FLASH RX 0x0 0x3A000;RAM RWX 0x20000000 0x6000"

    But the linker settings should not lead to  debugger errors. Can you try to do a chip erase with nrfjprog first and see if you get the same result? 

    > nrfjprog --erase 

  • Vidar, so first of all: Thank you for the original input to also adjust linker_section_placements_segments. Presumably that is a fix. And it sounds like you were able to flash it.

    As to my specific case, it appears that it turns into a JLink / Segger issue ?!

    I repeated my setup with a JLink-Lite and a different target board, and same result: I cannot flash the "emulated with extra flash" version to either target board due to the generic error.

    I upgraded JLink to the latest 6.52e version and also upgraded SES to 4.22 .

    Above, I assume I was to issue a "nrfjprog --eraseall". It did not help. I was able to program the softdevice and the hex file using "nrgprog --program <>.hex", if that tells you something.

    * if you don't mind, could I send you my .emProject file and you give it a quick try, just to make sure there is no hidden incorrect setting.

    * Otherwise, I presume, this is more a Segger issue ?

  • Attached is my modified example. I tested it with SDK 15.3.0. 

    4087.ses.zip

Related