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

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

Re: [avr-gcc-list] Relocate Data into bootloader-Section


From: Dave Hylands
Subject: Re: [avr-gcc-list] Relocate Data into bootloader-Section
Date: Mon, 10 May 2010 07:53:12 -0700

HI Johannes,

On Mon, May 10, 2010 at 7:37 AM, Johannes Bauer <address@hidden> wrote:
> Hi Dave,
>
> On 10.05.2010 16:22, Dave Hylands wrote:
>
>>> __attribute__ ((section(".bootloader")))
>>>
>>> this does still relocate the data into the non-bootloader flash section
>>> (although it works perfectly for functions). What must I do to force
>>> data into the bootloader?
>>
>> The data section itself has to be located in RAM, or are you talking
>> about the initial value of the data section which is copied to RAM?
>
> Yikes - that one bit me! Of course it has to be copied from .text to
> .data during startup, however I just did not think of that at the point
> I had written the code (possibly due to lack of caffeine).
>
> Is there an option to have gcc put data in the flash section and not
> reserve space for it in RAM? Some combination of noinit and progmem or
> something along those lines.
>
> The rationale for this being that I want to put a constant string in the
> FLASH memory, i.e. $Id$. When I send a command to the MCU, it will read
> the address directly from FLASH into the USART using lpm instructions. I
> do not need the whole string to reside in SRAM, but want the convenience
> of gcc resolving the address automatically for me.
>
> Is that possible at all?

I think that the following will work:

const char SomeString[] __attribute__((section(".bootloader"))) =
"Flash string";

although you should double check and make sure it shows up in a
reasonable place (like after your code instead of before  it)

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/



reply via email to

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