Literal Pool too Distant?

末鹿安然 提交于 2019-12-12 02:26:27

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/34075690/literal-pool-too-distant

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!