Preface
The openharmony transplantation example is based on the latest master version. The currently supported chips are:
STM32F407
GD32F303
GD32F450
The goal is to port more development boards and more MCUs to support OpenHarmony
After several days of hard work, we finally successfully transplanted the latest version of the OpenHarmony lightweight system kernel to the ARM microcontroller. Now the code is open source and 7 transplant articles have been completed. We will consider adding video explanations and live broadcasts in the future. So that everyone can transplant themselves.
Effect
The photo of the development board is as follows. I bought one randomly online.
The OpenHarmony kernel is now running, and the LED lights on the development board can flash.
Serial port debugging print information:
The system created two threads, as follows:
//线程2,用于点灯和打印
VOID TaskSampleEntry2(VOID)
{
printf("______>>>>>>>>> %s %d\r\n", __FILE__, __LINE__);
led_init();
while (1) {
printf("___>>>>>> %s %d\r\n", __FILE__, __LINE__);
led_on(0);
led_on(1);
led_on(2);
led_on(3);
LOS_TaskDelay(1000);
led_off(0);
led_off(1);
led_off(2);
led_off(3);
LOS_TaskDelay(1000);
}
}
//线程1,用于打印
VOID TaskSampleEntry1(VOID)
{
printf("______>>>>>>>>> %s %d\r\n", __FILE__, __LINE__);
while (1) {
printf("___>>>>>> %s %d\r\n", __FILE__, __LINE__);
LOS_TaskDelay(1000);
}
}
//创建线程
VOID TaskSample(VOID)
{
UINT32 uwRet;
UINT32 taskID1;
UINT32 taskID2;
UINT32 taskID3;
TSK_INIT_PARAM_S stTask = {
0};
stTask.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskSampleEntry1;
stTask.uwStackSize = 0x1000;
stTask.pcName = "TaskSampleEntry1";
stTask.usTaskPrio = 6; /* Os task priority is 6 */
uwRet = LOS_TaskCreate(&taskID1, &stTask);
if (uwRet != LOS_OK) {
printf("Task1 create failed\r\n");
}
stTask.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskSampleEntry2;
stTask.uwStackSize = 0x1000;
stTask.pcName = "TaskSampleEntry2";
stTask.usTaskPrio = 7; /* Os task priority is 7 */
uwRet = LOS_TaskCreate(&taskID2, &stTask);
if (uwRet != LOS_OK) {
printf("Task2 create failed\r\n");
}
}
Code open source
All codes for this transplant will be open sourced to everyone, and adaptation will continue. Later, network card, LCD, touch screen and other drivers will be adapted.
At the same time, a live broadcast will be organized to teach everyone how to transplant and use
Open source warehouse:
https://gitee.com/qidiyun/openharmony-bsp-example/tree/master