#4107 - regularkid - Wed Mar 19, 2003 5:57 am
Hi, I am using some code that had been working perfectly before:
Code: |
ldr r1, =videoBuffer @ r1 = &videoBuffer
ldr r1, [r1] @ r1 = videoBuffer
|
Then, the size of my assembly source code file increased by a huge amount and now I am getting this error for that same piece of code:
Code: |
Gfx.s:1026: Error: invalid literal constant: pool needs to be closer
|
Any ideas?
_________________
- RegularKid
#4108 - pelrun - Wed Mar 19, 2003 6:11 am
The ARM can't load arbitrary constants into registers directly.
If the constant can't be put in the form (C&0xFF)<<(S*2) for some integers C and S (I think, I'm working from memory here) then the constant is placed after the current function (in what is called the "pool") and the instruction is transparently changed to load the constant from there.
However, the new load instruction can only reach memory locations within a finite distance either side of it, so if your function gets too large then the pool moves out of range. To work around this, try splitting your code up into smaller functions, so the pools can live closer to the instructions that reference them.
#4109 - regularkid - Wed Mar 19, 2003 7:12 am
Since I need to be able to load these variables into registers and I don't want to change the size of my function, is there another way that I can load these variables into registers?
_________________
- RegularKid
#4115 - joet - Wed Mar 19, 2003 2:10 pm
Back in the days of the Acorn Archimedes (also an ARM machine) I used to get round this by loading address offsets from memory.
So further down the code I used to store the destination address in a memory location and load it from there ... pretty nasty, but it worked ...
#4117 - tepples - Wed Mar 19, 2003 4:33 pm
Have you added more functions to your assembly file? Try placing more .pool directives between the functions, or possibly a .pool at the beginning of the file.
Do you have a single function that has grown to 1 KB in size? You'll have to break it up, or load the video buffer address manually. If "videoBuffer" is 0x06000000 as I suspect (and not some sort of back buffer at some odd address in EWRAM), you can load it manually.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#4119 - regularkid - Wed Mar 19, 2003 6:11 pm
Good advice, I will try to add .pool statements and if that doesn't work, I can try breaking up my code. Thanks
_________________
- RegularKid