GCC臂无 - EABI(codesourcery)和C ++异常 [英] GCC arm-none-eabi (Codesourcery) and C++ Exceptions

查看:246
本文介绍了GCC臂无 - EABI(codesourcery)和C ++异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Raisonance的RIDE7 / codesourcery(a.k.a的Sourcery codeBench精简版)与STM32F4板开发一个裸机的HMI平台。

I am using Raisonance's Ride7/Codesourcery (a.k.a Sourcery CodeBench Lite) with an STM32F4 board developing a bare metal HMI platform.

我将利用C ++异常的在这个系统中,但我抛出任何异常与写入stderr了终止递归调用错误结束。

I will be making use of C++ exceptions in this system, but any exception I throw ends with a "Terminate called recursively" error written to stderr.

code重现该问题:
(main.cpp中)

Code to reproduce the problem: (main.cpp)

int main(void)
{
    try {
        throw 1;
    }
    catch (...) {
        printf("caught");
    }
}

我已经试过Raisonance的和其他来源的分辨率,并且没有收到任何可行的帮助。

I've already tried Raisonance and other sources for a resolution, and have not received any actionable help.

潜在的问题/解决方案1:

我问过其他论坛和他们提到我需要调用静态结构在我的启动汇编文件初始化展开表(至少这是我觉得他们是在谈论),但我不知道该怎么办这一点。

I've asked on other forums and they mention I need to call static constructions in my startup assembly file to initialize the unwind tables (at least that's what I think they are talking about), but I have no idea how to do this.

潜在的问题/解决方案2

我也发现了binutils的/气体的错误,可能是我的问题的根源在这里(的 http://sourceware.org/bugzilla/show_bug.cgi?id=13449 )。我一直在试图建立自己的这个补丁工具链的版本,但是这变成了自己的项目,尚未成功。

I have also discovered a bug in binutils/gas that may be the source of my problems here (http://sourceware.org/bugzilla/show_bug.cgi?id=13449). I've been trying to build my own version of the toolchain with this patch, but that's turning into a project of its own, and have not yet succeeded.

问题

The Question

我需要做code一件让使用C ++异常,或者这可能是错误的工具链?如果是前者,请详细说明。

Do I need to do something in code to make use of C++ exceptions, or is this likely a bug in the toolchain? If the former, please elaborate.

推荐答案

经过一番劝说,不应该是必要后,Raisonance公司终于通过与修改的解决了这一问题的默认链接脚本。这可能不合法,我张贴整个链接脚本,但这里有一个需要了解的知识。

After some persuasion that shouldn't have been necessary, Raisonance finally came through with a modification to their default linker script that fixed the problem. It may not be legal for me to post the entire linker script, but here's the knowledge that one needs to know

这添加到.text段

*(.eh_frame)

添加这些章节(名称的 YourMemory 的根据您在链接脚本设置,内存块矿是的闪存的)

Add these sections (name YourMemory according to the memory blocks you've set up in your linker script. Mine was Flash)

.ARM.extab :
{
    *(.ARM.extab* .gnu.linkonce.armextab.*)
} >YourMemory

.ARM :
{
    __exidx_start = .;
    *(.ARM.exidx*)
    __exidx_end = .;
} >YourMemory

确保发生在BSS部分这一行

Ensure this line occurs in the bss section

*(.bss*)

虽然在这一过程中,我遇到了以下有用的资源跑

While on this quest, I ran across the following useful resources

  • http://wiki.osdev.org/C%2B%2B_Exception_Support
  • https://docs.blackfin.uclinux.org/doku.php?id=toolchain:bare_metal:link
  • http://gcc.gnu.org/ml/gcc-help/2011-07/msg00112.html
  • http://www.airs.com/blog/archives/460

这篇关于GCC臂无 - EABI(codesourcery)和C ++异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆