This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: how to measure time from within flash_program_buf
- From: Andrew Lunn <andrew at lunn dot ch>
- To: "Neundorf, Alexander" <Alexander dot Neundorf at jenoptik dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Tue, 23 May 2006 10:03:39 +0200
- Subject: Re: [ECOS] how to measure time from within flash_program_buf
- References: <5A8A17126B73AC4C83968F6C4505E3C504315E0F@JO-EX01.JENOPTIK.NET>
On Tue, May 23, 2006 at 09:32:03AM +0200, Neundorf, Alexander wrote:
> Hi,
>
> in the Intel 28fxxx flash driver there is a timeout used, and this timeout is specified as a simple loop which is executed 5000000 times.
> Now we have a fast processor and a slow flash, so for us this timeout isn't big enough. We could simply increase the count, but this still depends on flash and processor speed.
>
> Ideally we'd like to use HAL_CLOCK_READ() to measure the time, but this isn't possible since hal_clock_read() is located in the section .text which is in the flash, but flash_program_buf() is located in the section .data which is located in RAM. When calling hal_clock_read() the linker complains and more importantly it won't work since the flash is busy while it is being programmed.
>
> So we see the following options:
> -just increase the loop counter (ugly)
> -use some ifdefs and access the timer registers directly (slightly less ugly)
> -remove the timeout completely and just wait until it has finished (still ugly)
> -make hal_clock_read() inline -> changes behaviour everywhere (also not too nice)
>
> So, how do you deal with this problem or do you have a better suggestion ?
Probably a better solution is to change the hard coded value into a
CDL paramter so that it can be configured.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss