This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

'c' casting in sfr space data

i have an unusual problem which i'd very much like some help with.

i'm using floating point notation in my project, however it is a defacto 16 bit floating point system with a hardware engine doing all the hard arthmetic work. this engine is mapped into the 8052 sfr space.

this system has the problem that when debugging in an fpga we can't use the uv2 to view the 16 bit floats in useful format. ie we can't view '3.14' in the watch window, we get '0xABCD'.

an attempt to work around this problem has been to get the hardware engine to report its output in 32 bit ieee float format. the idea was that i could then park a 'float' type _at_ that location and watch it in the view window.

the obvious (with hindsight) problem is that it is not possible to declare variables in the sfr space. nor was i able to make a pointer point to that space.

is there anything else that i can do to view this data?

any thoughts or opinions very welcome,

robert young

Parents
  • Here's something to try.

    1. Create a simple C source file with no other global variables. For example, I created MAIN.C as follows:

    float data sfrfloat;
    
    void main (void)
    {
    sfrfloat = 3.1415;
    
    while (1);
    }
    

    2. Since the file is MAIN.C the data segment (where sfrfloat is located) is named ?DT?MAIN.

    3. Using the BL51 linker options, locate the ?DT?MAIN segment using the IDATA directive (that's right, IDATA). Note that you'll also need to relocate the stack pointer (since the linker tries to place it after all data/idata segments). In the uVision options for IDATA, you should have ?STACK,?DT?MAIN(0xF8). Or on the linker command line:

    BL51 ... IDATA(?STACK,?DT?MAIN(0xF8))

    Hope this helps.

    Jon

Reply
  • Here's something to try.

    1. Create a simple C source file with no other global variables. For example, I created MAIN.C as follows:

    float data sfrfloat;
    
    void main (void)
    {
    sfrfloat = 3.1415;
    
    while (1);
    }
    

    2. Since the file is MAIN.C the data segment (where sfrfloat is located) is named ?DT?MAIN.

    3. Using the BL51 linker options, locate the ?DT?MAIN segment using the IDATA directive (that's right, IDATA). Note that you'll also need to relocate the stack pointer (since the linker tries to place it after all data/idata segments). In the uVision options for IDATA, you should have ?STACK,?DT?MAIN(0xF8). Or on the linker command line:

    BL51 ... IDATA(?STACK,?DT?MAIN(0xF8))

    Hope this helps.

    Jon

Children
No data