The Project (on a NRF52840) is setup to use an external toolchain (for C++) and we use the S140 softdevice (v7.2.0) for BLE stuff.
1. without loading the S140 hex file and disable all related stuff in code and the following memory placement defined in the linker script:
MEMORY { FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00100000 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00040000 }
OK
2. now I add the S140 hex as additional load file and change the memory placement to:
MEMORY { FLASH (rx) : ORIGIN = 0x00027000, LENGTH = 0x000D9000 RAM (rwx) : ORIGIN = 0x20001678, LENGTH = 0x0003E900 }
build and link is OK but when download the the target i get
I see a lot of problems in the Q&A but all with the SES section placement macros.
sources: Adjust RAM/Flash memory
EDIT 2022-02-03 14:14
When adjust the RAM/Flash values to something way bigger, it can flash but code is not working now: __NVIC_ClearPendingIRQ() in core_cm4.h fails.
MEMORY { FLASH (rx) : ORIGIN = 0x00030000, LENGTH = 0x00070000 RAM (rwx) : ORIGIN = 0x20003000, LENGTH = 0x00030000 }
Downloading ‘s140_nrf52_7.2.0_softdevice.hex’ to J-Link Programming 2.7 KB of addresses 00000000 — 00000aff Programming 149.5 KB of addresses 00001000 — 00026633 J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match Download successful Downloading ‘Node.elf’ to J-Link Programming 88.5 KB of addresses 00030000 — 0004621f Programming 2.4 KB of addresses 00046220 — 00046beb J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (94208 bytes) J-Link: Flash download: Total: 5.758s (Prepare: 0.277s, Compare: 0.065s, Erase: 1.929s, Program & Verify: 3.291s, Restore: 0.193s) J-Link: Flash download: Program & Verify speed: 27 KB/s Download successful