Forum: Mikrocontroller und Digitale Elektronik STM32F401 flashen geht nicht


von Stm M. (stmfresser)


Lesenswert?

Hallo!

ich versuche einen Program auf STM32F401 Discovery Board zu übertragen , 
der auf STM32F407 Disc.Board problemlos geflasht wird. Hab gemerkt, dass 
der STM32F01 andere Flash und Ram Größen hat als STM32F407.
Kann mir jemand helfen, wie ich den flash file ändere.

Viele Grüße!
1
(gdb) load prog.elf 
2
Loading section .isr_vector, size 0x188 lma 0x8000000
3
Loading section .text, size 0x36dc lma 0x8000188
4
Loading section .rodata, size 0x80 lma 0x8003864
5
Loading section .ARM, size 0x8 lma 0x80038e4
6
Loading section .init_array, size 0x8 lma 0x80038ec
7
Loading section .fini_array, size 0x4 lma 0x80038f4
8
Loading section .data, size 0x8cc lma 0x80038f8
9
Loading section .jcr, size 0x4 lma 0x80041c4
10
Error finishing flash operation
1
/*
2
*****************************************************************************
3
**
4
**  File        : stm32_flash.ld
5
**
6
**  Abstract    : Linker script for STM32F401VC Device with
7
**                256KByte FLASH, 64KByte RAM
8
**
9
**                Set heap size, stack size and stack location according
10
**                to application requirements.
11
**
12
**                Set memory bank area and size if external memory is used.
13
**
14
**  Target      : STMicroelectronics STM32
15
**
16
**  Environment : Atollic TrueSTUDIO(R)
17
**
18
**  Distribution: The file is distributed “as is,” without any warranty
19
**                of any kind.
20
**
21
**  (c)Copyright Atollic AB.
22
**  You may use this file as-is or modify it according to the needs of your
23
**  project. This file may only be built (assembled or compiled and linked)
24
**  using the Atollic TrueSTUDIO(R) product. The use of this file together
25
**  with other tools than Atollic TrueSTUDIO(R) is not permitted.
26
**
27
*****************************************************************************
28
*/
29
30
/* Entry Point */
31
ENTRY(Reset_Handler)
32
33
/* Highest address of the user mode stack */
34
_estack = 0x2000FFFF;    /* end of 64K RAM */
35
36
/* Generate a link error if heap and stack don't fit into RAM */
37
_Min_Heap_Size = 0;      /* required amount of heap  */
38
_Min_Stack_Size = 0x400; /* required amount of stack */
39
40
/* Specify the memory areas */
41
MEMORY
42
{
43
  FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 512K
44
  RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 96K
45
  MEMORY_B1 (rx)  : ORIGIN = 0x60000000, LENGTH = 0K
46
  CCMRAM (rw)     : ORIGIN = 0x10000000, LENGTH = 0K
47
}
48
49
/* Define output sections */
50
SECTIONS
51
{
52
  /* The startup code goes first into FLASH */
53
  .isr_vector :
54
  {
55
    . = ALIGN(4);
56
    KEEP(*(.isr_vector)) /* Startup code */
57
    . = ALIGN(4);
58
  } >FLASH
59
60
  /* The program code and other data goes into FLASH */
61
  .text :
62
  {
63
    . = ALIGN(4);
64
    *(.text)           /* .text sections (code) */
65
    *(.text*)          /* .text* sections (code) */
66
    *(.glue_7)         /* glue arm to thumb code */
67
    *(.glue_7t)        /* glue thumb to arm code */
68
    *(.eh_frame)
69
70
    KEEP (*(.init))
71
    KEEP (*(.fini))
72
73
    . = ALIGN(4);
74
    _etext = .;        /* define a global symbols at end of code */
75
  } >FLASH
76
77
  /* Constant data goes into FLASH */
78
  .rodata :
79
  {
80
    . = ALIGN(4);
81
    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
82
    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
83
    . = ALIGN(4);
84
  } >FLASH
85
86
  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
87
  .ARM : {
88
    __exidx_start = .;
89
    *(.ARM.exidx*)
90
    __exidx_end = .;
91
  } >FLASH
92
93
  .preinit_array     :
94
  {
95
    PROVIDE_HIDDEN (__preinit_array_start = .);
96
    KEEP (*(.preinit_array*))
97
    PROVIDE_HIDDEN (__preinit_array_end = .);
98
  } >FLASH
99
  .init_array :
100
  {
101
    PROVIDE_HIDDEN (__init_array_start = .);
102
    KEEP (*(SORT(.init_array.*)))
103
    KEEP (*(.init_array*))
104
    PROVIDE_HIDDEN (__init_array_end = .);
105
  } >FLASH
106
  .fini_array :
107
  {
108
    PROVIDE_HIDDEN (__fini_array_start = .);
109
    KEEP (*(SORT(.fini_array.*)))
110
    KEEP (*(.fini_array*))
111
    PROVIDE_HIDDEN (__fini_array_end = .);
112
  } >FLASH
113
114
  /* used by the startup to initialize data */
115
  _sidata = LOADADDR(.data);
116
117
  /* Initialized data sections goes into RAM, load LMA copy after code */
118
  .data : 
119
  {
120
    . = ALIGN(4);
121
    _sdata = .;        /* create a global symbol at data start */
122
    *(.data)           /* .data sections */
123
    *(.data*)          /* .data* sections */
124
125
    . = ALIGN(4);
126
    _edata = .;        /* define a global symbol at data end */
127
  } >RAM AT> FLASH
128
  
129
  _siccmram = LOADADDR(.ccmram);
130
131
  /* CCM-RAM section 
132
  * 
133
  * IMPORTANT NOTE! 
134
  * If initialized variables will be placed in this section, 
135
  * the startup code needs to be modified to copy the init-values.  
136
  */
137
  .ccmram :
138
  {
139
    . = ALIGN(4);
140
    _sccmram = .;       /* create a global symbol at ccmram start */
141
    *(.ccmram)
142
    *(.ccmram*)
143
    
144
    . = ALIGN(4);
145
    _eccmram = .;       /* create a global symbol at ccmram end */
146
  } >CCMRAM AT> FLASH
147
148
  /* Uninitialized data section */
149
  . = ALIGN(4);
150
  .bss :
151
  {
152
    /* This is used by the startup in order to initialize the .bss secion */
153
    _sbss = .;         /* define a global symbol at bss start */
154
    __bss_start__ = _sbss;
155
    *(.bss)
156
    *(.bss*)
157
    *(COMMON)
158
159
    . = ALIGN(4);
160
    _ebss = .;         /* define a global symbol at bss end */
161
    __bss_end__ = _ebss;
162
  } >RAM
163
164
  /* User_heap_stack section, used to check that there is enough RAM left */
165
  ._user_heap_stack :
166
  {
167
    . = ALIGN(4);
168
    PROVIDE ( end = . );
169
    PROVIDE ( _end = . );
170
    . = . + _Min_Heap_Size;
171
    . = . + _Min_Stack_Size;
172
    . = ALIGN(4);
173
  } >RAM
174
175
  /* MEMORY_bank1 section, code must be located here explicitly            */
176
  /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
177
  .memory_b1_text :
178
  {
179
    *(.mb1text)        /* .mb1text sections (code) */
180
    *(.mb1text*)       /* .mb1text* sections (code)  */
181
    *(.mb1rodata)      /* read-only data (constants) */
182
    *(.mb1rodata*)
183
  } >MEMORY_B1
184
185
  /* Remove information from the standard libraries */
186
  /DISCARD/ :
187
  {
188
    libc.a ( * )
189
    libm.a ( * )
190
    libgcc.a ( * )
191
  }
192
193
  .ARM.attributes 0 : { *(.ARM.attributes) }
194
}



    STM32F401VCT6 microcontroller featuring 256 KB of Flash memory, 64 
KB of RAM in an LQFP100 package
    On-board ST-LINK/V2 with selection mode switch to use the kit as a 
standalone ST-LINK/V2 (with SWD connector for programming and debugging)
    Board power supply: through USB bus or from an external 5 V supply 
voltage
    External application power supply: 3 V and 5 V
    L3GD20, ST MEMS motion sensor, 3-axis digital output gyroscope.
    LSM303DLHC, ST MEMS system-in-package featuring a 3D digital linear 
acceleration sensor and a 3D digital magnetic sensor.
    MP45DT02, ST MEMS audio sensor, omnidirectional digital microphone
    CS43L22, audio DAC with integrated class D speaker driver
    Eight LEDs:
    LD1 (red/green) for USB communication
    LD2 (red) for 3.3 V power on
    Four user LEDs: LD3 (orange), LD4 (green), LD5 (red) and LD6 (blue)
    Two USB OTG LEDs: LD7 (green) VBus and LD8 (red) over-current
    Two pushbuttons (user and reset)
    USB OTG with micro-AB connector
    Extension header for LQFP100 I/Os for a quick connection to the 
prototyping board and an easy probing

http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1199/PF259098?icmp=stm32f401discovery_pron_footer_jan2014&sc=stm32f401discovery

von Markus M. (Firma: EleLa - www.elela.de) (mmvisual)


Lesenswert?

In dem Abschnitt:
/* Specify the memory areas */

von Stm M. (stmfresser)


Lesenswert?

Guten Morgen.
ja hab geändert. geht immer noch nicht.
stm32f4xx.h
1
#if !defined (STM32F40_41xxx) && !defined (STM32F427_437xx) && !defined (STM32F429_439xx) && !defined (STM32F401xx)             
2
  #define STM32F401xx */     /*!< STM32F401CB, STM32F401CC,  STM32F401RB,  STM32F401RC, STM32F401VB and STM32F401VC Devices */
3
  
4
#endif
1
/*
2
*****************************************************************************
3
**
4
**  File        : stm32_flash.ld
5
**
6
**  Abstract    : Linker script for STM32F401VC Device with
7
**                256KByte FLASH, 64KByte RAM
8
**
9
**                Set heap size, stack size and stack location according
10
**                to application requirements.
11
**
12
**                Set memory bank area and size if external memory is used.
13
**
14
**  Target      : STMicroelectronics STM32
15
**
16
**  Environment : Atollic TrueSTUDIO(R)
17
**
18
**  Distribution: The file is distributed “as is,” without any warranty
19
**                of any kind.
20
**
21
**  (c)Copyright Atollic AB.
22
**  You may use this file as-is or modify it according to the needs of your
23
**  project. This file may only be built (assembled or compiled and linked)
24
**  using the Atollic TrueSTUDIO(R) product. The use of this file together
25
**  with other tools than Atollic TrueSTUDIO(R) is not permitted.
26
**
27
*****************************************************************************
28
*/
29
30
/* Entry Point */
31
ENTRY(Reset_Handler)
32
33
/* Highest address of the user mode stack */
34
_estack = 0x2000FFFF;    /* end of 64K RAM */
35
36
/* Generate a link error if heap and stack don't fit into RAM */
37
_Min_Heap_Size = 0;      /* required amount of heap  */
38
_Min_Stack_Size = 0x400; /* required amount of stack */
39
40
/* Specify the memory areas */
41
MEMORY
42
{
43
  FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 256K
44
  RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 64K
45
  MEMORY_B1 (rx)  : ORIGIN = 0x60000000, LENGTH = 0K
46
  CCMRAM (rw)     : ORIGIN = 0x10000000, LENGTH = 0K
47
}
48
49
/* Define output sections */
50
SECTIONS
51
{
52
  /* The startup code goes first into FLASH */
53
  .isr_vector :
54
  {
55
    . = ALIGN(4);
56
    KEEP(*(.isr_vector)) /* Startup code */
57
    . = ALIGN(4);
58
  } >FLASH
59
60
  /* The program code and other data goes into FLASH */
61
  .text :
62
  {
63
    . = ALIGN(4);
64
    *(.text)           /* .text sections (code) */
65
    *(.text*)          /* .text* sections (code) */
66
    *(.glue_7)         /* glue arm to thumb code */
67
    *(.glue_7t)        /* glue thumb to arm code */
68
    *(.eh_frame)
69
70
    KEEP (*(.init))
71
    KEEP (*(.fini))
72
73
    . = ALIGN(4);
74
    _etext = .;        /* define a global symbols at end of code */
75
  } >FLASH
76
77
  /* Constant data goes into FLASH */
78
  .rodata :
79
  {
80
    . = ALIGN(4);
81
    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
82
    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
83
    . = ALIGN(4);
84
  } >FLASH
85
86
  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
87
  .ARM : {
88
    __exidx_start = .;
89
    *(.ARM.exidx*)
90
    __exidx_end = .;
91
  } >FLASH
92
93
  .preinit_array     :
94
  {
95
    PROVIDE_HIDDEN (__preinit_array_start = .);
96
    KEEP (*(.preinit_array*))
97
    PROVIDE_HIDDEN (__preinit_array_end = .);
98
  } >FLASH
99
  .init_array :
100
  {
101
    PROVIDE_HIDDEN (__init_array_start = .);
102
    KEEP (*(SORT(.init_array.*)))
103
    KEEP (*(.init_array*))
104
    PROVIDE_HIDDEN (__init_array_end = .);
105
  } >FLASH
106
  .fini_array :
107
  {
108
    PROVIDE_HIDDEN (__fini_array_start = .);
109
    KEEP (*(SORT(.fini_array.*)))
110
    KEEP (*(.fini_array*))
111
    PROVIDE_HIDDEN (__fini_array_end = .);
112
  } >FLASH
113
114
  /* used by the startup to initialize data */
115
  _sidata = LOADADDR(.data);
116
117
  /* Initialized data sections goes into RAM, load LMA copy after code */
118
  .data : 
119
  {
120
    . = ALIGN(4);
121
    _sdata = .;        /* create a global symbol at data start */
122
    *(.data)           /* .data sections */
123
    *(.data*)          /* .data* sections */
124
125
    . = ALIGN(4);
126
    _edata = .;        /* define a global symbol at data end */
127
  } >RAM AT> FLASH
128
  
129
  _siccmram = LOADADDR(.ccmram);
130
131
  /* CCM-RAM section 
132
  * 
133
  * IMPORTANT NOTE! 
134
  * If initialized variables will be placed in this section, 
135
  * the startup code needs to be modified to copy the init-values.  
136
  */
137
  .ccmram :
138
  {
139
    . = ALIGN(4);
140
    _sccmram = .;       /* create a global symbol at ccmram start */
141
    *(.ccmram)
142
    *(.ccmram*)
143
    
144
    . = ALIGN(4);
145
    _eccmram = .;       /* create a global symbol at ccmram end */
146
  } >CCMRAM AT> FLASH
147
148
  /* Uninitialized data section */
149
  . = ALIGN(4);
150
  .bss :
151
  {
152
    /* This is used by the startup in order to initialize the .bss secion */
153
    _sbss = .;         /* define a global symbol at bss start */
154
    __bss_start__ = _sbss;
155
    *(.bss)
156
    *(.bss*)
157
    *(COMMON)
158
159
    . = ALIGN(4);
160
    _ebss = .;         /* define a global symbol at bss end */
161
    __bss_end__ = _ebss;
162
  } >RAM
163
164
  /* User_heap_stack section, used to check that there is enough RAM left */
165
  ._user_heap_stack :
166
  {
167
    . = ALIGN(4);
168
    PROVIDE ( end = . );
169
    PROVIDE ( _end = . );
170
    . = . + _Min_Heap_Size;
171
    . = . + _Min_Stack_Size;
172
    . = ALIGN(4);
173
  } >RAM
174
175
  /* MEMORY_bank1 section, code must be located here explicitly            */
176
  /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
177
  .memory_b1_text :
178
  {
179
    *(.mb1text)        /* .mb1text sections (code) */
180
    *(.mb1text*)       /* .mb1text* sections (code)  */
181
    *(.mb1rodata)      /* read-only data (constants) */
182
    *(.mb1rodata*)
183
  } >MEMORY_B1
184
185
  /* Remove information from the standard libraries */
186
  /DISCARD/ :
187
  {
188
    libc.a ( * )
189
    libm.a ( * )
190
    libgcc.a ( * )
191
  }
192
193
  .ARM.attributes 0 : { *(.ARM.attributes) }
194
}

von Markus M. (Firma: EleLa - www.elela.de) (mmvisual)


Lesenswert?

Der ST-Link wird erkannt?
Hast Du die SW vom ST-Link mal geupdatet?
Kannst Du mit den ST-Tools auf den µC zugreifen?

von Stm M. (stmfresser)


Lesenswert?

Oh je, es hat endlich funktionert. leider openocd unterstützt diese chip 
net mehr.

von Stm M. (stmfresser)


Lesenswert?

Markus Müller schrieb:
> Der ST-Link wird erkannt?
> Hast Du die SW vom ST-Link mal geupdatet?
> Kannst Du mit den ST-Tools auf den µC zugreifen?

stlink wird erkannt.

von Stm M. (stmfresser)


Lesenswert?

ok. neue openocd 0.8 unterstützt STM32F401C . hatte die alten

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.