Hello,
I have this scatter file
LR_IROM1 APPLICATION_START_ADDRESS APPLICATION_IMAGE_MAX_SIZE { ; load region size_region ER_IROM1 APPLICATION_START_ADDRESS RESET_VECTOR_AND_KERNEL_SIZE { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) *(privileged_functions) .ANY (+RO) } ER_IROM2 (APPLICATION_START_ADDRESS + RESET_VECTOR_AND_KERNEL_SIZE) (APPLICATION_IMAGE_MAX_SIZE - RESET_VECTOR_AND_KERNEL_SIZE) { .ANY (+RO) }
where
#define PBOOT_START_ADDRESS (0x0) #define MBOOT_START_ADDRESS (PBOOT_START_ADDRESS + PBOOT_IMAGE_MAX_SIZE) #define APPLICATION_START_ADDRESS (MBOOT_START_ADDRESS + MBOOT_IMAGE_MAX_SIZE) #define RESET_VECTOR_AND_KERNEL_SIZE (0x4000) #define INTERNAL_FLASH_MAX_SIZE (0x80000) #define PBOOT_IMAGE_MAX_SIZE (0x1000) #define MBOOT_IMAGE_MAX_SIZE (0x4000) #define APPLICATION_IMAGE_MAX_SIZE (INTERNAL_FLASH_MAX_SIZE - PBOOT_IMAGE_MAX_SIZE - MBOOT_IMAGE_MAX_SIZE)
and my LPC1788 ends up in a hard fault, after attempting to load the address of SystemInit, here:
Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0
But if I remove ER_IROM2 - scatter loading works and the controller starts up. Am I hitting a linker limitation here? Any ideas? I must place my kernel image at the beginning of flash (via the section "privileged_functions").
I have noticed that if ER_IROM2 is empty, there seems to be no problem. I did see occasionally an linker error indicating a possible corruption during runtime but that does not happen anymore - so the linker basically builds an image that cannot boot...?
Here is the solution (I'm not sure why this works):
ER_IROM2 (APPLICATION_START_ADDRESS + RESET_VECTOR_AND_KERNEL_SIZE) FIXED (APPLICATION_IMAGE_MAX_SIZE - RESET_VECTOR_AND_KERNEL_SIZE) {
tapeer,
its not good if you dont know why it works. have you fixed it. you know. really fixed it? not just moved the problem to byte in the posterier later?
did you maik the map file for no work and work and compair the too?
always yo're freind,
zeusti.
coding overlord and teem leeder.
Yes, my dear "friend" - I did. If you think I am making a fundamental mistake My (FreeRTOS/MPU system is working) I would appreciate if you tell me where!
and whot did yew find? the clew must be their. look for the ansa in the evidense.
if my teem playa hid a problum i will kick him out. i cannot be happy if somebudy hide a problem. can yew?
how can i say wear you have your fundamental mistake. yew show no code. i am onley a coding overlord. i am not a mind reeder.
always yo're freind.
I asked you specifically about the FIXED keyword. It is too hard to read your reply. If you cannot/won't do any better just forget about it - I'll manage.
"It is too hard to read your reply."
He's just having fun with you. Today, Zeusti is in one of his "I'm not so good at english" moods.
Some other times, he forgets to spell words incorrectly, or invent new grammar, and posts perfect sentences.
Well I am not amused. I asked a technical question, and I get back a pack of drivel. If the guy cannot make himself coherent, he better not say anything...
so tapeer i pas my drivel threw googel transleight and got this
<TranslateStart>
And what did you find? The clue must be there. Look for the answer in the evidence.
When you compare one map file from the failed build with one from the good build you must see a difference. Does this give you a clue?
When you say "I'm not sure why it works" it concerns me. If you don't know why it works, then you may not have really fixed it and the problem might show up and bite you in the backside at some future time.
For the record you did not ask me specifically about the FIXED keyword. Is it not detailed in the documentation?
</TranslateStart>
Zeusti
(now going back to my bottle)
The problem is that I could not find an explanation why the contents or the lack of contents of the second execution region determined why the image will not function. No matter which object file was mapped to it, without the FIXED keyword for the second execution region it would not function! I looked in the linker user manual but it offered no clues. I know there are some tool chain experts around here...
<holdingbackwhatifeellikesaying>
c'mon man! what diffrence do you see from the map files? the fixed is obviously having some effect. the map file will show a difference in the layout. why did you use the fixed? did you have some reason or was it just a guess?
</holdingbackwhatifeellikesaying>
zeusti