AnsweredAssumed Answered

Hard fault calling function in RAM

Question asked by Marlon Smith on Mar 18, 2013
Latest reply on Mar 19, 2013 by Marlon Smith

Hi everyone,


I'm working on a flash driver for a K20 chip, and since it only has one page of memory I believe I have to move my sector erase function to RAM so I'm not accessing the bank while erasing part of it.  I'm using GCC and a custom linker script for my project.


So far I've done this:


- Use the attribute label to tell the linker to put the function in RAM:

bool erase_sector(uint32_t address) __attribute__((long_call, section(".ramfunctions")));


- and in the linker script:

. = 0x1FFFE000;

  .data ()   :


    __data_start = . ;

    __data_start__ = .;

    *(.data .data.* .gnu.linkonce.d.*)

    . = ALIGN(32 / 8);


    . = ALIGN(32 / 8);

    *(.ramfunctions) /* Place specified functions in RAM */


- Add -mlong-calls to my compiler arguments


However when I run my code, I get a hard fault as soon as I call my erase_sector function.  Is there another step here that I'm missing?