Skip to main content
Pilous Droip
Senior
June 6, 2019
Question

STM32F767 linker script problem

Hello. I have problem with linker script.

I have this memory map:

MEMORY
{
 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
 ITCMRAM (rw) : ORIGIN = 0x00000000, LENGTH = 16K
 DTCMRAM (rw) : ORIGIN = 0x20000000, LENGTH = 128K
 SRAM1 (rw) : ORIGIN = 0x20020000, LENGTH = 368K
 SRAM2 (rw) : ORIGIN = 0x2007C000, LENGTH = 16K
 BKPSRAM (rw) : ORIGIN = 0x40024000, LENGTH = 4K
}
 
 
/* Include main link script. Note: it will be searched in -L paths. */
INCLUDE Linker/sections.ld

 When I add this line, program crash:

. = ALIGN(4);
 _si_itcmram = LOADADDR(.itcmram_code);
 .itcmram_code : ALIGN(32)
 {
 . = ALIGN(32);
 _sitcmram = .;
 /* NULL */
 QUAD(0)
 QUAD(0)
 QUAD(0)
 QUAD(0)
 QUAD(0)
 QUAD(0)
 QUAD(0)
 QUAD(0)
 /* code */
 *(.itcmram_code .itcmram_code.*)
 _eitcmram = .;
 . = ALIGN(32);
 } > ITCMRAM AT>FLASH

 any idea, why program fail?

>>>> HardFault Exception <<<<
 
Fault registers:
SCB->HFSR = 0x40000000
 DEBUGEVT = 0
 FORCED = 1
 VECTTBL = 0
SCB->CFSR = 0x00010000
 IACCVIOL = 0
 DACCVIOL = 0
 MUNSTKERR = 0
 MSTKERR = 0
 MLSPERR = 0
 MMARVALID = 0
 IBUSERR = 0
 PRECISE E = 0
 IMPRECISE = 0
 UNSTKERR = 0
 STKERR = 0
 LSPERR = 0
 BFARVALID = 0
 UNDEFINSTR= 1
 INVSTATE = 0
 INVPC = 0
 NOCP = 0
 UNALIGNED = 0
 DIVBYZERO = 0
SCB->DFSR = 0x0000000b
SCB->MMFAR = 0x00000000
SCB->BFAR = 0x00000000
SCB->AFSR = 0x00000000
SCB->ABFSR = 0x00000000
 
Exception stack frame:
R0 0x0000007e
R1 0x00000044
R2 0x0801c3c6
R3 0x40000000
R12 0x00000001
LR 0x08008063
PC 0x00000040
xPSR 0x81000000
 
 
 >>> forcing SYSTEM RESET

This topic has been closed for replies.

2 replies

Pilous Droip
Senior
June 6, 2019

Problem was in startup file: startup_stm32f7x7xx.s

Amel NASRI
ST Technical Moderator
June 18, 2019

Hi @Pilous Droip​ ,

Could you please explain what was exactly the issue?

Thanks,

Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.