Sign in

username:

password:



Not a member?

Search c55x



Search tips

Subscribe to c55x



c55x by Keywords

AIC23 | C5509 | CCS | CSL | EMIF | EVM | GEL | GPIO | HPI | Interfacing | JTAG | McBSP | OMAP | Omap15 | OMAP59 | RTDX | SDRAM | TMS320VC5509 | USB | XDS5

Ads

Discussion Groups

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | TMS320C55x | access to XSP, XSSP from c code, (I/O memory)

Technical discussions about the TI C55x DSPs (including the c5501, c5502, c5503, c5507, c5509, c5510 and OMAP5910).

  

Post a new Thread

access to XSP, XSSP from c code, (I/O memory) - grze...@woodanddouglas.co.uk - Sep 23 8:47:49 2008

Hi all

It is my first post in c55 group and I would like to say hello everyone!

I have one problem, how to get value of register XSP/XSSP from c code?
I could not find anything in CSL library, I know that XSP is under address 0x4E,
but how to get value of that memory?

I need this to measure consumption of stack, protection of stack overflow etc.
But maybe there is somewhere ready library?

Kind Regards
/Greg


______________________________
Start your Android Ice Cream Sandwich development on TI's AM35x Sitara ARM Cortex-A8 processor today.



(You need to be a member of c55x -- send a blank email to c55x-subscribe@yahoogroups.com )

Re: access to XSP, XSSP from c code, (I/O memory) - Jeff Brower - Sep 23 10:29:36 2008

Greg-

> It is my first post in c55 group and I would like to say hello everyone!
> 
> I have one problem, how to get value of register XSP/XSSP from c code?
> I could not find anything in CSL library, I know that XSP is under
> address 0x4E, but how to get value of that memory?
> 
> I need this to measure consumption of stack, protection of stack
> overflow etc. But maybe there is somewhere ready library?

Typically the codegen tools support register keywords, so you could try
something
like:

  extern cregister volatile unsigned int XSP;
  volatile unsigned int XSP_reg;

     XSP_reg = XSP;

This works on C6x, for example registers such as CSR, IER, etc.  Not sure about
C55x.

If that doesn't work, you can try this:

  #define XSP 0x4E

     XSP_reg = *(volatile unsigned int *)XSP;

-Jeff



______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c55x -- send a blank email to c55x-subscribe@yahoogroups.com )

Re: access to XSP, XSSP from c code, (I/O memory) - Jeff Brower - Sep 23 11:14:14 2008

Greg-

> > It is my first post in c55 group and I would like to say hello
everyone!
> >
> > I have one problem, how to get value of register XSP/XSSP from c
code?
> > I could not find anything in CSL library, I know that XSP is under
> > address 0x4E, but how to get value of that memory?
> >
> > I need this to measure consumption of stack, protection of stack
> > overflow etc. But maybe there is somewhere ready library?
> 
> Typically the codegen tools support register keywords, so you could try
something
> like:
> 
>   extern cregister volatile unsigned int XSP;
>   volatile unsigned int XSP_reg;
> 
>      XSP_reg = XSP;
> 
> This works on C6x, for example registers such as CSR, IER, etc.  Not sure
about C55x.
> 
> If that doesn't work, you can try this:
> 
>   #define XSP 0x4E
> 
>      XSP_reg = *(volatile unsigned int *)XSP;
> 
> -Jeff
> 
> <<--- Cat quote here
> 
> Hi, thank you for answer.
> Both method do not works.
> I tried second method of course before I posted, but obviously do not works
because:
> 
> From spru371f:
> "I/O space is separate from data/program space and is available only
for
> accessing registers of the peripherals on the DSP."
> In first I had compiler error (CCS 3.1):
> 
>           unrecognized cregister name 'XSP'
>     extern cregister volatile unsigned int XSP;
> 
> any include files or simply not supported? I can not find this 'cregister'
> in documentation.
> 
> Any hints?

Why didn't you mention I/O space in your first post?  That would be just a
little bit
significant.  Suggest to try this:

  XSP_reg = *(ioport volatile unsigned int *)XSP;

-Jeff



______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c55x -- send a blank email to c55x-subscribe@yahoogroups.com )

Re: access to XSP, XSSP from c code, (I/O memory) - Jeff Brower - Sep 23 11:43:35 2008

Greg-

> > > It is my first post in c55 group and I would like to say hello
everyone!
> > >
> > > I have one problem, how to get value of register XSP/XSSP from c
code?
> > > I could not find anything in CSL library, I know that XSP is
under
> > > address 0x4E, but how to get value of that memory?
> > >
> > > I need this to measure consumption of stack, protection of stack
> > > overflow etc. But maybe there is somewhere ready library?
> >
> > Typically the codegen tools support register keywords, so you could
try something
> > like:
> >
> >   extern cregister volatile unsigned int XSP;
> >   volatile unsigned int XSP_reg;
> >
> >      XSP_reg = XSP;
> >
> > This works on C6x, for example registers such as CSR, IER, etc.  Not
sure about C55x.
> >
> > If that doesn't work, you can try this:
> >
> >   #define XSP 0x4E
> >
> >      XSP_reg = *(volatile unsigned int *)XSP;
> >
> > -Jeff
> >
> > <<--- Cat quote here
> >
> > Hi, thank you for answer.
> > Both method do not works.
> > I tried second method of course before I posted, but obviously do not
works because:
> >
> > From spru371f:
> > "I/O space is separate from data/program space and is available
only for
> > accessing registers of the peripherals on the DSP."
> > In first I had compiler error (CCS 3.1):
> >
> >           unrecognized cregister name 'XSP'
> >     extern cregister volatile unsigned int XSP;
> >
> > any include files or simply not supported? I can not find this
'cregister'
> > in documentation.
> >
> > Any hints?
> 
> Why didn't you mention I/O space in your first post?  That would be just a
little bit
> significant.  Suggest to try this:
> 
>   XSP_reg = *(ioport volatile unsigned int *)XSP;
> 
> -Jeff
> 
> Thank You Jeff
> 
> Of course ioport... but XSP is not in ioport space but simply mapped in
> data space, I am sorry, I did not understand first time documentation
> and mix I/O and CPU Memory-Mapped Registers SPRS166J page 105.
> 
> Of course  this
> 
> XSP_reg = *(volatile unsigned int *) 0x004E;
> 
> Works but ... gave me 0x0000 and I though this is not working, but SP
> is on address 0x004D and:
> 
> XSP_reg = *(volatile unsigned int *) 0x004D;
> 
> is OK.

Ok... seems like it's working then, great!  XSP would only be non-zero if your
stack
is located above 64k in data mem.

-Jeff



______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c55x -- send a blank email to c55x-subscribe@yahoogroups.com )

RE: access to XSP, XSSP from c code, (I/O memory) - Grzegorz Konopko - Sep 23 12:10:25 2008

> It is my first post in c55 group and I would like to say hello
everyone!
>
> I have one problem, how to get value of register XSP/XSSP from c code?
> I could not find anything in CSL library, I know that XSP is under
> address 0x4E, but how to get value of that memory?
>
> I need this to measure consumption of stack, protection of stack
> overflow etc. But maybe there is somewhere ready library?

Typically the codegen tools support register keywords, so you could try
something
like:

  extern cregister volatile unsigned int XSP;
  volatile unsigned int XSP_reg;

     XSP_reg = XSP;

This works on C6x, for example registers such as CSR, IER, etc.  Not sure about
C55x.

If that doesn't work, you can try this:

  #define XSP 0x4E

     XSP_reg = *(volatile unsigned int *)XSP;

-Jeff
<<--- Cat quote here

Hi, thank you for answer.
Both method do not works.
I tried second method of course before I posted, but obviously do not works
because:

>From spru371f:
"I/O space is separate from data/program space and is available only for
accessing registers of the peripherals on the DSP."
In first I had compiler error (CCS 3.1):
          unrecognized cregister name 'XSP'
    extern cregister volatile unsigned int XSP;
any include files or simply not supported? I can not find this 'cregister' in
documentation.

Any hints?

Kind Regards
//greg



______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c55x -- send a blank email to c55x-subscribe@yahoogroups.com )

RE: access to XSP, XSSP from c code, (I/O memory) - Grzegorz Konopko - Sep 23 15:13:02 2008

> > It is my first post in c55 group and I would like to say hello
everyone!
> >
> > I have one problem, how to get value of register XSP/XSSP from c
code?
> > I could not find anything in CSL library, I know that XSP is under
> > address 0x4E, but how to get value of that memory?
> >
> > I need this to measure consumption of stack, protection of stack
> > overflow etc. But maybe there is somewhere ready library?
>
> Typically the codegen tools support register keywords, so you could try
something
> like:
>
>   extern cregister volatile unsigned int XSP;
>   volatile unsigned int XSP_reg;
>
>      XSP_reg = XSP;
>
> This works on C6x, for example registers such as CSR, IER, etc.  Not sure
about C55x.
>
> If that doesn't work, you can try this:
>
>   #define XSP 0x4E
>
>      XSP_reg = *(volatile unsigned int *)XSP;
>
> -Jeff
>
> <<--- Cat quote here
>
> Hi, thank you for answer.
> Both method do not works.
> I tried second method of course before I posted, but obviously do not works
because:
>
> From spru371f:
> "I/O space is separate from data/program space and is available only
for
> accessing registers of the peripherals on the DSP."
> In first I had compiler error (CCS 3.1):
>
>           unrecognized cregister name 'XSP'
>     extern cregister volatile unsigned int XSP;
>
> any include files or simply not supported? I can not find this 'cregister'
> in documentation.
>
> Any hints?

Why didn't you mention I/O space in your first post?  That would be just a
little bit
significant.  Suggest to try this:

  XSP_reg = *(ioport volatile unsigned int *)XSP;

-Jeff
Thank You Jeff

Of course ioport... but XSP is not in ioport space but simply mapped in data
space, I am sorry, I did not understand first time documentation and mix I/O and
CPU Memory-Mapped Registers SPRS166J page 105.

Of course  this

XSP_reg = *(volatile unsigned int *) 0x004E;

Works but ... gave me 0x0000 and I though this is not working, but SP is on
address 0x004D and:

XSP_reg = *(volatile unsigned int *) 0x004D;

is OK.

Thank You for your time and I am sorry for my mistake.

Kind Regards



______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c55x -- send a blank email to c55x-subscribe@yahoogroups.com )