This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F: VSCode configuration file for "simple_peripheral" project debugging

Part Number: CC2640R2F
Other Parts Discussed in Thread: BLE-STACK

I would like to use VSCode with C/C++ extension as my main IDE with TI compiler.

Unfortunately Is not easy to do that because TI compiler has internal preprocessor defines which are not visible?

Using ti compiler does not work, compiler commands are not recognized because it different than GCC internally?

"compilerPath": "C:\ti\ccs901\ccs\tools\compiler\ti-cgt-arm_18.12.1.LTS\bin\armcl.exe"


Step #1: Language Server

* I tried to use this config file with no success, filename: "c_cpp_properties.json"
{

	"configurations": [{
		"name": "WSL",
		"intelliSenseMode": "gcc-x64",
		"compilerPath": "/usr/bin/gcc",
		"includePath": [
			"${workspaceFolder}/**",
			"${simplelink_cc2640r2_sdk_1_50_00_58}",
			"${workspaceFolder}/simple_peripheral_cc2640r2lp_oad_offchip_app",
			"${workspaceFolder}/simple_peripheral_cc2640r2lp_oad_offchip_app/Application",
			"${workspaceFolder}/simple_peripheral_cc2640r2lp_oad_offchip_app/Include",
			"${workspaceFolder}/simple_peripheral_cc2640r2lp_oad_offchip_app/OAD",
			"${workspaceFolder}/simple_peripheral_cc2640r2lp_oad_offchip_app/PROFILES",
			"${workspaceFolder}/simple_peripheral_cc2640r2lp_oad_offchip_app/Startup",
			"${xdctools_3_50_03_33_core}",
			"${ti_cgt_arm_18_1_4_LTS}/include"
		],
		"defines": [
			"__TI_COMPILER_VERSION__",
			"__TI_COMPILER_VERSION",
			"__TI_TMS470_V4__",
			"__TMS470__",
			"_DEBUG",
			"_UNICODE",
			"BOARD_DISPLAY_USE_LCD=0",
			"BOARD_DISPLAY_USE_UART_ANSI=1",
			"BOARD_DISPLAY_USE_UART=1",
			"CC2640R2_LAUNCHXL",
			"CC26XX_R2",
			"CC26XX",
			"DeviceFamily_CC26X0R2",
			"EXT_HAL_ASSERT",
			"HAL_IMAGE_E",
			"ICALL_EVENTS",
			"ICALL_JT",
			"ICALL_LITE",
			"ICALL_MAX_NUM_ENTITIES=6",
			"ICALL_MAX_NUM_TASKS=3",
			"LED_DEBUG",
			"MAX_PDU_SIZE=251",
			"POWER_SAVING",
			"RF_SINGLEMODE",
			"TBM_ACTIVE_ITEMS_ONLY",
			"UNICODE",
			"USE_ICALL",
			"xdc_runtime_Assert_DISABLE_ALL",
			"xdc_runtime_Log_DISABLE_ALL",
			"xOAD_BLE_SECURITY"
		]
	}],
	"env": {
		"simplelink_cc2640r2_sdk_1_50_00_58": [
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/examples/rtos/CC2640R2_LAUNCHXL/blestack/simple_peripheral_oad_offchip/src/app",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/kernel/tirtos/packages",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/kernel/tirtos/packages/gnu/targets",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/boards/CC2640R2_LAUNCHXL/",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/common/cc26xx",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/controller/cc26xx_r2/inc",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/cc26xx",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/heapmgr",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/icall/inc",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/icall/src/inc",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/inc",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/profiles/dev_info",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/profiles/oad/cc26xx",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/profiles/roles",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/profiles/roles/cc26xx",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/profiles/simple_profile",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/profiles/simple_profile/cc26xx",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/rom",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/services/src/saddr",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/services/src/sdata",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/target",
			"C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2"
		],
		"xdctools_3_50_03_33_core": [
			"C:/ti/xdctools_3_50_03_33_core/packages",
			"C:/ti/xdctools_3_50_03_33_core/packages/xdc"
		],
		"ti_cgt_arm_18_1_4_LTS": [
			"C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.4.LTS"
		]
	},
	"version": 4
}

Step 2: Debugging:

  • Unfortunately GDB could not be used because TI GCC does not support this project?
    "gdbpath" : "C:/ti/ccs901/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gdb.exe"

    There is only this file which probably should do the same, but cannot be called as standalone:
    "gdbpath" : "C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/bin/armcg.exe"


  • There is not elf file created from the TI RTOS build process so this won't work, example of could work version:
    "target": "${workspaceRoot}/simple_peripheral_cc2640r2lp_app/FlashROM/simple_peripheral_cc2640r2lp_app_FlashROM_oad_merged.elf"

The debug configuration could look like this, filename: "launch.json"

Note: example modified from guide

{
    "name": "GDB",
    "type": "gdb",
    "request": "launch",
    "cwd": "${workspaceRoot}",
    "target": "${workspaceRoot}/simple_peripheral_cc2640r2lp_oad_offchip_app/FlashROM/simple_peripheral_cc2640r2lp_oad_offchip_app_FlashROM_oad_merged.elf", 
    "gdbpath" : "C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/bin/armcg.exe",
    "autorun": [
        "target remote localhost:3333",
        "symbol-file /simple_peripheral_cc2640r2lp_oad_offchip_app/FlashROM/simple_peripheral_cc2640r2lp_oad_offchip_app_FlashROM_oad_merged.elf",
        "monitor reset" 
        ]
}

Any help on this would be appreciated.