This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Memcop from the flash to the ram

Hi, I tried to copy all the memory from the FLASh to the RAM.
When I try it with small code I succeed but when the code go larger (around 94Kbyts) I failed.

I work with at91sam7x512.

I do:

memcpy(mem_get_start_ram(), // dest mem_get_start_rom(), // source mem_get_size_rom()); // size

The start_ram - 0x00200000
The start_rom - 0x00000000
The size_rom - 0x00016FE0

after the memcpy it's go to prefetch abort, what did wrong?

thanks all, chiko

  • Are you sure you are not overwriting your stack?

  • How can I know if so?
    where the stack locatd in the RAM?

    From what I undersand the stack and the heap located in the end of the RAM. am I wrong?

    In the Cstartup I do write this:

    BSS_Start_Ptr
         Import  |Image$$ZI$$Base|
         DCD     |Image$$ZI$$Base|
    
    BSS_End_Ptr
         Import  |Image$$ZI$$Limit|
         DCD     |Image$$ZI$$Limit|
    
    ROM_Start
         Import  |Image$$RO$$Base|
         DCD     |Image$$RO$$Base|
    
    RW_Start
         Import  |Image$$RW$$Base|
         DCD     |Image$$RO$$Limit| + 0x200000
    
    In the origin it was
         DCD     |Image$$RW$$Base|
    
    ROM_Size
         Import  |Image$$RO$$Limit|
         DCD     |Image$$RO$$Limit|
    
    RAM_Start_Ptr
         DCD     0x200000