Problem with .eeprom sections

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

Using Studio 7 on Windows:

Atmel Studio 7 (Version: 7.0.1931 - )
© 2015 Atmel Corp.
All rights reserved.

OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
Platform: Win32NT

Installed Packages: Shell VSIX manifest - 7.0
Shell VSIX manifest
Version: 7.0
Package GUID: e874ffe4-fbe3-4624-9a17-61014ede02d0
Company: Atmel Corporation

Installed Packages: Atmel Start - 1.0.161.0
Atmel Start
Version: 1.0.161.0
Package GUID: F8853255-9C7B-4DC2-8E0F-64D9324AEB0E
Company: Atmel

Installed Packages: Atmel Software Framework - 3.45.0.1425
ASF
Version: 3.45.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.45.0
Release Description: ASF - 3.45.0 Release

ASF
Version: 3.44.1
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.44.1
Release Description: ASF - 3.44.1 Release

ASF
Version: 3.44.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.44.0
Release Description: ASF - 3.44.0 Release

ASF
Version: 3.43.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.43.0
Release Description: ASF - 3.43.0 Release

ASF
Version: 3.42.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.42.0
Release Description: ASF - 3.42.0 Release

ASF
Version: 3.41.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.41.0
Release Description: ASF - 3.41.0 Release

ASF
Version: 3.40.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.40.0
Release Description: ASF - 3.40.0 Release

ASF
Version: 3.39.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.39.0
Release Description: ASF - 3.39.0 Release

ASF
Version: 3.38.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.38.0
Release Description: ASF - 3.38.0 Release

ASF
Version: 3.37
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.37
Release Description: ASF - 3.37 Release

 

Installed Packages: LiveWatch - 2.0.65
LiveWatch
Version: 2.0.65
Package GUID: 7DF6DCFD-2BCA-41C7-9C0E-1B7F606B008E
Company: Atmel

Installed Packages: GdbConsole - 7.0.188
GdbConsole
Version: 7.0.188
Package GUID: 49258291-0FED-4501-881B-6BAA91BEBCA8
Company: Atmel

Installed Packages: Atmel Kits - 7.0.122
Atmel Kits
Version: 7.0.122
Package GUID: 6F4B8FE4-C464-4916-8B43-AC92431C1CDF
Company: Atmel

Installed Packages: AtmelToolchainProvider - 7.0.895
AtmelToolchainProvider
Version: 7.0.895
Package GUID: AtmelToolchainProvider.Atmel.10EF9C74-D8DA-4872-85F5-D8BB3101E245
Company: Atmel

Installed Packages: Data Visualizer Extension - 2.20.735
Data Visualizer Extension
Version: 2.20.735
Package GUID: 25dc067d-df31-4e22-be7f-cc6a77ccc7f3
Company: Atmel

Installed Packages: Microchip Gallery - 8.1.0
Microchip Gallery
Version: 8.1.0
Package GUID: AtmelStudio7ExtensionManager
Company: Microchip

Installed Packages: MemoryLogger - 7.0.1
MemoryLogger
Version: 7.0.1
Package GUID: A12E158F-08A0-48D9-B4DF-189B86C0AA02
Company: Atmel

Installed Packages: Visual Assist for Atmel Studio - 10.9.2093.2
Visual Assist for Atmel Studio
Version: 10.9.2093.2
Package GUID: 7997A33C-B154-4b75-B2AC658CD58C9510
Company: Whole Tomato Software

Installed Packages: XFeatures - Beta - 1.6
XFeatures - Beta
Version: 1.6
Package GUID: 3ac9d6e9-a3dc-4a27-a048-f4bb7fe5889b
Company: Gramcha

Installed Packages: Data Size Viewer - 0.12
Data Size Viewer
Version: 0.12
Package GUID: 3e30bc56-2280-4652-ace4-c22cf8830515
Company: Dean Camera & Morten Olsen

Installed Packages: Terminal for Atmel Studio - 2.8.4
Terminal for Atmel Studio
Version: 2.8.4
Package GUID: EFC4C002-63A3-4BB9-981F-0C1ACAF81E03
Company: Atmel

Installed Packages: FreeRTOS Viewer - 1.2.45.0
FreeRTOS Viewer
Version: 1.2.45.0
Package GUID: 98399DB5-40DF-467A-A9CB-3401A7090C88
Company: Atmel

Installed Packages: Doxygen Integrator - 7.0.1
Doxygen Integrator
Version: 7.0.1
Package GUID: 0CC72B7A-5750-4E23-90A8-70555D4FE154
Company: Atmel

 

Processor is ATTiny404.

 

I have two arrays in eeprom (to save precious RAM)

This version worked fine:

const TProgmemRGBPalette16 RainbowColors_p[16] EEMEM =
{
  static_cast <HTMLColorCode_t> (0xFF0000),
  ....
};

#define MAXOF2TABLELEN  24
const uint8_t MaxOf2Table [MAXOF2TABLELEN] EEMEM = {
  0x01,
  ...
};

No problems.

 

In a second version of the code I modified this to

const TProgmemRGBPalette16 RainbowColors_p[16] EEMEM  =
{
  static_cast <HTMLColorCode_t> (0xFF0000),
...
};

#define CHASEPATTERNLEN  NUM_OF_DRIVERS*LP5036_NUM_LEDs
const ChasePair_t ChasePatTable [CHASEPATTERNLEN] EEMEM  =
{
	  {0, 2},
	  ...
};

Where the second table is now a table of structures, each of which has two elements. Ok, it compiles fine but I get the dreaded

" RainbowColors_p causes a section type conflict with ChasePatTable "

 

Ok, so I look around for solutions for this, but there appears to be nothing better than modifying the linker script.

So, after much research to find out where the default linker script is, where to put a custom script, and how to properly modify it:

 

const TProgmemRGBPalette16 RainbowColors_p[16] __attribute__((section("eepromT1"))) =
{
  static_cast <HTMLColorCode_t> (0xFF0000),
...

};

#define CHASEPATTERNLEN  NUM_OF_DRIVERS*LP5036_NUM_LEDs
const ChasePair_t ChasePatTable [CHASEPATTERNLEN] __attribute__((section("eepromT2"))) =
{
	  {0, 2},
	  ...
};

with a slight modification to the avrxmega3.xn file (now in the \release directory, and properly pointed to with a linker -T command)

  .eeprom  :
  {
    /* See .data above...  */
	*(eepromT1)
	KEEP(*(eepromT1))
	*(eepromT2)
	KEEP(*(eepromT2))	
    KEEP(*(.eeprom*))
     __eeprom_end = . ;
  }  > eeprom

But now, the linker stubbornly refuses to put the first array, section eepromT1, into .eeprom!

The .map file shows:

.eeprom         0x00810000       0x30
 *(eepromT1)
 *(eepromT1)
 *(eepromT2)
 eepromT2       0x00810000       0x30 V3_LED_PatternGenerator.o      << The second array properly goes into .eeprom
 *(eepromT2)
 *(.eeprom*)
                0x00810030                __eeprom_end = .

 

and it puts the first array into the .data section

 

 *(.progmem*)
 .progmem.data  0x00000058       0x40 V3_LED_PatternGenerator.o
                0x00000058                RainbowColors_p
                0x00000098                . = ALIGN (0x2)

Any suggestions would be greatly appreciated.

Last Edited: Thu. Nov 28, 2019 - 08:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You sure .xn not just simply .x is used by default?

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

I have -verbose on the linker, and it says that it's using that one.

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

If you name your sections .eeprom.T1 and .eeprom.T2 then I think they should be picked up by the .eeprom* pattern in the linker script...

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)