Hi,
ich habe jetzt schon etliche Tage das Problem, dass ich versuche den
internen Flash vom LPC1768 (Cortex - M3) zu sektionieren. Benutzen tue
ich die Red Suite 4 IDE. Ich bekomme immer die Fehlermeldung, dass der
angegebene Flash nicht beschreibbar ist.
Fehlermeldung:
"15: Target error from Write Flash: ET: Flash driver not ready"
So wie ich die Fehlermeldung verstehe wird der Flashbereich nicht
vorbereitet und kann somit nicht beschrieben werden.
Ich möchte den Flash in beispielsweise vier Bereiche unterteilen. Erster
Bereich (MFlashA) hat eine Größe von 392K. Zweiter und dritter Bereich
(MFlashB und MFlashC) 32K. MFlashD beschreibt den Rest. Ich habe das
Managed Linker Script geändert und angepasst (s. unten).
Über .flashds soll dann der Speicherbereich
1 | __attribute__ ((__section__(".flashds")))
|
angesprochen werden.
Linker Script:
1 | GROUP(libcr_semihost.a libcr_c.a libcr_eabihelpers.a)
|
2 | |
3 | __top_RamLoc32 = 0x10000000 + 0x8000;
|
4 | |
5 | MEMORY
|
6 | {
|
7 | MFlashA (rx) : ORIGIN = 0x0, LENGTH = 392K
|
8 | MFlashB (rx) : ORIGIN = 0x60000, LENGTH = 32K
|
9 | MFlashC (rx) : ORIGIN = 0x68000, LENGTH = 32K
|
10 | MFlashD (rx) : ORIGIN = 0x70000, LENGTH = 64K
|
11 | RamLoc32 (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
|
12 | RamAHB32 (rwx) : ORIGIN = 0x2007c000, LENGTH = 32K
|
13 | }
|
14 |
|
15 | ENTRY(ResetISR)
|
16 | |
17 | SECTIONS
|
18 | {
|
19 | .text : ALIGN(4)
|
20 | {
|
21 | FILL(0xff)
|
22 | KEEP(*(.isr_vector))
|
23 | *(.after_vectors*)
|
24 | *(.text*)
|
25 | *(.rodata .rodata.*)
|
26 | . = ALIGN(4) ;
|
27 | } > MFlashA
|
28 |
|
29 | .flashbs : ALIGN(4) {
|
30 | *(.flashbs)
|
31 | . = ALIGN(4) ;
|
32 | } > MFlashB
|
33 |
|
34 | .flashds : ALIGN(4) {
|
35 | *(.flashds)
|
36 | . = ALIGN(4) ;
|
37 | } > MFlashC
|
38 |
|
39 | .data : ALIGN(4)
|
40 | {
|
41 | FILL(0xff)
|
42 | _data = .;
|
43 | *(vtable)
|
44 | *(.data*)
|
45 | . = ALIGN(4) ;
|
46 | _edata = .;
|
47 | } > RamLoc32 AT>MFlashA
|
48 | |
49 | .ARM.extab : ALIGN(4)
|
50 | {
|
51 | *(.ARM.extab* .gnu.linkonce.armextab.*)
|
52 | } > MFlashA
|
53 | __exidx_start = .;
|
54 |
|
55 | .ARM.exidx : ALIGN(4)
|
56 | {
|
57 | *(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
58 | } > MFlashA
|
59 | __exidx_end = .;
|
60 |
|
61 | _etext = .;
|
62 |
|
63 | .data_RAM2 : ALIGN(4)
|
64 | {
|
65 | FILL(0xff)
|
66 | *(.data.$RAM2*)
|
67 | *(.data.$RamAHB32*)
|
68 | . = ALIGN(4) ;
|
69 | } > RamAHB32 AT>MFlashA
|
70 |
|
71 | /* MAIN DATA SECTION */
|
72 | |
73 | .uninit_RESERVED : ALIGN(4)
|
74 | {
|
75 | KEEP(*(.bss.$RESERVED*))
|
76 | } > RamLoc32
|
77 | |
78 | .data : ALIGN(4)
|
79 | {
|
80 | FILL(0xff)
|
81 | _data = .;
|
82 | *(vtable)
|
83 | *(.data*)
|
84 | . = ALIGN(4) ;
|
85 | _edata = .;
|
86 | } > RamLoc32 AT>MFlashA
|
87 | |
88 |
|
89 | .bss_RAM2 : ALIGN(4)
|
90 | {
|
91 | *(.bss.$RAM2*)
|
92 | *(.bss.$RamAHB32*)
|
93 | . = ALIGN(4) ;
|
94 | } > RamAHB32
|
95 | |
96 | /* MAIN BSS SECTION */
|
97 | .bss : ALIGN(4)
|
98 | {
|
99 | _bss = .;
|
100 | *(.bss*)
|
101 | *(COMMON)
|
102 | . = ALIGN(4) ;
|
103 | _ebss = .;
|
104 | PROVIDE(end = .);
|
105 | } > RamLoc32
|
106 |
|
107 | PROVIDE(_pvHeapStart = .);
|
108 | PROVIDE(_vStackTop = __top_RamLoc32 - 0);
|
109 | }
|
C-Code:
1 | const struct data __attribute__ ((__section__(".flashds"))) flash_data = {
|
2 | 1, 2, 3, 4
|
3 | };
|
Ich kann mehrmals mit dem Linker Script flashen, allerdings sobald ich
am Code Veränderungen vornehme, kommt die Fehlermeldung.
Ich hoffe ihr könnt mir helfen.
Gruß,
Achim