从 freeRTOS 运行应用程序 [英] Running applications from freeRTOS

查看:23
本文介绍了从 freeRTOS 运行应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为我公司正在开发的消费电子产品开发操作系统.我已经决定将 freeRTOS 作为我们操作系统的支柱,并且正在努力在操作系统中实现硬件功能.但是,我遇到了有关从 freeRTOS 中运行 3rd 方应用程序的问题.

最初我认为一个任务是一个应用程序,基本上你有myapplication.c"和myapplication.h"包含你所有应用程序必需的功能,代码将驻留在任务内的 for(;;) 循环中(作为主要的 while 循环).然后,当用户决定运行该应用程序时,一个函数指针被传递到一个队列,然后我的 app_launcher 任务使用该队列使用第 3 方任务或应用程序创建新任务.

然而,这种方法的问题是操作系统已经被编译并驻留在微控制器上,并且应用程序可以根据用户认为合适的方式安装和删除......所以显然应用程序需要从操作系统编译和执行.在标准的 unix 机器上,我会使用类似 fork 的东西来选择可执行文件并赋予它自己的进程.但是我在 freeRTOS 中找不到类似的功能.

所以问题是,我如何让 freeRTOS 运行来自 3rd 方开发人员但尚未融入操作系统的应用程序?

解决方案

由于请求,这里是我发现我的问题的解决方法.问题是从 freeRTOS 启动其他应用程序.这是通过利用 newlib 库中的System()"函数实现的.因此,我可以将应用程序放在闪存中直到需要它,然后使用提供的 newlib 函数启动它.这也允许我动态启动程序,无需对应用程序的代码或名称进行硬编码,我只需要向 System() 提供一个字符串,指向应用程序在内存中的位置.

I am currently in the process of developing the OS for a consumer electronics product my company is developing. I have settled on freeRTOS as the backbone for our OS, and am working diligently to implement hardware functionality within the OS. However, I have run into an issue concerning running 3rd-party applications from within freeRTOS.

Originally I considered a task to be an application, where basically you had "myapplication.c" and "myapplication.h" containing all your applications necessary functions and the code would reside within the for(;;) loop within the task (acting as a main while loop). Then when the user decides to run that application, a function pointer is passed to a queue, that my app_launcher task then uses to create the new task using the 3rd-party task or application.

The problem with this approach however, is the OS will already be compiled and reside on the microcontroller, and applications with be installed and deleted as the user sees fit... So obviously applications need to be compiled and executable from the OS. On a standard unix machine, I would use something like fork, to select the executable and give it it's own process. However I cannot find a similar functionality within freeRTOS.. My other idea is approaching a scripting language for app development, but again I'm not sure on how to launch those applications...

So the question is, how do I get freeRTOS to run applications from 3rd party developers that aren't already baked into the OS?

解决方案

Due to request, here is the work around I found to my problem. The issue was launching other applications from freeRTOS. This was accomplished by utilizing the "System()" function in the newlib library. Thus, I can place an application in flash until it's needed, then launch it using the newlib functions provided. This also allows me to launch programs dynamically, without hard coding the code or name of the application, I just need to provide System() with a string, pointing to the app's location in memory.

这篇关于从 freeRTOS 运行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆