匿名
未登录
登录
百问网嵌入式Linux wiki
搜索
查看“Coprocessor resource table”的源代码
来自百问网嵌入式Linux wiki
名字空间
页面
讨论
更多
更多
页面选项
Read
查看源代码
历史
←
Coprocessor resource table
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
== Role of the resource table== The resource table is a global variable declared as a structure in the coprocessor firmware. This table contains resources that the remote processor requires before being powered on, such as the allocation of a physically contiguous memory. In addition, the resource table may also contain resource entries that publish the existence of supported features or configurations by the remote processor, such as trace buffers and/or supported Virtio devices used for the IPC. This table must be defined in a specific data section of the coprocessor firmware, parsed by the [[Linux remoteproc framework overview | RemoteProc]] Linux<sup>®</sup> framework during the firmware load phase to: * Allocate memories defined in the resource table carveout section (not used in the ST Arm<sup>®</sup> Cortex<sup>®</sup>-M4 firmware). * Load the RPMsg and Virtio frameworks to support messaging services. * Provide a user sysfs interface to access coprocessor traces for debug. == How to define the resource table == The resource table must be part of the firmware’s ELF image, in order to be accessible by the Linux RemoteProc framework. This resource table can be a default table or customized depending on the enabled features. In the STM32MCU cube firmware package, the resource table is defined in rsc_table.c === Default table === For the Cortex-M firmware that does not require interaction with the Linux OS, a default structure must be declared in the Cortex-M firmware <syntaxhighlight lang="c"> struct remote_resource_table __resource __attribute__((used)) rproc_resource = { .version = 1, .num = 0, .reserved = {0, 0}, .offset = { 0 }, }; </syntaxhighlight> === How to add trace for the log buffer === This feature allows to dump Cortex-M firmware traces on the linux side. For this a '''system_log_buf''' buffer defined in log.c file and declared in the resource table allows Linux to dump the associated memory area (under "__LOG_TRACE_IO_" preprocessor definition). <syntaxhighlight lang="c" line highlight="6,12,17-20"> const struct shared_resource_table __resource __attribute__((used)) resource_table = { .version = 1, #if defined (__LOG_TRACE_IO_) .num = 2, #else .num = 1, #endif .reserved = {0, 0}, .offset = { offsetof(struct shared_resource_table, vdev), #if defined (__LOG_TRACE_IO_) offsetof(struct shared_resource_table, cm_trace), #endif }, ....... #if defined (__LOG_TRACE_IO_) .cm_trace = { RSC_TRACE, (uint32_t)system_log_buf, SYSTEM_TRACE_BUF_SZ, 0, "cm4_log", }, #endif }; </syntaxhighlight> These logs can be retrieved after a firmware crash: refer to [[How to retrieve Cortex-M4 logs after crash]] for more information. === How to add RPMsg inter-processor communication === The messaging service is enabled by declaring: * The rpmsg Virtio device for control, * The rpmsg Virtio ring buffers for message management. These structures are used by the Linux [[Linux remoteproc framework overview | RemoteProc]] framework. The Remoteproc framework is in charge of allocating buffers associated to Vring (for both direction) in the shared memory and of providing information in the rpmsg_vring structures. <syntaxhighlight lang="c" line highlight="1-5,9,11-22"> #define NUM_VRINGS 0x02 /* number of Vring used , must be fixed to 2 (one for TX one for RX) */ #define VRING_ALIGN 0x1000 /* must be fixed to 0x1000 (Linux constraint) */ #define VRING_TX -1 /* allocated by master processor */ #define VRING_RX -1 /* allocated by master processor */ #define VRING_SIZE 8 /* number of 512 bytes buffers associated to a Vring: can be customized */ struct remote_resource_table __resource __attribute__((used)) rproc_resource = { .version = 1, .num = 1, /* rely to number of offsetof structures declared in .offset */ .reserved = {0, 0}, .offset = { offsetof(struct remote_resource_table, rpmsg_vdev), }, /* Virtio device entry */ .rpmsg_vdev= { RSC_VDEV, VIRTIO_ID_RPMSG_, 0, RPMSG_IPU_C0_FEATURES, 0, 0, 0, NUM_VRINGS, {0, 0}, }, /* Vring rsc entry - part of vdev rsc entry */ .rpmsg_vring0 = {VRING_TX, VRING_ALIGN, VRING_SIZE, 1, 0}, .rpmsg_vring1 = {VRING_RX, VRING_ALIGN, VRING_SIZE, 2, 0}, }; </syntaxhighlight> <noinclude> [[Category:Coprocessor management Linux]] [[Category:Coprocessor management STM32Cube]] {{PublicationRequestId | 6230 | 2018-02-17 | AlainF}} </noinclude>
该页面使用的模板:
模板:PublicationRequestId
(
查看源代码
)
返回至
Coprocessor resource table
。
导航
导航
WIKI首页
官方店铺
资料下载
交流社区
所有页面
所有产品
MPU-Linux开发板
MCU-单片机开发板
Linux开发系列视频
单片机开发系列视频
所有模块配件
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志