[ECOS] Running code from on-chip flash

Mandeep Sandhu mandeepsandhu.chd@gmail.com
Wed Sep 30 10:36:00 GMT 2009

On Wed, Sep 30, 2009 at 2:49 PM, Robin Randhawa
<robin.randhawa@gmail.com> wrote:
> Hi.
> On 30 Sep 2009, at 09:25, Mandeep Sandhu wrote:
>> On Wed, Sep 30, 2009 at 1:20 PM, Bob Brusa <bob.brusa@gmail.com> wrote:
>>> Am 27.09.2009, 05:27 Uhr, schrieb Mandeep Sandhu
>>> <mandeepsandhu.chd@gmail.com>:
>>>> Hi all,
>>>> I'm going to be using a real hardware for the first time (with ECOS).
>>>> The h/w is the Atmel AT91SAM7X512 SoC.
>>>> In order to save RAM, i'll be running the code from the on-chip flash
>>>> itself (512KB).
>>>> Now is it true that if my code resides on the flash, I will not be
>>>> able to write to it? I.e is the whole flash area is marked as
>>>> readonly?
>>>> Thanks,
>>>> -mandeep
>>> Yes, its true. You will not be able to run tricks like self-modifying
>>> code
>>> that resides in flash. You would have to move such a routine to RAM and
>>> execute it there.
>> Ok, I'm confused now!
>> Andrew mentioned that I _could_ write to a different area of the flash
>> (i.e different from the one from where the code is running).
>> To give an example, say I have to do a firmware upgrade. Now I
>> download the image from, say an ethernet interface, and keep writing
>> chunks of it (since the whole firmware image won't fit in my RAM of
>> 128KB) to a "well-known" safe area on the flash.
> IMHO, this is subject to the Flash part's abilities. I have worked with NOR
> Flash parts in the past where it was possible to run code from one sector
> while erasing/programming another sector. I suppose that the AT91SAM7X512's
> manuals and/or the Flash part manufacturer's manuals should shed light on
> this.
> Bear in mind that the Flash chips might need a sector's worth of data to be
> buffered in RAM before writing to the sector in one go.

Thanks. I'll go through the manual in detail. As Andrew mentioned, it
has 2 flash controllers, where one can be used to control the sector
which has RO data (code seg), while I can use the other controller to
write to it.


> Cheers,
> Robin

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list