[En-Nut-Discussion] re location truncated to fit: R_ARM_PC24 against symbol solved - so far

ml mludwig at adc-elektronik.de
Sat May 17 16:56:08 CEST 2008


Hi Alain,

it´s not a big deal. I want to run my program in flash and use the flash
even for data-storage.
So i place all functions for writing the flash in RAM. That´s the part who
works now. I can
link the code and it is copied to ram. Due to the lack of debuging
possibilty i write a little
dump which shows me that the routine is really placed in RAM and called from
the other
parts in Flash.  (Modern debugging via UART)

Unfortunately the call to _FlashEraseComplete doesn´t come back. I can´t see
the reason why this
happens.  If i remove the flashcode from the function so that only
NutEnterCritical and NutExitCritical
is there than it comes back. :( ??

It would be very nice to have a debugger for that, but all i tried doesn´t
work. Wether in insight or Eclipse.
Debugging in RAM works well.

Martin 



RAMFUNC int _FlashWaitReady(flashptr_t addr, flashdat_t data, u_long tmo) {
    while(*addr != data) {    	
        if (--tmo <= 0) {        	
            return 1;
        } else {
          asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop");
asm volatile ("nop");
          asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop");
asm volatile ("nop");
        }
         //NutSleep(1); not possible here, because we must stay in ram !!
    }
    return 0;	
}


RAMFUNC unsigned long _FlashIdentifier(void) {
unsigned long id;
    NutEnterCritical();   
    id = 0;
    FLASHBASE[0x555] = 0xAA;
    FLASHBASE[0xAAA] = 0x55;
    FLASHBASE[0x555] = 0x90; 
    id = FLASHBASE[0]; 
    id <<= 16;
    id |= FLASHBASE[1];
    FLASHBASE[0x555] = 0xAA;
    FLASHBASE[0xAAA] = 0x55;
    FLASHBASE[0x555] = 0xF0; 
    NutExitCritical();            
    return(id);
}


RAMFUNC int _FlashEraseComplete(void) 
{
	int r;
    NutEnterCritical();
    FLASHBASE[0x555] = 0xAA;
    FLASHBASE[0xAAA] = 0x55;
    FLASHBASE[0x555] = 0x80;
    FLASHBASE[0x555] = 0xAA;
    FLASHBASE[0xAAA] = 0x55;
    FLASHBASE[0x555] = 0x10; 
    r = _FlashWaitReady(FLASHBASE, (flashdat_t)-1,5000000);   
    NutExitCritical();            
    return(r);
}

RAMFUNC int _FlashEraseSector(flashptr_t addr)
{
    int r;
    NutEnterCritical();      
    FLASHBASE[0x555] = 0xAA;
    FLASHBASE[0xAAA] = 0x55;
    FLASHBASE[0x555] = 0x80;
    FLASHBASE[0x555] = 0xAA;
    FLASHBASE[0xAAA] = 0x55; 
    *addr = 0x30;
    r = _FlashWaitReady(addr,(flashdat_t)-1,300000);   
    NutExitCritical();            
    return(r);
}

-- 
View this message in context: http://www.nabble.com/relocation-truncated-to-fit%3A-R_ARM_PC24-against-symbol-tp17258465p17292657.html
Sent from the MicroControllers - Ethernut mailing list archive at Nabble.com.




More information about the En-Nut-Discussion mailing list