HAL and C++
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-24 4:02 PM
Hello.
When do you plan to support C++ for HAL library STM32L1xx ? #hal #stm32l1xx #c++- Labels:
-
STM32Cube MCU Packages
-
STM32L1 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-24 10:10 PM
C code (in compiled object form) can be linked to C++, so in some ways this seems to be not a question, as there is nothing to do.
The only requirement for C header files is to have the function headers wrapped in extern ''C'', but this is already done in the HAL headers. This tells the C++ compiler to not use the name mangling.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-24 10:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-25 12:57 AM
Of course I know that. The cause of the problem was that I2C stops working if you use C ++ compiler (IAR 7.3).
After sending the slave address and receiving ACK, the controller pulls SCL to ground - and said that BUS BUSY. If the same code compiled with C, it works.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-25 1:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-25 1:43 AM
HAL 1.0.0 for stm32l1xx already have extern ''C''. I just change in the IAR project options Language: C to C ++.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-25 1:49 AM
I do not rename sources to .cpp. Some of them (HAL and CMSIS files) are .c, my sources are .cpp.
In general, it is strange that it does not work I2C. Other HAL features - Timers, GPIO, NVIC, ADC work properly. Even USB CDC!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-25 10:46 AM
Yes, I too have a mix of CMSIS/HAL .c sources and my own .cpp files.
With IAR, I leave the compiler configuration in ''auto' mode for C/C++ so the IDE will tell the compiler which mode to use. I don't try to force C or C++ mode rather than auto mode when there is a mix of C/C++ files.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-25 1:12 PM
When do you plan to support C++ for HAL library STM32L1xx ?
When a large commercial customer demands it?With respect to your failure I'd suggest combing over the .MAP file and seeing if there are any I2C related name mangling issues that would break functionality.Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-26 9:27 AM
Yes, auto mode solve the problem :)
Thank you,