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

Help In Assembler

I work with at91sam7X512
In my trying to ran from the RAM I decide to do memcopy from the FLASH to the RAM,
I saw in assembler that the code copied to the RAM,
but it doesn't succeed to run back to the program.
I look on the assembler and I found the problem,
I have this line:

0x00010FFC 0xEB0001D2 bl __aeabi_memcpy

I understand that bl command supposed to places the return address in the link register, and set the PC to the address of the subroutine.
It's set the PC to the address of the subroutine but in the Link register It's put undefined address 0xEB0001F5, and then to prefetch abort.

What's go wrong?
thanks all, chiko.

Parents
  • the problem is that you are not using the provisions of the linker to do it. This scatter load file will map anything in the execution region "ER_NOR_FLASH_RAM_ZONE" into RAM:

    ; ********************************************************************
    ; * ACCESS TO THE NOR FLASH IS SLOWER THAN TO LPC2478 INTERNAL FLASH *
    ; * DO NO MAP ANY TIME CRITICAL CODE HERE (COMPRESSOR CONTROL ETC.)  *
    ; * USE RAM REGION "ER_NOR_FLASH_RAM_ZONE" TO MAP MODULES TO RAM FOR *
    ; * FAST EXECUTION                                                                                                       *
    ; ********************************************************************
    LR_IROM2 0x80000000 0x400000  {    ; load region size_region
      FMMAPP2 0x80000000 0x00400000  {  ; load address = execution address
            SYSTEM_ERROR_CODES.o
      }
    
    ; *********************************************************************
    ; * These modules are executed in RAM (but stored in the NOR flash)   *
    ; * This code is copied into RAM by overriding the "__main" function  *
    ; * so that the scatter loading process of the application can access *
    ; * the NOR flash. See "main.c"                                                                             *
    ; *********************************************************************
      ER_NOR_FLASH_RAM_ZONE 0xA1100000 0x10400  {
            APP_MACHINE_ID.o
            APP_SOFTWARE_UPDATE.o
            APP_IO_CFG.o
            APP_VAR_INIT.o
            SOFTWARE_EVENT.o
            APP_OPTION_MODULE.o
            APP_FEATURE_LST.o
      }
    

Reply
  • the problem is that you are not using the provisions of the linker to do it. This scatter load file will map anything in the execution region "ER_NOR_FLASH_RAM_ZONE" into RAM:

    ; ********************************************************************
    ; * ACCESS TO THE NOR FLASH IS SLOWER THAN TO LPC2478 INTERNAL FLASH *
    ; * DO NO MAP ANY TIME CRITICAL CODE HERE (COMPRESSOR CONTROL ETC.)  *
    ; * USE RAM REGION "ER_NOR_FLASH_RAM_ZONE" TO MAP MODULES TO RAM FOR *
    ; * FAST EXECUTION                                                                                                       *
    ; ********************************************************************
    LR_IROM2 0x80000000 0x400000  {    ; load region size_region
      FMMAPP2 0x80000000 0x00400000  {  ; load address = execution address
            SYSTEM_ERROR_CODES.o
      }
    
    ; *********************************************************************
    ; * These modules are executed in RAM (but stored in the NOR flash)   *
    ; * This code is copied into RAM by overriding the "__main" function  *
    ; * so that the scatter loading process of the application can access *
    ; * the NOR flash. See "main.c"                                                                             *
    ; *********************************************************************
      ER_NOR_FLASH_RAM_ZONE 0xA1100000 0x10400  {
            APP_MACHINE_ID.o
            APP_SOFTWARE_UPDATE.o
            APP_IO_CFG.o
            APP_VAR_INIT.o
            SOFTWARE_EVENT.o
            APP_OPTION_MODULE.o
            APP_FEATURE_LST.o
      }
    

Children
  • Thank you, but I succeed to run from the flash without this in much smaller code , only when we take the code bigger, around 94KB, there was a problems.
    first the RO section wasn't big enough so I increase it to the exactly size of the RO.
    I conifgure it like this-

    START_RAM  = 0x00200000
    START_RW   = 0x00216FE0
    SIZE_RO    = 0x00016FE0 - 94,176
    SIZE_RW    = 0x00002BE8 - 11,240
    SIZE_ZI    = 0x00005F28 - 24,360
    

    All together is 129,776 KB, and in at91sam7x512 there is 1024 * 128 = 131,072, RAM Size.

    Why when thr RO size was smaller I succeed to do it and now not?