Debugging ARMV5 compiled project + soft device with GDB

Hi. I have a BLE application aimed to be used with softdevice and SDK17. I use Keil IDE to code and to debug. I flash the soft device first, and then, I can compile/flash my app, and debug it, it works perfectly.

I have another project. The code is the same, but the entire architecture/hierarchy is different, and now I use CMake to compile it, and vscode to code and Cortex Debug extension to debug. I Integrated ARMCC toolchain throught a .cmake file and I am able to compile my app. When I flash my program, it doesn't work, but I kind of expected that result. I need to debug the program to know where it fails.

The issue: when I try to debug throught vscode, I have following warning : 

I assume this comes from the scatter file I use : 

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x00026000 0x00051FFF  {    ; load region size_region
  ER_IROM1 0x00026000 0x00051FFF  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
  RW_IRAM1 0x200025E8 0x0000D868  {  ; RW data
   .ANY (+RW +ZI)
  }
}

It is the one that Keil generates following the settings I decided in my Keil project (the one that works perfectly). We see that RW_IRAM1 is indeed outside the LR_IROM1 load region. This I think (could someone confirms?) makes the debugger to not work properly.

What is the best practice to debug ARMCC compiled project in vscode? More generally, is there any limitation to integrate ARMCC toolchain in CMake? Thank you for your answers

EDIT : To get rid of this warning, I modified my scatter file and created two load regions : one for rom, one for ram. GDB is happy but while I can make simple SDK example to work, (ble_app_blinky), it works only when I launch debug session. If I try to run the program, it doesn't work. Then I tried this : this and it works perfectly either I launch a debug session or I start the eval board. Even though, it doesn't work with my app, but now, I can debug, and I see that sd_flash_page_erase function is somehow problematic. Any idea why? I will try to add this part of the code on my 100% working example (ble_app_blinky) and keep you in touch 

EDIT2 : I can make fstorage example works perfectly by tweaking scatter file sections, and it uses sd_flash_page_erase function that makes my app crash so I assume my integration of ARMCC toolchain in CMake + VScode is valid, and the error lies in one of my CMakeLists.txt files... I will investigate.

Related