Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
RT-Thread一般讨论
smxDLM? Dynamic Load Module Support
发布于 2008-12-03 12:34:06 浏览:4551
订阅该版
smxDLM permits independent executable modules (dynamic load modules) to be loaded and executed as tasks under smx. This gives additional flexibility since it permits parts of an application to be separate from the main application. Operation smx is designed to be linked with the application code into a single executable. While ideal for most embedded applications, this is too limiting for some. smxDLM extends smx to permit an application to be divided into a resident section, referred to as the resident, and one or more transient sections, referred to as Dynamic Load Modules (DLM's). DLM's are not linked with smx. Instead, each DLM is linked with a pseudo smx library that uses software interrupts, or traps, to invoke smx functions. The resident includes the standard smx functions, the DLM loader, resident application code, and possibly other SMX products. DLM's may be loaded and unloaded, at will, and any number may run simultaneously. The resident is likely to be linked, located, and burned into ROM or flash. However, DLM's are most likely to be linked into relocatable formats and loaded into RAM from disk or downloaded from another computer. DLM's are an ideal way to add functionality or to distribute bug fixes to products which have already been shipped. To facilitate this, the resident should be as minimal as possible and thoroughly debugged. (It is basically a custom OS.) Complex or likely-to-change portions of the application should be implemented as DLM's. These can be altered and easily reloaded in the future. How smx Calls Work from DLM's DLM application code differs in only minor ways from resident smx application code. (In fact, DLM's are most easily debugged by initially linking them with the resident.) Prior to loading, each DLM is linked with a special, pseudo-smx library (and any other libraries it requires). This library has a pseudo call of the same name and syntax as each smx call. Each pseudo call loads its call ID into a register, then executes a software interrupt or trap. The interrupt or trap level is user selectable. In the resident application, the smx interface routine interprets the call ID, adjusts the stack, and invokes the specified smx call. When done, the smx call returns directly to the DLM caller and passes back a return value, as normal. Thus, the operation is transparent to the DLM application code - it need not know which smx library (actual or pseudo) it has been linked to. Loading DLM's DLM's are typically linked as .exe files that are loaded from disk. The smxDLM loader currently supports the MZ, NE, and PE file formats for x86 systems. Support for other re-locatable formats will be added in the future. DLM's can also be in absolute format (i.e. located code) and be loaded into fixed locations. This tends to undermine their usefulness, but may be the only option in some cases. smxDLM code is supplied to load from disk using smxFile. Intermediary routines are provided for the file i/o calls used by the loader. These few calls can be re-implemented to get the data from another source, such as a data link or network. The DLM loader obtains memory from the smx heap, loads the DLM into it, performs segment or offset fixups, and creates a root task for the DLM startup code. The loader then starts the DLM's root task. This causes the DLM's startup code to begin executing. The API for use by the resident to load and unload DLM's consists of two routines: create_process() and delete_process(). They are used as follows: To load and start a DLM: PRCB_PTR process; process = create_process(path, pri, stack_sz); if (process) start(process->tcb_handle); else /* DLM load failed */ To unload a DLM: if (!delete_process(process)) /* DLM unload failed */ DLM Operation Because handles are assigned values by the linker and because a DLM is independently linked, the DLM does not know the values of handles in the resident or in other DLM's. Suppose that a DLM wants to send a message to XchgA in the resident. To do so, it must first get the value of the handle from the handle table, then do the send: xchga = get_handle ("XchgA"); send (msg, xchga); The handle table is maintained by smx in the resident. The above code sequence will work correctly in both a free-standing DLM and in a DLM linked to the resident during debugging. Once a DLM begins operation, it can spawn any number of additional tasks and create any number of other smx objects. As it creates objects, the DLM may register them in the handle table so that the resident and other DLM's can access them. This is done the same as in normal code: taska = create_taskf(taska_main, 3, 500); BUILD_HT(taska, "TaskA"); Other Information Full source code is provided for smxDLM. This makes it easy to add non-smx services, such as file, GUI, stack, and special resident application services. It is also possible to alter or change the loader.
查看更多
1
个回答
默认排序
按发布时间排序
撰写答案
登录
注册新账号
关注者
0
被浏览
4.6k
关于作者
shaolin
这家伙很懒,什么也没写!
提问
115
回答
444
被采纳
0
关注TA
发私信
相关问题
1
有关动态模块加载的一篇论文
2
最近的调程序总结
3
晕掉了,这么久都不见layer2的踪影啊
4
继续K9ii的历程
5
[GUI相关] FreeType 2
6
[GUI相关]嵌入式系统中文输入法的设计
7
20081101 RT-Thread开发者聚会总结
8
嵌入式系统基础
9
linux2.4.19在at91rm9200 上的寄存器设置
10
[转]基于嵌入式Linux的通用触摸屏校准程序
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
使用百度AI助手辅助编写一个rt-thread下的ONVIF设备发现功能的功能代码
2
RT-Thread 发布 EtherKit开源以太网硬件!
3
rt-thread使用cherryusb实现虚拟串口
4
《C++20 图形界面程序:速度与渲染效率的双重优化秘籍》
5
《原子操作:程序世界里的“最小魔法单位”解析》
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
ESP8266
I2C_IIC
WIZnet_W5500
UART
ota在线升级
PWM
cubemx
freemodbus
flash
packages_软件包
BSP
潘多拉开发板_Pandora
定时器
ADC
GD32
flashDB
socket
中断
Debug
编译报错
msh
SFUD
keil_MDK
rt_mq_消息队列_msg_queue
at_device
ulog
C++_cpp
本月问答贡献
踩姑娘的小蘑菇
7
个答案
3
次被采纳
a1012112796
13
个答案
2
次被采纳
张世争
9
个答案
2
次被采纳
rv666
5
个答案
2
次被采纳
用户名由3_15位
11
个答案
1
次被采纳
本月文章贡献
程序员阿伟
7
篇文章
2
次点赞
hhart
3
篇文章
4
次点赞
大龄码农
1
篇文章
2
次点赞
ThinkCode
1
篇文章
1
次点赞
Betrayer
1
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部