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

[Cortex-M3] Execution code from RAM during Flash Programming

I am writing a bootloader for Cortex M3 Toshiba controller.

During Flash Programming I need to execute code from RAM as entire Flash is inaccessible during write/erase operations

I wish to know how to copy code from FLASH to RAM and execute that code from RAM.

Thanks...
Parents
  • Note: This was originally posted on 11th April 2012 at http://forums.arm.com

    Hi Joseph,

    Many thanks for your replying.
    I will create the project which contains code runnung is flash and SRAM.
    but I am not familiar with creating the linker script.
    following is my ,sct file:
    could you give me some advice?

    FLASH 0x08000000 0x00010000
    {
        ;
        ; Place the vector table and reset handlers into flash.
        ;
        RESET 0x08000000 0x00010000
        {
            *.o (RESET, +First)
           my_startup.o(+RO)
           * (InRoot$$Sections)
        }

        ;
        ; Place everything else remaining into SRAM (RO, RW, and ZI)
        ;
        SRAM 0x20000000 0x00010000
        {
            * (+RO, +RW, +ZI)
        }
    }

    Best Regards,
    Kent


    Hi Kent,

    It depends on how you want the project to look like.

    If the program code in RAM is created as a completely independent project, and then merged into your other project running in flash using a hex file editor, then you don't have to use scatter files. In this way you will have two separated images in your running system. This can make sure you don't accidentally call a function in flash or read it when you are programming the flash.

    If you are trying to create a project that contains code running in flash as well as code running in SRAM, then you need to define the code running in SRAM with a section name, and then use linker script to specify this section is to be copied to and executed from SRAM.

    regards,
    Joseph





Reply
  • Note: This was originally posted on 11th April 2012 at http://forums.arm.com

    Hi Joseph,

    Many thanks for your replying.
    I will create the project which contains code runnung is flash and SRAM.
    but I am not familiar with creating the linker script.
    following is my ,sct file:
    could you give me some advice?

    FLASH 0x08000000 0x00010000
    {
        ;
        ; Place the vector table and reset handlers into flash.
        ;
        RESET 0x08000000 0x00010000
        {
            *.o (RESET, +First)
           my_startup.o(+RO)
           * (InRoot$$Sections)
        }

        ;
        ; Place everything else remaining into SRAM (RO, RW, and ZI)
        ;
        SRAM 0x20000000 0x00010000
        {
            * (+RO, +RW, +ZI)
        }
    }

    Best Regards,
    Kent


    Hi Kent,

    It depends on how you want the project to look like.

    If the program code in RAM is created as a completely independent project, and then merged into your other project running in flash using a hex file editor, then you don't have to use scatter files. In this way you will have two separated images in your running system. This can make sure you don't accidentally call a function in flash or read it when you are programming the flash.

    If you are trying to create a project that contains code running in flash as well as code running in SRAM, then you need to define the code running in SRAM with a section name, and then use linker script to specify this section is to be copied to and executed from SRAM.

    regards,
    Joseph





Children
No data