EmbeddedRelated.com
Forums
Memfault Beyond the Launch

problem with xmem2root

Started by INDRANUJ HALDAR December 30, 2003
Hi all,
I am downloading an email through the pop3
server and saving it into the ram. I am using the
rcm2250. I have 512k flash.Now the data is written
properly ,I can see that from my tool inspect-->dump
at address .Hence it is confirmed that it is storing
the data to the flash properly. But if I try to revert
back to the base physical address(initial physical
address)& try to read the data from flash then I find
the data is getting corrupted.I am starting at a
physical address 0x40000 & upto 0x80000 I'm going.
I am writing using root2xmem & reading through
xmem2root and displaying in stdio.I am little confused
a'out this matter. Can somebody suggest me a wayout to
this problem.
thanking you,

Indranuj

__________________________________



How can you be sure that the address range you mentioned is not
being used by something else (code, stack, etc.)?

Try this:

#define MY_XMEM_RESEVE_SIZE (insert the number of bytes you need
here)
static long xmem_addr;
xmem_addr = xalloc(MY_XMEM_RESERVE_SIZE);

now, when you need to store something from an email in xmem, you are
guranteed to have a reserved space (provided that
MY_XMEM_RESERVE_SIZE is not bigger than the amount of xmem you have
available). To read/write data to this area use:

root2xmem(xmem_addr, (void*)src, len);
xmem2root((void*)dest, xmem_addr, len);

of course, you can use offsets to access different locations in you
xalloc space:

root2xmem(xmem_addr+offset, (void*)src, len);
xmem2root((void*)dest, xmem_addr+offset, len);

hope this helps.

-Neil Peiffer
--- In rabbit-semi@rabb..., INDRANUJ HALDAR
<indraid2002@y...> wrote:
> Hi all,
> I am downloading an email through the pop3
> server and saving it into the ram. I am using the
> rcm2250. I have 512k flash.Now the data is written
> properly ,I can see that from my tool inspect-->dump
> at address .Hence it is confirmed that it is storing
> the data to the flash properly. But if I try to revert
> back to the base physical address(initial physical
> address)& try to read the data from flash then I find
> the data is getting corrupted.I am starting at a
> physical address 0x40000 & upto 0x80000 I'm going.
> I am writing using root2xmem & reading through
> xmem2root and displaying in stdio.I am little confused
> a'out this matter. Can somebody suggest me a wayout to
> this problem.
> thanking you,
>
> Indranuj
>
> __________________________________
>




--- Neil Peiffer <npeiffer@npei...> wrote:
> How can you be sure that the address range you
> mentioned is not
> being used by something else (code, stack, etc.)?
>
> Try this:
>
> #define MY_XMEM_RESEVE_SIZE (insert the number of
> bytes you need
> here)
> static long xmem_addr;
> xmem_addr = xalloc(MY_XMEM_RESERVE_SIZE);
>
> now, when you need to store something from an email
> in xmem, you are
> guranteed to have a reserved space (provided that
> MY_XMEM_RESERVE_SIZE is not bigger than the amount
> of xmem you have
> available). To read/write data to this area use:
>
> root2xmem(xmem_addr, (void*)src, len);
> xmem2root((void*)dest, xmem_addr, len);
>
> of course, you can use offsets to access different
> locations in you
> xalloc space:
>
> root2xmem(xmem_addr+offset, (void*)src, len);
> xmem2root((void*)dest, xmem_addr+offset, len);
>
> hope this helps.
>
> -Neil Peiffer >
> --- In rabbit-semi@rabb..., INDRANUJ HALDAR
> <indraid2002@y...> wrote:
> > Hi all,
> > I am downloading an email through the pop3
> > server and saving it into the ram. I am using the
> > rcm2250. I have 512k flash.Now the data is written
> > properly ,I can see that from my tool
> inspect-->dump
> > at address .Hence it is confirmed that it is
> storing
> > the data to the flash properly. But if I try to
> revert
> > back to the base physical address(initial physical
> > address)& try to read the data from flash then I
> find
> > the data is getting corrupted.I am starting at a
> > physical address 0x40000 & upto 0x80000 I'm going.
> > I am writing using root2xmem & reading through
> > xmem2root and displaying in stdio.I am little
> confused
> > a'out this matter. Can somebody suggest me a
> wayout to
> > this problem.
> > thanking
> you,
> >
> > Indranuj
> >
> > __________________________________
> >
>
Hi Niel,
Thanks a lot for your response.I was using a
function mem_usage() which gives me the usage of
memory (ram & flash ).It shows in ram
from where it uses for stack & other usage etc etc.It
also shows for stack where is the free space. Hence I
am sure that from 0x40000 to 0x80000 is a free space.
Now previously I was using a global array for reading
from pop3server as well as for writing to the ram
using root2xmem. after that in the same array only I
was retrieving the data from the ram &printing into
the stdio. Now this was creating the problem.I changed
it (the reading operation only thru xmem2root)to a
locally declared array. the problem went off. I am
confused a'out one thing .I think u can clear out my
doubt i.e.my global array size was 100 .Now I had seen
in the watch window that in the end of the array/in
the begining ) also(say for e.g.
array[99],array[98],etc)the data was there retrieved
from flash. Hence there was no junc.But still each
time the internet explorer(5.5.---.---)this thing was
getting embedded. Hence I dont know what is the reason
behind this? During this thing I had a doubt a'out the
ram content. Hence I checked with inspect---dump at
address
40000, I found that my ram content is also changed.
If sometimes the routine works fine in the sense the
ram content was not getting changed still the above
mentioned thing was coming .I changed the size of the
array(globally declared) to 10 from 100 ,the problem
went off. hence what could be the problem do you think

in this case?I would be highly thankful if you can
give me some clues in tracking out the problem.
thanking you ,
with rgds,
Indranuj

__________________________________



--- In rabbit-semi@rabb..., INDRANUJ HALDAR
<indraid2002@y...> wrote:
>
> --- Neil Peiffer <npeiffer@i...> wrote:
> > How can you be sure that the address range you
> > mentioned is not
> > being used by something else (code, stack, etc.)?
> >
> > Try this:
> >
> > #define MY_XMEM_RESEVE_SIZE (insert the number of
> > bytes you need
> > here)
> > static long xmem_addr;
> > xmem_addr = xalloc(MY_XMEM_RESERVE_SIZE);
> >
> > now, when you need to store something from an email
> > in xmem, you are
> > guranteed to have a reserved space (provided that
> > MY_XMEM_RESERVE_SIZE is not bigger than the amount
> > of xmem you have
> > available). To read/write data to this area use:
> >
> > root2xmem(xmem_addr, (void*)src, len);
> > xmem2root((void*)dest, xmem_addr, len);
> >
> > of course, you can use offsets to access different
> > locations in you
> > xalloc space:
> >
> > root2xmem(xmem_addr+offset, (void*)src, len);
> > xmem2root((void*)dest, xmem_addr+offset, len);
> >
> > hope this helps.
> >
> > -Neil Peiffer
> >
> >
> >
> > --- In rabbit-semi@rabb..., INDRANUJ HALDAR
> > <indraid2002@y...> wrote:
> > > Hi all,
> > > I am downloading an email through the pop3
> > > server and saving it into the ram. I am using the
> > > rcm2250. I have 512k flash.Now the data is written
> > > properly ,I can see that from my tool
> > inspect-->dump
> > > at address .Hence it is confirmed that it is
> > storing
> > > the data to the flash properly. But if I try to
> > revert
> > > back to the base physical address(initial physical
> > > address)& try to read the data from flash then I
> > find
> > > the data is getting corrupted.I am starting at a
> > > physical address 0x40000 & upto 0x80000 I'm going.
> > > I am writing using root2xmem & reading through
> > > xmem2root and displaying in stdio.I am little
> > confused
> > > a'out this matter. Can somebody suggest me a
> > wayout to
> > > this problem.
> > > thanking
> > you,
> > >
> > > Indranuj
> > >
> > > __________________________________
> > >
> >
> Hi Niel,
> Thanks a lot for your response.I was using a
> function mem_usage() which gives me the usage of
> memory (ram & flash ).It shows in ram
> from where it uses for stack & other usage etc etc.It
> also shows for stack where is the free space. Hence I
> am sure that from 0x40000 to 0x80000 is a free space.
> Now previously I was using a global array for reading
> from pop3server as well as for writing to the ram
> using root2xmem. after that in the same array only I
> was retrieving the data from the ram &printing into
> the stdio. Now this was creating the problem.I changed
> it (the reading operation only thru xmem2root)to a
> locally declared array. the problem went off. I am
> confused a'out one thing .I think u can clear out my
> doubt i.e.my global array size was 100 .Now I had seen
> in the watch window that in the end of the array/in
> the begining ) also(say for e.g.
> array[99],array[98],etc)the data was there retrieved
> from flash.

> Hence there was no junc.But still each
> time the internet explorer(5.5.---.---)this thing was
> getting embedded. Hence I dont know what is the reason
> behind this?

I don't understand what your question is.

> During this thing I had a doubt a'out the
> ram content. Hence I checked with inspect---dump at
> address
> 40000, I found that my ram content is also changed.
> If sometimes the routine works fine in the sense the
> ram content was not getting changed still the above
> mentioned thing was coming .

What is the above mentioned thing?

> I changed the size of the
> array(globally declared) to 10 from 100 ,the problem
> went off. hence what could be the problem do you think
>
> in this case?

Again, I don't fully understand your question.

> I would be highly thankful if you can
> give me some clues in tracking out the problem.
> thanking you ,
> with rgds,
> Indranuj
>
> __________________________________
>



> > Hi Niel,
> > Thanks a lot for your response.I was using
> a
> > function mem_usage() which gives me the usage of
> > memory (ram & flash ).It shows in ram
> > from where it uses for stack & other usage etc
> etc.It
> > also shows for stack where is the free space.
> Hence I
> > am sure that from 0x40000 to 0x80000 is a free
> space.
> > Now previously I was using a global array for
> reading
> > from pop3server as well as for writing to the ram
> > using root2xmem. after that in the same array only
> I
> > was retrieving the data from the ram &printing
> into
> > the stdio. Now this was creating the problem.I
> changed
> > it (the reading operation only thru xmem2root)to a
> > locally declared array. the problem went off. I am
> > confused a'out one thing .I think u can clear out
> my
> > doubt i.e.my global array size was 100 .Now I had
> seen
> > in the watch window that in the end of the
> array/in
> > the begining ) also(say for e.g.
> > array[99],array[98],etc)the data was there
> retrieved
> > from flash.
>
> > Hence there was no junc.But still each
> > time the internet explorer(5.5.---.---)this thing
> was
> > getting embedded. Hence I dont know what is the
> reason
> > behind this?
>
> I don't understand what your question is.
please see the next part.
>
> > During this thing I had a doubt a'out the
> > ram content. Hence I checked with inspect---dump
> at
> > address
> > 40000, I found that my ram content is also
> changed.
> > If sometimes the routine works fine in the sense
> the
> > ram content was not getting changed still the
> above
> > mentioned thing was coming .
>
> What is the above mentioned thing?
I meant "internet explorer(5.5.---.---)"this
particular string was getting printed on the stdio
after each and everytime the global array was printed
to be more specific I will just mention one e.g.
say the global array content is "//uSBAAAAAAAAAAAA"
in iteration 1 and in iteration 2 the global array
content is"/////////////////"then in the stdio they
were printed in the way given below:

"//uSBAAAAAAAAAAAAinternet explorer(5.5.---.---)
/////////////////internet explorer(5.5.---.---)"

Here in the example I have given an array of 18
bytes(but in reality I was using 100 byte array.Please
consider that.)What I see in the watch window is
globalarray[17],globalarray[16] are the corrosponding
ascii chars of 'A' in iteration 1
globalarray[17],globalarray[16] are the corrosponding
ascii chars of'/' in iteration2
this gives me the evidence that globalarray does not
contain "internet explorer(5.5.---.---)"but thru the
stepwise execution when I print on stdio window in
iteration1 & iteration2 the printout is coming like
whatever mentioned above.Here my question is where
from & how this "internet explorer(5.5.---.---)"is
coming. I am not printing anything other than
globalarray.
>
> > I changed the size of the
> > array(globally declared) to 10 from 100 ,the
> problem
> > went off. hence what could be the problem do you
> think
> >
> > in this case?
>
> Again, I don't fully understand your question.
>
previously I had mentioned that the globalarray
size was 100 bytes.But now if I reduce it to 10
and do the same operation I dont find "internet
explorer (5.5.---.----)"everytime after printing
the globalarray.this time it comes "//usbAAAAAAAAA"
only this much.Now I think it is clear to you.
> > I would be highly thankful if you can
> > give me some clues in tracking out the problem.
> > thanking
> you ,
> > with rgds,
> > Indranuj
> >
> > __________________________________
> >
>


__________________________________



How are you reading data from the pop3 server into your array?

How many bytes are you reading from the pop3 server?

are you using POP_PARSE_EXTRA? (causes email to be separated into
Sender, Recipient, Subject, and Body).

"internet explorer(5.5.---.---)" is coming from somewhere, and it
could be part of the email header.

When you write your array to xmem, how many bytes to you write?

When you read from xmem and put the result into your array, how many
bytes to you retrieve?

How are you printing your array?

It is impossible to answer your question without seeing some code. --- In rabbit-semi@rabb..., INDRANUJ HALDAR
<indraid2002@y...> wrote:
> > > Hi Niel,
> > > Thanks a lot for your response.I was using
> > a
> > > function mem_usage() which gives me the usage of
> > > memory (ram & flash ).It shows in ram
> > > from where it uses for stack & other usage etc
> > etc.It
> > > also shows for stack where is the free space.
> > Hence I
> > > am sure that from 0x40000 to 0x80000 is a free
> > space.
> > > Now previously I was using a global array for
> > reading
> > > from pop3server as well as for writing to the ram
> > > using root2xmem. after that in the same array only
> > I
> > > was retrieving the data from the ram &printing
> > into
> > > the stdio. Now this was creating the problem.I
> > changed
> > > it (the reading operation only thru xmem2root)to a
> > > locally declared array. the problem went off. I am
> > > confused a'out one thing .I think u can clear out
> > my
> > > doubt i.e.my global array size was 100 .Now I had
> > seen
> > > in the watch window that in the end of the
> > array/in
> > > the begining ) also(say for e.g.
> > > array[99],array[98],etc)the data was there
> > retrieved
> > > from flash.
> >
> > > Hence there was no junc.But still each
> > > time the internet explorer(5.5.---.---)this thing
> > was
> > > getting embedded. Hence I dont know what is the
> > reason
> > > behind this?
> >
> > I don't understand what your question is.
> please see the next part.
> >
> > > During this thing I had a doubt a'out the
> > > ram content. Hence I checked with inspect---dump
> > at
> > > address
> > > 40000, I found that my ram content is also
> > changed.
> > > If sometimes the routine works fine in the sense
> > the
> > > ram content was not getting changed still the
> > above
> > > mentioned thing was coming .
> >
> > What is the above mentioned thing?
> I meant "internet explorer(5.5.---.---)"this
> particular string was getting printed on the stdio
> after each and everytime the global array was printed
> to be more specific I will just mention one e.g.
> say the global array content is "//uSBAAAAAAAAAAAA"
> in iteration 1 and in iteration 2 the global array
> content is"/////////////////"then in the stdio they
> were printed in the way given below:
>
> "//uSBAAAAAAAAAAAAinternet explorer(5.5.---.---)
> /////////////////internet explorer(5.5.---.---)"
>
> Here in the example I have given an array of 18
> bytes(but in reality I was using 100 byte array.Please
> consider that.)What I see in the watch window is
> globalarray[17],globalarray[16] are the corrosponding
> ascii chars of 'A' in iteration 1
> globalarray[17],globalarray[16] are the corrosponding
> ascii chars of'/' in iteration2
> this gives me the evidence that globalarray does not
> contain "internet explorer(5.5.---.---)"but thru the
> stepwise execution when I print on stdio window in
> iteration1 & iteration2 the printout is coming like
> whatever mentioned above.Here my question is where
> from & how this "internet explorer(5.5.---.---)"is
> coming. I am not printing anything other than
> globalarray.
> >
> > > I changed the size of the
> > > array(globally declared) to 10 from 100 ,the
> > problem
> > > went off. hence what could be the problem do you
> > think
> > >
> > > in this case?
> >
> > Again, I don't fully understand your question.
> >
> previously I had mentioned that the globalarray
> size was 100 bytes.But now if I reduce it to 10
> and do the same operation I dont find "internet
> explorer (5.5.---.----)"everytime after printing
> the globalarray.this time it comes "//usbAAAAAAAAA"
> only this much.Now I think it is clear to you.
> > > I would be highly thankful if you can
> > > give me some clues in tracking out the problem.
> > > thanking
> > you ,
> > > with rgds,
> > > Indranuj
> > >
> > > __________________________________
> > >
> > __________________________________
>




Memfault Beyond the Launch