AVRStudio doesn't handle memory directives correctly

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

Hello, I wish to report a bug:

Topic about AVR Studio 5, but same bug in AVR Studio 4,

In a project it is possible to define sections and set values in the memory tab of project properties. See attached screen capture.

AVR Studio knows the section, but does not "Remove" those EEPROM section from the flash and does not add them to EEPROM either which in a sense is consistent. So they are in the hex file not in eeprom file, and the loader refuses to load!

Extract from Makefile:

# AVR/GNU C/C++ Linker
$(QUOTE)$(AVR_APP_PATH)avr-gcc.exe$(QUOTE) -mmcu=atmega644p -Wl,-section-start=.EECV=0x810000 -Wl,-section-start=.ee_loco=0x810028 -Wl,-Map=$(MAP_FILE_PATH_AS_ARGS) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS)

The section are there, but not removed from FLASH nor added to EEPROM:

$(HEX_FLASH_FILE_PATH): $(OUTPUT_FILE_PATH)
$(QUOTE)$(AVR_APP_PATH)avr-objcopy.exe$(QUOTE) -O ihex -R .eeprom -R .fuse -R .lock -R .signature $(QUOTE)$<$(QUOTE) $(QUOTE)$@$(QUOTE)
$(HEX_EEPROM_FILE_PATH): $(OUTPUT_FILE_PATH)
-$(QUOTE)$(AVR_APP_PATH)avr-objcopy.exe$(QUOTE) -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex $(QUOTE)$<$(QUOTE) $(QUOTE)$@$(QUOTE) || exit 0

Where it should be:

$(HEX_FLASH_FILE_PATH): $(OUTPUT_FILE_PATH)
$(QUOTE)$(AVR_APP_PATH)avr-objcopy.exe$(QUOTE) -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .EECV "“R .ee_loco $(QUOTE)$<$(QUOTE) $(QUOTE)$@$(QUOTE)

$(HEX_EEPROM_FILE_PATH): $(OUTPUT_FILE_PATH)
-$(QUOTE)$(AVR_APP_PATH)avr-objcopy.exe$(QUOTE) -j .eeprom "“j .EECV "“j .ee_loco --set-section-flags=.eeprom=alloc,load --set-section-flags=.EECV=alloc,load --set-section-flags=.ee_loco=alloc,load --change-section-lma .eeprom=0 --no-change-warnings --change-section-lma .EECV=0x0 --no-change-warnings --change-section-lma .ee-loco=0x0 --no-change-warnings -O ihex $(QUOTE)$<$(QUOTE) $(QUOTE)$@$(QUOTE) || exit 0

Attachment(s): 

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

This issue now has been brought into developers notice :)

Regards,
Deena

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

Issue reported has been fixed in Atmel Studio 6.0 beta!
Now, eeprom sections are removed from *.hex file and extracted to *.eep file.

Note: Memory settings are moved inside "Properties -> Toolchain -> Linker -> Memory Settings"

Regards,
Deena