EmbDev.net

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


Author: Marcin Domaszewicz (marcind)
Posted on:

Rate this post
0 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.

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 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.

Author: Marcin Domaszewicz (marcind)
Posted on:
Attached files:

Rate this post
0 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.

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 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.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.