Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


FreeRTOS API for running external file

Posted by Nomi on July 21, 2011
I have to design a API or use the API to execute a a file.c which contain functions and datatypes .I have to provide the platform for this file.c to execute as a Task of the FreeRTOS.

RE: FreeRTOS API for running external file

Posted by MEdwards on July 21, 2011
Thanks for telling us. I hope your project goes well.

RE: FreeRTOS API for running external file

Posted by Nomi on July 21, 2011
unfortunately its not working well.i have not been able to make a interface for the file.c to execute.i need some help from you people. it is my first project on FreeRTOS so i will be looking for your help.

RE: FreeRTOS API for running external file

Posted by sven-de on July 21, 2011
Maybe you can clarify your aim. I'm certainly not the only one who doesn't understand what you mean by API or interface, that can be everything. My current understanding is that you want to write a C-interpreter for a FreeRTOS-environment - which would be a VERY ambitious project for a beginner.

Maybe you can give an example of the expected behaviour or describe what you've tried so far. What is not working well?

RE: FreeRTOS API for running external file

Posted by Richard Damon on July 22, 2011
As others have commented, you can't load a "file.c" file into a machine (unless you are writing an interpreter, which is a major task). You also can't easily compile that "file.c" and load that into a running program. The closest operations to what you are describing is either build a dynamically linked library and dynamically loading it at run time, or the building of a second independent program that is loaded into memory in free space, which then runs, and when done returns back to the "executive" program.

The first operation is probably what you are really asking for, but this sort of operation is in the domain of major operating systems (like Windows or Unix), not real time kernels like FreeRTOS. I suppose you could build this on your own built on FreeRTOS, but it is a major undertaking. It may be possible to do a limited version if you can live with some constraints:
1) You will only load a single extra program at a time (or able to divide them into 1 from column A and 1 from column B), and you reserve the space in your main program.

2) You can define a fixed and limited number of entry points into the loaded module that the main program will interact with (this might be just an init function, that will setup the desired tasks), and assign fixed locations to place jumps to these entry points (likely at the beginning of the reserved memory block)

3) You can define a fixed and limited number of routines/data members that the loaded program needs to be able to call from the main program. This will probably include the set of FreeRTOS routines that the loaded program needs to be able to call, as well as some routines from the C library that you don't want duplicated (like malloc and free). You need to get your system to build a jump table for these functions at a fixed location in memory, and create a stub library that the loaded program is linked with the points calls to those routines to that jump table.

This is doable, but is a significant project, and requires you to understand a lot of details about your implementation to make sure that you make the list in part 3 complete.

RE: FreeRTOS API for running external file

Posted by Nomi on July 22, 2011
Thnx for your replies.
Here is the thing which i will like to do.Like when we have to create a task we simply include the task file and call the task create() function with the function to be executed as its parameter.Now i have a file.c and there are functions in it to execute .What i want to do is create an intermediate function or interpreter which will help to execute the funtions using the Task API provided by FreeRTOS.

I hope i have explained it well so that you all can understand it.

RE: FreeRTOS API for running external file

Posted by Richard Damon on July 22, 2011
If your goal is to be able to, at program compile time, just add the file.c to your program and compile it in, we basically have that already, there isn't much need for an intermediate function (unless there are other requirements not yet stated). I regularly have programs that to add features I add a new source file, and than add a call to an init function in main() to set up the task and any queues it needs. Since standard C has no way to force actions before main starts, you are going to need to edit main, or at least some file with some sort of list of init functions (or tasks) to process.

[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists