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.

regards,

phani tej

Parents
  • 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:

            seg_dmda
            {
                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.

    Regards,

    Craig

Reply
  • 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:

            seg_dmda
            {
                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.

    Regards,

    Craig

Children
No Data