Open Flashloader SEGGER_OPEN_Read function problem

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Open Flashloader SEGGER_OPEN_Read function problem

      Hello.

      I am trying to write a flash loader for the STM32F207 SPI flash.
      The debug build was successful and works.

      The release build works too, but the read back function in J-Flash app returns garbage.

      The problem is with the SEGGER_OPEN_Read function (U32 Addr, U32 numBytes, U8 *pdestbuf). When calling the SEGGER_OPEN_Read function, the argument is numBytes = 0. My code returns -1 (error), because it is not known how many bytes to read from spi-flash, but j-flash does not give any error messages and continues to work.

      Calling the SEGGER_OPEN_Read function with the argument numBytes = 0 is a bug, or I misunderstand the "read back" procedure?

      I'm use J-Flash V6.94b.
    • Hello,

      Just to make sure that we got you right, in your case, our software passes NumBytes == 0 to SEGGER_OPEN_Read()?
      If yes, could you please upload the flashloader project + used JLinkDevices.xml file + step-by-step instructions which can be used to reproduce this behavior here?

      Thanks,
      Erik
    • Hello,

      we have investigated this issue and were not able to reproduce it. With the project you sent us, SEGGER_Open_Read() is not called when using the flash loader ELF file with J-Flash.

      We were able to successfully use our template project as flash loader.
      Could you try out the attached template project and let us know the results?

      Best regards
      Matthias
      Files
    • SEGGER - Matthias wrote:

      Hello,

      we have investigated this issue and were not able to reproduce it. With the project you sent us, SEGGER_Open_Read() is not called when using the flash loader ELF file with J-Flash.

      We were able to successfully use our template project as flash loader.
      Could you try out the attached template project and let us know the results?

      Best regards
      Matthias

      Hello.

      Are you sure that the "SEGGER_OPEN_Read" function is not called in my project? If you add an infinite loop to a function, j-flash completes the "Read Back" procedure by timeout. Maybe you tested the wrong flash loader.elf file. The "Flashloader.elf" file is located in the archive attached in the previous message in the "Output\Release\Exe" directory.

      I tried to use the project you sent, a log file with the result attached to this message. Also, if the "SEGGER_OPEN_Read" function returns -1, j-flash does not return any error messages, as I described earlier. However, when using the method described above in your project, the "numBytes" argument passed to the "SEGGER_OPEN_Read" function is 0x2600. And here I do not understand why in your case numBytes = = 0x2600, and in my case numBytes == 0x00? Maybe there are some additional requirements for writing flash loader?

      Thanks.
      Files
      • JFlash.log

        (3.86 kB, downloaded 9 times, last: )
    • Hello,

      we have tested the flash loader elf file from the "Output\Release\Exe" directory that you sent us. The elf file did not contain the SEGGER_OPEN_Read function. At a guess, it looks like it may have been optimized away when compiling.

      We have prepared a project for you so that we can be certain, that we are testing with the same conditions.
      download.segger.com/Matthias/STM32F207VC_Test.7z

      This contains a StartTest.bat which starts J-Flash and executes a readback of the selected sectors. This runs successfully on our end and indicates, that the SEGGER_OPEN_Read behaves as expected.
      Could you please run the StartTest.bat in the attached archive and let us know if this runs successfully?

      As a reminder: In general, Segger does not give support for open flash loader.

      Best regards
      Matthias