使用 FreeRTOS 和 OpenOCD 配置 GCC

发布于 2024-09-15 10:08:31 字数 723 浏览 12 评论 0原文

我很确定这是可能的,但我不知道如何去做。一般来说,我对使用 GCC 进行构建非常陌生,并且从未使用过 FreeRTOS,但我想尝试在 TI ARM Cortex MCU 上启动并运行该操作系统,但有一点小小的不同:我想得到它与 Pascal 一起启动并运行。我很好奇:

  • 这样还能找到工作吗?如果不是,接下来的问题就没有实际意义了。
  • 从我使用 Delphi 的时候起,我就隐约记得访问 C 库中的函数的能力。我想知道我是否可以访问 FreeRTOS 中的 C 例程。
  • 如果我使用 GCC 版本(首选),我可以在目标上使用 OpenOCD 进行调试吗?我不太确定调试符号是如何工作的,以及它是否或多或少与语言无关(希望在这种情况下)。
  • 作为有点超出原始查询范围的额外问题,我可以在 x86 处理器(例如我的开发 PC)上模拟 FreeRTOS 以便在开发过程中更轻松地进行调试吗? (当然,使用 Pascal 程序..)

我还没有找到任何关于实现此目的的文档,所以希望这里有人可以阐明一些!任何资源都会非常有帮助。就像我说的,我对这种开发非常陌生。如果您认为有更好的选择,我也愿意接受建议。

仅供参考,我首选的主机配置类似于:

  • Linux (Ubuntu/Debian)
  • Eclipse IDE,用于开发、单元测试,并希望模拟/调试
  • OpenOCD,用于
  • 目标调试 GNU Pascal + FreeRTOS

I'm pretty sure this is possible but I'm not sure how to go about it. I'm very new to building with GCC in general and I have never used FreeRTOS, but I'd like to try getting the OS up and running on a TI ARM Cortex MCU but with a slight twist: I'd like to get it up and running with Pascal. I'm curious:

  • Is this even possible to get work? If not, the next issues are kind of moot points.
  • From my Delphi days, I vaguely recall the ability to access functions in C libraries. I'm wondering if I would have access to the C routines in FreeRTOS.
  • If I use the GCC version (preferable) would I be able to debug using OpenOCD on the target? I'm not quite sure how debug symbols work and if it's more or less language agnostic (hopefully, in this case).
  • As kind of a bonus question a bit outside the scope of the original query, can I simulate FreeRTOS on an x86 processor (e.g. my development PC) for easier debugging during development? (With a Pascal program, of course..)

I haven't found any documentation on achieving this, so hopefully someone here can shed some light! Any resources would be most helpful. Like I said, I'm very new to this kind of development. I'm also open to suggestions if you think there is a better alternative.

FYI, my preferred host configuration would be something similar to:

  • Linux (Ubuntu/Debian)
  • Eclipse IDE for development, unit testing, and hopefully simulation / debugging
  • OpenOCD for target debugging
  • GNU Pascal + FreeRTOS on target

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

红墙和绿瓦 2024-09-22 10:08:31

FreeRTOS 是 C 源代码,所以就像你说的,你必须有某种机制将 C 与你的 Pascal 程序链接起来。此外,FreeRTOS 依赖于某些寄存器来执行诸如将参数传递到任务等操作(作为一个假设的示例,任务可能始终期望参数位于寄存器 R0 中),因此您必须确保 C 编译器的 ABI Pascal 编译器是相同的 - 或者让你的任务输入 C 语言,然后让它调用 Pascal 函数(非常讨厌)。然后是中断、调用内联宏等问题。我想说这很难实现。

FreeRTOS is C source code, so like you say you would have to have some mechanism for linking C with your Pascal programs. Also, FreeRTOS relies on certain registers to be used for things like passing a parameter into a task (as a hypothetical example, the task might always expect the parameter to be in register R0) so you would have to ensure the ABI for the C compiler and the Pascal compiler was the same - or have your task entry in C then have it call a Pascal function (very nasty). Then there is the issue of interrupts, calling inline macros, etc. I would say this would be extremely difficult to achieve.

清君侧 2024-09-22 10:08:31

GNU Pascal 和 Free Pascal 都支持链接到 C (gcc) 和 ARM,以及从 C 等调用 pascal 代码。编写标头并使用 cdecl 声明原型就足够了。

宏是一个更大的问题。通常我只是将它们重写为内联函数(无论如何它们都应该是这样)。除了宏/头文件问题之外,问题更多的是编译器特定的功能(从一个 C 编译器移植到下一个时也会遇到问题)

如果您更喜欢 TP/Delphi 方言,Free Pascal 是更好的选择。

我在 sheevaplug 上运行我的旧 Delphi 代码很好。

Both GNU Pascal and Free Pascal support linking to C (gcc) and ARM, as well as calling pascal code from C etc. Writing a header and declaring the prototypes with cdecl is all there is to it.

Macros are a bit bigger problem. Usually I just rewrite them to inline functions (what they should have been anyway). Except for the macro/header issue, the problems are more compiler specific functionality (which you also would have a problem with when porting from one C compiler to the next)

If you prefer TP/Delphi dialect, Free Pascal is the better choice.

I run my old Delphi code fine on my sheevaplug.

來不及說愛妳 2024-09-22 10:08:31

TI Cortex-M3(以前是 Luminary Micro Cortex-M3)上已经有 FreeRTOS/GCC/OpenOCD 的示例。请注意,这是一个非常古老的示例,并且使用的 Eclipse 和 OpenOCD 版本都已过时。

尽管提供了 Eclipse 项目,但该项目被配置为标准 make(而不是托管 make)项目,因此有一个标准 makefile,可以像在 Eclipse 中一样轻松地从命令行执行。

http://www.freertos.org/portLM3Sxxxx_Eclipse.html

There is already an example for FreeRTOS/GCC/OpenOCD on a TI Cortex-M3 (was Luminary Micro Cortex-M3). Be aware though that this is a really old example and both the Eclipse and OpenOCD versions used are out of date.

Although there is an Eclipse project provided, the project is configured as a standard make (as opposed to a managed make) project, so there is a standard makefile that can be just as easily executed from the command line as from within Eclipse.

http://www.freertos.org/portLM3Sxxxx_Eclipse.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文