gcc toolchain c++ project

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

gcc toolchain c++ project

跳至解决方案
1,266 次查看
dh1
Contributor II

Hello

We created an Azure RTOS project for the RT1062 using the SDK Dashboard. The project was built for the GCC ARM embedded toolchain (not MCUXpresso). We are using CMake to build the project.
This works good so far.

Now we need to change the project to C++ and we have some trouble.

The problem is, that the startup code is in an assembler file called "startup_MIMXRT1062.S"
This file seems to be specifically for the C language, not for the C++ language, is this correct?

So we tried to replace the file with a file from a MCUxpresso C++ project. The file is called startup_mimxrt1062.cpp

Both files are in the attachment.

Now when we try to build the project, the following errors appear:

cmd.exe /C "cd . && C:\nxp\MCUXpressoIDE_11.5.1_7266\ide\tools\\bin\arm-none-eabi-g++.exe -DDEBUG -DCPU_MIMXRT1062DVL6A -DSERIAL_PORT_TYPE_UART=1 -DMCUXPRESSO_SDK -g -O0 -mcpu=cortex-m7 -Wall -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb -MMD -MP -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mapcs -fno-rtti -fno-exceptions -g -mcpu=cortex-m7 -Wall -mfloat-abi=hard -mfpu=fpv5-d16 --specs=nano.specs --specs=nosys.specs -fno-common -ffunction-sections -fdata-sections -ffreestanding -fno-builtin -mthumb -mapcs -Xlinker --gc-sections -Xlinker -static -Xlinker -z -Xlinker muldefs -Xlinker -Map=output.map -Wl,--print-memory-usage -Xlinker --print-memory-usage -TC:/Development/zub_TestFW/Mojon/src/platform/MiniMACS6/linkscripts/MIMXRT1062xxxxx_flexspi_nor.ld -static CMakeFiles/mojon.dir/src/platform/MiniMACS6/board/pin_mux.c.obj CMakeFiles/mojon.dir/src/platform/MiniMACS6/board/board.c.obj CMakeFiles/mojon.dir/src/platform/MiniMACS6/board/clock_config.c.obj CMakeFiles/mojon.dir/src/platform/MiniMACS6/board/dcd.c.obj CMakeFiles/mojon.dir/src/platform/MiniMACS6/main.c.obj CMakeFiles/mojon.dir/src/cpu/rt1060/system_MIMXRT1062.c.obj CMakeFiles/mojon.dir/src/cpu/rt1060/startup_mimxrt1062.cpp.obj CMakeFiles/mojon.dir/src/cpu/rt1060/xip/fsl_flexspi_nor_boot.c.obj CMakeFiles/mojon.dir/src/cpu/rt1060/xip/evkmimxrt1060_flexspi_nor_config.c.obj CMakeFiles/mojon.dir/thirdparty/azure-rtos/threadx/ports/cortex_m7/gnu/src/tx_thread_context_restore.S.obj CMakeFiles/mojon.dir/thirdparty/azure-rtos/threadx/ports/cortex_m7/gnu/src/tx_thread_context_save.S.obj CMakeFiles/mojon.dir/thirdparty/azure-rtos/threadx/ports/cortex_m7/gnu/src/tx_thread_interrupt_control.S.obj CMakeFiles/mojon.dir/thirdparty/azure-rtos/threadx/ports/cortex_m7/gnu/src/tx_thread_interrupt_disable.S.obj CMakeFiles/mojon.dir/thirdparty/azure-rtos/threadx/ports/cortex_m7/gnu/src/tx_thread_interrupt_restore.S.obj CMakeFiles/mojon.dir/thirdparty/azure-rtos/threadx/ports/cortex_m7/gnu/src/tx_thread_schedule.S.obj CMakeFiles/mojon.dir/thirdparty/azure-rtos/threadx/ports/cortex_m7/gnu/src/tx_thread_stack_build.S.obj CMakeFiles/mojon.dir/thirdparty/azure-rtos/threadx/ports/cortex_m7/gnu/src/tx_thread_system_return.S.obj CMakeFiles/mojon.dir/thirdparty/azure-rtos/threadx/ports/cortex_m7/gnu/src/tx_timer_interrupt.S.obj CMakeFiles/mojon.dir/thirdparty/azure-rtos/threadx/ports/common/tx_initialize_low_level.c.obj CMakeFiles/mojon.dir/src/cpu/rt1060/utilities/fsl_sbrk.c.obj CMakeFiles/mojon.dir/thirdparty/RTT/SEGGER_RTT.c.obj CMakeFiles/mojon.dir/thirdparty/RTT/SEGGER_RTT_ASM_ARMv7M.S.obj CMakeFiles/mojon.dir/thirdparty/RTT/SEGGER_RTT_printf.c.obj CMakeFiles/mojon.dir/thirdparty/RTT/SEGGER_RTT_Syscalls_GCC.c.obj -o ..\bin\mojon -Wl,--start-group ../bin/libfilex.a ../bin/liblevelx.a ../bin/libthreadx.a ../bin/libdrivers.a -lm -lc -lgcc -lnosys -Wl,--end-group ../bin/libfilex.a ../bin/libthreadx.a && cd ."
c:/nxp/mcuxpressoide_11.5.1_7266/ide/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: warning: cannot find entry symbol Reset_Handler; defaulting to 60002400
c:/nxp/mcuxpressoide_11.5.1_7266/ide/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/mojon.dir/src/cpu/rt1060/startup_mimxrt1062.cpp.obj:C:/Development/zub_TestFW/Mojon/src/cpu/rt1060/startup_mimxrt1062.cpp:432: undefined reference to `_vStackTop'
c:/nxp/mcuxpressoide_11.5.1_7266/ide/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/mojon.dir/src/cpu/rt1060/startup_mimxrt1062.cpp.obj:(.isr_vector+0x204): undefined reference to `USB_OTG1_IRQHandler'
c:/nxp/mcuxpressoide_11.5.1_7266/ide/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/mojon.dir/src/cpu/rt1060/startup_mimxrt1062.cpp.obj: in function `ResetISR':
C:/Development/zub_TestFW/Mojon/src/cpu/rt1060/startup_mimxrt1062.cpp:729: undefined reference to `_vStackTop'
c:/nxp/mcuxpressoide_11.5.1_7266/ide/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Development/zub_TestFW/Mojon/src/cpu/rt1060/startup_mimxrt1062.cpp:729: undefined reference to `__data_section_table'
c:/nxp/mcuxpressoide_11.5.1_7266/ide/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Development/zub_TestFW/Mojon/src/cpu/rt1060/startup_mimxrt1062.cpp:729: undefined reference to `__data_section_table_end'
c:/nxp/mcuxpressoide_11.5.1_7266/ide/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:/Development/zub_TestFW/Mojon/src/cpu/rt1060/startup_mimxrt1062.cpp:729: undefined reference to `__bss_section_table_end'

The vStackTop symbol is not found.

Are we going in the wrong direction? Is there an assembler startup file specifically for c++, or do we need to adapt the .cpp file for the gcc toolchain?

Thanks in advance for some help in this topic,
Regards Daniel

标签 (1)
标记 (2)
0 项奖励
1 解答
1,246 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi @dh1 ,

All these undefined reference are defined in the link file. Did you change the link file? 

You can use MCUXpresso to create a c++ project. This project will use the c++ startup file you attached. You can refer to the project.

 

Regards,

Jing

在原帖中查看解决方案

0 项奖励
2 回复数
1,247 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi @dh1 ,

All these undefined reference are defined in the link file. Did you change the link file? 

You can use MCUXpresso to create a c++ project. This project will use the c++ startup file you attached. You can refer to the project.

 

Regards,

Jing

0 项奖励
1,221 次查看
dh1
Contributor II

Hi Jing

Thanks.

I did that now, using the startup files AND linker files from an MCUXpresso project. This works fine now.

Regards,
Daniel

0 项奖励