当前位置:网站首页>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)
边栏推荐
- Void convolution, deformable convolution, deformable ROI pooling
- Zhongke Panyun - module a infrastructure setting and safety reinforcement scoring standard
- (4) Canal multi instance use
- 力扣 第 300 场周赛
- Exercise bubble sort
- KMP match string
- 简易零钱通
- 小程序毕业设计---美食、菜谱小程序
- Yyds dry goods inventory TCP & UDP
- ping端口神器psping
猜你喜欢
[high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk
June 2022 summary
Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
2022g2 power station boiler stoker special operation certificate examination question bank and answers
Programming example of stm32f1 and stm32subeide -74hc595 drives 4-bit 7-segment nixie tube
光模块字母含义及参数简称大全
Solar insect killing system based on single chip microcomputer
724. 寻找数组的中心下标
【QT】制作MyComboBox点击事件
Analysis of classical pointer and array written test questions in C language
随机推荐
【QT】定时器
Trie数-字典树
基于单片机的太阳能杀虫系统
The data mark is a piece of fat meat, and it is not only China Manfu technology that focuses on this meat
Write a complete answer applet (including single choice questions, judgment questions and multiple topics) (III) single choice questions, judgment questions, and the first question display
Nodejs learning document
Just do it with your hands 7 - * project construction details 2 - hook configuration
ETCD数据库源码分析——初始化总览
[matlab] matlab simulates digital baseband transmission system - digital baseband transmission system
[matlab] general function of communication signal modulation Fourier transform
ansys命令
LM small programmable controller software (based on CoDeSys) note XXI: error 3703
Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
Thread pool: use thread pool to optimize query speed
724. 寻找数组的中心下标
2022 t elevator repair operation certificate examination question bank and simulation examination
Solar insect killing system based on single chip microcomputer
Zhongke panyun-2022 Guangdong Trojan horse information acquisition and analysis
EVM proof in appliedzkp zkevm (11)
LM小型可编程控制器软件(基于CoDeSys)笔记二十一:错误3703