RT-Thread / RT-Thread/rt-thread

[Feature] rtt进入临界区直接粗暴的关掉全局中断,为何不像FreeRtos那样,只关闭受操作系统管理的中断,而不关闭不受操作系统管理的中断

Open
#9,169 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

RT-Thread Version
master
Hardware Type/Architectures
bsp/stm32
Develop Toolchain
GCC

Describe problem solved by the proposed feature

https://github.com/RT-Thread/rt-thread/blob/master/libcpu/arm/cortex-m4/context_gcc.S#L34-L39

.global rt_hw_interrupt_disable
.type rt_hw_interrupt_disable, %function
rt_hw_interrupt_disable:
    MRS     r0, PRIMASK
    CPSID   I
    BX    

image

https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/portable/GCC/ARM_CM4F/portmacro.h#L122
https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/portable/GCC/ARM_CM4F/portmacro.h#L213-L247

    __asm volatile
    (
        "   mov %0, %1                                              \n" \
        "   msr basepri, %0                                         \n" \
        "   isb                                                     \n" \
        "   dsb                                                     \n" \
        : "=r" ( ulNewBASEPRI ) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) : "memory"
    );

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with libcpu/arm/cortex-m4/context_gcc.S, especially rt_hw_interrupt_disable, and compare its PRIMASK handling with the referenced FreeRTOS portmacro.h BASEPRI implementation. Determine the required RT-Thread behavior for interrupts outside OS management and verify the result on the stated STM32/GCC Cortex-M4 setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.