This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to make a far call with fuction pointer

Part Number: TMS320VC5410A

Tool/software: TI C/C++ Compiler

Hi,

I define a fuction pointer type as ftype,  and define a function fun(...)  as following: 

typedef int (*ftype )(const int16_t* data_in,
                              int16_t*data_out);

int fun(    const int16_t* data_in,
                              int16_t* data_out) {
  ...

  return 0;
}

Then, I define a fuction pointer pfun and point to the fun(..):

ftype pfun;

pfun = fun;

the fuction is located at address 0x18XXX(extended memory), but the fuction pointer pfun = 0x8XXX  with the page 1 lost, not the exptected 0x18XXX. if  make call to pfun, the program run corrupted.

What is wrong?

I select the Runtime Model Options "Far fuction pointers(--use_far_alls,-mf)", but when linked, it  failed:

fatal error #16019: file "D:/ti/myprojects/vcs/dtmf_aec/rts.lib<assert.obj>"
<Linking>
   specifies non-extended memory model, which is not compatible with extended

   memory model specified in a previous file or on the command line

What shuld do I? How to specify memory model?

Our CCS version is  Version: 5.5.0.00077, the compiler version is V4.2.0.

Best Regards,

Dudechao

  • I am not familiar with the TMS320VC5410A device.  I presume it supports the instructions for far call and return named FCALL and FRET.  In that case, tell the compiler by using the option -v548.  

    user5926475 said:
    I select the Runtime Model Options "Far fuction pointers(--use_far_alls,-mf)",

    Continue to do that as well.

    user5926475 said:

    but when linked, it  failed:

    fatal error #16019: file "D:/ti/myprojects/vcs/dtmf_aec/rts.lib<assert.obj>"
    <Linking>
       specifies non-extended memory model, which is not compatible with extended

       memory model specified in a previous file or on the command line

    You have selected the wrong RTS library.  Let the linker choose the RTS library for you.  Instead of specifying --library rts.lib (or something similar), change that to --library libc.a.  This method is documented in the text file LINKER_README.txt that is located in the root directory of the compiler installation.

    Thanks and regards,

    -George

  • Hi George,

    I select options accordingly to your direction. the project building is unsuccessful yet as following

    'Building target: D:/ti/myprojects/vcs/dtmf_aec/dtmf_aec/../Debug/dtmf_aec.out'
    'Invoking: C5400 Linker'
    "D:/ti/ccs5_5/ccsv5/tools/compiler/c5400_4.2.0/bin/cl500" --define="_DEBUG" --define=c5410a --symdebug:dwarf --display_error_number --gcc --pipeline_warn --silicon_version=548 --use_far_calls --call_assumptions=0 --gen_opt_info=0 --opt_level=0 --obj_directory="D:/ti/myprojects/vcs/dtmf_aec/Debug" -z --reread_libs --display_error_number --warn_sections --search_path="D:/ti/ccs5_5/ccsv5/tools/compiler/c5400_4.2.0/lib" --search_path="D:/ti/ccs5_5/ccsv5/tools/compiler/c5400_4.2.0/include" --search_path="D:/ti/myprojects/vcs/dtmf_aec/dtmf_aec" --search_path="D:/ti/myprojects/vcs/dtmf_aec" --search_path="D:/ti/ccs3_3/C5400/csl/lib" --map_file="D:/ti/myprojects/vcs/dtmf_aec/Debug/dtmf_aec.map" --xml_link_info="dtmf_aec_linkInfo.xml" --rom_model -o "D:/ti/myprojects/vcs/dtmf_aec/dtmf_aec/../Debug/dtmf_aec.out"  "D:/ti/myprojects/vcs/dtmf_aec/Debug/vector_scaling_operations.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/spl_sqrt_floor.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/spl_sqrt.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/spl_init.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/real_fft.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/randomization_functions.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/min_max_operations.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/downsample_fast.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/division_operations.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/cross_correlation.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/complex_fft.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/complex_bit_reverse.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/echo_control_mobile.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/aecm_core.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/ring_buffer.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/delay_estimator_wrapper.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/delay_estimator.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/main.obj" "D:/ti/myprojects/vcs/dtmf_aec/Debug/codec_mf.obj" "D:/ti/myprojects/vcs/dtmf_aec/dtmf_aec.cmd" "D:/ti/myprojects/vcs/dtmf_aec/rts.lib" --library=libc.a
    <Linking>
    fatal error #16019: file "D:/ti/myprojects/vcs/dtmf_aec/rts.lib<assert.obj>"
       specifies non-extended memory model, which is not compatible with extended
       memory model specified in a previous file or on the command line

    >> Compilation failure


     Best Regards,

    Dudechao

  • You need to remove this from the invocation of the linker ...

    user5926475 said:
    "D:/ti/myprojects/vcs/dtmf_aec/rts.lib"

    Thanks and regards

    -George

  • Hi George,

    Thank you for your help! It can work now,

    By the way, how to assign a large static const Table to the extended memory(0x18000~0x18fff) area in C program?

    Best Regard!

    Dudechao