Forum: Mikrocontroller und Digitale Elektronik STM32F439VI und das stm32_flash.ld File


von Markus W. (dl8mby)


Lesenswert?

Hallo Forum,

wie muss ich ein vorhandenes stm32_flash.ld File von einem STM32F405
anpassen um es für den STM32F439VI nehmen zu können.

Vorhanden ist:

/* Entry Point */
ENTRY(Reset_Handler)

/* Highest address of the user mode stack */
_estack = 0x2001c000;    /* end of 112K RAM */

/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0;      /* required amount of heap  */
_Min_Stack_Size = 0x400; /* required amount of stack */

/* Specify the memory areas */
MEMORY
{
  FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 1024K
  RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 112K
  MEMORY_B1 (rx)  : ORIGIN = 0x60000000, LENGTH = 0K
}


wie sieht das Linker File für den 439VI aus?
Mit der u.g. Konfiguration läuft der zugehörige externe Bootloader 
leider nicht.
Er soll ein Programm ab Adresse 0x08010000 starten.

/* Entry Point */
ENTRY(Reset_Handler)

/* Highest address of the user mode stack */
_estack = 0x20040000;    /* end of 256K RAM */

/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0;      /* required amount of heap  */
_Min_Stack_Size = 0x400; /* required amount of stack */

/* Specify the memory areas */
MEMORY
{
  FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 2048K
  RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 256K
  MEMORY_B1 (rx)  : ORIGIN = 0x60000000, LENGTH = 0K
}


Die o.g. Linker Datei hat folgenden Header:

/*
************************************************************************ 
*****
**
**  File        : stm32_flash.ld
**
**  Abstract    : Linker script for STM32F207IG Device with
**                1024KByte FLASH, 112KByte RAM
**
**                Set heap size, stack size and stack location according
**                to application requirements.
**
**                Set memory bank area and size if external memory is 
used.
**
**  Target      : STMicroelectronics STM32
**
**  Environment : Atollic TrueSTUDIO(R)
**
**  Distribution: The file is distributed �as is,� without any warranty
**                of any kind.

Habt Ihr möglicherweise diese Datei für den 439VI ARM zur Hand und 
könntet
sie mir posten?

Gruß
Markus
DL8MBY

von N. C. (nixchecker)


Angehängte Dateien:

Lesenswert?

Das link file mit CubeMX erstellt im Anhang.

Das Erste das auffällt ist die Unterteilung des 256KB RAM in:
1
RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 192K
2
CCMRAM (rw)    : ORIGIN = 0x10000000, LENGTH = 64K
wie im Datenblatt angegeben
und sich die daraus ergebende Stack Grenze auf:
1
/* Highest address of the user mode stack */
2
_estack = 0x20030000;    /* end of RAM */

Markus W. schrieb:
> Er soll ein Programm ab Adresse 0x08010000 starten.

Wenn dein Programm ab Adresse 0x08010000 starten soll, musst Du deine 
FLASH-section auch auf diese Adresse setzen.

von Markus W. (dl8mby)


Lesenswert?

Hallo N. C.,

danke für das File, kann es erst heute abend ausprobieren.
Ich bin successive mit dem RAM Wert bei meinem Probieren
bis 224k runter gegangen, jedoch nicht bis 196k.

Der 439er hat ja eine crypt-engine on chip, könnte der CCMRAM
zu dieser engine gehören.

Ich würde gerne wissen, ob ein 429er den 256k RAM-Bereich voll
ausnützt.

Eventuell würde ich dann diesen auf meiner Platine verbauen.

Kannst Du mir zum Vergleich auch ein 429VI Linkerfile zur Verfügung
stellen?

Ich hoffe diese Anfrage wirkt nicht zu unverschämt ;-)

Lieben Dank im Vorraus.

Markus
DL8MBY

PS.:

Wie hast Du das konkret gemeint:

"Wenn dein Programm ab Adresse 0x08010000 starten soll, musst Du deine
FLASH-section auch auf diese Adresse setzen."

Der im mcHF eingesetzte Bootloader, für den ich das Linkerfile einsetzen
will, wird ab 0x08000000 im Flasch abgelegt.
Z.Z. ist er ca. 24k groß.
Er startet dann die SDR Applikation bei 0x08010000.
Für die Compilierung muss ich auch dort das .ld File anpassen.

von Markus W. (dl8mby)


Lesenswert?

Sehe gerade, dass CCM für "core coupled memory" steht.

Ist das die Schnittstelle zwischen CPU und DSP?

Laut DS:

Up to 256+4 KB of SRAM including 64-KB of CCM (core coupled memory)
data RAM Flexible external memory controller with up to 32-bit data bus: 
SRAM,PSRAM,SDRAM/LPSDR SDRAM , Compact Flash/NOR/NAND memories


Markus

von N. C. (nixchecker)


Angehängte Dateien:

Lesenswert?

Markus W. schrieb:
> Ich würde gerne wissen, ob ein 429er den 256k RAM-Bereich voll
> ausnützt.

Leider nicht, ist das Gleiche. Siehe auch Datenblatt.

Markus W. schrieb:
> Er startet dann die SDR Applikation bei 0x08010000.
> Für die Compilierung muss ich auch dort das .ld File anpassen.
1
/* Specify the memory areas */
2
MEMORY
3
{
4
FLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 2048K

wird dann zu:
1
/* Specify the memory areas */
2
MEMORY
3
{
4
FLASH (rx)      : ORIGIN = 0x8010000, LENGTH = 2048K - 64K

Da der Bootloader auch den RAM benutzt würde ich mir an deiner Stelle 
ein komplettes Beispiel für ein derartiges Bootloader Projekt ansehen.

von N. C. (nixchecker)


Lesenswert?

N. C. schrieb:
> ein komplettes Beispiel für ein derartiges Bootloader Projekt

Das Stichwort lautet IAP und gibt es in der Firmware Lib.

von Markus W. (dl8mby)


Lesenswert?

Hallo N.C.,

wenn es Dich interessiert,

das Projekt, das ich benütze, ist unter

https://github.com/df8oe/mchf-github

im GitHub anzusehen.

Dort stehen auch die *.ld Files drin,
in
./mchf-eclipse/bootloader/src/mchf-eclipse/arm-gcc-link.ld
und in
./mchf-eclipse/mchf-eclipse/stm32_flash.ld

Es handelt sich um einen SDR (software defined radio) TRX für den
Amateurfunk.

Siehe auch Beitrag: Beitrag "mcHF-SDR Selbstbau-Projekt"

Danke für Deine Hilfe und Hinweise.

Markus
DL8MBY

von Long Don (Gast)


Lesenswert?

Markus W. schrieb:
> Sehe gerade, dass CCM für "core coupled memory" steht.
>
> Ist das die Schnittstelle zwischen CPU und DSP?


Nein. Das steht aber auch in den Dokus...


*****
The CCM RAM is tightly coupled with the Cortex™
core. it is primarily intended to execute code at maximum system clock 
frequency (72 MHz) without any wait state penalty. It thus allows to 
significantly decrease critical task execution time, compared to code 
execution from Flash memory.
CCM RAM is typically used for real-time and computation intensive 
routines, such as:
- Digital power conversion control loops (switch mode power supplies, 
lighting)
- Field-oriented 3-phase motor control
- Real-time DSP tasks
When code is located in CCM  RAM and data stored in the regular SRAM, 
the Cortex-M4  core is in the optimum Harvard configuration. A dedicated 
zero-wait state memory is connected to each of its I- and D-bus and can 
thus perform at 1.25DMIPS/MHz up to 72 MHz, with a deterministic 
performance of 90 DMIPS. This also guarantees a minimal latency if 
interrupt service routines are placed in the CCM RAM.

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.