2015-01-24 04:02 PM
Hello.
When do you plan to support C++ for HAL library STM32L1xx ? #hal #stm32l1xx #c++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.2015-01-24 10:24 PM
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.2015-01-25 01:10 AM
2015-01-25 01:43 AM
HAL 1.0.0 for stm32l1xx already have extern ''C''. I just change in the IAR project options Language: C to C ++.
2015-01-25 01: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!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.2015-01-25 01: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.2015-01-26 09:27 AM
Yes, auto mode solve the problem :)
Thank you,