C++ hello world project in MCUXPresso IDE

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

C++ hello world project in MCUXPresso IDE

ソリューションへジャンプ
5,292件の閲覧回数
azhar
Contributor III

Hello.

I am able to compile and run C hello world project (from new project template) on RT1064. However, C++ hello world project (from new project template) compiles and runs but there is no output on the console. I am connecting through jtag. Any ideas about working in C++ is highly appreciated.

Thanks

Azhar

0 件の賞賛
返信
1 解決策
5,249件の閲覧回数
converse
Senior Contributor V

Check the SDK Debug Console settings - read the MCUXpresso User Manual for details. I think you have it set to use the UART instead of the console. If you want to guarantee that you are using the console, use printf instead of PRINTF.

Another note: You need to understand the difference between newlibnano and newlib wrt C++ - newlibnano (for example) does not support exceptions. This is again described in the User Manual.

元の投稿で解決策を見る

10 返答(返信)
5,278件の閲覧回数
azhar
Contributor III

Thanks converse for the response. According to this post : What are Redlib and Newlib? - NXP Community

Newlib is c++ library. More instructions are at: Switching the selected C library - NXP Community

In the linker settings, I tried both Newlib(semihost) and NewlibNano(semihost) but the result is the same no output on the console. Let me know if something else needed to be changed?

0 件の賞賛
返信
5,272件の閲覧回数
converse
Senior Contributor V

Export and post your project here. There are several settings to do with where output is placed. However, C++ I/O is very memory hungry, so may not be suitable to use in an embedded environment anyway. 

btw: what is you chip/board?

0 件の賞賛
返信
5,267件の閲覧回数
azhar
Contributor III

The problem is It seems running fine (no errors about memory etc). It just doesn't display output at the console.

0 件の賞賛
返信
5,269件の閲覧回数
azhar
Contributor III

Device is RT1064.

Here are the exported project settings... (xml is not supported for attachment here, so I paste it below)

<?xml version="1.0" encoding="UTF-8"?>
<cdtprojectproperties>
<section name="org.eclipse.cdt.internal.ui.wizards.settingswizards.IncludePaths">
<language name="C++ Source File">
<includepath workspace_path="true">/${ProjName}/board</includepath>
<includepath workspace_path="true">/${ProjName}/source</includepath>
<includepath workspace_path="true">/${ProjName}/drivers</includepath>
<includepath workspace_path="true">/${ProjName}/xip</includepath>
<includepath workspace_path="true">/${ProjName}/component/serial_manager</includepath>
<includepath workspace_path="true">/${ProjName}/component/uart</includepath>
<includepath workspace_path="true">/${ProjName}/utilities</includepath>
<includepath workspace_path="true">/${ProjName}/component/lists</includepath>
<includepath workspace_path="true">/${ProjName}/CMSIS</includepath>
<includepath workspace_path="true">/${ProjName}/device</includepath>

</language>
<language name="C Source File">
<includepath workspace_path="true">/${ProjName}/board</includepath>
<includepath workspace_path="true">/${ProjName}/source</includepath>
<includepath workspace_path="true">/${ProjName}/drivers</includepath>
<includepath workspace_path="true">/${ProjName}/xip</includepath>
<includepath workspace_path="true">/${ProjName}/component/serial_manager</includepath>
<includepath workspace_path="true">/${ProjName}/component/uart</includepath>
<includepath workspace_path="true">/${ProjName}/utilities</includepath>
<includepath workspace_path="true">/${ProjName}/component/lists</includepath>
<includepath workspace_path="true">/${ProjName}/CMSIS</includepath>
<includepath workspace_path="true">/${ProjName}/device</includepath>

</language>
<language name="Assembly Source File">
<includepath workspace_path="true">/${ProjName}/board</includepath>
<includepath workspace_path="true">/${ProjName}/source</includepath>

</language>
<language name="Additional Assembly Source Files">
<includepath workspace_path="true">/${ProjName}/board</includepath>
<includepath workspace_path="true">/${ProjName}/source</includepath>

</language>
<language name="Object File">

</language>
</section>
<section name="org.eclipse.cdt.internal.ui.wizards.settingswizards.Macros">
<language name="C++ Source File">
<macro>
<name>CPU_MIMXRT1064DVL6A</name><value/>
</macro>
<macro>
<name>CPU_MIMXRT1064DVL6A_cm7</name><value/>
</macro>
<macro>
<name>FSL_RTOS_BM</name><value/>
</macro>
<macro>
<name>SDK_OS_BAREMETAL</name><value/>
</macro>
<macro>
<name>XIP_EXTERNAL_FLASH</name><value>1</value>
</macro>
<macro>
<name>XIP_BOOT_HEADER_ENABLE</name><value>1</value>
</macro>
<macro>
<name>SERIAL_PORT_TYPE_UART</name><value>1</value>
</macro>
<macro>
<name>SDK_DEBUGCONSOLE</name><value>0</value>
</macro>
<macro>
<name>__MCUXPRESSO</name><value/>
</macro>
<macro>
<name>__USE_CMSIS</name><value/>
</macro>
<macro>
<name>DEBUG</name><value/>
</macro>
<macro>
<name>__NEWLIB__</name><value/>
</macro>

</language>
<language name="C Source File">
<macro>
<name>__NEWLIB__</name><value/>
</macro>
<macro>
<name>CPU_MIMXRT1064DVL6A</name><value/>
</macro>
<macro>
<name>CPU_MIMXRT1064DVL6A_cm7</name><value/>
</macro>
<macro>
<name>FSL_RTOS_BM</name><value/>
</macro>
<macro>
<name>SDK_OS_BAREMETAL</name><value/>
</macro>
<macro>
<name>XIP_EXTERNAL_FLASH</name><value>1</value>
</macro>
<macro>
<name>XIP_BOOT_HEADER_ENABLE</name><value>1</value>
</macro>
<macro>
<name>SERIAL_PORT_TYPE_UART</name><value>1</value>
</macro>
<macro>
<name>SDK_DEBUGCONSOLE</name><value>0</value>
</macro>
<macro>
<name>__MCUXPRESSO</name><value/>
</macro>
<macro>
<name>__USE_CMSIS</name><value/>
</macro>
<macro>
<name>DEBUG</name><value/>
</macro>

</language>
<language name="Assembly Source File">

</language>
<language name="Additional Assembly Source Files">

</language>
<language name="Object File">

</language>
</section>
</cdtprojectproperties>

0 件の賞賛
返信
5,261件の閲覧回数
converse
Senior Contributor V

I asked for the project, not the settings. Please export the project (as a zip file) and post it here.

0 件の賞賛
返信
5,257件の閲覧回数
azhar
Contributor III

Here.

0 件の賞賛
返信
5,250件の閲覧回数
converse
Senior Contributor V

Check the SDK Debug Console settings - read the MCUXpresso User Manual for details. I think you have it set to use the UART instead of the console. If you want to guarantee that you are using the console, use printf instead of PRINTF.

Another note: You need to understand the difference between newlibnano and newlib wrt C++ - newlibnano (for example) does not support exceptions. This is again described in the User Manual.

5,244件の閲覧回数
azhar
Contributor III

I was able to resolve by setting preprocessor by SDK_DEBUGCONSOLE=1. The new project template creates this to be 0 by default.

0 件の賞賛
返信
5,283件の閲覧回数
converse
Senior Contributor V
0 件の賞賛
返信
5,275件の閲覧回数
azhar
Contributor III

Thanks converse for the response. According to this post : What are Redlib and Newlib? - NXP Community

Newlib is c++ library. More instructions are at: Switching the selected C library - NXP Community

In the linker settings, I tried both Newlib(semihost) and NewlibNano(semihost) but the result is the same no output on the console. Let me know if something else needed to be changed?

0 件の賞賛
返信