Regd Adding Cpp Application files

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
11 posts / 0 new
Last post
sandeep.kelasangada
Offline
Last seen:7 months 6 hours ago
Joined:2019-08-09 09:30
Regd Adding Cpp Application files

Hi,

This is regarding to DA14695. I have an application written in C++ and driver writen in C for another MCU, now i have port the same application on Dailog MCU environment.

When i try to create a C++ project I'm not able to see the SDK folder as it is available in the built-in examples like ble_adv, ble_cli.

When i take the base project as ble_adv, and try to add my Cpp application, i'm not able to add the cpp files.

Kindly let me know how to create CPP project with FreeRTOS part of it or how to modify exisiting project like ble_dev example.

regards

设备:
MHv_Dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2013-12-06 15:10
Hi,

Hi,

I have escalated this issue to our internal support team. We should receive a reply in the next day or two.

/MHv

MHv_Dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2013-12-06 15:10
Hi,

Hi,

I received the following hint from our internal support team:

"

In order to get the C++ to coexist peacefully with the C, it is required to have all C header decorated with the following pattern:

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __cplusplus
}
#endif

"

I hope that helps you resolve the problem.

/MHv

sandeep.kelasangada
Offline
Last seen:7 months 6 hours ago
Joined:2019-08-09 09:30
hi,

hi,

The question was regarding to create a projec C++ .

When we try to create a C++ project, we don't see any folders like what is seen in the example projects like ble_adv, ble_peripheral. SDK folder is not seen.

my requirement is to create a project with FreeRTOS support and the project has C source files as well as C++ source files.

Kindly shared details regarding this. How to create a project for a ble_peripheral with support for FreeRTOS and has C and C++ source files.

regards

ben.lauret
Offline
Last seen:2 months 3 weeks ago
Staff
Joined:2015-11-24 10:20
Hi Sandeep,

Hi Sandeep,

I think the best approach would be to convert an existing project from C nature to C++. There's an integrated tool in Smartsnippets studio. you need to "File->New Project -> Convert to a C/C++ project" and then follow the wizzard.

Then you start to make sure all the headers you include are correctly decorated.

sandeep.kelasangada
Offline
Last seen:7 months 6 hours ago
Joined:2019-08-09 09:30
Hi,

Hi,

The steps mentioned by you work only partially. I have taken a demo project from sdk folder. ble_peripheral. perform clean and build it build successfully.

Now as mentioned by you i try to Open new project and select the option to convert to C/C++ project. In the wizard i can see the ble_peripheral project i select it and select ARM_CROSS_GCC. I have not added any new C++ files yet.

Now again i perform clean and perform build. The build invokes C++ compiler and gives below errors. Kindly advice.

Invoking: GNU ARM Cross C++ Linker
c:/program files (x86)/gnu tools arm embedded/7 2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main/fpv5-sp/hard\libg.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x16): undefined reference to `_exit'
./startup/DA1469x/GCC/exception_handlers.o: In function `.code_starts':
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/bsp/startup/DA1469x/GCC/exception_handlers.S:153: undefined reference to `__copy_table_start__'
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/bsp/startup/DA1469x/GCC/exception_handlers.S:154: undefined reference to `__copy_table_end__'
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/bsp/startup/DA1469x/GCC/exception_handlers.S:198: undefined reference to `__zero_table_start__'
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/bsp/startup/DA1469x/GCC/exception_handlers.S:199: undefined reference to `__zero_table_end__'
/启动/ DA1469x / init_da1469x.o: In function `SystemInitPre':
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/bsp/startup/DA1469x/init_da1469x.c:506: undefined reference to `__copy_table_start__'
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/bsp/startup/DA1469x/init_da1469x.c:506: undefined reference to `__copy_table_end__'
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/bsp/startup/DA1469x/init_da1469x.c:506: undefined reference to `__zero_table_start__'
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/bsp/startup/DA1469x/init_da1469x.c:506: undefined reference to `__zero_table_end__'
./sdk/ble/stack/da14690/src/arch_main.o: In function `cmac_update_power_ctrl_reg_values':
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/interfaces/ble/stack/da14690/src/arch_main.c:185: undefined reference to `cmac_dynamic_config_table_ptr'
./sdk/ble/stack/da14690/src/arch_main.o: In function `cmac_mem_ctrl_setup':
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/interfaces/ble/stack/da14690/src/arch_main.c:202: undefined reference to `cmi_fw_dst_addr'

sandeep.kelasangada
Offline
Last seen:7 months 6 hours ago
Joined:2019-08-09 09:30
Hi,

Hi,

Can you guys reply to my query. The cpp file get compiled but there is a linker error. i have shown some of the errors.

have you guys tried conversion of C to C++ for any example code like ble_peripheral, bli_central

sandeep.kelasangada
Offline
Last seen:7 months 6 hours ago
Joined:2019-08-09 09:30
Hi,

Hi,

Currently i have made some changes in linker settings and adding library path to linker. linking errors have reduced.

currently i get only two linking error.

Invoking: GNU ARM Cross C++ Linker
./sdk/ble/stack/da14690/src/arch_main.o: In function `cmac_mem_ctrl_setup':
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/interfaces/ble/stack/da14690/src/arch_main.c:204: undefined reference to `cmi_fw_dst_addr'
C: / DiaSemi SmartSnippetsStudio2.0.8 / SDK_10.0.6.88 /sdk/interfaces/ble/stack/da14690/src/arch_main.c:204: undefined reference to `__cmi_section_end__'
collect2.exe: error: ld returned 1 exit status
make: *** [ble_peripheral.elf] Error 1

Kindly let us know how to resolve this.

Danny_Vanderydt...
Offline
Last seen:7 months 1 week ago
Joined:2019-09-18 09:44
Hi Sandeep, were you able to

Hi Sandeep, were you able to solve the linker problem when building your cpp application?

I'm facing the same problem. Compiling is working but the linker is missing a lot of references.

Could you please advise?

Thx!

JE_Dialog
Offline
Last seen:5 hours 35 min ago
Staff
Joined:2013-12-05 14:02
Hi Danny, we will reach out

Hi Danny, we will reach out to you directly BR JE_dialog

JE_Dialog
Offline
Last seen:5 hours 35 min ago
Staff
Joined:2013-12-05 14:02
Hi Sandeep, we are taking

Hi Sandeep, we are taking this offline onto direct communictaion. BR JE_Dialog .