Write data to Flash EFC

OP #1264045
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
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

A question of your own? This thread is over 17 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.