Post Go back to editing

error in building a project

hi ,

i got a message "PC,DADDR or FADDR holds an invalid address " in the visual dsp++5.0 on 1dsp 21062. platform.

how to find the bug in the problem and rectify it.

any help would be appreciated.


phani tej

  • Hi,

    Although this error occurs 'in building' your project - does it actually occur then, or does it occur when your DXE is loaded and run to main? Can you disable "Run to main after load" under 'Settings: Preferences: General', and load the DXE.

    If it loads without incident, step through the code until the failure occurs. This may give a better idea where/why the failure is occurring.

    This error typically indicates that the stack has become corrupted which can occur when allocating very large local arrays (that exceed the stack size). It may occur if you are trying to access a peripheral which is not supported by the simulator.

    If you are unable to trace it, can you provide an example? Can you also confirm whether you are still using the Simulator?



  • Hi,

    It definitely looks like the stack is being corrupted, though I haven't been able to pin-point why yet. Some points to get you started, though:

    In your LDF the Stack is defined as being 4K words:

                RESERVE(heaps_and_stack, heaps_and_stack_length = 8K)
                INPUT_SECTIONS( $OBJECTS(seg_dmda) $LIBRARIES(seg_dmda))
                RESERVE_EXPAND(heaps_and_stack, heaps_and_stack_length)
                ldf_stack_space = heaps_and_stack;
                ldf_stack_end = ldf_stack_space + ((heaps_and_stack_length * 4K) / 8K);
                ldf_stack_length = ldf_stack_end - ldf_stack_space;
                ldf_heap_space = ldf_stack_end;
                ldf_heap_end = ldf_heap_space + ((heaps_and_stack_length * 4K) / 8K);
                ldf_heap_length = ldf_heap_end - ldf_heap_space;
            } > seg_dmda

    Stepping through the code in your application, just as an initial example I can see that in "uu_mil_preamble()" you are allocating huge amounts of data locally, from the stack:

    int D0,D1,D2;
    int S0[31]={0};
    int S1[31]={0};
    int S2[31]={0};
    int S3[31]={0};
    int S4[31]={0};
    int S5[31]={0};
    int Increment_Value;
    int Array0[13]={0};
    int Array1[13]={0};
    int Array2[13]={0};
    int Array[39]={0};
    int Reinsert_Preamble[72]={0};
    int Sync_preamble[287]={0};
    int mp_Init[248]={0};
    int Mp_1_18[558]={0};
    int Mp_19_36[558]={0};
    int Mp_37_54[558]={0};
    int Mp_55_72[558]={0};
    int Total_Mp_1_72[2232]={0};
    int uuIndex=0;
    int uuIndex1=0;
    int uuIndex2=0;
    complex_number *Mod_mpP31[31];
    complex_number *Mod_mpN31[31];

    That's ~5400 words by my calculation, not including any preceding allocations such as the large buffers declared in main(), which would blow through the stack and corrupt it. I recommend first allocating more stack space. You might also want to check your code in case of out-of-bounds accesses which could corrupt the stack pointer.



  • Hi,

    I'm out of time to look at this further at the moment, but I tracked the problem to this call at the end of uu_mil_preamble():


    If you comment this out, the function returns normally. If you comment out the other 4 calls to uu_mil_mod() at the end of uu_mil_preamble(), leaving only that call, the application crashes.

    Hopefully that's enough to help you track down the underlying problem.


  • hi,

    yes i am still using the simulator.

    this error appears after the build is complete , and after i click on the run button.

    i am attaching my sample project with this. please take a look.


    phani tej