iarsystems / iar-risc-v-gd32v-eval

Example projects for the IAR RISC-V GD32V Evaluation board in IAR Embedded Workbench for RISC-V
https://iar.com/riscv
Other
27 stars 7 forks source link

Template project for C++ #12

Closed sharpgeek closed 3 years ago

sharpgeek commented 4 years ago

Hi @felipe-iar

I am planning to start working on a C++ project using the EWRISCV and the eval board. Would be possible to clarify the prerequisites in order to create a C++ project under this scenario?

Perhaps a C++ project example or template could be helpful.

Many thanks.

felipe-iar commented 3 years ago

Hi @sharpgeek,

It is a nice idea.

Even then, right now we do not have any plans of publishing a template for C++ projects from our side. Still, even if the GD32VF103 Firmware Library from GigaDevice was written in C, it comes prepared to play nicely along C++ projects because its implementation uses extern "C" to cope with the name mangling and allow such a mix.

#ifdef __cplusplus
  extern "C" {
#endif 

// <some C code goes here>

#ifdef __cplusplus
  }
#endif

The __cplusplus symbol is generated automatically by the IAR C/C++ compiler when building C++ modules.

Anyway, if you have done some work related to that or have created any cool project with the evaluation board, please feel free to create a new project and then perform a pull request for the contributions folder.

sharpgeek commented 3 years ago

Hi @felipe-iar ,

I created a simple LED blink program using modern C++ features and then performed the PR #17.

felipe-iar commented 3 years ago

Looks great, @sharpgeek .

Thank you for your contribution.

sharpgeek commented 3 years ago

Great! Thank you. I will come up with more contributions soon.