当前位置:网站首页>Risc-v-qemu-virt in FreeRTOS_ Lock mechanism analysis of GCC
Risc-v-qemu-virt in FreeRTOS_ Lock mechanism analysis of GCC
2022-07-04 05:28:00 【__ pop_】
List of articles
brief introduction
riscv Provides atomic Instruction extension (A)
freertos Also provided Locking mechanism , Let's see how the two rub together
Related concepts
MUTEX( The mutex ) From the ”MUTual EXclusion
Competitive state
Concurrency will produce race
---
We were https://blog.csdn.net/u011011827/article/details/117690639 We have analyzed linux Competitive state of
Be careful : Soft interrupt , Kernel preemption yes linux A unique concept
freertos I won't support it SMP, So it's single core , There are two reasons for the race of mononuclear
1. interrupt
2. Dispatch
and freertos-riscv There are two scheduling opportunities
1. Active scheduling
2. systick(mtimer) Interrupt function Dispatch
therefore about freertos-riscv Come on , " Close the interrupt " Namely solve Competitive Method
But in fact , freertos Of " Locking mechanism " Essentially Namely " Close the interrupt ", Not used riscv Atomic instructions for
freertos lock API
https://blog.csdn.net/qq_26226375/article/details/123955528
./Source/portable/GCC/RISC-V/portmacro.h
98 /*-----------------------------------------------------------*/
99
100
101 /* Critical section management. */
102 #define portCRITICAL_NESTING_IN_TCB 1
103 extern void vTaskEnterCritical( void );
104 extern void vTaskExitCritical( void );
105
106 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
107 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
108 #define portDISABLE_INTERRUPTS() __asm volatile( "csrc mstatus, 8" )
109 #define portENABLE_INTERRUPTS() __asm volatile( "csrs mstatus, 8" )
110 #define portENTER_CRITICAL() vTaskEnterCritical()
111 #define portEXIT_CRITICAL() vTaskExitCritical()
112
113 /*-----------------------------------------------------------*/
Analyze the code implementation , I found it was just off interrupt ( Set up mstatus Medium MIE by 1)
边栏推荐
- Viewing and using binary log of MySQL
- Integer type of C language
- XII Golang others
- Simulated small root pile
- [interested reading] advantageous filtering modeling on long term user behavior sequences for click through rate pre
- Unity is connected to the weather system
- [matlab] general function of communication signal modulation inverse Fourier transform
- 拓扑排序和关键路径的图形化显示
- 1480. 一维数组的动态和
- [matlab] general function of communication signal modulation - generation of narrow-band Gaussian white noise
猜你喜欢

KMP匹配字符串

KMP match string

Letter meaning and parameter abbreviation of optical module Daquan

Build an Internet of things infrared temperature measuring punch in machine with esp32 / rush to work after the Spring Festival? Baa, no matter how hard you work, you must take your temperature first

【雕爷学编程】Arduino动手做(105)---压电陶瓷振动模块

ping端口神器psping

光模塊字母含義及參數簡稱大全

LM small programmable controller software (based on CoDeSys) note 22: error 4268/4052

2022年T电梯修理操作证考试题库及模拟考试

Appearance of LabVIEW error dialog box
随机推荐
Appearance of LabVIEW error dialog box
Just do it with your hands 7 - * project construction details 2 - hook configuration
[matlab] matlab simulates digital bandpass transmission system ask, PSK, FSK system
Simulated small root pile
光模块字母含义及参数简称大全
Several smart watch related chips Bluetooth chip low power consumption
Flask
Useful plug-ins for vscode
Zhongke Panyun - module a infrastructure setting and safety reinforcement scoring standard
[matlab] matlab simulation modulation system SSB system
2022年T电梯修理操作证考试题库及模拟考试
LabVIEW错误对话框的出现
Unity2d -- character moves and turns
C language simple student management system (including source code)
LM small programmable controller software (based on CoDeSys) note 22: error 4268/4052
Flink1.13 basic SQL syntax (II) join operation
flink1.13 sql基础语法(二)join操作
【QT】定时器
Simple g++ and GDB debugging
Flutter ‘/usr/lib/libswiftCore. dylib‘ (no such file)