Generating *.userpage file

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

Hi,

I am starting project with UC3C0512C and I need to have separate production files, one for program and one for userpage. In older projects with different MCU, I can set up these properities in Atmel Studio, but in this case, I cannot do this.

At this moment, I have project, that store his configuration data in user page, but they are override every time I flash new version of project. The whole part of userpage is stored at the end of .hex file.

Is there a way to do this?

Thank you for your help.

O.Bostik

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

example: defining a structure at a given address:

 

struct{
	U32  FWVERSION;
} __attribute__ ((packed)) config __attribute__ (( __section__ (".config"))) =
{
	.FWVERSION = FW_VERSION
};

 

this defines a structure that holds a single integer, initializes it and says "put it in section config", now for that you need to edit your linker script file (please google) like this:

 

MEMORY
{
    ...
	FLASH2 (rxai!w) : ORIGIN = 0x8007D000, LENGTH = 0x1000
	...
}

SECTIONS
{
    ...
    .config	      : { KEEP(*(.config))} >FLASH2 AT>FLASH2
    ...
}

 

you can also include binary images this way, for example:

 

__attribute__ (( __section__ (".trampoline"))) __attribute__ ((__naked__))void bootloader(void)
{
	asm volatile(".incbin \"boot.bin\"");
}

this defines a function block (well it has to define SOMETHING) at my ".trampoline" section (at flash 0x80000000), and fills it with the bytes of that file (my bootloader in this case, has to reside in the debug subfolder). hope it helps

 

greetz

 

EDIT: you can goto project properties, select tool and there select to "only erase program area" f.e.

Last Edited: Mon. Nov 14, 2016 - 03:27 PM