This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Scatter load routine uses incorrect data

Please help.
My project compiled in uVision runs in to HartFault before reaching main function.
I investigated what could be reason for it, I located and found:
- It occures when I add some variables and code it to my code (so the memory layout is reordered).
- It happens in _scatterLoad section, where the pointers to scatterload_copy routine are not correct:

0x08000188 F000F802 BL.W __scatterload (0x08000190)
0x0800018C F000F86C BL.W __rt_entry (0x08000268)
0x08000190 A00A ADR r0,{pc}+4 ; @0x080001BC
0x08000192 E8900C00 LDM r0,{r10-r11}
0x08000196 4482 ADD r10,r10,r0
0x08000198 4483 ADD r11,r11,r0
0x0800019A F1AA0701 SUB r7,r10,#0x01
0x0800019E 45DA CMP r10,r11
0x080001A0 D101 BNE 0x080001A6
0x080001A2 F000F861 BL.W __rt_entry (0x08000268)
0x080001A6 F2AF0E09 ADR.W lr,{pc}-0x07 ; @0x0800019F
0x080001AA E8BA000F LDM r10!,{r0-r3}
0x080001AE F0130F01 TST r3,#0x01
0x080001B2 BF18 IT NE
0x080001B4 1AFB SUBNE r3,r7,r3
0x080001B6 F0430301 ORR r3,r3,#0x01
0x080001BA 4718 BX r3
0x080001BC F2D4 DCW 0xF2D4
0x080001BE 0000 DCW 0x0000
0x080001C0 F2F4 DCW 0xF2F4
0x080001C2 0000 DCW 0x0000

F2D4 + 1BC = 0x0800F450 incorrect address <> 0x0800F44C should be this: correct address

... scatter load tables: Region$$Table$$Base....

0x0800F44C F480 DCW 0xF480 (from - RW data init data stored)
0x0800F44E 0800 DCW 0x0800

0x0800F450 0000 DCW 0x0000 (to - where to copy it)
0x0800F452 2000 DCW 0x2000
0x0800F454 0234 DCW 0x0234 (count - how much)
0x0800F456 0000 DCW 0x0000
0x0800F458 01C4 DCW 0x01C4 (routine to call for the bob)
0x0800F45A 0800 DCW 0x0800

0x0800F45C F6B4 DCW 0xF6B4
0x0800F45E 0800 DCW 0x0800
0x0800F460 0234 DCW 0x0234 (to)
0x0800F462 2000 DCW 0x2000
0x0800F464 0FCC DCW 0x0FCC (count - how much to set to zero)
0x0800F466 0001 DCW 0x0001
0x0800F468 01E0 DCW 0x01E0 (routine)
0x0800F46A 0800 DCW 0x0800
....

The instruction on address 1BA jumps to incorrect address, because the adresses loaded at adresses 196,198 (from addr 1BC) are shifted by 4 bytes.

What do I do so unstandard that it leads in not correct preparation of ASM pointers to Region$$Table$$Base.

I think the reason could be:
- I use some coding technique that can lead to this (virtual methods, unions, ...)
- switching --datacompressor off leads to not correct computing of the addresses
- a bug in linker?

I am using const volatile variable holding compilation time and version in the middle of my code (0x08002000). I need datacompressor off (it compress const volatile data in RW flash regions on address 0x080E0000).

Thank you.

I am using STM32F407.

Parents Reply Children