中文版 / Chinese Version
Current page: English
A lightweight RT-Thread utility package for inspecting Cortex®-M NVIC interrupt priorities from the MSH shell. It can display enabled interrupts, sort them by IRQ number or priority, and update the priority of a selected IRQ at runtime.
- 📘 Online Documentation: https://wdfk-prog.space/rt-thread-get_irq_priority/
get_irq_priority is a debugging-oriented package for RT-Thread. It is designed to:
- list currently enabled interrupts;
- show IRQ number, IRQ name, Pending/Active state, and priority;
- print the output sorted by IRQ number or interrupt priority;
- temporarily change the priority of a selected IRQ from the command line.
The output style is intentionally close to the NVIC view in the Keil debugger, which makes it useful for cross-checking runtime behavior against IDE/debugger expectations.
Based on the uploaded source package, the project currently includes IRQ name tables for the following STM32 families:
- STM32F0
- STM32F1
- STM32F2
- STM32F3
- STM32F4
- STM32F7
- STM32G0
- STM32G4
- STM32H7
- STM32L0
- STM32L4
- STM32H750
- STM32F747
- STM32F429
- STM32F103
The package reads NVIC runtime information through CMSIS APIs, including:
NVIC_GetEnableIRQ()NVIC_GetPendingIRQ()NVIC_GetActive()NVIC_GetPriority()NVIC_SetPriority()
The output covers two categories:
-
Cortex-M exception types
Such asNonMaskableInt_IRQn,HardFault_IRQn,MemoryManagement_IRQn,PendSV_IRQn, andSysTick_IRQn. -
External interrupts (IRQs)
That is, device interrupts defined by the chip IRQ table.
With the default command, the package first prints exception-type entries and then prints enabled IRQs.
get_irq_priority
├── figures/ # Screenshots used by the documentation
├── inc/ # IRQ name tables for different STM32 families
│ ├── irq_stm32f0.h
│ ├── irq_stm32f1.h
│ ├── irq_stm32f2.h
│ ├── irq_stm32f3.h
│ ├── irq_stm32f4.h
│ ├── irq_stm32f7.h
│ ├── irq_stm32g0.h
│ ├── irq_stm32g4.h
│ ├── irq_stm32h7.h
│ ├── irq_stm32l0.h
│ └── irq_stm32l4.h
├── src/
│ └── get_irq.c # Core implementation and MSH entry
├── Kconfig # Package configuration entry
├── LICENSE # LGPL-2.1
├── SConscript # RT-Thread build script
└── readme.md # Original README (recommended to rename to README.md)
Before using this package, make sure the project meets the following requirements:
- RT-Thread MSH / FinSH is enabled;
- a console device is correctly registered;
- the target platform is an STM32 Cortex-M device;
- CMSIS and chip-specific IRQ definitions are available in the build.
The current Kconfig contains:
depends on SOC_FAMILY_STM32
So the online package menu entry is only exposed when the STM32 SoC family condition is satisfied.
- Download or copy the
get_irq_prioritypackage directory. - Place it into a manageable location in your project.
- Add
src/get_irq.cto the build. - Make sure the expected chip macro is defined, such as
SOC_SERIES_STM32H7orSOC_SERIES_STM32F4. - Rebuild the project.
The package can be enabled from:
RT-Thread online packages -> miscellaneous packages -> get_irq_priority
If SOC_FAMILY_STM32 is not selected correctly, the package may not appear in the menu. In that case, check the BSP SoC/Kconfig setup first.
The package registers the following shell command:
nvic_irqSupported forms are listed below.
nvic_irqBehavior:
- prints Cortex-M exception-type information first;
- then prints the currently enabled external interrupts;
- IRQ entries are listed in ascending IRQ-number order.
This is the most complete view and is useful for a quick NVIC inspection.
nvic_irq numBehavior:
- prints enabled external interrupts only;
- sorts them by ascending IRQ number.
nvic_irq priorityBehavior:
- prints enabled external interrupts only;
- sorts them by priority from low to high, following the wording and implementation used by the source code.
Note
In real projects, you should interpret this together with the priority encoding rules of your Cortex-M target, because “smaller numeric value” and “higher logical priority” are not the same statement.
nvic_irq set <IRQn> <priority>Example:
nvic_irq set 25 3Behavior:
- directly calls
NVIC_SetPriority(IRQn, priority)at runtime; - affects the current runtime state only;
- does not persist the change back into static project configuration.
Parameter constraints:
IRQnmust be within the current IRQ table range;prioritymust be in the range0 ~ 15.
The command header looks like this:
num IRQ name E P A Priotity
--- -------- - - - --------
Column meanings:
num: IRQ numberIRQ name: interrupt nameE: Enable stateP: Pending stateA: Active statePriotity: priority value reported by the current implementation
Note
The source code and existing README both use the spellingPriotity. If the project is maintained further, it would be better to normalize it toPriority.
Both nvic_irq and nvic_irq num ultimately print enabled IRQs in IRQ-number order.
nvic_irq priority caches the priority of enabled IRQs, sorts that buffer, and then prints the results.
This makes it useful for:
- checking which interrupts currently share the same priority;
- reviewing preemption ordering;
- diagnosing timing issues or priority inversions.
- verifying that critical peripheral IRQs are enabled after BSP initialization;
- checking priority assignments for DMA, UART, TIM, EXTI, and similar interrupts;
- comparing runtime NVIC state against the Keil debugger view;
- verifying whether later driver initialization accidentally overwrote IRQ priorities;
- temporarily adjusting priorities to observe behavior changes.
CMSIS/NVIC access principle:
Comparison with the Keil NVIC view:
Default output example:
Priority-sorted output example:
Set-priority example:
Default query:
Priority-sorted query:
Set priority:
Default query:
Priority-sorted query:
Default query:
Priority-sorted query:
Default query:
Priority-sorted query:
- The package depends on console output; make sure a console device is available.
- The online-package entry currently depends on
SOC_FAMILY_STM32. - IRQ name tables are maintained per STM32 family in the current implementation.
- The
setcommand changes priorities at runtime; it is not a replacement for BSP/driver initialization code. - If MSH / FinSH is not enabled, the command-line interface will not be available.
- Disabled IRQs are not printed in the IRQ list.
This project is licensed under LGPL-2.1. See the LICENSE file for details.
- Maintainer:
wdfk-prog - Repository:
https://github.com/wdfk-prog/rt-thread-get_irq_priority











