How to use progmem on 256kb

30 posts / 0 new
Last post
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't get "internal error: out of range error". What tools throws the error? Looks like from the linker.

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And I fail to find the post where you say what options and linker skript you use.

Together with -g I see the following ICE: http://gcc.gnu.org/PR52472

You mean that?

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SprinterSB wrote:
And I fail to find the post where you say what options and linker skript you use.

I made a new one where the messages pops up.

Avr-gcc options in avr studio:
-funsigned-char -funsigned-bitfields -O0 -fpack-struct -fshort-enums -g2 -Wall -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -mmcu=($DEVICE)

avr linker options in avrstudio:
-Wl,-Map="$(OutputFileName).map" -Wl,-lm -save-temps -mmcu=($DEVICE) ($MEMORY_SETTINGS)

avr assambler options in avrstudio:
-Wa,-gdwarf2 -x assembler-with-cpp -c -mmcu=($DEVICE)

when compiled i get 26 warnings saying:
"Warning 1 internal error: out of range error c:\....\Debug\avr_memory_demo2.o 1 1 avr_memory_demo2 "

when i try to run the program in the simulator i never enters my " find_lys " function and the program jumps around randomly

Edit:
Did not see that you linked to a bug, but the message dont look the same, i have no idear if they are they the same.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry, that AS stuff is of no use on this side of the cable.

These are *not* avr-gcc options, it's some part of a script that will expand to the options eventually.

Just post the compiler output with -v

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

this?

------ Build started: Project: avr_memory_demo2, Configuration: Debug AVR ------
Build started.
Project "avr_memory_demo2.cproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\AVR Studio 5.1\Vs\Compiler.targets" from project "M:\atmel projects\avr memory demo2\avr_memory_demo2\avr_memory_demo2.cproj" (target "Build" depends on it):
	Task "RunCompilerTask"
		C:\Program Files (x86)\Atmel\AVR Studio 5.1\make\make.exe all 
avr_memory_demo2.c
		Invoking: AVR/GNU C Compiler
		"C:\avr-gcc-4.7\bin\avr-gcc.exe"  -funsigned-char -funsigned-bitfields -O0 -fpack-struct -fshort-enums -g2 -Wall -c -std=gnu99 -v -MD -MP -MF "avr_memory_demo2.d" -MT"avr_memory_demo2.d"  -mmcu=atmega2560  -o"avr_memory_demo2.o" ".././avr_memory_demo2.c" 
		Using built-in specs.
		COLLECT_GCC=C:\avr-gcc-4.7\bin\avr-gcc.exe
		COLLECT_LTO_WRAPPER=c:/avr-gcc-4.7/bin/../libexec/gcc/avr/4.7.0/lto-wrapper.exe
		Target: avr
		Configured with: ../../gcc.gnu.org/trunk/configure --target=avr --prefix=/local/gnu/install/gcc-4.7-mingw32 --host=i386-mingw32 --build=i686-linux-gnu --enable-languages=c,c++ --disable-nls --disable-shared --disable-lto --disable-checking --disable-libquadmath --with-dwarf2
		Thread model: single
		gcc version 4.7.0 20120102 (experimental) (GCC) 
		COLLECT_GCC_OPTIONS='-funsigned-char' '-funsigned-bitfields' '-O0' '-fpack-struct' '-fshort-enums' '-g2' '-Wall' '-c' '-std=gnu99' '-v' '-MD' '-MP' '-MF' 'avr_memory_demo2.d' '-MT' 'avr_memory_demo2.d' '-mmcu=atmega2560' '-o' 'avr_memory_demo2.o'
		 c:/avr-gcc-4.7/bin/../libexec/gcc/avr/4.7.0/cc1.exe -quiet -v -imultilib avr6 -iprefix c:\avr-gcc-4.7\bin\../lib/gcc/avr/4.7.0/ -MD avr_memory_demo2.d -MF avr_memory_demo2.d -MP -MT avr_memory_demo2.d .././avr_memory_demo2.c -quiet -dumpbase avr_memory_demo2.c -mmcu=atmega2560 -auxbase-strip avr_memory_demo2.o -g2 -O0 -Wall -std=gnu99 -version -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -o C:\Users\sste\AppData\Local\Temp\ccEvOcm1.s
		GNU C (GCC) version 4.7.0 20120102 (experimental) (avr)
			compiled by GNU C version 3.4.5 (mingw-vista special r2), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
		GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
		ignoring nonexistent directory "c:\avr-gcc-4.7\bin\../lib/gcc/avr/4.7.0/../../../../avr/sys-include"
		ignoring duplicate directory "c:/avr-gcc-4.7/lib/gcc/../../lib/gcc/avr/4.7.0/include"
		ignoring duplicate directory "c:/avr-gcc-4.7/lib/gcc/../../lib/gcc/avr/4.7.0/include-fixed"
		ignoring nonexistent directory "c:/avr-gcc-4.7/lib/gcc/../../lib/gcc/avr/4.7.0/../../../../avr/sys-include"
		ignoring duplicate directory "c:/avr-gcc-4.7/lib/gcc/../../lib/gcc/avr/4.7.0/../../../../avr/include"
		#include "..." search starts here:
		#include <...> search starts here:
		 c:\avr-gcc-4.7\bin\../lib/gcc/avr/4.7.0/include
		 c:\avr-gcc-4.7\bin\../lib/gcc/avr/4.7.0/include-fixed
		 c:\avr-gcc-4.7\bin\../lib/gcc/avr/4.7.0/../../../../avr/include
		End of search list.
		GNU C (GCC) version 4.7.0 20120102 (experimental) (avr)
			compiled by GNU C version 3.4.5 (mingw-vista special r2), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
		GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
		Compiler executable checksum: afdfce2a7797df9535e30568ba8f538f
		COLLECT_GCC_OPTIONS='-funsigned-char' '-funsigned-bitfields' '-O0' '-fpack-struct' '-fshort-enums' '-g2' '-Wall' '-c' '-std=gnu99' '-v' '-MD' '-MP' '-MF' 'avr_memory_demo2.d' '-MT' 'avr_memory_demo2.d' '-mmcu=atmega2560' '-o' 'avr_memory_demo2.o'
		 c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/../../../../avr/bin/as.exe -mmcu=atmega2560 -o avr_memory_demo2.o C:\Users\sste\AppData\Local\Temp\ccEvOcm1.s
		COMPILER_PATH=c:/avr-gcc-4.7/bin/../libexec/gcc/avr/4.7.0/;c:/avr-gcc-4.7/bin/../libexec/gcc/;c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/../../../../avr/bin/
		LIBRARY_PATH=c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/avr6/;c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/../../../../avr/lib/avr6/;c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/;c:/avr-gcc-4.7/bin/../lib/gcc/;c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/../../../../avr/lib/
		COLLECT_GCC_OPTIONS='-funsigned-char' '-funsigned-bitfields' '-O0' '-fpack-struct' '-fshort-enums' '-g2' '-Wall' '-c' '-std=gnu99' '-v' '-MD' '-MP' '-MF' 'avr_memory_demo2.d' '-MT' 'avr_memory_demo2.d' '-mmcu=atmega2560' '-o' 'avr_memory_demo2.o'
		Finished building: .././avr_memory_demo2.c
		Building target: avr_memory_demo2.elf
		Invoking: AVR/GNU C Linker
		"C:\avr-gcc-4.7\bin\avr-gcc.exe" -o avr_memory_demo2.elf  avr_memory_demo2.o   -Wl,-Map="avr_memory_demo2.map" -Wl,-lm  -save-temps -v  -mmcu=atmega2560  
		Using built-in specs.
		COLLECT_GCC=C:\avr-gcc-4.7\bin\avr-gcc.exe
		COLLECT_LTO_WRAPPER=c:/avr-gcc-4.7/bin/../libexec/gcc/avr/4.7.0/lto-wrapper.exe
		Target: avr
		Configured with: ../../gcc.gnu.org/trunk/configure --target=avr --prefix=/local/gnu/install/gcc-4.7-mingw32 --host=i386-mingw32 --build=i686-linux-gnu --enable-languages=c,c++ --disable-nls --disable-shared --disable-lto --disable-checking --disable-libquadmath --with-dwarf2
		Thread model: single
		gcc version 4.7.0 20120102 (experimental) (GCC) 
		COMPILER_PATH=c:/avr-gcc-4.7/bin/../libexec/gcc/avr/4.7.0/;c:/avr-gcc-4.7/bin/../libexec/gcc/;c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/../../../../avr/bin/
		LIBRARY_PATH=c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/avr6/;c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/../../../../avr/lib/avr6/;c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/;c:/avr-gcc-4.7/bin/../lib/gcc/;c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/../../../../avr/lib/
		COLLECT_GCC_OPTIONS='-o' 'avr_memory_demo2.elf' '-save-temps' '-v' '-mmcu=atmega2560'
		 c:/avr-gcc-4.7/bin/../libexec/gcc/avr/4.7.0/collect2.exe -m avr6 -Tdata 0x800200 -o avr_memory_demo2.elf c:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/../../../../avr/lib/avr6/crtm2560.o -Lc:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/avr6 -Lc:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/../../../../avr/lib/avr6 -Lc:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0 -Lc:/avr-gcc-4.7/bin/../lib/gcc -Lc:/avr-gcc-4.7/bin/../lib/gcc/avr/4.7.0/../../../../avr/lib avr_memory_demo2.o -Map=avr_memory_demo2.map -lm -lgcc -lc -lgcc
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
M:\atmel projects\avr memory demo2\avr_memory_demo2\Debug\avr_memory_demo2.o(1,1): internal error: out of range error
		Finished building target: avr_memory_demo2.elf
		"C:\avr-gcc-4.7\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature  "avr_memory_demo2.elf" "avr_memory_demo2.hex"
		"C:\avr-gcc-4.7\bin\avr-objcopy.exe" -j .eeprom  --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0  --no-change-warnings -O ihex "avr_memory_demo2.elf" "avr_memory_demo2.eep" || exit 0
		"C:\avr-gcc-4.7\bin\avr-objdump.exe" -h -S "avr_memory_demo2.elf" > "avr_memory_demo2.lss"
		"C:\avr-gcc-4.7\bin\avr-size.exe" -C --mcu=atmega2560  "avr_memory_demo2.elf"
		AVR Memory Usage
		----------------
		Device: atmega2560
		Program:  144098 bytes (55.0% Full)
		(.text + .data + .bootloader)
		Data:         24 bytes (0.3% Full)
		(.data + .bss + .noinit)
	Done executing task "RunCompilerTask".
Done building target "CoreBuild" in project "avr_memory_demo2.cproj".
Target "PostBuildEvent" skipped, due to false condition; ('$(PostBuildEvent)' != '') was evaluated as ('' != '').
Target "Build" in file "C:\Program Files (x86)\Atmel\AVR Studio 5.1\Vs\Avr.common.targets" from project "M:\atmel projects\avr memory demo2\avr_memory_demo2\avr_memory_demo2.cproj" (entry point):
Done building target "Build" in project "avr_memory_demo2.cproj".
Done building project "avr_memory_demo2.cproj".

Build succeeded.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The problem is generate stubs by gs() in a jump offset table and these stubs are not located in the expected memory chunk, i.e. segment #0.

You can work around that by -fno-jump-tables but this is just a hack because there are situations where you cannot avoid stubs.

For now that's all I can say and otherwise I get lost in the big files...

Beside that, you should use own linker script to place all that data after the code, not before it.

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You should not locate the lengthy tables to .progmem, as that pushes vital segments such as .trampolines etc. beyond the usable area (64kB/64kW). As they are accessed through ELPM anyway, they should be deliberately positioned above all "conventional" segments, including .text. That was one of the key points in my writeup and the reason why I suggested changes in the default linker script.

JW

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As a solution, you can use a custom linker script and place .trampolines before .progmem, not after.

You can also locate .trampolines at, say, 0x30000, and everything works smooth, bit you need so set EIND = 1 in the startup code then nbecause 0x30000 is in the second 64 KiW chunk of flash.

wek wrote:
I suggested changes in the default linker script.
Ah, what PR number is it?

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SprinterSB wrote:
wek wrote:
I suggested changes in the default linker script.
Ah, what PR number is it?
I have no idea what "PR number" is, although I've seen you using that a lot.

I've requested said changes in original post in https://savannah.nongnu.org/bugs/?26365 , and explained in the related discussion on the reflector that I don't know how to accomplish the changes (and I add that I don't want to accomplish them by now). I then posted an example modified linker script to that tracker item and explained the changes in the extensive post here I linked above.

JW

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

wek wrote:
I have no idea what "PR number" is, although I've seen you using that a lot.
PR is short for "problem report".

Bugs, feature requeste etc. in GCC, binutils and other GNU projects have a PR number. For example, GCC's PR52261 is XMEGA enhancement for avr-gcc.

To go to the respective bugzilla page, simply append PR52261 to gcc.gnu.org for GCC PRs, or append to sourceware.org for binutils PRs, e.g.

http://sourceware.org/PR13410

Quote:
I've requested said changes in original post in https://savannah.nongnu.org/bugs/?26365 [...] I then posted an example modified linker script to that tracker item and explained the changes in the extensive post here I linked above.
As far as I can see it's bunch of changes for _far resp. _PF support for AVR-libc.

The default linker scripts are supplied by binutils.

I still don't understand what the problem with "(.progmem.gcc_sw_table+0x26): warning: internal error: out of range error" is about.

For example, if I locate .trampolines at 0x30000 everything works smooth and the code is correct (except EIND initialization which must me made by hand).

Size of arrays is limited by the C language and the ABI; even with 3-byte pointers all objects must be smaller than 32768 bytes.

And I am unsure if all that > 64k stuff is supposed to work out of the box. If I had to use such devices (I never used them and will never use them), I'd expect to write my own linker scripts, anyway.

In order to locate data in upper part of flack you could use avr-gcc 4.7 and its __flash1/2/3 but there is still still of home brew linker script for that because the default scripts know nothing about .progmem.data1/2/3

You think the far stuff is still needed in times of named address space support?

avrfreaks does not support Opera. Profile inactive.

Pages