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

MDK(Keil) SPI Flash Programming Algorithm

STM32F207 + S25FL128P(SPI Flash)
I found a similar demo in folder C:\Keil_v5\ARM\Flash\STM32F10x_M25P64
with this kind of Flash Programming Algorithm, can i flash other files like photo/fpga data( not the code data) into the SPI flash ? how ? thanks

  • If you add data to the .AXF it will get written. So you can make object files you link into the image.

  • Thanks for the reply, can you describe in detail?
    For example, i want to flash a fpga file named ABC.PGA into the SPI-Flash at a fixed offset 0x100000, and the program data still in the internal-flash , can that work?

    i modify the scatter file like:

    LR_IROM1 0x08000000 0x00040000  {    ; Internal-Flash
      ER_IROM1 0x08000000 0x00040000  {  ;
       *.o (RESET, +First)
       *(InRoot$$Sections)
       .ANY (+RO)
      }
      RW_IRAM1 0x20000000 0x0001FE00  {  ; RW data
       .ANY (+RW +ZI)
      }
    }
    LR_ROM1 0xC0100000 0x00100000  {    ; SPI-Flash
      ER_ROM1 0xC0100000 0x00100000  {  ;
       ABC.PGA
      }
    }
    

    i tried and it didn't work. Looking forward to your reply

  • Ok, but that's not an "Object File" in the sense the linker can use.

    Perhaps you have familiarity with File IO operations, where you can fopen()/fread() the file and convert the binary data into an array in a .C file which you can compile and include that way?

    ie

    uint8_t pga_data[] = {
    0x00,0x01,0x02,0x03, ... };

  • Ok, i'm sorry to bother u again...
    Actually, i failed the first step, i can't flash the common program data into the SPI-Flash with the newly created algorithm.
    I wonder if i miss the Pre-download scripts, i didn't add one, it always prompt:
    Erase Failed!
    Error: Flash Download failed - "Cortex-M3"

    As to STM32F207, when i use the SPI-Flash Programming Algorithm, how to write the Init File? what commands should be done before the program is flashed? Can u provide something? Thanks so much!