Technical discussions about the TI C55x DSPs (including the c5501, c5502, c5503, c5507, c5509, c5510 and OMAP5910).
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______________________________
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
______________________________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______________________________
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______________________________
> 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
______________________________> > 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______________________________