如果设备已经开启了Secure Boot,可以通过Unsigned PD的方式开发Hexagon DSP的应用:
Unsigned PD is a sandboxed low-rights process that allows the signature-free modules to run on the cDSP
只需要三行代码,就可以帮助开发者确定设备是否支持Unsigned PD:
UNSIGNED_PD_SUPPORT
Description: Check if DSP supports unsigned PD.
Return value: Supported = 1, unsupported = 0.
Example:
// Querying CDSP struct remote_dsp_capability dsp_cap = {CDSP_DOMAIN_ID, UNSIGNED_PD_SUPPORT, 0}; remote_handle_control(DSPRPC_GET_DSP_INFO, &dsp_cap, sizeof(struct remote_dsp_capability); printf("Result of capability query for UNSIGNED_PD_SUPPORT is %d", dsp_cap.capability);
如果确定设备支持Unsigned PD,就可以通过下面这段代码获得创建Unsigned PD的权限,但是这段代码必须在调用FastRPC函数前执行:
#pragma weak remote_session_control
if (remote_session_control) {
struct remote_rpc_control_unsigned_module data;
data.enable = 1;
data.domain = CDSP_DOMAIN_ID;
remote_session_control(DSPRPC_CONTROL_UNSIGNED_MODULE, (void*)&data, sizeof(data));
}
未签名的模块,存在一些限制,下面的内容摘自Hexagon SDK 3.5.1的文档:
Unsigned PD available services
Thread creation and thread services
Timer creation and timer services
HVX contexts
Clock frequency controls
VTCM
Cache operations
Map HLOS memory allocated by corresponding HLOS application
Unsigned PD limitations
Access to limited drivers i.e. UBWC/DMA and Camera Streamer are not available to Unsigned PDs
Following are the limitations on Threads per Unsigned PD:
Thread priority ceiling (Highest priority for any Unsigned PD thread) : 64
Maximum number of threads allowed per Unsigned PD : 128
NOTE: These limitations could change in the future.
简而言之,部分驱动是不可访问的,同时线程的优先级和最大线程数也会受限,但是基本功能都是可用的,而且这些限制在以后可能会有变动。
对于三方开发者,可以通过这种方式在Hexagon DSP上开发应用,或者在调试程序时,如果觉得给设备签名很麻烦,也可以采用这种方式。