Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7181709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:36:51+00:00 2026-05-28T17:36:51+00:00

I have linkers errors(undefined reference) that I cannot solve by myself. I use GCC

  • 0

I have linkers errors(undefined reference) that I cannot solve by myself. I use GCC Sourcery G++ Lite 4.5.2 for ARM.

I have a lot of undefined reference and they almost all refer to assembly file. Here one example :

I have “_CPU_MmuConfigGet” defined in an assembly file named cpu.sx :

.global _CPU_MmuConfigGet
CPU_MmuConfigGet: 
mrc p15,0,r0,c1,c0,0        
mov pc,lr

In a c file named mmu.c , CPU_MmuConfigGet is called :

#include "cpu.h"
U32 MMU_ConfigGet(void) {
    return CPU_MmuConfigGet();
}

Finally, in the header file cpu.h, CPU_MmuConfigGet is declared :

extern U32 CPU_MmuConfigGet(void);

Theses tree files are located in the following folders :

Base/Common/src/mmu.c     
Base/Common/inc/cpu.h     
Base/Common/src/cpu.sx    

From different post I red on the net, I found that I should add an underline to CPU_MmuConfigGet (tried, but didn’t solve my problem). I also red in some forum that , when linking, object file order are important, but in others forums, object order are not important (I’m confused here…). I tried the -S parameter to see the assembly version of mmu.c, but that didn’t help me finding a clue about my error…

Here’s is the compiler command used (I have added -H in case this help finding what is wrong…) :

arm-none-eabi-gcc -c -g3 -gdwarf-2  -H -o"mmu.o" -Wall -Wa,-adhlns="mmu.o.lst" 
-fmessage-length=0 -MMD -MP -MF"mmu.d" -MT"mmu.d" -fpic  -march=armv4t -mcpu=arm7tdmi -mlittle-endian 
-I"../../OS/ngos/hw/cdb89712" -I"../../OS/ngos" -I"../../OS/ngos/include" -I"../../OS/ngos/rtos/ucosii"  
-I"C:/Program Files/CodeSourcery/Sourcery G++ Lite/lib/gcc/arm-none-eabi/4.5.2/include" -I"./"  
-I"src/" -I"../../Common/inc" -I"../../OS/uCOS-II/SOURCE" -I"../../OS/ngos/drivers/arm" 
-I"../../OS/ngos/include/ngos" -I"../../OS/ngip/include" -I"../../OS/ngip/include/ngip" 
-I"../../Dvcscomponent/Inc" -I"../../Inc"  "../../Common/src/mmu.c"
. ../../Common/inc/base.h
. ../../Common/inc/hw7312.h
. ../../Common/inc/serial.h
.. ../../Common/inc/base.h
.. ../../Common/inc/hw7312.h
. ../../Common/inc/base.h
. ../../Common/inc/cpu.h
.. ../../Common/inc/base.h
.. ../../Common/inc/hw7312.h
. ../../Common/inc/mmu.h

Now the assembly command :

arm-none-eabi-gcc -g3 -gdwarf-2  -x assembler-with-cpp -Wa,-adhlns="cpu.o.lst" -Wall -c 
-fmessage-length=0 -MMD -MP -MF"cpu.d" -MT"cpu.d" -fpic -o"cpu.o" -march=armv4t  -mcpu=arm7tdmi -mlittle-endian 
-I"../../OS/ngos/hw/cdb89712" -I"../../Common" -I"../../OS/ngos/drivers/arm" 
"../../Common/src/cpu.sx"

Finally the linking command with the error :

arm-none-eabi-gcc -fpic -mcpu=arm7tdmi -T".\linker.ld" -Wl,-Map,BootLoad.map -g3 -gdwarf-2  -o "BootLoad.elf"  
InitMain.o tsk_main.o ecp.o memalloc.o tsk_ecp.o firmdesc.o crc.o flash.o eth.o firmflash.o 
firmdest.o bcfg.o bootdownload.o cinit.o serial.o cpu.o mmu.o  ngucos.o cdbini.o cs712sio.o  
cs712eth.o  ../../OS/ngos/lib/rtstub/arm/gcc/libngosd4m32l.a ../../OS/ngip/lib/rtstub/arm/gcc/libngipd4m32l.a 
mmu.o: In function `MMU_ConfigGet':
C:\Working\SF2100-0074-BootLoaderMezz\Base\NexGen\BootLoader/../../Common/src/mmu.c:28: undefined reference to `CPU_MmuConfigGet'

I someone have any suggestions, I would be pleased to hear them!

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:36:53+00:00Added an answer on May 28, 2026 at 5:36 pm

    Finally, after consulting the listing of cpu.sx, I was surprised that a part of the file was “missing”. I realized that the file had an include of another assembly file. This included assembly file was ended… by a

    .end
    

    directive.

    I removed this directive and the project compiled.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whilst compiling with avr-gcc I have encountered linker errors such as the following: undefined
Possible Duplicate: GCC C++ Linker errors: Undefined reference to 'vtable for XXX', Undefined reference
I have no trouble building 1.35.0, as well as 1.36.0 on the timesys arm-gcc
I have a linker error when trying to build my JNI application: undefined reference
I have a link error where the linker complains that my concrete class's destructor
I have a linker command file that assigns the top address of the stack
What does the Linux /proc/meminfo Mapped topic mean? I have seen several one-liners that
I have this class that has a static member. it is also a base
I have a template class that I've subclassed with a pointer to it (Decorator
I have a Point class (with integer members x and y) that has a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.