fix(rf): register isr_jump.asm and redirect Port3 vector 40
App/isr_jump.asm was never added to wristband.uvproj, so the Port0/Port2/Port3 hardware vector redirects it defines were never assembled. Port3_Isr (declared as interrupt 16) never actually ran on real P3 port events, causing the edge-interrupt-driven RF decode to silently never fire. Adds the missing CSEG/LJMP redirect for vector 40 and registers the file as FileType=2.
This commit is contained in:
@@ -4,11 +4,17 @@
|
||||
; 【技术原理分析】:
|
||||
; 1. Keil C251 编译器为了节省硬件资源,默认的 `interrupt` 关键字只支持 0 ~ 31 范围的软件中断向量号。
|
||||
; 2. 然而,STC32G 单片机拥有大量的扩展硬件外设,其 Port0 端口中断物理向量号为 37,Port2 端口中断物理向量号为 39,
|
||||
; 超出了编译器的直接定义范畴。如果直接在 C 语言中声明 `interrupt 37`,编译器会报错。
|
||||
; Port3 端口中断物理向量号为 40 (定义见 Drivers/stc32g.h 的 P0INT_VECTOR/P2INT_VECTOR/P3INT_VECTOR),
|
||||
; 均超出了编译器的直接定义范畴。如果直接在 C 语言中声明 `interrupt 37`,编译器会报错。
|
||||
; 3. 为此,本汇编模块采用“绝对地址跳转重定向”技术:
|
||||
; - 直接在硬件物理中断向量入口地址(Port0: 0x00012B, Port2: 0x00013B)处放置一条长跳转 `LJMP` 汇编指令。
|
||||
; - 将触发的物理中断强行重定向引导至 Keil C251 所能合法编译生成的较小编译向量入口地址(例如 13 号和 15 号中断服务程序入口)。
|
||||
; - 由此,我们在 C 语言中声明 `interrupt 13` 和 `interrupt 15`,就能够成功被硬件 Port0 和 Port2 端口中断触发调用。
|
||||
; - 直接在硬件物理中断向量入口地址(Port0: 0x00012B, Port2: 0x00013B, Port3: 0x000143)处放置一条长跳转 `LJMP` 汇编指令。
|
||||
; - 将触发的物理中断强行重定向引导至 Keil C251 所能合法编译生成的较小编译向量入口地址(例如 13、15、16 号中断服务程序入口)。
|
||||
; - 由此,我们在 C 语言中声明 `interrupt 13`、`interrupt 15`、`interrupt 16`,就能够成功被硬件
|
||||
; Port0、Port2、Port3 端口中断触发调用。
|
||||
; 【重要修复记录】:Port3 这条重定向此前一直缺失——C 代码里 `Port3_Isr` 声明的是 `interrupt 16`
|
||||
; (对应真实向量 16 号 INT4,与 P3 端口无关),而 P3 端口真正的硬件向量号是 40,此前没有任何代码
|
||||
; 把向量 40 重定向过去,导致 P3.6 硬件中断真正触发时,CPU 会跳转到 0x000143 这个从未写入过任何
|
||||
; 指令的地址,造成运行跑飞/复位。现已补上对应的跳转条目。
|
||||
; =========================================================================
|
||||
|
||||
NAME ISR_JUMP ; 定义当前汇编模块的名字为 ISR_JUMP
|
||||
@@ -31,4 +37,13 @@ CSEG AT 00013BH
|
||||
; 0x00007B 即为 C 语言声明的 `interrupt 15` 所对应的中断服务函数入口地址
|
||||
LJMP 00007BH
|
||||
|
||||
; -------------------------------------------------------------------------
|
||||
; 端口 3 掉电唤醒/常态边沿中断跳转配置 (P3.6 / RF_RX_DATA)
|
||||
; -------------------------------------------------------------------------
|
||||
; 硬件 Port3 中断向量号 40 (P3INT_VECTOR) 对应的绝对闪存入口地址为 0x000143
|
||||
CSEG AT 000143H
|
||||
; 当硬件触发 Port3 中断时,程序计数器 (PC) 定位到 000143H,此处 LJMP 指令强行将 PC 指向 000083H
|
||||
; 0x000083 即为 C 语言声明的 `interrupt 16` 所对应的中断服务函数入口地址 (Port3_Isr)
|
||||
LJMP 000083H
|
||||
|
||||
END ; 汇编文件结束标志
|
||||
|
||||
@@ -329,6 +329,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\App\main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>isr_jump.asm</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>.\App\isr_jump.asm</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>rgb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
||||
Reference in New Issue
Block a user