问题描述
OK,这可能是一个非常普遍的问题,但我不熟悉的话题,快乐的任何暗示。
OK, this might be a very general question but I'm not to familiar with the topic and happy for any hint.
我从Soucerey codeBench一个交叉编译工具链为ARM(ARM-赛灵思Linux的gnueabi-)。我穿过编译它使用的编译器选项库: -DSC_INCLUDE_FX -DSC_USE_PTHREADS -pthreads -fPIC -DPIC
I have a Cross Compiling tool chain from SoucereyCodeBench for ARM ( arm-xilinx-linux-gnueabi-). I cross compiled a library which uses the compiler Options: -DSC_INCLUDE_FX -DSC_USE_PTHREADS -pthreads -fPIC -DPIC
所以,如果我想使用libary裸机程序,我需要为裸机的pthreads编译器(ARM-赛灵思eabi-)我猜?
So if I want to use the libary for bare metal program I would need pthreads for the bare metal compiler (arm-xilinx-eabi-) I guess?
否则我的程序probally不会运行或摆在首位编译。所以可以把它做编译pthreads的裸机?
Otherwise my program probally wouldn't run or compile in the first place. So could it be done to compile pthreads for bare metal?
推荐答案
我认为这将是你的移植code,而不是简单的交叉编译它不变的matetr。正如其名称所暗示的 POSIX线程的(pthreads的)假定POSIX API。
I think it will be a matetr of porting your code rather than simply cross-compiling it unchanged. As its name suggests POSIX threads (pthreads) assumes a POSIX API.
如果您需要在裸机的ARM目标线程,你至少需要某种形式的线程调度库,其中还有的。大多数实时操作系统都没有完全操作系统Linux中的意义,而是简单的调度与静态库与您的整体应用程序链接像任何其他IPC机制 - 这可能仍然在这个意义上算作裸机,系统会直接引导到你的的main()
功能,你在哪里,负责创建任务/线程并启动调度程序。
If you need threads on a bare metal ARM target, the you at least need some sort of thread scheduling libraries of which there are many. Most RTOSs are not full OSs in the sense of Linux, but rather simple schedulers with IPC mechanisms that link as static libraries like any other to your monolithic application - that probably still counts as "bare metal" in the sense that the system boots directly to your main()
function where you are responsible for creating tasks/threads and starting the scheduler.
有些实时操作系统支持POSIX API和因此pthreads的,但这些往往是更大更完整的操作系统,而不是简单的调度程序 - 无论哪种方式,他们一般都比较小,更灵活的那么Linux这样仍然可以达到YOUT裸机的要求
Some RTOSs support POSIX APIs and therefore pthreads, but these tend to be the larger more complete OSs rather than simple schedulers - either way they are generally smaller and more scalable then Linux so may meet yout "bare metal" requirements nonetheless.
当然,没有什么可以阻止您创建周围的任何RTOS库的包装,提供的pthread兼容的API,可能使你的移植code简单。
Of course nothing stops you from creating a wrapper around any RTOS library to provide a pthread compatible API that might make porting your code simpler.
这篇关于它使用pthreads的裸机交叉编译程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!