Forum: Mikrocontroller und Digitale Elektronik CUBE STM32F769 STLink2.1 checksum mismatch


von Tycho B. (asellus)


Lesenswert?

Hallo,

ich habe Ethernet-CUBE-Projekt für STM32F769 compiliert, beim flashen 
bekomme ich aber einen checksum mismatch:
1
target halted due to breakpoint, current mode: Thread 
2
xPSR: 0x61000000 pc: 0x20000084 msp: 0x20080000
3
Info : flash size probed value 2048
4
Info : flash1 'mac 25l51245' id = 0x1a20c2 size = 65536kbytes
5
Warn : no flash bank found for address 2007c080
6
wrote 262144 bytes from file Debug/STM32F769I_DISCOVERY.elf in 3.306157s (77.431 KiB/s)
7
** Programming Finished **
8
** Verify Started **
9
target halted due to breakpoint, current mode: Thread 
10
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20080000
11
target halted due to breakpoint, current mode: Thread 
12
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20080000
13
Error: checksum mismatch - attempting binary compare
14
diff 0 address 0x2007c082. Was 0xd0 instead of 0x00
15
[...]
16
diff 110 address 0x2007c0ff. Was 0x5a instead of 0x00
17
No more differences found.
18
embedded:startup.tcl:476: Error: ** Verify Failed **
19
in procedure 'program' 
20
in procedure 'program_error' called at file "embedded:startup.tcl", line 521
21
at file "embedded:startup.tcl", line 476

Linker script:
1
/* Entry Point */
2
ENTRY(Reset_Handler)
3
4
/* Highest address of the user mode stack */
5
_estack = 0x20080000;    /* end of RAM */
6
/* Generate a link error if heap and stack don't fit into RAM */
7
_Min_Heap_Size = 0x400;      /* required amount of heap  */
8
_Min_Stack_Size = 0x800; /* required amount of stack */
9
10
/* Specify the memory areas */
11
MEMORY
12
{
13
FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 2048K
14
RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 512K
15
Memory_B1(xrw)   : ORIGIN = 0x2007C000, LENGTH = 0x80
16
Memory_B2(xrw)   : ORIGIN = 0x2007C080, LENGTH = 0x80
17
Memory_B3(xrw)   : ORIGIN = 0x2007C100, LENGTH = 0x17d0 
18
Memory_B4(xrw)   : ORIGIN = 0x2007D8D0, LENGTH = 0x17d0
19
ITCMRAM (xrw)      : ORIGIN = 0x00000000, LENGTH = 16K
20
}
21
22
/* Define output sections */
23
SECTIONS
24
{
25
  /* The startup code goes first into FLASH */
26
  .isr_vector :
27
  {
28
    . = ALIGN(4);
29
    KEEP(*(.isr_vector)) /* Startup code */
30
    . = ALIGN(4);
31
  } >FLASH
32
33
  /* The program code and other data goes into FLASH */
34
  .text :
35
  {
36
    . = ALIGN(4);
37
    *(.text)           /* .text sections (code) */
38
    *(.text*)          /* .text* sections (code) */
39
    *(.glue_7)         /* glue arm to thumb code */
40
    *(.glue_7t)        /* glue thumb to arm code */
41
    *(.eh_frame)
42
43
    KEEP (*(.init))
44
    KEEP (*(.fini))
45
46
    . = ALIGN(4);
47
    _etext = .;        /* define a global symbols at end of code */
48
  } >FLASH
49
50
  /* Constant data goes into FLASH */
51
  .rodata :
52
  {
53
    . = ALIGN(4);
54
    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
55
    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
56
    . = ALIGN(4);
57
  } >FLASH
58
59
  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
60
  .ARM : {
61
    __exidx_start = .;
62
    *(.ARM.exidx*)
63
    __exidx_end = .;
64
  } >FLASH
65
66
  .preinit_array     :
67
  {
68
    PROVIDE_HIDDEN (__preinit_array_start = .);
69
    KEEP (*(.preinit_array*))
70
    PROVIDE_HIDDEN (__preinit_array_end = .);
71
  } >FLASH
72
  .init_array :
73
  {
74
    PROVIDE_HIDDEN (__init_array_start = .);
75
    KEEP (*(SORT(.init_array.*)))
76
    KEEP (*(.init_array*))
77
    PROVIDE_HIDDEN (__init_array_end = .);
78
  } >FLASH
79
  .fini_array :
80
  {
81
    PROVIDE_HIDDEN (__fini_array_start = .);
82
    KEEP (*(SORT(.fini_array.*)))
83
    KEEP (*(.fini_array*))
84
    PROVIDE_HIDDEN (__fini_array_end = .);
85
  } >FLASH
86
87
  /* used by the startup to initialize data */
88
  _sidata = LOADADDR(.data);
89
90
  /* Initialized data sections goes into RAM, load LMA copy after code */
91
  .data : 
92
  {
93
    . = ALIGN(4);
94
    _sdata = .;        /* create a global symbol at data start */
95
    *(.data)           /* .data sections */
96
    *(.data*)          /* .data* sections */
97
98
    . = ALIGN(4);
99
    _edata = .;        /* define a global symbol at data end */
100
  } >RAM AT> FLASH
101
102
  
103
  /* Uninitialized data section */
104
  . = ALIGN(4);
105
  .bss :
106
  {
107
    /* This is used by the startup in order to initialize the .bss secion */
108
    _sbss = .;         /* define a global symbol at bss start */
109
    __bss_start__ = _sbss;
110
    *(.bss)
111
    *(.bss*)
112
    *(COMMON)
113
114
    . = ALIGN(4);
115
    _ebss = .;         /* define a global symbol at bss end */
116
    __bss_end__ = _ebss;
117
  } >RAM
118
119
  /* User_heap_stack section, used to check that there is enough RAM left */
120
  ._user_heap_stack :
121
  {
122
    . = ALIGN(8);
123
    PROVIDE ( end = . );
124
    PROVIDE ( _end = . );
125
    . = . + _Min_Heap_Size;
126
    . = . + _Min_Stack_Size;
127
    . = ALIGN(8);
128
  } >RAM
129
130
  
131
132
  /* Remove information from the standard libraries */
133
  /DISCARD/ :
134
  {
135
    libc.a ( * )
136
    libm.a ( * )
137
    libgcc.a ( * )
138
  }
139
140
  .ARM.attributes 0 : { *(.ARM.attributes) }
141
  .RxDescripSection : { *(.RxDescripSection) } >Memory_B1
142
  .TxDescripSection : { *(.TxDescripSection) } >Memory_B2
143
  .RxBUF : { *(.RxBUF) } >Memory_B3
144
  .TxBUF : { *(.TxBUF) } >Memory_B4
145
}

Anscheinend wird SRAM2 (16KB) als Tx-Puffer verwendet. Wenn ich flashe, 
dann wird dieser Bereich nicht mit 0x00 überschrieben, sondern die Werte 
vom letzten Start sind noch im Speicher. Damit scheitert das Überprüfen 
des Flashers. Der Fehler hat jedoch keine Auswirkung auf die 
Lauffähigkeit des Programms.

Ich sehe zwei Möglichkeiten:
- das Überprüfen des RAMs deaktivieren (warum wird überhaupt RAM 
überprüft?)
- den Bereich im startup code mit 0x00 überschreiben, meine Vermutung 
hierbei ist aber, dass es dann schon zu spät ist, denn der Programmer 
überprüft noch for startup code, oder?

Ich benutze System Workbench. Leider finde ich im Netz sehr wenig Infos 
wie der STLink2.1 funktioniert und wo in System Workbench die 
Einstellungen für den Programmer zu finden sind. "Run configuration" -> 
Startup habe ich zwar gefunden, aber dort kann man nicht viel 
einstellen.

Grüße
Tycho

von Stefan F. (Gast)


Lesenswert?

Tycho B. schrieb:
> Ich benutze System Workbench. Leider finde ich im Netz sehr wenig Infos
> wie der STLink2.1 funktioniert und wo in System Workbench die
> Einstellungen für den Programmer zu finden sind.

http://stefanfrings.de/stm32/system_workbench.html

Für tiefer gehende Infos musst du in die Dokumentation von OpenOCD 
gucken.

Der ST-Link ist im Grunde genommen nur ein serieller Adapter, großartige 
Eigenintelligenz steckt da nicht drin.

von A. B. (Gast)


Lesenswert?

Das "Warn : no flash bank found for address 2007c080" sagt, dass in dem 
elf-File irgendwas in diesem RAM initialisiert wird.

Wenn das beabsichtigt ist, müsste die entsprechende Sektion analog wie 
.data behandelt werden und der Startup-Code entsprechend erweitert 
werden. Ansonsten muss die Initialisierung halt weg ...

von Tycho B. (asellus)


Lesenswert?

@ Stefan F.

Super Seite! Seltsam, dass ich beim googeln noch nicht darüber 
gestolpert bin.

von Tycho B. (asellus)


Angehängte Dateien:

Lesenswert?

A. B. schrieb:
> Das "Warn : no flash bank found for address 2007c080" sagt, dass in dem
> elf-File irgendwas in diesem RAM initialisiert wird.
>
> Wenn das beabsichtigt ist, müsste die entsprechende Sektion analog wie
> .data behandelt werden und der Startup-Code entsprechend erweitert
> werden. Ansonsten muss die Initialisierung halt weg ...

Ich stelle mir das so vor: der programmer schreibt das ELF-File, 
vergleicht es nochmal und erst dann startet startup.
For Allem ist doch die flash bank schon da, oder nicht? Warum wird sie 
nich gefunden?

von Tycho B. (asellus)


Lesenswert?

Ich finde die Stelle nicht, wo SRAM2 im Programm definiert wird.

Deklaration:
1
ETH_DMADescTypeDef  DMATxDscrTab[ETH_TXBUFNB] __attribute__((section(".TxDescripSection")));/* Ethernet Tx DMA Descriptors */

und
1
/* Initialize Tx Descriptors list: Chain Mode */
2
HAL_ETH_DMATxDescListInit(&EthHandle, DMATxDscrTab, &Tx_Buff[0][0], ETH_TXBUFNB);
das ist zwar eine Initialisierung, aber zur Laufzeit.

von A. B. (Gast)


Lesenswert?

Das kann schon kompliziert sein, die zu finden ... Möglicherweise 
implizit genullt oder so. Vielleicht hilft ein Blick ins Map-File.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.