avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Link script question


From: Dave N6NZ
Subject: Re: [avr-gcc-list] Link script question
Date: Thu, 09 Oct 2008 19:56:07 -0700
User-agent: Thunderbird 1.5 (X11/20051201)

I would take very slightly different approach. Make that a section of it's own, and put it in the linker script just after your exported symbol:

  __user_prog_start = .;
  *.(.userprog.*) ;

then create a simple .S

  .section .userprog
  .byte 0xff ; is this the correct directive? I forget
  .end

anyway, that should put the 0xff into .userprog, which I presume will
then be overwritten by your user data at a later time using the mechanism that you have currently defined.

-dave

Gre7g Luterman wrote:
I've got an avrgcc application that uses free Flash blocks to hold user code. 
To maximize the space available for the user, I start this area at the 
beginning of the first block following my application code. To locate this, I 
added the following to my linker script:

--- mega32.orig 2008-10-09 17:14:10.921875000 -0600
+++ mega32.ld   2008-10-09 12:48:58.281250000 -0600
@@ -170,6 +170,10 @@
      _edata = . ;
      PROVIDE (__data_end = .) ;
   }  > data
+  /* User-programming space */
+  . = _etext + SIZEOF(.data);
+  . = ALIGN(128);
+  __user_prog_start = .;
   .bss  SIZEOF(.data) + ADDR(.data) :
   {
      PROVIDE (__bss_start = .) ;

This works great. It creates __user_prog_start at the correct location. Then, 
in my application, I can initialize a variable to this value with:

prog_uint8_t *VPC = (prog_uint8_t *) &__user_prog_start;

This also works great. The problem is that this user space is completely 
uninitialized. I need to have at least one 0xFF at this location in my .hex 
file to insure that uploading a new version of my code will wipe out any user 
code that might have been there previously.

Can anyone suggest an easy way to do this? Is there something I can add to my 
script to include an 0xFF at location __user_prog_start? Perhaps something I 
can do in one of the .c files .S files to stuff a single 0xFF there? Otherwise 
I'm going to have to write a program to alter the .hex file after its creation 
and that's awful Kludgey.

Thanks!
Gre7g



------------------------------------------------------------------------

_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list





reply via email to

[Prev in Thread] Current Thread [Next in Thread]