Post Go back to editing

CCES call assembler function from C

Category: Software
Software Version: CCES V2.9.4

Dear,

We are trying to call an assembler function from C, but get the following error during compilation:

'Building target: test_asm_Core1.dxe'
'Invoking: CrossCore SHARC Linker'
cc21k -proc ADSP-SC587 -si-revision 1.0 -TD:/workspace_cces/test_asm_Core1/system/startup_ldf/app.ldf -no-mem -map test_asm_Core1.map.xml -LD:/workspace_cces/test_asm_Core1/Debug/system/startup_ldf -flags-link -MDCORE1,-MDOTHERCORE,-MDDEBUG -add-debug-libpaths -o test_asm_Core1.dxe @input-file.txt -flags-link -od,.\.

[Error li1021] The following symbols referenced in processor 'SC587_CORE_1' could not be resolved:
'Test_Function [Test_Function.]' referenced from 'src\test_asm_Core1.doj'

Linker finished with 1 error

See attached project files

What we doing wrong and how resolve this issue?

test_asm_Core1.zip

  • Hi,

    When the compiler generates the assembly version of a C-namespace symbol, it either prepends an underscore or appends a dot to the symbol name.

    Compiling with the -char-size-8 switch on processors that support byte-addressing, the asm symbol name will have a dot suffix, otherwise, it will have an underscore prefix.

    For example, your assembly function, "_Test_Function" should be renamed to "Test_Function.", To fix the error.

    Please find the attached updated project which works fine.

    We recommend you refer to CCES help below for more information on Naming Conventions for Symbols
    CrossCore® Embedded Studio 2.x.x > SHARC® Development Tools Documentation > C/C++ Compiler Manual for SHARC® Processors > Compiler > C/C++ Run-Time Model and Environment > Function Call and Return > Symbol Names in C/C++ and Assembly


    Regards,
    Nishanthi.V
    4532.test_asm_Core1.zip

  • thanks for the clarification.

    both methods works fine.

    - option1   -char-size-8     with a dot suffix after the function name in assembler.

    - option2   -char-size-32   with an underscores before the function name in assembler 

    We have choices for option 2 (changed the compiler settings to -char-size-32 )

  • When using the option -char-size-32 we have the follows error messages

    adi_gpio.h", line 40: cc0035:  catastrophic error: #error directive: "Only Byte addressing mode is supported

    How to resolve this?

  • Hi,

    Could you please try adding "__BYTE_ADDRESSING__" macro in the Preprocessor definitions and build the code.

    To do the same, Go to project properties > C/C++ Build > Settings > Tools Settings > Crosscore C/C++ SHARC Compiler > Preprocessor > Preprocessor Definitions

    Hope this helps!

    Regards,
    Nishanthi.V

  • After adding "__BYTE_ADDRESSING__" macro in the Preprocessor definitions we having the following errors during the link.


    [Error li1021] The following symbols referenced in processor 'SC587_CORE_2' could not be resolved:
    'adi_int_InstallHandler [_adi_int_InstallHandler]' referenced from 'src\audio_framework\audio_framework.doj'
    'adi_int_InstallHandler [_adi_int_InstallHandler]' referenced from 'src\common\sport\sport_flow.doj'
    'adi_tmr_Close [_adi_tmr_Close]' referenced from 'src\bsp\systimer\bsp_systimer.doj'
    'adi_tmr_DisableOutput [_adi_tmr_DisableOutput]' referenced from 'src\bsp\systimer\bsp_systimer.doj'
    'adi_tmr_Enable [_adi_tmr_Enable]' referenced from 'src\bsp\systimer\bsp_systimer.doj'
    'adi_tmr_EnableGracefulStop [_adi_tmr_EnableGracefulStop]' referenced from 'src\bsp\systimer\bsp_systimer.doj'
    'adi_tmr_Open [_adi_tmr_Open]' referenced from 'src\bsp\systimer\bsp_systimer.doj'
    'adi_tmr_SetClkInSource [_adi_tmr_SetClkInSource]' referenced from 'src\bsp\systimer\bsp_systimer.doj'
    'adi_tmr_SetEmuRun [_adi_tmr_SetEmuRun]' referenced from 'src\bsp\systimer\bsp_systimer.doj'
    'adi_tmr_SetIRQMode [_adi_tmr_SetIRQMode]' referenced from 'src\bsp\systimer\bsp_systimer.doj'
    'adi_tmr_SetMode [_adi_tmr_SetMode]' referenced from 'src\bsp\systimer\bsp_systimer.doj'
    'adi_tmr_SetPeriod [_adi_tmr_SetPeriod]' referenced from 'src\bsp\systimer\bsp_systimer.doj'
    'adi_tmr_SetPulsePolarity [_adi_tmr_SetPulsePolarity]' referenced from 'src\bsp\systimer\bsp_systimer.doj'
    'adi_tmr_SetWidth [_adi_tmr_SetWidth]' referenced from 'src\bsp\systimer\bsp_systimer.doj'

  • Hi,

    For SHARC+ processors,the interface to enable interrupts and install interrupt handlers is provided for byte-addressing mode only.

    So, the best way to use the ASM symbol name with a dot suffix in SHARC+ byte addressed processors and compile the code with -char-size-8 in default.

    Please refer in CCES help:
    CrossCore® Embedded Studio 2.x.x > System Run-Time Documentation > Interrupt Support > Interrupt Support Specific to SHARC and SHARC+ Processors > Supported Mode on SHARC+ Processors

    Regards,
    Nishanthi.V