嵌入式linux段错误,在嵌入式Linux上使用C Std Lib时出现异常的段错误

通过一些研究后我可以看到,vivado是硬件开发IDE [因为它们提供了一个试用期 – 所以它是硬件开发,他们总是想要收费].

如果您使用的是Xilinx的标准SDK板,则应该预先配置所有内容.否则,硬件设计师会生成一个具有Microblaze的硬件设计.

从那时起,您可能必须使用petalinux来生成兼容的新引导,内核等图像.

您可能需要从源代码重建libstdc,但我会将其作为最后的手段.例如,不要打扰它,直到你有gdb工作并有测试结果.

开发指南显示了如何调用gdb(例如):

在目标系统上:

gdbserver主机:1534 / bin / myapp

在开发系统上:

petalinux-utils –gdb myapp后跟目标远程192.168.0.10:1534

我已经使用注释对Makefile进行了一些编辑.我已经评论了一些非必要的选项.请注意,我正在使用=运算符逐渐构建CFLAGS / CXXFLAGS

这里的基本思想是以最小的“标准”偏差进行构建.仅添加经过验证的基本选项构建和测试.逐个添加选项[每次重建和测试],直到找到导致问题的选项.

然而,我确实怀疑 – 共同 – 是一个问题的根源.此外,在较小的程度上,我有点怀疑-Wl,– 根据需要

这些选项应该有效吗?当然,但xilinx / microblaze不是没有x86 ……

我添加了两个命令行make变量:

DEBUG – 使用gdb生成调试

VERBOSE – 显示构建过程的所有内容

例如,尝试make< whatever> DEBUG = 1 VERBOSE = 1

CC = microblazeel-xilinx-linux-gnu-gcc

CXX = microblazeel-xilinx-linux-gnu-g++

CPPFLAGS ?=

CMFLAGS += -Wall -Werror

CMFLAGS += -fmessage-length=0

# compile for gdb session

# NOTES:

# (1) -gdwarf-2 may or may not be the the right option for microblaze

# (2) based on doc for -feliminate-unused-debug* petalinux/microblaze may want

# stabs format

ifdef DEBUG

CMFLAGS += -gdwarf-2

CMFLAGS += -O0

# compile for normal build

#else

CMFLAGS += -O2

CMFLAGS += -feliminate-unused-debug-types

endif

# NOTE: I used to use "@" on commands,but now I leave it off -- debug or not

# sure it's "ugly" but you can get used to it pretty quickly--YMMV

ifndef VERBOSE

Q :=

else

###Q := @

Q :=

endif

# let compiler/linker tell you _everything_:

# (1) configure options when tool was built

# (2) library search paths

# (3) linker scripts being used

ifdef VERBOSE

CMFLAGS += -v

LDFLAGS += -Wl,--verbose=2

endif

CMFLAGS += -fno-builtin

# NOTE: I'd _really_ leave this off as it may confuse c++ std as "<

# _M_insert (which is in the library,which is almost certainly _not_ using

# -fno-common)

###CMFLAGS += -fno-common

# NOTE: I'm also suspicIoUs of this a little bit because the c++ lib may have

# some "weak" symbols that the c library doesn't

###LDFLAGS += -Wl,--as-needed

# NOTE: this seems harmless enough,but you can comment it out to see if it

# helps

LDFLAGS += -Wl,--hash-style=gnu

# NOTE: an optimization only

ifndef DEBUG

LDFLAGS += -Wl,-O1

endif

CFLAGS += $(CMFLAGS)

CXXFLAGS += $(CMFLAGS)

# NOTES:

# (1) leave this off for now -- doesn't save _that_ much and adds complexity

# to the build

# (2) IMO,I _never_ use it and I erase/uninstall it on any system I

# administrate (or just ensure the build doesn't use it by removing it

# from $PATH)--YMMV

###XCCACHE = $(CCACHE)

# to compile

$(Q)$(XCCACHE) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CFLAGS) $< -o "$@"

# to link

$(Q)$(CXX) $(RELOBJECTS) $(LDFLAGS) $(EXT_LIBS) -o $(RELBINARY)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值