[Top][All Lists]

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

[avr-gcc-list] Link script question

From: Gre7g Luterman
Subject: [avr-gcc-list] Link script question
Date: Thu, 9 Oct 2008 16:27:10 -0700 (PDT)

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.

reply via email to

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