|
移植Cortex-M程序到RV32中的问题
|
Abstract:
具有开源、简单和灵活等特点,RISC-V架构受到业界广泛关注。近年来,市场上相继出现了多款RISC-V架构微处理器,32位RISC-V架构MCU正逐步进入Cortex-M MCU应用领域。本文针对将应用程序从RV32移植到Cortex-M的需求,分析RV32与Cortex-M结构、编程模型和过程调用规范等方面的不同之处,提出程序移植过程中遇到的问题,提出方法和建议,并进行相关性能分析和比较。
As a simplicityand flexibilityopen source microprocessor architecture, RISC-V has received widespread attention in the industry. In recent years, a lot of RISC-V microprocessors have been emerging in the market. The MCUs with the core of RV32 core are gradually entering into the ap-plication fields of Cortex-M MCUs. This article introduces the differences between RV32 and Cor-tex-M in terms of structure, programmer’s model, and procedure call convention, discusses the problems during the program porting processfromCortex-MtoRV32, proposes some suggestions, and conducts relevant performance comparison.
[1] | Waterman, A. (2016) Design of the RISC-V Instruction Set Architecture. Ph.D. Dissertation, University of California. https://www2.eecs.berkeley.edu/Pubs/TechRpts/2016/EECS-2016-1.html |
[2] | SiFive FE310-G002 Manual v1p5. https://www.sifive.com/ |
[3] | RISC-V. https://www.gigadevice.com/product/mcu/risc-v |
[4] | 青稞RISC-V通用系列[EB/OL]. https://www.wch.cn/products/productsCenter/mcuInterfacecategoryId=70, 2024-06-10. |
[5] | 微控制器[EB/OL]. https://www.hpmicro.com/product/product.html?id=07e8d638-1c6c-44d1-9e53-a48d8560ad78, 2024-06-10. |
[6] | Reness Introduces Industry’s First General-Purpose 32-bit RISC-V MCUs with Internally Developed CPU Core. https://www.renesas.com/us/en/about/press-room/renesas-introduces-industry-s-first-general-purpose-32-bit-risc-v-mcus-internally-developed-cpu-core |
[7] | Embedded-Studio. https://www.segger.com/downloads/embedded-studio/ |
[8] | The Leading Commercial Tools for RISC-V. https://www.iar.com/products/architectures/risc-v/ |
[9] | Eclipse Embedded CDT (C/C++ Development Tools). https://projects.eclipse.org/projects/iot.embed-cdt |
[10] | Singhal, S.P., Sridevi, M., Narayanan, N.S., et al. (2021) Porting of eChronos RTOS on RISC-V Architecture. In: Hura, G.S., Singh, A.K. and Siong Hoe, L., Eds., Advances in Communication and Computational Technology, Springer, 1269-1279. https://doi.org/10.1007/978-981-15-5341-7_96 |
[11] | Pieper, P., Herdt, H. and Drechsler, R. (2022) Advanced Embedded System Modeling and Simulation in an Open Source RISC-V Virtual Prototype. Journal of Low Power Electronics and Applications, 12, Article 52. https://doi.org/10.3390/jlpea12040052 |
[12] | 在RISC-V微控制器上使用FreeRTOS[EB/OL]. https://www.freertos.org/zh-cn-cmn-s/Using-FreeRTOS-on-RISC-V.html, 2024-06-13. |
[13] | 邰阳, 韩昌刚, 全雨, 于佳耕, 武延军. 基于QEMU RISC-V架构的OpenHarmony标准系统移植[J]. 计算机系统应用, 2023, 32(11): 21-28. |
[14] | Gordon, N., Pedretti, K. and Lange, J.R. (2022) Porting the Kitten Lightweight Kernel. Operating System to RISC-V. IEEE/ACM International Workshop on Runtime and Operating Systems for Supercomputers (ROSS), Dallas, 13-18 November 2022, 1-7. https://doi.org/10.1109/ROSS56639.2022.00008 |
[15] | Zhang, L. (2022) The Porting and Optimization of RISC-V UEFI Boot. 2022 7th International Conference on Intelligent Computing and Signal Processing (ICSP), Xi’an, 15-17 April 2022, 840-843. https://doi.org/10.1109/ICSP54964.2022.9778600 |
[16] | Balas, R. and Benini, L. (2021) RISC-V for Real-Time MCUs—Software Optimization and Microarchitectural Gap Analysis. 2021 Design, Automation & Test in Europe Conference & Exhibition (DATE), Grenoble, 1-5 February 2021, 874-877. https://doi.org/10.23919/DATE51398.2021.9474114 |
[17] | Arm Holdings Market Share across Key Technology Markets Worldwide 2020-2022. https://www.statista.com/statistics/1132112/arm-market-share-targets/ |
[18] | 21世纪经济报道. RISC-V快速成长, 哪些应用领域落地更快更完整? [EB/OL]. https://new.qq.com/rain/a/20221130A0AATG00.html, 2022-11-30. |
[19] | ARMv7-M Architecture Application Level Reference Manual. https://www.arm.com/ |
[20] | RISC-V Foundation, the RISC-V Instruction Set Manual, Volume I: Unprivileged ISA. https://riscv.org/ |
[21] | GigaDevice, GD32VF103 User Manual V1.2. f https://www.gd32mcu.com/data/documents/userManual/GD32VF103_User_Manual_Rev1.5.pdf |
[22] | Coremark 1.0. https://github.com/eembc/coremark |
[23] | STM32 Cortex®-M4 MCUs and MPUs Programming Manual. https://www.st.com.cn/resource/en/programming_manual/pm0214-stm32-cortexm4-mcus-and-mpus-programming-manual-stmicroelectronics.pdf |
[24] | Procedure Call Standard for the ARM Architecture. https://eecs.umich.edu/courses/eecs373/readings/ARM-AAPCS-EABI-v2.08.pdf |
[25] | Understanding RISC-V Calling Convention. https://cs.sfu.ca/~ashriram/Courses/CS7ARCH/assets/notebooks/RISCV/RISCV_CALL.pdf |