文字池太远?(Literal Pool too Distant?)

710 IT屋

I'm writing code in ARM assembly language on the Freescale Freedom KL46Z board in the Keil uVision 5 environment. My code is quite lengthy, but in the main part of the code, whenever I try to load (LDR) a constant or variable, I get this error: error: A1284E: Literal pool too distant, use LTORG to assemble it within 4KB I have no idea what this means or how to fix it. The spots where the errors occur are all on similar instructions. For example, the first error is on an instruction that reads: LDR R1,=Time where Time is defined as: Time SPACE 4 That instance was a variable but it also happens on defined constants. Can anyone help me figure out how to fix this error?

解决方案

The error message explains more or less what you need to do. Insert an LTORG directive into your assembly code somewhere within 4096 bytes of line giving the error message. The LTORG statement must be in the same section as your code and it must not be on a code path that might be executed. It results in the insertion of constants (literals) into the section that will cause a crash or otherwise misbehave if executed.

A good place is either is after end of the function (or before the function's entry label) that gives the error. If that's still more than 4K away then you need to find an unconditional branch or return instruction in your function that you can put it after. If there's no such instruction, then you'll have to insert an unconditional branch instruction that does nothing but jumps over an LTORG statement somewhere in your code.

我在Keil uVision 5环境飞思卡尔自由KL46Z板写code ARM汇编语言编写。我的code是相当长的,但在code,每当我尝试加载(LDR)不变或可变的主要部分,我得到这个错误:
错误:A1284E:文字池太遥远,使用LTORG内4KB组装起来
我不知道这意味着什么或如何解决它。其中,发生错误的地点都在类似的指令所有。例如,第一个错误是在读取指令:
LDR R1,=时间
其中,时间被定义为:
时空4
该实例是一个变量,但它也发生在定义的常量。谁能帮我找出如何解决这个问题?


解决方案

该错误消息解释或多或少,你需要做什么。插入 LTORG指令到组装code范围内的某处4096字节行给出的错误信息。该LTORG声明必须在同一节作为你的code和它不能是可能被执行的code道路。它导致常数(字面)插入部,其将导致崩溃或以其他方式被执行行为不端的插入

有一个不好的地方就是要么是给错误的函数(或函数入口标签之前)结束之后。如果这仍然超过4K消失,那么你需要找到一个无条件分支或在你的功能,你可以以后把它返回指令。如果没有这样的指令,那么你就必须要插入一个无条件分支指令,可以做什么,但地方跃过一个LTORG声明在code。

本文地址:IT屋 » 文字池太远?