This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C++ project linking problem

Hi everyone,

I created a C++ project and implemented some basic classes. The compilation works fine but in the linking process I get some errors. I don't really know what I do wrong. I assume someone familiar with using C++ and RealView can help.

Here are the error messages I get:

linking...
.\Obj\OrigaII_Test.axf: Error: L6218E: Undefined symbol __aeabi_unwind_cpp_pr0 (referred from new.o).
.\Obj\OrigaII_Test.axf: Error: L6218E: Undefined symbol __rt_new_handler_addr (referred from new.o).
.\Obj\OrigaII_Test.axf: Error: L6218E: Undefined symbol abort (referred from arm_exceptions_terminate.o).
.\Obj\OrigaII_Test.axf: Error: L6218E: Undefined symbol __rt_eh_globals_addr (referred from arm_exceptions_globs.o).
Target not created

Thank you,
Frank

Parents
No data
Reply
  • Hi Philip,

    you should not publish third party source code files, it is legally not correct!

    Here is a part of a startup-code that shows the parts of interest:

    ;  Enter User Mode and set its Stack Pointer
    
                    EXPORT __initial_sp
    
     ; Enter the C code -------------------------------------------------------------
    
                    IMPORT  __main
                    LDR     R0, =__main
                    BX      R0
    
    .
    .
    .
    
    ; User Initial Stack & Heap
                    AREA    |.text|, CODE, READONLY
    
                    IMPORT  __use_two_region_memory
                    EXPORT  __user_initial_stackheap
    __user_initial_stackheap
    
                    LDR     R0, =  Heap_Mem
                    LDR     R1, =(Stack_Mem + USR_Stack_Size)
                    LDR     R2, = (Heap_Mem +      Heap_Size)
                    LDR     R3, = Stack_Mem
                    BX      LR
                    ENDIF
    
    

    Take a look at other startup files in your code samples if you need more info. I hope this helps.

    Frank

Children
  • Hi F D
    Thanks for your opinion.

    I added EXPORT __initial_sp only because i have other codes.

    ;  Enter User Mode and set its Stack Pointer
    
                    EXPORT __initial_sp ; <---- here
                    MSR     CPSR_c, #Mode_USR
                    MOV     SP, R0
                    SUB     SL, SP, #USR_Stack_Size
    
    
    ; Enter the C code
    
                    IMPORT  __main
                    LDR     R0, =__main
                    BX      R0
    
    
    ; User Initial Stack & Heap
                    AREA    |.text|, CODE, READONLY
    
                    IMPORT  __use_two_region_memory
                    EXPORT  __user_initial_stackheap
    __user_initial_stackheap
    
                    LDR     R0, = Heap_Mem
                    LDR     R1, = (Stack_Mem + USR_Stack_Size)
                    LDR     R2, = (Heap_Mem +      Heap_Size)
                    LDR     R3, = Stack_Mem
                    BX      LR
    


    But, the error message is:

    assembling LPC2300.s...
    LPC2300.s(500): error: A1145E: Undefined exported symbol '__initial_sp'
    


    The Micro-Lib option is checked.

    What can i do?

  • Again take a look at the startup files provided in your RealView MDK installation (for example Keil\ARM\Startup\Philips\LPC2300.s).

    Missing is the declaration for __initial_sp defined as:

                    AREA    STACK, NOINIT, READWRITE, ALIGN=3
    
    Stack_Mem       SPACE   USR_Stack_Size
    __initial_sp    SPACE   ISR_Stack_Size
    

  • Thanks,

    i used LPC2300.s 2006 version, i downloaded new version and the problem is solved.

    Thank you very much again.