I took the ble_app_hrs code and made changes to suit my application (increased number of peripherals, included bonding/pairing, included ble_nus, added code for button, led, etc). But as I keep adding code, at one stage, when I enter debug mode, the program flow does not even come to main. It goes to 0xFFFF FFFE. Following are my memory configs: IROM1: start: 0x1B000 size: 0x25000 IRAM1: start:0x200022D8 size: 0x4FC0. When I make IRAM1 to be 0x200012D8, I can get into main, but after sd_ble_enable, app_ram_base = 0x200022D8 and ram_start = 0x200012D8 and hence the program flow fails at softdevice_enable. I use 32kB RAM nRF51822 and SDK 12.3.0 and soft device s130v2. From my map file, this is my memory consumption:
==============================================================================
Code (inc. data) RO Data RW Data ZI Data Debug
38260 3438 904 556 6956 698700 Grand Totals
38260 3438 904 88 6956 698700 ELF Image Totals (compressed)
38260 3438 904 88 0 0 ROM Totals
==============================================================================
Total RO Size (Code + RO Data) 39164 ( 38.25kB)
Total RW Size (RW Data + ZI Data) 7512 ( 7.34kB)
Total ROM Size (Code + RO Data + RW Data) 39252 ( 38.33kB)
==============================================================================
I have attached my .map file herewith: nrf51422_xxac.map
Before entering main, the program flow goes to SystemInit - If I step through this, it comes out of SystemInit (but never gets into main). But, if I run using F5(short key press for continuous run), the program flow never exits SystemInit. Please advice as how to handle this situation.