添加外部c++工程后程序不能运行

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

添加外部c++工程后程序不能运行

1,568 Views
brli
Contributor III

Hi,

我将外部的c++工程(工程包含.a文件)添加到demo例程hello_world中,gcc只编译进去,不调用它的任何函数,编译出来的elf无法运行,如果不添加这个c++工程,程序运行正常。

程序运行环境选择:MIMXRT1052xxxxx_flexspi_nor_sdram.ld

发现一个规律,当添加的c++文件较少,产生的.elf 145KB左右,可以正常跑,

当添加的c++文件较多,产生的.elf 545KB左右,就不能跑了。

试验修改链接脚本的空间大小设置,无改善。

m_flash_config (RX) : ORIGIN = 0x60000000, LENGTH = 0x00001000
m_ivt (RX) : ORIGIN = 0x60001000, LENGTH = 0x00001000
m_interrupts (RX) : ORIGIN = 0x60002000, LENGTH = 0x00000400
m_text (RX) : ORIGIN = 0x60002400, LENGTH = 0x03FFDC00
m_data (RW) : ORIGIN = 0x80000000, LENGTH = 0x01E00000
m_ncache (RW) : ORIGIN = 0x81E00000, LENGTH = 0x00200000
m_data2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00020000
m_data3 (RW) : ORIGIN = 0x20200000, LENGTH = 0x00040000

附件是我对比有外部c++工程和无外部c++工程的elf文件的section信息。

目前没思路了,请麻烦建议一下。

谢谢!

Labels (1)
0 Kudos
3 Replies

1,494 Views
jeremyzhou
NXP Employee
NXP Employee

Hi ,

非常感谢使用NXP产品,很高兴为你提供技术支持!
你使用的IDE是IAR吗,是在SDK library的hello_world上做的实验吗?

TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,494 Views
brli
Contributor III

Hi, Jeremyzhou

不是IAR, 使用的是:MinGW + CMake + ARM GCC Command.

谢谢!

0 Kudos

1,494 Views
jeremyzhou
NXP Employee
NXP Employee

Hi ,

感谢回复。
我猜测问题应该跟IDE开发环境有关,我建议你参考一下IDE的用户手册或者考虑换一个IDE开发环境试试。

TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos