同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
To implement board-level driver adaptation, perform the following steps:
Develop the SDK based on the CMSIS/POSIX APIs provided by OpenHarmony.
The board-level SDK can be adapted to OS interfaces via CMSIS and POSIX APIs. Currently, the LiteOS Cortex-M kernel is adapted to most CMSIS APIs (including APIs used for basic kernel management, thread management, timer, event, mutex, semaphore, and queue), which meets the requirements of porting. POSIX APIs provide basic capabilities for porting, and more POSIX APIs are to be implemented. If the SDK is implemented based on the CMSIS or POSIX APIs, it can directly adapt to the LiteOS Cortex-M kernel.
If the SDK is developed based on other embedded OSs such as FreeRTOS, or has an abstraction layer for OS interfaces, it is recommended that the OS-dependent APIs be directly adapted to the CMSIS APIs.
Here is an OS interface defined by a product for creating a queue:
bool osif_msg_queue_create(void **pp_handle, uint32_t msg_num, uint32_t msg_size)
The CMSIS API used for creating a queue is as follows:
osMessageQueueId_t osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr);
The following example shows how to adapt the OS interface to the CMSIS API:
#include "CMSIS_os2.h"
osMessageQueueId_t osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr);
bool osif_msg_queue_create(void **pp_handle, uint32_t msg_num, uint32_t msg_size)
{
(*pp_handle) = osMessageQueueNew (msg_num, msg_size, NULL);
if((*pp_handle) == NULL){
return FALSE;
}
return TRUE;
}
Compile the SDK independently or modify the SDK based on the OpenHarmony building framework and integrate the SDK code into the device directory of OpenHarmony as required.
After completing the OS API adaptation, you can integrate the board-level driver to OpenHarmony by the following two methods:
Verify the basic functions of the SDK.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。