Skip to main content
Simon NOWAK
Associate II
September 12, 2017
Question

''C'' STM32 ADC Project to ''Cpp'' (CubeMX)

  • September 12, 2017
  • 1 reply
  • 2093 views
Posted on September 12, 2017 at 10:32

Hi everyone,

I'm trying to convert a 'C' generated project with CubeMX in 'Cpp' but I have some problems with that. Indeed with CubeMX I have generate a project to read ADC values. This one work fine. The same project converted in Cpp compile but the value of the ADC is always the same ( 0 ).

Do you have any idea where this problem could come from ?

Thank you for your help and for your time.

Regards

Simon

#stm32l0 #cpp #eclipse #adc #cubemx

Note: this post was migrated and contained many threaded conversations, some content may be missing.
This topic has been closed for replies.

1 reply

AvaTar
Senior III
September 12, 2017
Posted on September 12, 2017 at 10:51

I would guess the interrupt routine names don't match.

C++ requires a extern 'C' to not mangle object names.

Simon NOWAK
Associate II
September 12, 2017
Posted on September 12, 2017 at 10:56

So I have to add the extern 'C' on all the libraries in my project ? 

Thank you for your help.
Tesla DeLorean
Guru
September 12, 2017
Posted on September 12, 2017 at 11:00

No, Specifically the IRQ Handlers described in the vector table, they are in an assembler file with weak linkage, you have to get the names right to use yours, the C++ names will be mangled.

And perhaps other things where the linkage fails.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..