《2-12657-Adapt Open Source Operating System RT-Thread to Core-V-MCU.pdf》由會員分享,可在線閱讀,更多相關《2-12657-Adapt Open Source Operating System RT-Thread to Core-V-MCU.pdf(20頁珍藏版)》請在三個皮匠報告上搜索。
1、Adapt Open Source Operating System RT-Thread to Core-V-MCUHenson Guo,at RT-Thread Open and Easy to Use Operating System20142014Launched 1.2.0Added key components like msh20172017Launched 3.0.o as an IoT OS version202320232010201020092009Launched 0.3.0Added file system,network protocols,command line,
2、etcLaunched 0.2.4Introduced lightweight TCP/IP protocol20062006Started RT-Thread project,launched 0.1.0 kernel20112011Launched 1.0.0Have Complete RTOS features after all the stabilities tested20192019Launched 4.0.0 Launched 4.0.0 Added Applets,Added Applets,SMP,SMP,StuStudio IDE built dio IDE built
3、20222022Launched 5.0.0Launched 5.0.0RT-Thread SmartRT-Thread SmartMicro KernelMicro Kernelhttps:/www.rt-thread.ioOverviewOpen and Easy to Use Operating Systemhttps:/www.rt-thread.ioWhy RT-Thread?01 SimplicityWere more focusing and emphasizing the simplicity,making things clear and for certain.We put
4、 kernel,file system,shell and many other features well designed into a simple way,the code and the file are the best fit.02 Object Oriented DesignRT-Thread applies object-oriented programming methods.Code is elegant,neat,as well as high reusability.03 ModularizationModularize programming,componentiz
5、e programming.For example file system,network protocol stack,device driver,command line,etc.04 Easy to useWere doing a lot of work to make the RT-Thread easy to use and keep you productive.Apart from the system part,I want to thank the power of the developer community,which has empowered many energi
6、es for this open-source project.We have many documents,materials,BSPs,PRs from the community,and feedback to the community.You can easily find support in RT-Thread.Open and Easy to Use Operating Systemhttps:/www.rt-thread.ioRT-Thread Kernel Interrupt latency less than 1us.A cycle of task switching i
7、n about 200.01.High Real Time01.High Real Time The line of code of kernel is less than 5000.3 KB Flash,1.5 KB RAM usage.02.02.ExtremelyExtremely S Streamlinedtreamlined Has installed on billions of devices.Applied in the field of Electricty,Industry,Rail transit,Consumer electronics and many more.03
8、.High Reliability03.High ReliabilitySemaphoreEventMutexMailboxMsgQThread MgrTimerInterruptMemory MgrCommand shellARMRISC-VOpen and Easy to Use Operating Systemhttps:/www.rt-thread.ioRT-Thread Kernel+Components File system,protocol stack.Great command-line interaction style.01.Complete 01.Complete OS
9、 FunctionalityOS Functionality Support mainstream tool chain,compiler.Provide a unified command-line compilation experience in the form of scons.02.Many 02.Many IDEs SuppportedIDEs Suppported Low resource occupancy.low coupling high cohesion.03.03.Delivers a Competitive OSDelivers a Competitive OSKe
10、rnelPlatformARMRISC-Vlibcpu/BSPSALRT-Thread KernelPOSIX API|C+|RT-Thread APIDFSlwIPFATFSROMFSATulogDevice DriversshellOpen and Easy to Use Operating Systemhttps:/www.rt-thread.ioRT-Thread Platform+Packages Clear structure and low coupling between components.Home-made easy to use development tools.01
11、.01.Highly Highly C Customizableustomizable Intergrate chips,components/software packages,web applications and community platform,network applications to build a complete ecosystem.02.Complete Ecosystem02.Complete Ecosystem03.一體化系統一體化系統 Applications are compiled with the kernel for maintenance as a
12、whole.03.System U03.System UnificationnificationPlatformARMRISC-Vlibcpu/BSPKernel and ComponentsPOSIX API|C+|RT-Thread APIsecuritytoolslanguagesystemAIperipheralsIoTmultimediaPackagesPlatformARMRISC-Vlibcpu/BSPKernel and ComponentsPOSIX API|C+|RT-Thread APIsecuritytoolslanguagesystemAIperipheralsIoT
13、multimediaPackagesOpen and Easy to Use Operating Systemhttps:/www.rt-thread.ioRT-Thread Smart for AI and IoT Application and kernel consistent with RT-Thread API.The user mode is highly extensible.03.Same API03.Same API 500 KB in size.Only contains basic functionalities,customization options are ava
14、ilable(like adjusting system service location).01.Lite Kernel01.Lite Kernel 02.User Mode System Service02.User Mode System Service Removable and restartable.Each application process has a separate address space,isolated from each other to stay secure.File SystemsNetwork StackUser AppsUser DriversRT-
15、Thread SmartKernelSALDFSThread MgrAddr MgrSchedulerProcess MgrOpen and Easy to Use Operating Systemhttps:/www.rt-thread.ioEcosystem-IC Open and Easy to Use Operating Systemhttps:/www.rt-thread.ioEcosystem IDE and ToolsRT-Thread StudioRT-Thread StudioIncludes operating system project creation and man
16、agement,code editing,tailoring configuration,build configuration,debugging configuration,program download and debug,etc.All in OneSupports creating the project based on the board and automatically generating the code,can quickly validate prototypes.Easy to UseA variety of emulators are supported and
17、 integrated with multiple types of terminal tools.Easily get started debugging&developing even without having hardware on hands.Simulation Development Open and Easy to Use Operating Systemhttps:/www.rt-thread.ioEcosystem-CommunityCommunity ActivitiesCommunity ActivitiesnHolding Holding 4040+training
18、 sessions training sessions and and salons salons per year per yearnHolding Holding 4040+live streams and 5 online learning sessions per year live streams and 5 online learning sessions per yearnHolding at least Holding at least 2 2 D Developer eveloper C Conferencesonferences and and design design
19、contestcontests s per per yearyearnMaintaining a community working&studying groupMaintaining a community working&studying groupLearning MaterialsLearning Materialsn4 published books in Chines plus 1 English book4 published books in Chines plus 1 English booknMaintaining a comprehensive documentation
20、 centerMaintaining a comprehensive documentation centernSupporting more than 100 dev boardsSupporting more than 100 dev boardsnOutputing more than 5 new technical articles per Outputing more than 5 new technical articles per weekweek高可靠實時操作系統https:/www.rt-Books/PublishedThe Design and Implementation
21、 of the RT-Thread Operating System Published by American Publishing Group CRC PressOpen and Easy to Use Operating Systemhttps:/www.rt-thread.ioThis transplantation is based on the FreeRTOS project of CORE-V-MCU provided by PLCT of Chinese Academy of Sciences.It runs and tests on QEMU in Linux enviro
22、nment provided by PLCT,so the compilation and debugging environment required for transplantation should be set up in Linux environment first.Adapt to RT-ThreadOpen and Easy to Use Operating Systemhttps:/www.rt-thread.ioTo reduce porting difficulty,RT-Thread provides a generic porting code in the com
23、mon folder for the 32-bit RISC-V architecture kernel.RV32 Universal Port CodeAdapt to RT-ThreadOpen and Easy to Use Operating Systemhttps:/www.rt-thread.ioFor core-v-mcu,call the interrupt source query distribution function given by RT-Thread,which is implemented in the trap_gcc.S filetrap_gcc.Sregi
24、sterAdapt to RT-ThreadOpen and Easy to Use Operating Systemhttps:/www.rt-thread.ioThe address of the interrupt stack needs to be loaded uniformly after the system is started,we need to add the following code after the location of the name of the interrupt stack in the link scriptAdapt to RT-ThreadOp
25、en and Easy to Use Operating Systemhttps:/www.rt-thread.ioModify the interrupt entry function to change the original interrupt entry function name to the interrupt entry function name provided by RT-Threadvector_table:j freertos_risc_v_trap_handler j freertos_risc_v_trap_handlerj freertos_risc_v_tra
26、p_handler .vector_table:j SW_handler j SW_handlerj SW_handler.Adapt to RT-ThreadOpen and Easy to Use Operating Systemhttps:/www.rt-thread.ioThe interrupt function of the original system has been enabled and the interrupt entry function has been implemented.Modify the interrupt entry function of the
27、original system timer at the time of migration.void timer_irq_handler(uint32_t mcause)if(xTaskIncrementTick()!=0)vTaskSwitchContext();void timer_irq_handler(uint32_t mcause)rt_interrupt_enter();rt_tick_increase();rt_interrupt_leaves();The normal operation of the RT-Thread system requires an accurate
28、 clock beat.This is achieved by periodically calling the rt_tick_increase()function in the interrupt function.Adapt to RT-ThreadOpen and Easy to Use Operating Systemhttps:/www.rt-thread.io#define RT_HEAP_SIZE(64*1024)static rt_uint8_t rt_heapRT_HEAP_SIZE;void*rt_heap_begin_get(void)return rt_heap;vo
29、id*rt_heap_end_get(void)return rt_heap+RT_HEAP_SIZE;To realize dynamic memory,add the following code in board.c:Add the following code to void rt_hw_board_init():rt_system_heap_init(rt_heap_be gin_get(),rt_heap_end_get();Adapt to RT-ThreadOpen and Easy to Use Operating Systemhttps:/www.rt-thread.ioc
30、har rt_hw_console_getchar(void)Add the following code in the.text section of the link script:Implement the following two functions:void rt_hw_console_output(const char*str).=ALIGN(4);_fsymtab_start=.;KEEP(*(FSymTab)_fsymtab_end=.;.=ALIGN(4);_vsymtab_start=.;KEEP(*(VSymTab)_vsymtab_end=.;.=ALIGN(4);Adapt to RT-ThreadOpen and Easy to Use Operating Systemhttps:/www.rt-thread.io