Re: uint8_t SRAM variable for ATmega328p allocated at 0x060 (instead of 0x0100) in avr-gcc 4.6.2, 7.3.2

Kirill Shklovsky <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <CABhZC8MH1Bu98ZADYEOr-XM=n9k7FwOOM5uOiy6wSn7znFncRA@mail.gmail.com>
Senthil Kumar Selvaraj wrote:

> I don't see the problem when I tried compiling the below code with 4.6.2.
> Can you paste the command line you used, with -v and -Wl,--verbose turned on?
> It would be helpful to know what version of binutils was used, as well as the build steps.

Command used:

/usr/local/avr/bin/avr-gcc -I. \
    -D F_CPU=20000000UL \
    -g -mmcu=atmega328 -O1 \
    -fpack-struct \
    -fshort-enums \
    -funsigned-bitfields \
    -funsigned-char \
    -Wall \
    -ffunction-sections \
    -fdata-sections \
    -fno-exceptions \
    -Wa,-ahlms=obj/main.lst.gcc \
    -Wno-uninitialized \
    -c main.cpp -o obj/main.o

Here the result with -v -Wl,--verbose:

COLLECT_GCC=/usr/local/avr/bin/avr-gcc
Target: avr
Configured with: ../configure --prefix=/usr/local/avr --target=avr
--enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
Thread model: single
gcc version 4.7.3 (GCC)
COLLECT_GCC_OPTIONS='-I' '.' '-D' 'F_CPU=20000000UL' '-g'
'-mmcu=atmega328' '-O1' '-fpack-struct' '-fshort-enums'
'-funsigned-bitfields' '-funsigned-char' '-Wall' '-ffunction-sections'
'-fdata-sections' '-fno-exceptions' '-Wno-uninitialized' '-v' '-c'
'-o' 'obj/main.o'
 /usr/local/avr/libexec/gcc/avr/4.7.3/cc1plus.exe -quiet -v -I .
-imultilib avr5 -D F_CPU=20000000UL main.cpp -quiet -dumpbase main.cpp
-mmcu=atmega328 -auxbase-strip obj/main.o -g -O1 -Wall
-Wno-uninitialized -version -fpack-struct -fshort-enums
-funsigned-bitfields -funsigned-char -ffunction-sections
-fdata-sections -fno-exceptions -fno-rtti -fno-enforce-eh-specs
-fno-exceptions -o /tmp/ccFOZ1pq.s
GNU C++ (GCC) version 4.7.3 (avr)
        compiled by GNU C version 4.5.3, GMP version 4.3.2, MPFR
version 3.0.1-p4, MPC version 0.8
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/include/c++/4.7.3"
ignoring nonexistent directory
"/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/include/c++/4.7.3/avr/avr5"
ignoring nonexistent directory
"/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/include/c++/4.7.3/backward"
ignoring nonexistent directory
"/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/local/avr/lib/gcc/avr/4.7.3/include
 /usr/local/avr/lib/gcc/avr/4.7.3/include-fixed
 /usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/include
End of search list.
GNU C++ (GCC) version 4.7.3 (avr)
        compiled by GNU C version 4.5.3, GMP version 4.3.2, MPFR
version 3.0.1-p4, MPC version 0.8
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 49d98612d3bd1e77bd63ccc498787f2f
COLLECT_GCC_OPTIONS='-I' '.' '-D' 'F_CPU=20000000UL' '-g'
'-mmcu=atmega328' '-O1' '-fpack-struct' '-fshort-enums'
'-funsigned-bitfields' '-funsigned-char' '-Wall' '-ffunction-sections'
'-fdata-sections' '-fno-exceptions' '-Wno-uninitialized' '-v' '-c'
'-o' 'obj/main.o'
 /usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/bin/as.exe
-mmcu=atmega328 -mno-skip-bug -ahlms=obj/main.lst.gcc -o obj/main.o
/tmp/ccFOZ1pq.s
COMPILER_PATH=/usr/local/avr/libexec/gcc/avr/4.7.3/:/usr/local/avr/libexec/gcc/avr/4.7.3/:/usr/local/avr/libexec/gcc/avr/:/usr/local/avr/lib/gcc/avr/4.7.3/:/usr/local/avr/lib/gcc/avr/:/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/bin/
LIBRARY_PATH=/usr/local/avr/lib/gcc/avr/4.7.3/avr5/:/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/lib/avr5/:/usr/local/avr/lib/gcc/avr/4.7.3/:/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/lib/
COLLECT_GCC_OPTIONS='-I' '.' '-D' 'F_CPU=20000000UL' '-g'
'-mmcu=atmega328' '-O1' '-fpack-struct' '-fshort-enums'
'-funsigned-bitfields' '-funsigned-char' '-Wall' '-ffunction-sections'
'-fdata-sections' '-fno-exceptions' '-Wno-uninitialized' '-v' '-c'
'-o' 'obj/main.o'

The build steps is the command line above for compiling + link command:

/usr/local/avr/bin/avr-gcc
-Wl,--gc-sections,-Map,obj/testVolatile.elf.map  -mmcu=atmega328
/usr/local/avr/avr/lib/libm.a -o obj/testVolatile.elf
obj/main.o
-lm

Binutils:
$ ld -v
GNU ld (GNU Binutils) 2.23.52.20130309
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.