EmbDev.net

Forum: ARM programming with GCC/GNU tools Write data to Flash EFC


von Marcin D. (marcind)


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.

von Martin T. (mthomas) (Moderator)


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.

von Marcin D. (marcind)


Attached files:

Rate this post
useful
not useful
Hi

I attached my linker script. I changed file as You suggest and there is 
no more error :) . I would be pleased if You could check it  because to 
be honest I'm not to good at linkers scripts.

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
The extenstion of the script should be o.k. like this. Just look into 
the map-file to see how the linker assigend addresses.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.