Forum: Mikrocontroller und Digitale Elektronik AT32UC3C mit Ateml Studio 6.1 Program memory usage memory overflow


von Peter M. (skybiker)


Lesenswert?

Hallo ich entwickle gerade ein Programm
mit Atmel Studio 6.1 für den Atmel AT32UC3C mit externem Ram.

Wenn ich variablen im externen Ram anlege die mehr Platz einnehmen
als das Flash der CPU speichern kann kommt im Compiler nachstehender

Fehler:
"
Error  458      Program Memory Usage   :  726738 bytes   138,6 % Full 
(Memory Overflow)  TEST  0  0
"


Hier ein Auszug aus dem Programm

definiere ich MAXAUSWEISE mit 1000 tritt der Fehler nicht auf
definiere ich MAXAUSWEISE mit 8000 tritt der Fehler auf

Mit dem debugger habe ich nachvollzogen dass das array der struct auch 
wirklich im externen ram liegt.
Es sieht so aus als würde noch etwas im Programm Flash abgelegt ?
Hat jemand eine Ide was das sein könnte ?

Gruß von Peter


#define SRAM_STAMM        ((void *)0xd0080000)
#define EXTRAM __attribute__((__section__(".data_sdram")))

#define MAXAUSWEISE 1000
//#define MAXAUSWEISE 8000

struct ausweisstammsatz    // 34 Zeichen
{
  unsigned char auswnr[10]; // 20 Hex Zeichen
  unsigned char version;
  unsigned char protimmer;
  unsigned char irz;
  uint16_t  lbl;       // letzte Buchung Leser Nr.
  unsigned long lbtime;     // letzte Buchung Uhrzeit in
  unsigned char pincode[4]; // 0000...9999 packed BCD
  unsigned char verfall[3]; // jjmmtt
  uint16_t   bgr;

} stamsatz ;
struct  ausweisstammsatz EXTRAM stamm[MAXAUSWEISE];

von aevo (Gast)


Lesenswert?


von Peter M. (skybiker)


Lesenswert?

Das Problem habe ich eine Zeit lang nicht weiterverfolgt da mir der 
Speicherplatz von 512K ausgereicht hatte.
Jetzt benötige ich aber mehr Platz und habe noch mal versucht woran das 
Problem liegen könnte.
Ich habe festgestellt das Atmel Studio 6.0 und 6.1 immer den Code und 
die Variablen zusammenrechnet und so kommt es dann zum memory overflow.

Ich habe auch die linker datei aus einem Atmel Beispiel benutzt ( 32733 
)
in dem der externe SDRAM benutzt wird.
Es hat aber auch nichts gebracht.



Test variablen
#define EXTRAM __attribute__((__section__(".data_sdram")))
#define EXTRAMBSS __attribute__((__section__(".bss_sdram")))

EXTRAM static char dummy[1000000];   // geht locker in den sdram himein

Ergebnis im Output windows :
----------------------------------------------------------------------
 text     data      bss      dec      hex  filename
 108578  1315032    39084  1462694   1651a6  AC1232.elf
  Done executing task "RunCompilerTask".
  Task "RunOutputFileVerifyTask"
AC1232(0,0): Program Memory Usage :1423610 bytes   271,5 % Full  (Memory 
Overflow)
----------------------------------------------------------------------
Atmel Studio rechnet also text + data zusammen zu Program Memory Usage
ist das Ergebnis grösser als 512k bei der AT32UC3A CPU ( Flash grösse)
wird der fehler generiert.
----------------------------------------------------------------------
Ich habe damit jetz schon über eine Woche Zeit reingesteckt um den 
Fehler zu lokalisieren aber nichts hat etwas gebracht .
Unter anderem habe ich dummy[1000000] in der bss_sdram section 
deklariert.
Dies ergab auch keine Änderung.

Zum Schluss habe ich dann das ATMEL AVR32 Studio
Version: 2.6.0
Build id: 753 Umgebung installiert

und habe das Testprogramm 32733 aus der Atmel ASF importiert
habe dann meine testvariable deklariert und siehe da es gibt keinen
Memory overflow.
Die link Dateien sind identisch und genau die gleiche Variable 
deklariert.

------------------------------------------------------------------------
Ich habe weiter gesucht und habe in der Atmel studio 6.0 und 6.1
nach Beispielprogrammen mit SDRAM in der ASF gesucht.
Es sind etliche drin aber bei keiner Version wird eine Variable benutzt
die in einer section deklariert wird.

Etwa so: EXTRAM __attribute__((__section__(".data_sdram")))  int 
testvariable[1000000] ;

In den Beispielprogrammen für Atmel Studio 6.x die ich in der ASF 
gefunden habe wird der SDRAM
nur über Pointer mit einer absoluten Adresse angesprochen und getestet.
Dies ist zum Test ok aber ich kann ja nicht alle Variablen mit einer 
absoluten Adresse deklarieren .



Jetzt meine Frage kennt jemand ein Demoprogramm oder hat eins selber 
geschrieben welches für Atmel Studio 6.x geschrieben ist in dem 
Variablen > 512 K in einer section im sdram deklariert werden und auch 
ohne Memory overflow funktioniert ,
oder kann mir jemand einen tip geben.

Viele Grüße von Peter.

von Softwareverwickler (Gast)


Lesenswert?

Poste mal das Linkerskript. Vermutlich ist der falsche Typ für den 
ProgramHeader angegeben, zu dem die Sektionen .data_sdram und .data_bss 
hinzugefügt werden. Ist der Typ PT_LOAD wird angenommen, dass der Inhalt 
der Sektionen in der elf-Datei stehen soll (und von dort von nem OS oder 
dem programmer geladen werden kann).

es sollte in etwa so aussehen
1
MEMORY
2
{
3
  [...]
4
  SDRAM : ORIGIN = <baseaddress>, LENGTH = <size>
5
}
6
7
PHDRS
8
{
9
   [...]
10
   SDRAM_NOLOAD PT_NULL ;
11
}
12
13
SECTIONS
14
{
15
   [...]
16
   .bss_sdram { *(.bss_sdram) }>SDRAM :SDRAM_NOLOAD
17
}

von Peter M. (skybiker)


Lesenswert?

Hallo Softwareentwickler Gast,
hier ist das link file alles im Original von Atmel aus der ASF
AVR32733: Placing data and the heap in
external SDRAM.


/*********************************************************************** 
*******
 * AVR32 AT32UC3A0512 GNU LD script file (special for heap and 
allocation in
 * external SDRAM).
 *
 * - Compiler:           GNU GCC for AVR32
 * - Supported devices:  AVR32 AT32UC3A0512
 *
 * - author              Atmel Corporation: http://www.atmel.com \n
 *                       Support and FAQ: http://support.atmel.no/
 *
 ************************************************************************ 
******/

/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions 
are met:
 *
 * 1. Redistributions of source code must retain the above copyright 
notice, this
 * list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright 
notice,
 * this list of conditions and the following disclaimer in the 
documentation
 * and/or other materials provided with the distribution.
 *
 * 3. The name of Atmel may not be used to endorse or promote products 
derived
 * from this software without specific prior written permission.
 *
 * 4. This software may only be redistributed and used in connection 
with an Atmel
 * AVR product.
 *
 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIE
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
NON-INFRINGEMENT ARE
 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE 
LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
 *
 */OUTPUT_FORMAT("elf32-avr32", "elf32-avr32", "elf32-avr32")

OUTPUT_ARCH(avr32:uc)

ENTRY(_start)

MEMORY
{
  FLASH (rxai!w) : ORIGIN = 0x80000000, LENGTH = 0x00080000
  INTRAM (wxa!ri) : ORIGIN = 0x00000004, LENGTH = 0x0000FFFC
  SDRAM (wxa!ri) : ORIGIN = 0xD0000000, LENGTH = 0x02000000
  USERPAGE : ORIGIN = 0x80800000, LENGTH = 0x00000200
}

PHDRS
{
  FLASH PT_LOAD;
  INTRAM_ALIGN PT_NULL;
  INTRAM_AT_FLASH PT_LOAD;
  INTRAM PT_NULL;
  SDRAM_AT_FLASH PT_LOAD;
  SDRAM PT_NULL;
  USERPAGE PT_LOAD;
}

SECTIONS
{
  /* Use a default heap size if heap size was not defined. */
  _heap_size_ = DEFINED(_heap_size_) ? _heap_size_ : 
LENGTH(SDRAM);

  /* Use a default stack size if stack size was not defined. */
  _stack_size_ = DEFINED(_stack_size_) ? _stack_size_ : 4K;

  /* Read-only sections, merged into text segment: */
  PROVIDE (__executable_start = 0x80000000); . = 0x80000000;
  .interp         : { *(.interp) } >FLASH AT>FLASH :FLASH
  .reset : {  *(.reset) } >FLASH AT>FLASH :FLASH
  .hash           : { *(.hash) } >FLASH AT>FLASH :FLASH
  .dynsym         : { *(.dynsym) } >FLASH AT>FLASH :FLASH
  .dynstr         : { *(.dynstr) } >FLASH AT>FLASH :FLASH
  .gnu.version    : { *(.gnu.version) } >FLASH AT>FLASH :FLASH
  .gnu.version_d  : { *(.gnu.version_d) } >FLASH AT>FLASH :FLASH
  .gnu.version_r  : { *(.gnu.version_r) } >FLASH AT>FLASH :FLASH
  .rel.init       : { *(.rel.init) } >FLASH AT>FLASH :FLASH
  .rela.init      : { *(.rela.init) } >FLASH AT>FLASH :FLASH
  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } 
>FLASH AT>FLASH :FLASH
  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) 
} >FLASH AT>FLASH :FLASH
  .rel.fini       : { *(.rel.fini) } >FLASH AT>FLASH :FLASH
  .rela.fini      : { *(.rela.fini) } >FLASH AT>FLASH :FLASH
  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) 
} >FLASH AT>FLASH :FLASH
  .rela.rodata    : { *(.rela.rodata .rela.rodata.* 
.rela.gnu.linkonce.r.*) } >FLASH AT>FLASH :FLASH
  .rel.data.rel.ro   : { *(.rel.data.rel.ro*) } >FLASH AT>FLASH :FLASH
  .rela.data.rel.ro   : { *(.rel.data.rel.ro*) } >FLASH AT>FLASH :FLASH
  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } 
>FLASH AT>FLASH :FLASH
  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) 
} >FLASH AT>FLASH :FLASH
  .rel.tdata    : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } 
>FLASH AT>FLASH :FLASH
  .rela.tdata    : { *(.rela.tdata .rela.tdata.* 
.rela.gnu.linkonce.td.*) } >FLASH AT>FLASH :FLASH
  .rel.tbss    : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } 
>FLASH AT>FLASH :FLASH
  .rela.tbss    : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } 
>FLASH AT>FLASH :FLASH
  .rel.ctors      : { *(.rel.ctors) } >FLASH AT>FLASH :FLASH
  .rela.ctors     : { *(.rela.ctors) } >FLASH AT>FLASH :FLASH
  .rel.dtors      : { *(.rel.dtors) } >FLASH AT>FLASH :FLASH
  .rela.dtors     : { *(.rela.dtors) } >FLASH AT>FLASH :FLASH
  .rel.got        : { *(.rel.got) } >FLASH AT>FLASH :FLASH
  .rela.got       : { *(.rela.got) } >FLASH AT>FLASH :FLASH
  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } 
>FLASH AT>FLASH :FLASH
  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } 
>FLASH AT>FLASH :FLASH
  .rel.plt        : { *(.rel.plt) } >FLASH AT>FLASH :FLASH
  .rela.plt       : { *(.rela.plt) } >FLASH AT>FLASH :FLASH
  .init           :
  {
    KEEP (*(.init))
  } >FLASH AT>FLASH :FLASH =0xd703d703
  .plt            : { *(.plt) } >FLASH AT>FLASH :FLASH
  .text           :
  {
    *(.text .stub .text.* .gnu.linkonce.t.*)
    KEEP (*(.text.*personality*))
    /* .gnu.warning sections are handled specially by elf32.em.  */
    *(.gnu.warning)
  } >FLASH AT>FLASH :FLASH =0xd703d703
  .fini           :
  {
    KEEP (*(.fini))
  } >FLASH AT>FLASH :FLASH =0xd703d703
  PROVIDE (__etext = .);
  PROVIDE (_etext = .);
  PROVIDE (etext = .);
  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) } >FLASH 
AT>FLASH :FLASH
  .rodata1        : { *(.rodata1) } >FLASH AT>FLASH :FLASH
  .eh_frame_hdr : { *(.eh_frame_hdr) } >FLASH AT>FLASH :FLASH
  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) } >FLASH AT>FLASH 
:FLASH
  .gcc_except_table   : ONLY_IF_RO { KEEP (*(.gcc_except_table)) 
*(.gcc_except_table.*) } >FLASH AT>FLASH :FLASH
  .lalign  : { . = ALIGN(8); PROVIDE(_data_lma = .); } >FLASH AT>FLASH 
:FLASH
  . = ORIGIN(INTRAM);
  .dalign  : { . = ALIGN(8); PROVIDE(_data = .); } >INTRAM AT>INTRAM 
:INTRAM_ALIGN
  /* Exception handling  */
  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) } >INTRAM AT>FLASH 
:INTRAM_AT_FLASH
  .gcc_except_table   : ONLY_IF_RW { KEEP (*(.gcc_except_table)) 
*(.gcc_except_table.*) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  /* Thread Local Storage sections  */
  .tdata    : { *(.tdata .tdata.* .gnu.linkonce.td.*) } >INTRAM AT>FLASH 
:INTRAM_AT_FLASH
  .tbss      : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } 
>INTRAM AT>FLASH :INTRAM_AT_FLASH
  /* Ensure the __preinit_array_start label is properly aligned.  We
     could instead move the label definition inside the section, but
     the linker would then create the section even if it turns out to
     be empty, which isn't pretty.  */
  PROVIDE (__preinit_array_start = ALIGN(32 / 8));
  .preinit_array     : { KEEP (*(.preinit_array)) } >INTRAM AT>FLASH 
:INTRAM_AT_FLASH
  PROVIDE (__preinit_array_end = .);
  PROVIDE (__init_array_start = .);
  .init_array     : { KEEP (*(.init_array)) } >INTRAM AT>FLASH 
:INTRAM_AT_FLASH
  PROVIDE (__init_array_end = .);
  PROVIDE (__fini_array_start = .);
  .fini_array     : { KEEP (*(.fini_array)) } >INTRAM AT>FLASH 
:INTRAM_AT_FLASH
  PROVIDE (__fini_array_end = .);
  .ctors          :
  {
    /* gcc uses crtbegin.o to find the start of
       the constructors, so we make sure it is
       first.  Because this is a wildcard, it
       doesn't matter if the user does not
       actually link against crtbegin.o; the
       linker won't look for a file to match a
       wildcard.  The wildcard also means that it
       doesn't matter which directory crtbegin.o
       is in.  */
    KEEP (crtbegin.o(.ctors))
    /* We don't want to include the .ctor section from
       from the crtend.o file until after the sorted ctors.
       The .ctor section from the crtend file contains the
       end of ctors marker and it must be last */
    KEEP (*(EXCLUDE_FILE (crtend.o ) .ctors))
    KEEP (*(SORT(.ctors.*)))
    KEEP (*(.ctors))
  } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  .dtors          :
  {
    KEEP (crtbegin.o(.dtors))
    KEEP (*(EXCLUDE_FILE (crtend.o ) .dtors))
    KEEP (*(SORT(.dtors.*)))
    KEEP (*(.dtors))
  } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  .jcr            : { KEEP (*(.jcr)) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } >INTRAM 
AT>FLASH :INTRAM_AT_FLASH
  .dynamic        : { *(.dynamic) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  .got            : { *(.got.plt) *(.got) } >INTRAM AT>FLASH 
:INTRAM_AT_FLASH
  .ramtext        : { *(.ramtext .ramtext.*) } >INTRAM AT>FLASH 
:INTRAM_AT_FLASH
  .ddalign  : { . = ALIGN(8); } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  .data           :
  {
    *(.data .data.* .gnu.linkonce.d.*)
    KEEP (*(.gnu.linkonce.d.*personality*))
    SORT(CONSTRUCTORS)
  } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  .data1          : { *(.data1) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  .balign  : { . = ALIGN(8); PROVIDE(_edata = .); } >INTRAM AT>FLASH 
:INTRAM_AT_FLASH
  PROVIDE (edata = .);
  __bss_start = .;
  .bss            :
  {
    *(.dynbss)
    *(.bss .bss.* .gnu.linkonce.b.*)
    *(COMMON)
    /* Align here to ensure that the .bss section occupies space up to
       _end.  Align after .bss to ensure correct alignment even if the
       .bss section disappears because there are no input sections.  */
    . = ALIGN(8);
  } >INTRAM AT>INTRAM :INTRAM
  . = ALIGN(8);
  _end = .;
  PROVIDE (end = .);
  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the 
beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }
  .stack         ORIGIN(INTRAM) + LENGTH(INTRAM) - _stack_size_ :
  {
    _stack = .;
    *(.stack)
    . = _stack_size_;
    _estack = .;
  } >INTRAM AT>INTRAM :INTRAM

  . = ORIGIN(SDRAM);
  .data_sdram     ORIGIN(SDRAM) : AT ( LOADADDR(.balign) + SIZEOF 
(.balign) )
  {
    PROVIDE(_data_sdram = .);
    *(.data_sdram)
    . = ALIGN(8);
    PROVIDE(_edata_sdram = .);
  } >SDRAM :SDRAM_AT_FLASH

  PROVIDE(_data_sdram_lma = ABSOLUTE(LOADADDR(.data_sdram)));

  . = ALIGN(8);
  .bss_sdram :
  {
    PROVIDE(__bss_sdram_start = .);
    *(.bss_sdram)
    PROVIDE(_bss_sdram_end = .);
  } >SDRAM AT>SDRAM :SDRAM

  .heap :
  {
    _heap_start_ = .;
    *(.heap)
    . = _heap_size_;
    _heap_end_ = .;
  } >SDRAM AT>SDRAM :SDRAM

  .userpage       : { *(.userpage .userpage.*) } >USERPAGE AT>USERPAGE 
:USERPAGE
  DISCARD : { *(.note.GNU-stack) }
}

---------------------------------------------------------------------
hier die deklaration der variable im c sorce file

#define EXTRAM __attribute__((__section__(".data_sdram")))
#define EXTRAMBSS __attribute__((__section__(".bss_sdram")))

EXTRAMBSS static char dummy[1000000];


wie gesagt im AVR32 Studio
Version: 2.6.0
Build id: 753 von Atmel

klappt es
aber nicht im Atmel Studio 6.0 und 6.1

ich benutze aber das Atmel Studio 6.1 da dort mein Jtagic3 funktioniert
aber nicht im  AVR32 Studio

Gruß von Peter

von Softwareverwickler (Gast)


Lesenswert?

Das skript sieht korrekt aus.
Hab grad nochmal deinen zweiten Post durchgelesen

Peter M. schrieb:
> Ergebnis im Output windows :
> ----------------------------------------------------------------------
>  text     data      bss      dec      hex  filename
>  108578  1315032    39084  1462694   1651a6  AC1232.elf
>   Done executing task "RunCompilerTask".
>   Task "RunOutputFileVerifyTask"
> AC1232(0,0): Program Memory Usage :1423610 bytes   271,5 % Full  (Memory
> Overflow)
> ----------------------------------------------------------------------

der build war wohl erfolgreich, nur die Verifikation vom Atmel Studio 
scheitert. Scheinbar summiert der Test alles außer bss und den debug 
sections auf. Mit dem Atmel Studio hab ich noch nicht geschafft. Hab 
immer die Toolchain mit anderen IDEs genutzt.
Versuch mal ob es sich trotzdem Flashen lässt.
Schau dir auch mal die Header und die zugeordneten Sektionen des elf 
genauer an mit (konsole)
1
readelf -l AC1232.elf

von Peter M. (skybiker)


Lesenswert?

Hallo Softwareentwickler, Gast

Hier ist die Asgabe von avr32-readelf -l AC1232.elf,
wird der Typ NULL auch geladen ?
Ich versuche jetzt noch mal das zu flashen
Läßt sich das Segment 04 bss_sdram aus dem elf file per comando 
entfernen ?

Gruß Peter


Elf file type is EXEC (Executable file)
Entry point 0x80000000
There are 7 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg 
Align
  LOAD           0x000400 0x80000000 0x80000000 0x0546c 0x05470 RWE 
0x400
  NULL           0x000000 0x00000004 0x00000004 0x00000 0x00004 RW  0x1
  LOAD           0x005c08 0x00000008 0x80005470 0x0050c 0x00510 RW 
0x400
  NULL           0x000000 0x00000518 0x00000518 0x00000 0x03b70 RW  0x4
  LOAD           0x006114 0x00000000 0x00000000 0x00000 0x00000 
0x400
  NULL           0x01d400 0xd0000000 0xd0000000 0xf4240 0x2f4240 RW  0x4
  LOAD           0x006114 0x00000000 0x00000000 0x00000 0x00000 
0x400

 Section to Segment mapping:
  Segment Sections...
   00     .reset .rela.got .text .exception .rodata .lalign
   01     .dalign
   02     .data .balign
   03     .bss
   04
   05     .bss_sdram .heap
   06

: Bearbeitet durch User
von Softwareverwickler (Gast)


Lesenswert?

Sieht alles gut aus.
Die Segmente/ProgramHeader vom Typ NULL werden nicht geladen.
Google hat mir das hier gefunden:
http://delog.wordpress.com/2013/08/01/runoutputfileverifytask-compile-task-in-atmel-studio-6-1/
So kann der Test ausgeschaltet werden, damit Atmel Studio den build auch 
als erfolgreich ansieht, und damit weiterarbeiten kann.
Hier ist nen Thread zu dem Test:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=132199
Da wird mein Eindruck eigentlich bestätigt. Die elf Datei ist korrekt 
gelinkt, nur der Test ist falsch.

von Peter M. (skybiker)


Lesenswert?

Also es sieht jetzt so aus:
Es werden beim build zwar 2 Fehler angezeigt->

Error  458  Program Memory Usage   :613714 bytes   117,1 % Full  (Memory 
Overflow)  AC1232  0  0  AC1232

Error  457  AC1232.elf: warning: allocated section `.bss_sdram' not in 
segment    1  1  AC1232


aber die elf datei wird erstellt.
Wenn ich alle Variablen im sd Ram ins bss_sdram lege kann ich auch
das Programm debuggen.

In der erzeugten HEX Datei sind aber noch alle Variablen die im 
bss_sdram
liegen vorhanden.
Diese Daten kann man dan mit dem ISPBATCH Programm vom Atmel Flip nicht 
flashen.
Die erzeugte ELF Datei kann man aber mit dem ISPBATCH flashen.
batchisp -device at32uc3c0512c -hardware usb -operation erase f memory 
flash loadbuffer ac1232.elf program verify start reset



Mit nachstehender Bat Datei kann man aber auch eine Hex Datei erstellen
ohne die Variablen des bss_sdram.

avr32-objcopy.exe -O ihex -R .eeprom -R .fuse -R .lock -R .signature
-R .bss_sdram AC1232.elf AC1232.hex

Fazit: Zum Entwickeln verkleinere ich den wert des arrays auf die sruct 
soweit dass "Program Memory Usage" unter 100% liegt, damit man schneller 
sieht ob ein Fehler aufgetreten ist und für das entgültige Programm wird 
der richtige wert eingetragen und dann kontrolliert ob die elf datei 
erstellt worden ist.

Vielen Dank unbekannter weise an den  (Gast) für die schnelle Hilfe.
So komme ich bei der Projektentwicklung weiter.

Vielleicht passt das Atmel beim nächsten Studio Update mit an.

Gruß von Peter

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.