小编eac*_*tor的帖子

用于ARM的Cross Compile helloworld

我正在为ARM-CORTEX-A9尝试一个简单的交叉编译(cc):为了简单起见,这就是c代码:

#include <stdio.h>
int main()
{
   printf("Hello World!\n");
   return 0;
}
Run Code Online (Sandbox Code Playgroud)

arm上的本机编译工作正常,并gcc helloworld.c -o helloworld以交叉编译开始时开始arm-xilinx-linux-gnueabi-gcc helloworld.c -o helloworld_cc

GCC版本:

NATIV: gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) Target: arm-linux-gnueabihf

CC: gcc version 4.6.3 (Sourcery CodeBench Lite 2012.03-79) Target: arm-xilinx-linux-gnueabi

来自readelf的ABI:

readelf-nativ:OS: Linux, ABI: 2.6.31 readelf-cc:OS: Linux, ABI: 2.6.16

链接库 - 交叉编译是静态链接的,所以它不应该错过任何库:

root@localhost:/temp# ldd helloworld
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6ed8000)
        /lib/ld-linux-armhf.so.3 (0xb6fce000)
root@localhost:/temp# ldd helloworld_cc
        not a dynamic executable
Run Code Online (Sandbox Code Playgroud)

问题:本机程序运行正常,cc总是以:

root@localhost:/tmp# ./helloworld_cc
-bash: ./helloworld_cc: No such file or …
Run Code Online (Sandbox Code Playgroud)

gcc arm cross-compiling

13
推荐指数
1
解决办法
3万
查看次数

Eclipse编辑器:在垂直标尺的自定义列上显示标记

之前我问了一个关于VerticalRulers问题,我提到了这个提示我在VerticalRuler中添加了第二个Column并尝试添加一个Marker,但Marker总是出现在标准Column上,但不在我的上面.我添加了第二个行号列来说明我的问题.我该如何改变这种行为?谢谢你的帮助.

@Override
protected IVerticalRuler createVerticalRuler(){
    IVerticalRuler ruler =  super.createVerticalRuler();
    ruler2 = (CompositeRuler) ruler;
    column1 = new AnnotationRulerColumn(100);
    ruler2.addDecorator(0, column1);
    ruler2.addDecorator(2, createLineNumberRulerColumn());
    column1.addAnnotationType("MARKER");
    return ruler;
}
public String check_line(){
    IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    IFileEditorInput input = (IFileEditorInput)editor.getEditorInput() ;
    IFile file = input.getFile();
    IResource res = (IResource) file;
    try{
        IMarker m = res.createMarker(IMarker.MARKER);
        m.setAttribute(IMarker.LINE_NUMBER,2);
        m.setAttribute(IMarker.MESSAGE, "lala");
        m.setAttribute(IMarker.TEXT, "test");
        m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
        m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
    } catch (CoreException e) { ... }
    return "marker created";
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

eclipse eclipse-plugin editor eclipse-rcp

7
推荐指数
1
解决办法
2325
查看次数

用于RT补丁的Linux内核的Cyclictest

您好我用RT-Patch修补了Linux内核,并使用监视延迟的Cyclinctest对其进行了测试.内核不是很好,也不比vanilla内核好. https://rt.wiki.kernel.org/index.php/Cyclictest

我检查了uname的RT,看起来很好.

所以我检查了cyclinctest的要求,并指出我必须确保在内核配置中配置以下内容:

CONFIG_PREEMPT_RT=y
CONFIG_WAKEUP_TIMING=y
CONFIG_LATENCY_TRACE=y
CONFIG_CRITICAL_PREEMPT_TIMING=y
CONFIG_CRITICAL_IRQSOFF_TIMING=y 
Run Code Online (Sandbox Code Playgroud)

现在出现的问题是配置不包含此类条目.也许有旧的,它们可能会在新的补丁版本(3.8.14)中重命名?

我找到了以下选项:

CONFIG_PREEMPT_RT_FULL=y
CONFIG_PREEMPT=y
CONFIG_PREEMPT_RT_BASE=y
CONFIG_HIGH_RES_TIMERS=y 
Run Code Online (Sandbox Code Playgroud)

这是在3.x内核中提供从上面提供所需的吗?有人提示吗?

linux kernel real-time linux-kernel

6
推荐指数
1
解决办法
4119
查看次数

利用-mfloat-abi = hard和-mfpu = vfp/neon Codesourcery Lite 2013.05-24

为了使用vfp或者neon,我添加了-mfpu = vfp和-mfloat-abi =我的交叉编译很难.该程序是一个非常简单的hellofloat.cpp,然后使用Sourcery CodeBench Lite 2013.05-24不再编译.

#include <string>
#include <iostream>
using namespace std;
int main()
{
    double val=1.04;
    cout << "Hello Float: " << val  << endl;
}
Run Code Online (Sandbox Code Playgroud)

编译指令:

arm-none-linux-gnueabi-g++ -o armhf-main main.cpp  -march=armv7-a  -mfloat-abi=hard -mfpu=neon
Run Code Online (Sandbox Code Playgroud)

我很困惑,因为Codesorcery应该支持armhf编译?

错误:

In file included from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../arm-none-linux-gnueabi/libc/usr/include/features.h:399:0,
                 from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/../../../../arm-none-linux-gnueabi/include/c++/4.7.3/arm-none-linux-gnueabi/bits/os_defines.h:40,
                 from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/../../../../arm-none-linux-gnueabi/include/c++/4.7.3/arm-none-linux-gnueabi/bits/c++config.h:414,
                 from /home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/../../../../arm-none-linux-gnueabi/include/c++/4.7.3/string:40,
                 from main.cpp:1:
/home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../arm-none-linux-gnueabi/libc/usr/include/gnu/stubs.h:10:29: fatal error: gnu/stubs-hard.h: No such file or directory
compilation terminated.
Run Code Online (Sandbox Code Playgroud)

编译器

arm-none-linux-gnueabi-g++ -v
Using built-in specs.
COLLECT_GCC=arm-none-linux-gnueabi-g++
COLLECT_LTO_WRAPPER=/home/user/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../libexec/gcc/arm-none-linux-gnueabi/4.7.3/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /scratch/jbrown/2013.05-arm-linux-release/src/gcc-4.7-2013.05/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads …
Run Code Online (Sandbox Code Playgroud)

embedded floating-point arm cross-compiling codesourcery

5
推荐指数
1
解决办法
1万
查看次数

用户定义的语言为文件标准

我在notepad ++中设计了自己的用户自定义语言.要真正使用它,将它分配给特定的文件结尾将是非常好的吗?有谁知道这是怎么做到的吗?感谢帮助

eactor

notepad++

4
推荐指数
1
解决办法
5471
查看次数

使用相对路径使用DTD或XSD进行本地XML验证?

可以使用文档类型描述(DTD)或XML架构(xsd)定义和验证XML文件,如下所示:

<?xml version='1.0' encoding='UTF-8'?>
<annotation xmlns="http://www.xyz.com"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.xyz.com
    file:system.xsd" >
Run Code Online (Sandbox Code Playgroud)

要么

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE annotation SYSTEM "http://www.xyz.de/system.dtd">
Run Code Online (Sandbox Code Playgroud)

两种方式都定义了找到DTD或XSD的URL.有没有办法给出相对或本地路径?所以我可以将它们与XML文件一起存储,而不是依赖于服务器?

xml xsd dtd xml-validation xsd-validation

4
推荐指数
1
解决办法
1万
查看次数

在solaris和linux下对一个struct diffrent的恐惧

我正在使用fread读取文件的第一个字节:

fread(&example_struct, sizeof(example_struct), 1, fp_input);
Run Code Online (Sandbox Code Playgroud)

哪个在linux和solaris下结果不同?那么example_struct(Elf32_Ehdr)是elf.h中定义的Standart GNU C Liborary的一部分?我很高兴知道为什么会这样?

一般结构看起来如下:

typedef struct
{
  unsigned char e_ident[LENGTH];    
  TYPE_Half e_type;         
} example_struct;
Run Code Online (Sandbox Code Playgroud)

调试代码:

for(i=0;paul<sizeof(example_struct);i++){
    printf("example_struct->e_ident[%i]:(%x) \n",i,example_struct.e_ident[i]);
}
printf("example_struct->e_type: (%x) \n",example_struct.e_type);
printf("example_struct->e_machine: (%x) \n",example_struct.e_machine);
Run Code Online (Sandbox Code Playgroud)

Solaris输出:

Elf32_Ehead->e_ident[0]: (7f) 
Elf32_Ehead->e_ident[1]: (45) 
...
Elf32_Ehead->e_ident[16]: (2) 
Elf32_Ehead->e_ident[17]: (0)
...
Elf32_Ehead->e_type: (200) 
Elf32_Ehead->e_machine: (6900) 
Run Code Online (Sandbox Code Playgroud)

Linux输出:

Elf32_Ehead->e_ident[0]: (7f) 
Elf32_Ehead->e_ident[1]: (45) 
...
Elf32_Ehead->e_ident[16]: (2) 
Elf32_Ehead->e_ident[17]: (0)
...
Elf32_Ehead->e_type: (2) 
Elf32_Ehead->e_machine: (69)
Run Code Online (Sandbox Code Playgroud)

也许类似于:http://forums.devarticles.com/cc-help-52/file-io-linux-and-solaris-108308.html

c linux solaris fread

1
推荐指数
1
解决办法
308
查看次数

使用pthreads裸机的交叉编译程序

好的,这可能是一个非常笼统的问题,但是我不熟悉该主题,也很高兴获得任何提示。

我有一个来自SoucereyCodeBench的ARM交叉编译工具链(arm-xilinx-linux-gnueabi-)。我交叉编译了一个使用编译器选项的库:-DSC_INCLUDE_FX -DSC_USE_PTHREADS -pthreads -fPIC -DPIC

因此,如果我想将库用于裸机程序,那么我会为裸机编译器(arm-xilinx-eabi-)需要pthreads吗?

否则我的程序可能首先不会运行或编译。那么可以为裸机编译pthread吗?

embedded arm bare-metal xilinx

0
推荐指数
1
解决办法
6022
查看次数