<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Hercules Safety Microcontroller: Use C++ with HALCoGen C Projects</title><link>/technologies/embedded/b/blog/posts/hercules-safety-microcontroller-use-c-with-halcogen-c-projects</link><description>TI Hercules microcontrollers are &amp;quot;functional safety&amp;quot; devices for automotive, industrial and medical use.When you create a new firmware project for this family, you use the TI HALCoGen tool to configure the peripherals and create the source....</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Hercules Safety Microcontroller: Use C++ with HALCoGen C Projects</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/hercules-safety-microcontroller-use-c-with-halcogen-c-projects</link><pubDate>Sun, 19 Jan 2020 21:59:22 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:1e7cd957-10c2-4648-82e2-7a256b2fd479</guid><dc:creator>Jan Cumps</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Just a warning: If you have Class instances declared as global variables, their constructors will be calld before the main() function.&lt;/p&gt;&lt;p&gt;This is normal, but for HALCoGen developers that are used to have the first line of custom code executed in the main() function, it could be a surprise.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;If your classes use HALCoGen API calls (gio, spi, i2c, uart, ...) in their constructor and they are created as global variables (Arrduino / MBED style) ,&lt;/p&gt;&lt;p&gt;and you call gioInit, spiInit, i2cInit, sciInit, ... at the start of main (as usual), this will create issues.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In a C program this is normally not an issue, because declaring a global variable in C does nor invoke a code call.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Advice is to not perform any hardware manipulations in the constructors.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=8168&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Hercules Safety Microcontroller: Use C++ with HALCoGen C Projects</title><link>https://community.element14.com/technologies/embedded/b/blog/posts/hercules-safety-microcontroller-use-c-with-halcogen-c-projects</link><pubDate>Sat, 09 Nov 2019 22:08:21 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:1e7cd957-10c2-4648-82e2-7a256b2fd479</guid><dc:creator>clem57</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I guess the following is true then:&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p&gt;&lt;span style="font-weight:bold;font-style:inherit;"&gt;This works for any C project where you want to start using C++&lt;/span&gt;&lt;span&gt; - if the toolset supports that.&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Nice work &lt;span&gt;[mention:acaf6a9338de4eef8f6717d5561ed01d:e9ed411860ed4f2ba0265705b8793d05]&lt;/span&gt;. You have come up with some real help.&lt;/p&gt;&lt;p&gt;Clem&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=8168&amp;AppID=7&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>