经验分享 · 2023年4月5日

keil编译STM32L4程序时,提示 Warning: L6989W: Could not apply patch …

使用Keil新版本编译STM32L4的程序时,提示

**.axf: Warning: L6989W: Could not apply patch sdcomp-29491-629360 to instruction VPOP {d8-d12} at offset 0x24, instruction is within an IT block and is not the last instruction for sin_i_x.o(i.____kernel_sin$lsc).

功能正常,但这个警告总让人不放心,后查阅ARM官方文档如下。

简单来说,如果你没有使用FMC访问外部存储,完全可以忽略这个警告。如果程序中使用了DSP库,可以在编译器选项中增加 –no_conditionalize 选项即可去掉该警告;另外,某些math库函数也会导致此警告,比如 log10(), 这种情况下使用 log10f()替代即可消除警告。

原文如下:

SYMPTOM

I am using the STM32L476 and I an getting warning L6989W when using some math functions or DSP library functions. For example, when I build a project using the arm_fir_f32() filter functions, I get the following warning:

 


 

How do I resolve this warning? Can I ignore it?

CAUSE

Some members of the STM32L4 family have an eratta for the FMC (Flexible Memory Controller) where a read burst access of 9 words or more is not supported by FMC. To prevent burst accesses that are greater than 8 words, a special linker patch was developed to patch certain instructions that result in burst accesses of greater than 8 words. The patch can be applied in most cases with a few exceptions. One of these exceptions is when the instruction to be patched is inside an IT (If-Then) block and is not the last instruction in that block. In this case this warning will be generated.

RESOLUTION

Since the FMC is only used for external memory, you can ignore this warning if you are only using internal memory. If you are using external memory, make sure your stack is located on-chip. In compiled code, the use of IT blocks can be eliminated by using the –no_conditionalize compiler option. If you are using the DSP library, you will need to rebuild it with the –no_conditionalize compiler option to prevent this warning.This can increase the processing time for DSP functions, so this should only be done for the library used with the STM32L4xx. Also, some math functions such as log10() contain IT blocks that cannot be patched. Since these math functions are not available to be re-built, it may be difficult to eliminate the warning in all cases. In the case of log10(), you can use a similar function, log10f() that does not have the IT block restriction.