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.
New thread, but seems related to this: http://www.keil.com/forum/61768/
No, this is other issue. The initialisation table from Region$$table$$base is incorrectly builded in asm. Nothing connected with data compression const volatile.
I need help with this issue also.
Ludek
You have verified that there is no correlation between the two issues, by removing that configuration sector with absolutely placed const volatile data?
Show the .SCT scatter file and the .MAP file and it might be possible to determine what's actually happening rather than making random guesses with half a set of facts.
I second that. It's pointless trying to understand, prove or answer half details and guesses.
Test
Thank you for willing help:
I am not able to add MapFile that is so long that webforum writes : "Down for maintenance".
Please, see my mapfile here:
ludek.holoubek.sweb.cz/forum.txt
Thank you, Ludek
Don't forget to post the scatter file.
Hi Per,
as i have written, I do not use scatter file. I use Keil linker defaults.
But doesn't the output directory contain an auto-generated scatter file?
Per,
thank for your reply, there is no such a file genarated. The linker takes just this parameters in Option setting window:
--cpu Cortex-M4.fp *.o --ro-base 0x08000000 --entry 0x08000000 --rw-base 0x20000000 --entry Reset_Handler --first __Vectors --strict --datacompressor off --feedback=unused.txt --summary_stderr --info summarysizes --map --xref --callgraph --symbols --info sizes --info totals --info unused --info veneers --list ".\OBJ\Dista_olimex_2_052_PHY.map" -o .\OBJ\Dista_olimex_2_052_PHY.axf
thank for your reply, there is no such a file genarated
Highly unlikely that is true. I see one generated along with the object files. (it has an extension of sct)
Hmm - many years since I worked on a project without an explicit scatter file.
Isn't it enough to just specify a scatter file name (while keeping the checkbox "Use Memory Layout from Target Dialog" checked), to get the tools to produce a scatter file from the project settings?
Isn't it enough to just specify a scatter file name
Always has been for me.
Actually, scrub that.
I don't even have to specify a scatter file name. if you don't explicitly state a user supplied file, it creates one.