Write data to Flash EFC

OP #1264045
Rate this post
useful
not useful
Hi I would like to write data to internal flash. I use function:

_attribute_ ((section (".ramfunc"))) int AT91F_Flash_Write( unsigned 
int Flash_Address ,int size ,unsigned int * buff)
{
    AT91PS_MC ptMC = AT91C_BASE_MC;
    unsigned int i, page, status;
    unsigned int * Flash;

    status = 0;

    Flash = (unsigned int *) Flash_Address;
        page = ((Flash_Address - (unsigned int)AT91C_IFLASH ) 
/FLASH_PAGE_SIZE);

        for (i=0; (i < FLASH_PAGE_SIZE) & (size > 0) ;i++, 
Flash++,buff++,size-=4 ){
    *Flash=*buff;
    }

    unsigned long ulIntrStat = AT91C_BASE_AIC->AIC_IMR;
    AT91C_BASE_AIC->AIC_IDCR = 0xFFFFFFFF;

    ptMC->MC_FCR =AT91C_MC_CORRECT_KEY | AT91C_MC_FCMD_START_PROG | 
(AT91C_MC_PAGEN & (page<<8));

    for(i=0;i<100000;i++) asm("nop");

     while ((status & AT91C_MC_FRDY) != AT91C_MC_FRDY )
     {
         status = AT91C_BASE_MC->MC_FSR;
     }

    AT91C_BASE_AIC->AIC_IECR = ulIntrStat;

    if ( (status & ( AT91C_MC_PROGE | AT91C_MC_LOCKE ))!=0)
    return false;
    return true;
}

The problem is that the error occurs during making project:

arm-elf-ld: error: no memory region specified for loadable section 
`.ramfunc'
make: *** [main.out] Error 1

I use Eclipse with Yagarto.

Please for help. Thanks in Advance.
Moderator #1264722
Rate this post
useful
not useful
Marcin Domaszewicz wrote:
>...
> The problem is that the error occurs during making project:
>
> arm-elf-ld: error: no memory region specified for loadable section
> `.ramfunc'
> make: *** [main.out] Error 1
>...
make sure the linker script includes an entry *(.ramfunc*) near the 
*(data...) line. IRC the linker-scripts included in the Atmel Software 
Packages include such entry (with such an entry the input section 
.ramfunc gets linked into the output-section .data with RAM VMA). So if 
there is no special reason to use another linker-script please try with 
one from the software-package.

If it still does not work, attach the linker-script you are using to a 
message.

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now