EmbDev.net

Forum: ARM programming with GCC/GNU tools Error: undefined symbol xxx used as an immediate value


von Steve W. (Company: Hobby) (stevewainwright)


Rate this post
useful
not useful
I'm trying to build the latest HPGCC3 libraries to enable C programming 
of a HP50g calculator. The preferred toolchain from  'CodeSourcery' 
appears to cause misalignment problems when linking multiple object 
files, which is proving to be a massive problem in converting a HPGCC2 
project.
I decided to try the Yagarto toolchain instead, and through Eclipse I'm 
having a problem building one file in a library. I'm using Mac OSx 
10.6.8.

Here's the error:
/Users/stevewainwright/yagarto/yagarto-4.6.0/tools/gnumake all
cpu_flush_cache.c: In function '__go_superv':
cpu_flush_cache.c:42:18: warning: variable 'fptr' set but not used 
[-Wunused-but-set-variable]
{standard input}: Assembler messages:
{standard input}:30: Error: undefined symbol _flush_MVA used as an 
immediate value
gnumake[1]: *** [cpu_flush_cache.o] Error 1


 Here's the file


// ROMLIB CHECKED


static void _flush_MVA(void) _attribute_ ((naked));

static void _flush_MVA(void)
{
    // REMOVED NOP'S, SEEMS TO WORK FINE 01/09/05

    asm volatile ("stmfd sp!, {r0, r14}");
    asm volatile ("___looplabel:");
    // CLEAN SINGLE ENTRY USING MVA
    asm volatile ("mcr p15, 0, r0, c7, c10, 1");
    // next MVA
    asm volatile ("add r0,r0,#0x20");
    asm volatile ("teq r0,r1");
    asm volatile ("bne ___looplabel");
    asm volatile ("ldmfd sp!, {r0, r14}");
    asm volatile ("movs pc, r14");
}

static void __go_superv(int firstMVA,int lastMVA) _attribute_ 
((naked));

static void __go_superv(int firstMVA,int lastMVA)
{
    asm volatile ("stmfd sp!, {r2-r3, lr}");
//
//    // CODE TO FOOL THE COMPILER, MAY NOT WORK IN FUTURE VERSIONS...
//    // THE COMPILER OPTIMIZES THIS CODE AWAY, BUT AT LEAST IT
//    // DOES NOT ELIMINATE THE ENTIRE _flush_buf_handler FUNCTION.
//
    register int fptr asm("r3");
    fptr = (int)_flush_MVA;
//
//
//    // STANDARD CODE FROM HERE

    asm volatile ("mov r2, #0x8000000");
    asm volatile ("add r2, r2, #8");
    asm volatile ("adr r3, _flush_MVA");
    asm volatile ("swp r3, r3, [r2]");
    asm volatile ("add lr, pc, #0");
    asm volatile ("swi #0");
    asm volatile ("str r3, [r2]");
    asm volatile ("ldmfd sp!, {r2-r3, pc}");
}

// FLUSH THE D-CACHE IN A BLOCK OF size BYTES

void cpu_flush_cache(int *ptr,int size)
{
    int firstMVA=(int)ptr;
    int lastMVA=firstMVA+size+32;
    firstMVA&=0xffffffe0;
    lastMVA&=0xffffffe0;
    __go_superv(firstMVA,lastMVA);
}

Now this library will build using the CodeSourcery Toolchain without 
problems.
Appreciate any help here
rgds

: Locked by Moderator
This topic is locked and can not be replied to.