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.

Compiler/SECDEVTOOL-OMAPL138C6748: unresolved symbols remain

Part Number: SECDEVTOOL-OMAPL138C6748
Other Parts Discussed in Thread: OMAPL138

Tool/software: TI C/C++ Compiler

Hi,

    I can't solve the Linker "unresolved symbols remain" problem. The project is a copy of a project that builds and runs correctly. I changed the copied project to use TI-COFF instead of ELF. I have some older libraries without the source and they were built with COFF. I would like to try and use the older libraries. I rebuilt the system_config.lib from the source files in TI starterware. That seems to work. I have tried all sorts of changes to paths and underscore, double underscores and still get the same error.

   I'm using a startup.c file from starterware that has the function  start_boot(void) in it, and loading init.obj in the linker cmd file. The reason for those steps is to have the main() called while remaining in supervisor mode. There are many initializations I need to do at startup and would like to do them in C and not ASM or the GEL file.

  I think my problem is in specifying the correct paths, a name mangling issue, or some difference between ELF and COFF formats..

Here's the last part of the build listing:

'Building target: DP770_COFF.out'
'Invoking: ARM Linker'
"C:/ti/ccsv6/tools/compiler/arm_5.2.8/bin/armcl" -mv5e --code_state=32 --abi=ti_arm9_abi -me -g --define=omapl138 --define=OMAP_ARM_CORE --define=LITTLE_ENDIAN --verbose_diagnostics --display_error_number --diag_warning=225 --diag_wrap=off -k --c_src_interlist --asm_listing -z -m"DP770_COFF.map" --stack_size=0x8000 --heap_size=0x2000 -i"C:/ti/ccsv6/tools/compiler/arm_5.2.8/lib" -i"C:/Users/Dean/workspace_v6_1/DP770_COFF" -i"C:/Users/Dean/workspace_v6_1/DP770_COFF/lib" -i"C:/ti/ccsv6/tools/compiler/arm_5.2.8/include" --reread_libs --warn_sections --diag_wrap=off --no_demangle --display_error_number --xml_link_info="DP770_COFF_linkInfo.xml" --entry_point=Entry --rom_model -o "DP770_COFF.out" "./DstarGMSKdemodulate.obj" "./FIRFilter.obj" "./cpu.obj" "./exceptionhandler.obj" "./gpio_utilities.obj" "./init.obj" "./main.obj" "./psc.obj" "./startup.obj" "./syscfg.obj" "../OMAPL138-DP770.cmd" "../lib/system_config.lib"  -l"libc.a" -l"C:\Users\Dean\workspace_v6_1\DP770_COFF\lib\system_config.lib" 
<Linking>
 undefined  first referenced
  symbol        in file     
 ---------  ----------------
 start_boot ./init.obj      
error #10234-D: unresolved symbols remain
warning #10063-D: entry-point symbol other than "_c_int00" specified:  "Entry"
error #10010: errors encountered during linking; "DP770_COFF.out" not built

Here are the code sections I think are important.

Part of the linker cmd file:

SECTIONS

{
    .init : {
                  init.obj (.text)
                  } load > 0xC1080000
    .text     : load > DDR_MEM              /* CODE                              */
   .data    : load > DDR_MEM
    .bss     : load > DDR_MEM              /* GLOBAL & STATIC VARS              */
                  RUN_START(bss_start),
                  RUN_END(bss_end)
  Parts of the init.asm file:

.global    Entry
.global    start_boot
.global    __TI_auto_init

.ref    __stack
.ref    __STACK_END
.ref    bss_start
.ref    bss_end
.ref    start_boot

;
; Enter the start_boot function. The execution still happens in system mode
;
         LDR   r10, _start_boot       ; Get the address of start_boot
         MOV   lr,pc                           ; Dummy return 
         BX    r10                               ; Branch to start_boot
         SUB   pc, pc, #0x08           ; looping
;         MSR   cpsr_c, #MODE_SVC|I_F_BIT       ; change to SVC mode
;         BX   lr

_stackptr:              .word __STACK_END
_bss_start: .          word bss_start
_bss_end:            .word bss_end
_start_boot:          .word start_boot
_data_auto_init:  .word __TI_auto_init

Part of the startup.c file
/**
 * \brief   Boot strap function which enables the PLL(s) and PSC(s) for basic
 *          module(s)
 *
 * \param   none
 *
 * \return  None.
 * 
 * This function is the first function that needs to be called in a system.
 * This should be set as the entry point in the linker script if loading the
 * elf binary via a debugger, on the target. This function never returns, but
 * gives control to the application entry point
 **/
unsigned int start_boot(void)
{
    /* Enable write-protection for registers of SYSCFG module. */
    SysCfgRegistersLock();
    /* Disable write-protection for registers of SYSCFG module. */
    SysCfgRegistersUnlock();
    PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_UART2, 0, PSC_MDCTL_NEXT_ENABLE);
    PSCModuleControl(SOC_PSC_0_REGS, HW_PSC_AINTC, 0, PSC_MDCTL_NEXT_ENABLE);
    /* Initialize the vector table with opcodes */
    CopyVectorTable();
   /* Calling the main */
    main();
    while(1);
}
Startup.c, and init.asm are in the project and build without errors. It all worked fine in ELF mode, and the project was copied, not created from new.
Any help would be appreciated.
  • Remember that in COFF mode, all C functions get an extra prefixed underscore, so the linkname of the C function start_boot is _start_boot. You will need to rename your existing variable _start_boot to something else, like so:
    my_start_boot: .word _start_boot ; note the underscore on _start_boot
  • Ok! This works.

    Put the underscore in the references to the C function

    .global     _start_boot

    .ref           _start_boot

    AND change the name of the variable in ASM file

    my_start_boot:    .word  _start_boot    ;  <- using the underscored name

    and then use the newly named variable in the instruction

             LDR   r10, my_start_boot              ; Get the address of start_boot

    I had tried both adding underscores and renaming, but I don't think I tried doing both at the same time :-P

    Thank you very much. Compiles, links and runs.