You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Keil MDK-ARM V5.38搭配ARM Compiler V6.19时__isb()未定义问题求助

uC/OS-III 搭建中__isb未定义的链接错误解决方法

问题场景

使用Keil MDK-ARM专业版V5.38.0.0,编译器为ARM Compiler V6.19,搭建uC/OS-III项目时,链接阶段终止并报错:

.\Objects\main.axf: Error: L6218E: Undefined symbol __isb (referred from os_core.o).

问题根源是os_cpu.h中的宏OS_TASK_SW_SYNC()调用了__isb(0xF),该宏在os_core.c中被引用,但编译器无法找到__isb的定义。

完整构建输出:

Rebuild started: Project: main
*** Using Compiler 'V6.19', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Rebuild target 'STM32F103'
compiling main.c...
compiling os_core.c...
compiling os_var.c...
compiling os_cfg_app.c...
compiling os_dbg.c...
compiling os_flag.c...
compiling os_mem.c...
compiling os_msg.c...
compiling os_mutex.c...
compiling os_prio.c...
compiling os_q.c...
compiling os_sem.c...
compiling os_stat.c...
compiling os_task.c...
compiling os_tick.c...
compiling os_time.c...
compiling os_tmr.c...
compiling os_app_hooks.c...
compiling os_cpu_c.c...
assembling os_cpu_a.asm...
assembling cpu_a.asm...
compiling cpu_core.c...
compiling cpu_c.c...
compiling lib_ascii.c...
compiling lib_math.c...
compiling lib_mem.c...
compiling lib_str.c...
assembling startup_stm32f10x_md.s...
compiling system_stm32f10x.c...
linking...
.\Objects\main.axf: Error: L6218E: Undefined symbol __isb (referred from os_core.o).
Not enough information to list image symbols.
Not enough information to list load addresses in the image map.
Finished: 2 information, 0 warning and 1 error messages.
".\Objects\main.axf" - 1 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:05

解决方法

  • 添加ARM编译器内置函数头文件
    在os_cpu.h或者引用该宏的os_core.c开头,添加头文件:

    #include <arm_acle.h>
    

    ARM Compiler V6中,__isb这类内置指令函数定义在arm_acle.h中,引入后编译器就能识别该函数。

  • 直接替换为内嵌汇编
    如果不想依赖头文件,可以把宏定义替换为内嵌汇编。对于STM32F103对应的Cortex-M3架构,__isb(0xF)对应的汇编指令是ISB 0xF,修改宏定义:

    #define OS_TASK_SW_SYNC()  __asm volatile ("ISB 0xF")
    

    直接通过内嵌汇编实现同步屏障功能,绕过对__isb函数的依赖。

  • 检查编译器目标架构配置
    确认Keil项目中目标架构设置正确:

    1. 打开项目选项(Project -> Options for Target)
    2. 切换到Target标签页,确认Core设置为Cortex-M3
    3. 切换到ARM Compiler标签页,确保Architecture选择ARMv7-M
      错误的架构配置可能导致编译器无法识别针对该架构的内置函数。

内容的提问来源于stack exchange,提问作者Arian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 14:28:24