English 中文(简体)
Configuring GCC with FreeRTOS and OpenOCD
原标题:

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
问题回答

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.

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.

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





相关问题
gcc -fPIC seems to muck with optimization flags

Following along from this question: how-do-i-check-if-gcc-is-performing-tail-recursion-optimization, I noticed that using gcc with -fPIC seems to destroy this optimization. I am creating a shared ...

Generate assembler code from C file in linux

I would like to know how to generate assembler code from a C program using Unix. I tried the gcc: gcc -c file.c I also used firstly cpp and then try as but I m getting errors. I m trying to build an ...

Getting rid of pre-compiled headers

OK, I have old Metrowerks code for Mac and Windows where the previous developer used pre-compiled headers for every project that this code base builds. How does one get rid of Pre-compiled headers, ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

How to compile for Mac OS X 10.5

I d like to compile my application for version 10.5 and forward. Ever since I upgraded to Snow Leopard and installed the latest XCode, gcc defaults to 10.6. I ve tried -isysroot /Developer/SDKs/...

热门标签