Hi all,

We have the need to update one erase block in our FLASH RAM to record
some data permanently. We are running Windows CE.NET V4.2 on a PXA255
processor with IPSM V3.6 managing the Flash File system.

The documentation from Intel refers to "PSM Flash Control Semaphore"
to communicate to the IPSM software that you want to access the flash.

I originally planned to implement this write function in the
OEMIoControl() function but was stopped because I could not access the
Win32 Mutex() functions from the HAL. So, I moved the function into a
device driver and initiate the write by opening the device and calling
the DeviceIoControl() function.

Having implemented, I tested it on a target device using the Platform
Builder and it seemed to function correctly. I then moved it to a
release build and calling this function causes the Windows CE
operating system to completely lock up.

I suspect that the debug build works because the OS is executing out
of RAM.
The OS build is XIP from the FLASH RAM. But I thought that the design
of the Intel chips allowed me to run code from one block while erasing
and then writing to another.

I tried reconfiguring the driver MODULE in the BIB file to be SHC so
that it would be decompressed and so run out of RAM. But that
configuration also fails.

Would I have to disable interrupts while I do the erase and write?

The block that I am trying to overwrite has only configuration data in
it.

Any suggestions as to how to get this to work would be greatly
received.

Thanks in Advance
Brian Price
brianprice_AT_appliedcs_DOT_com_DOT_au

Re: Problem writing to directly flash while IPSM running by Valter

Valter
Thu Jun 24 03:26:13 CDT 2004

brianp@appliedcs.com.au (Brian Price) wrote in
news:83ae2378.0406232333.194ebd60@posting.google.com:

[..]
> Would I have to disable interrupts while I do the erase and write?
>

If nk.exe is executed from flash (and this is the default behaviour if
you enable XIP mode) the interrupt handler is in flash and you have to
disable interrupts while erasing flash blocks and avoid to call APIs
and functions outside your module while you are erasing the flash.

--
Valter Minute
vminute@inwind.it (the reply address of this message is invalid)

Re: Problem writing to directly flash while IPSM running by brianp

brianp
Thu Jun 24 18:09:12 CDT 2004

Hi
We are using the Intel Strata Flash 28F640J3A120 chips.

Reading of the specification would seem to indicate that if an erase
is in progress then before anything else can run, the erase suspend
command should
be issued. Similarly, when writing the program.

So, if I understand this right, for my application to work I need to
have the code running out of RAM AND disable interrupts to prevent
access to the flash.

If this is the case then is it sufficient to mark a module as SHC to
get it to run out of RAM.

Following on from that - how do I disable interrupts from the device
driver that is doing the operation. It runs at User mode level. Do I
need to switch to kernel mode to disable interrupts? Or should I
provide a mechanism in the OAL via OEMIoControl() to disable and
enable interrupts.

Thanks in Advance
Brian Price
brianprice_AT_appliedcs_DOT_com_DOT_au

"Robert Magyar" <RobertMagyar@discussions.microsoft.com> wrote in message news:<78500914-8A79-40B8-819E-EE64C5B57DE2@microsoft.com>...
> Check that your flash's device specification, to see if it says that you can run from one block while writing another, or if it says that you can run from
one bank while writing to a different bank. Often you can not read,
from a
bank, that you are writing to.
> --
> Robert
>

Re: Problem writing to directly flash while IPSM running by K

K
Fri Jun 25 10:07:01 CDT 2004

To enable/disable interrupt you can use INTERRUPTS_ON and INTERRUPTS_OFF,
but they can only be invoked in OAL.
WinCE do have using the deman paging skill so that memory allocate might in
run-time, so that even you using C flag in FILES section,
there still be some possiblity that NOT all of your caode and data already
loaded into SDRAM!!

"Brian Price" <brianp@appliedcs.com.au>
???????:83ae2378.0406241509.257f8e68@posting.google.com...
> Hi
> We are using the Intel Strata Flash 28F640J3A120 chips.
>
> Reading of the specification would seem to indicate that if an erase
> is in progress then before anything else can run, the erase suspend
> command should
> be issued. Similarly, when writing the program.
>
> So, if I understand this right, for my application to work I need to
> have the code running out of RAM AND disable interrupts to prevent
> access to the flash.
>
> If this is the case then is it sufficient to mark a module as SHC to
> get it to run out of RAM.
>
> Following on from that - how do I disable interrupts from the device
> driver that is doing the operation. It runs at User mode level. Do I
> need to switch to kernel mode to disable interrupts? Or should I
> provide a mechanism in the OAL via OEMIoControl() to disable and
> enable interrupts.
>
> Thanks in Advance
> Brian Price
> brianprice_AT_appliedcs_DOT_com_DOT_au
>
> "Robert Magyar" <RobertMagyar@discussions.microsoft.com> wrote in message
news:<78500914-8A79-40B8-819E-EE64C5B57DE2@microsoft.com>...
> > Check that your flash's device specification, to see if it says that you
can run from one block while writing another, or if it says that you can run
from
> one bank while writing to a different bank. Often you can not read,
> from a
> bank, that you are writing to.
> > --
> > Robert
> >



Re: Problem writing to directly flash while IPSM running by xiang

xiang
Thu Jul 01 03:51:02 CDT 2004

Hi:
I'm using function SC_WaitForMultiple in HAL for flash MUX,it works but
I'm not sure whether it works fine.
You can find the prototype in PB4.2 sharing source.
BTW: Maybe you can relocate youre codes in OEMInit().

regards
xiang



"Brian Price" <brianp@appliedcs.com.au> ????
news:83ae2378.0406232333.194ebd60@posting.google.com...
> Hi all,
>
> We have the need to update one erase block in our FLASH RAM to record
> some data permanently. We are running Windows CE.NET V4.2 on a PXA255
> processor with IPSM V3.6 managing the Flash File system.
>
> The documentation from Intel refers to "PSM Flash Control Semaphore"
> to communicate to the IPSM software that you want to access the flash.
>
> I originally planned to implement this write function in the
> OEMIoControl() function but was stopped because I could not access the
> Win32 Mutex() functions from the HAL. So, I moved the function into a
> device driver and initiate the write by opening the device and calling
> the DeviceIoControl() function.
>
> Having implemented, I tested it on a target device using the Platform
> Builder and it seemed to function correctly. I then moved it to a
> release build and calling this function causes the Windows CE
> operating system to completely lock up.
>
> I suspect that the debug build works because the OS is executing out
> of RAM.
> The OS build is XIP from the FLASH RAM. But I thought that the design
> of the Intel chips allowed me to run code from one block while erasing
> and then writing to another.
>
> I tried reconfiguring the driver MODULE in the BIB file to be SHC so
> that it would be decompressed and so run out of RAM. But that
> configuration also fails.
>
> Would I have to disable interrupts while I do the erase and write?
>
> The block that I am trying to overwrite has only configuration data in
> it.
>
> Any suggestions as to how to get this to work would be greatly
> received.
>
> Thanks in Advance
> Brian Price
> brianprice_AT_appliedcs_DOT_com_DOT_au



Re: Problem writing to directly flash while IPSM running by K

K
Thu Jul 01 04:59:22 CDT 2004

To relocate code into SDRAM, you may write a kernel mode DLL let it lays in
FILES section.
And using LoadKernelLibrary in OEMInit to load the DLL in to kernel space.

"xiang" <xiang_hopeNOSPAM@hotmail.com> ¼¶¼g©ó¶l¥ó·s»D
:OIKAVi0XEHA.3512@TK2MSFTNGP12.phx.gbl...
> Hi:
> I'm using function SC_WaitForMultiple in HAL for flash MUX,it works but
> I'm not sure whether it works fine.
> You can find the prototype in PB4.2 sharing source.
> BTW: Maybe you can relocate youre codes in OEMInit().
>
> regards
> xiang
>
>
>
> "Brian Price" <brianp@appliedcs.com.au> ????
> news:83ae2378.0406232333.194ebd60@posting.google.com...
> > Hi all,
> >
> > We have the need to update one erase block in our FLASH RAM to record
> > some data permanently. We are running Windows CE.NET V4.2 on a PXA255
> > processor with IPSM V3.6 managing the Flash File system.
> >
> > The documentation from Intel refers to "PSM Flash Control Semaphore"
> > to communicate to the IPSM software that you want to access the flash.
> >
> > I originally planned to implement this write function in the
> > OEMIoControl() function but was stopped because I could not access the
> > Win32 Mutex() functions from the HAL. So, I moved the function into a
> > device driver and initiate the write by opening the device and calling
> > the DeviceIoControl() function.
> >
> > Having implemented, I tested it on a target device using the Platform
> > Builder and it seemed to function correctly. I then moved it to a
> > release build and calling this function causes the Windows CE
> > operating system to completely lock up.
> >
> > I suspect that the debug build works because the OS is executing out
> > of RAM.
> > The OS build is XIP from the FLASH RAM. But I thought that the design
> > of the Intel chips allowed me to run code from one block while erasing
> > and then writing to another.
> >
> > I tried reconfiguring the driver MODULE in the BIB file to be SHC so
> > that it would be decompressed and so run out of RAM. But that
> > configuration also fails.
> >
> > Would I have to disable interrupts while I do the erase and write?
> >
> > The block that I am trying to overwrite has only configuration data in
> > it.
> >
> > Any suggestions as to how to get this to work would be greatly
> > received.
> >
> > Thanks in Advance
> > Brian Price
> > brianprice_AT_appliedcs_DOT_com_DOT_au
>
>



Re: Problem writing to directly flash while IPSM running by Bruce

Bruce
Thu Jul 01 06:47:41 CDT 2004

Wouldn't it be better to leave it in the MODULES section and set the C and K
flags?

I have not used LoadKernelLibrary, but assume that your intent was to
compress the dll so that it does not XIP.

--
Bruce Eitman (eMVP)
Senior Engineer





Re: Problem writing to directly flash while IPSM running by K

K
Fri Jul 02 00:00:01 CDT 2004

But I think for DLL in modules section even we add the C flag, the ROMIMAGE
will only compress the resource
and data section, for CODE is still uncompressed and can be XIP in flash...

Waht I want to do that is
1) DLL in files section will never be XIP
2) Kernel Mode DLL can be invoked in OAL and will NOT dmand paging.

"Bruce Eitman (eMVP)" <beitmannospam@nospam.neo.rr.com> ¼¶¼g©ó¶l¥ó·s»D
:uc2mkE2XEHA.2388@TK2MSFTNGP11.phx.gbl...
> Wouldn't it be better to leave it in the MODULES section and set the C and
K
> flags?
>
> I have not used LoadKernelLibrary, but assume that your intent was to
> compress the dll so that it does not XIP.
>
> --
> Bruce Eitman (eMVP)
> Senior Engineer
>
>
>
>



Re: Problem writing to directly flash while IPSM running by brianp

brianp
Thu Jul 08 18:17:30 CDT 2004

Hi All,

I solved the problem as follows:

1) I modified OEMIoCtrl() to process two new IOCTL codes. The first
disables all interrupts (INTERRUPTS_OFF()) and the second enables
interrupts (INTERRUPTS_ON()). The implementation has some strict
checking on the parameters passed in, so you really can't accidently
turn the interrupts on or off.

2) My device driver had two changes made to it.
First, in the BIB file I changed its type from NK to NKC. This results
in it being fully compressed and so being loaded and run out of RAM.
Second, I call the new IOCTL codes using KernelIoControl() just after
I gain control of the IPSM Mutex and restore it just before releasing
the Mutex. Note that all this is wrapped in a try()/except() handler
to make sure that I restore any Flash operations if an error occurs
otherwise the device could lock up with no interrupts.

Regards,
Brian Price
brianprice_AT_appliedcs_DOT_com_DOT_au