What happened to __pgmx address space?

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

Months ago named address spaces have been introduced into gcc. And there was __pgmx address space, which uses 24-bit pointers. What happened with that? Now __pgmx is not recognized by compiler (avr-gcc 4.7.2 from Atmel Toolchain), __flashx too. __memx works fine. How I can use a linear 24-bit address pointer which points into FLASH?

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

__pgm was renamed to __flash.
__pgmx was renamed to __memx.

AFAIK none of the "old" names made it into a GCC release.

avrfreaks does not support Opera. Profile inactive.

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

Ok, but __memx is a generic address space for SRAM and FLASH. How can I get a 24-bit pointer which points only into FLASH for devices with >64 kB of FLASH?
And btw, can you take a look into the following topic:
https://www.avrfreaks.net/index.p...

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

There is no 24-bit, flash-only address space.

"initializer element is not computable at load time" means that the address spaces don't match. You need something like PGMX_STR that yields a __memx pointer.

avrfreaks does not support Opera. Profile inactive.

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

BTW, I’ve found a piossible bug in __memx implementation. Take a look at the following example:

#include 

extern __memx const uint8_t _binary____intro8kHz8PWMHL_raw_end;
extern __memx const uint8_t _binary____intro8kHz8PWMHL_raw_size;
extern __memx const uint8_t _binary____intro8kHz8PWMHL_raw_start;

extern __memx const uint8_t _binary____intro16kHz16PCM_raw_start;
extern __memx const uint8_t _binary____intro16kHz16PCM_raw_size;
extern __memx const uint8_t _binary____intro16kHz16PCM_raw_end;

uint8_t bufor[10];

int main(void)
{
	__memx const uint8_t *ptr;
	uint32_t start1=(__uint24) &_binary____intro8kHz8PWMHL_raw_start;
	ptr=&_binary____intro8kHz8PWMHL_raw_start;
	for(uint8_t i=0; i<10; i++) bufor[i]=*ptr++;

	while(1)
	{
		//TODO:: Please write your application code
	}
}

It won’t compile with the following error (gcc 4.7.2):

Error	2	in convert_debug_memory_address, at cfgexpand.c:2491	bin\bindata\bindata\bindata.c	40	5	bindata

If I will use your gcc 4.8.0, it crashes:

Quote:
bin\bindata\bindata\bindata.c(43,11): unused variable 'start1' [-Wunused-variable]
uint32_t start1=(__uint24) &_binary____intro8kHz8PWMHL_raw_start;
^
bin\bindata\bindata\bindata.c(40,5): in convert_debug_memory_address, at cfgexpand.c:2527
int main(void)
^
bin\bindata\bindata\bindata.c(40,5): Segmentation fault

The symbols _binary____intro8kHz8PWMHL* and _binary____intro16kHz16PCM* are external symbols to obj files with raw data.

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

This is known as PR52472, see gcc(dot)gnu(dot)org/PR52472

As a work around you can compile without debug info.

avrfreaks does not support Opera. Profile inactive.

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

Thanks.