Cannot compile to ATMEGA808 with global variables

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The latest device packs (1.4.xxx) aren't correct for the MEGA808. When I compile this code:

 

#include <avr/io.h>

uint8_t GlobalByteVar;

main()
{
	while(1)
	{
		GlobalByteVar = PORTA_IN;
	}
}

I get this error from the linker:

address 0x803c01 of GccApplication11.elf section `.bss' is not within region `data'

Older device packs don't support the 808.

 

Any suggestions for linker settings, or device-pack edits to get this to compile?

 

Edit: This might belong in the Atmel Studio forum.

 

This topic has a solution.
Last Edited: Thu. Jan 30, 2020 - 05:40 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is happening to you?
I used device pack 1.4.346 and tried all optimization options -O0, -O1, -O2, -O3, -Os, and -Og, but I couldn't reproduce your phenomenon.

 

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

Search the forum for your error

is not within region `data'

much has been discussed about that. This is probably the most complete thread:

https://www.avrfreaks.net/forum/solved-compiling-attiny1607-or-other-0-series1-series-avr-gcc

 

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

Seems popular.

 

in addition, a recent thread which will solve your problem with less reading required-

https://www.avrfreaks.net/commen...

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From another thread:

 

je_ruud wrote:

We have done some changes related to definitions of origin and length. This require both a new toolchain and new DFP.

 

Now, there's a couple of things that have gone wrong here:

- The ATtiny and ATmega DFPs should have had a requirement for at least avr-gcc-3.6.2.1778.

avr-gcc-3.6.2.1778 was included in Studio 7.0.2389, but hasn't been released to web yet. But the linker script modifications in #27 is what's needed to make the old toolchain work with the new DFPs.

 

I was using the lastest toolchain on the website: 3.6.2.1759.

Could compile Series-1 Tinys but not Series-0 Megas. frown

 

I reinstalled Studio (2+ hours angry) and that got me up to toolchain 3.6.2.1778 and all is good.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

Hi guys,

 

Just change the DFP version. Project > Properties > Packs > Change Version to a version 1.3.XXX

 

I got the error report below and solve changing the DFP,

 

https://www.avrfreaks.net/forum/...

 

 

Diego Padilha

Electrical Engineer
Brazil