AnsweredAssumed Answered

SW4STM32 and C++

Question asked by b.m.002 on Oct 23, 2017
Latest reply on Oct 24, 2017 by b.m.002

Hi Everyone.

I mostly work with a C environment when I create a STM32 project but in the last few days I have been
creating STM32 C++ projects by selecting a C++ project instead of a C project, and I can see in the
properties, tool settings, C++ parameters are there. Also I have created very simple classes and so far
the simple stuff works, but I have to rename my files from .C to .CPP extension otherwise
I cant include code from a (.c) file? and I cant call a function located in a (.cpp) file from a (.c) file?

 


The project I have created now has a uart serial class that has the usual transmit and receive routines plus the
interrupt handler. The problem is if I leave the interrupt service routine in the traditional stm32f0xx_it.c file
I can see that the ISR handler will be executed, but if I transfer the handler in one of the .C++ files
like within the serial class, I cant get it to work?

 


Similarly if I rename the stm32f0xx_it.c to stm32f0xx_it.cpp, again the handle will not executed.

 


Can anyone help out with a solution on how to call other functions from either file type or how to get
the ISR handler to be executed from within the serial class, or any c++ file?

Cheers
martin

Outcomes