Using the QuadSPI on STM32F7 Discovery

Sysprogs forums Forums VisualGDB Using the QuadSPI on STM32F7 Discovery

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #7189
    andyjt
    Participant

    Hi,

    Just started using VisualGDB with the STM32F7 discovery board and have found your tutorials extremely helpful !

    Can you advise on how I might be able to program the QSPI flash from VisualGDB with a data array for example  ?

    Is it possible to do this or would I have to do it through ST-Link utility ?

    Any advice on addressing data from the QSPI using the HAL library would also be much appreciated.

    Thanks.

    #7198
    support
    Keymaster

    Hi,

    Sorry, we don’t support that yet. We would recommend using the ST-Link utility. We will also monitor the popularity of QSPI-related searches and add a tutorial on it if the topic becomes popular.

    #7203
    andyjt
    Participant

    Thanks for the reply.

    Using STLink is an issue at the moment as it doesn’t find the board anymore…could this be related to VisualGDB taking control of the driver ?
    I have tried it with VisualStudio closed but STLink still wouldn’t find the board 🙁

    If you could do a tutorial on reading image data from QSPI flash or the SD card would be very helpful I’m sure!

    Regards

     

     

    #7207
    support
    Keymaster

    Hi,

    Please use the USBDriverTool to restore the original ST-Link driver. It also looks like the newest OpenOCD works correctly with the stock driver, so you don’t need to install the WinUSB-based one anymore.

    #7240
    andyjt
    Participant

    Thanks, the USB driver tool worked.
    I can now use STLink Utility and OpenOCD.

    Am I right in thinking that the Quad SPI flash can only be programmed from the STLink ?
    I don’t seem to be able to ‘read’ memory at 0x90000000 from STlink utility, only erase and program.

    #7241
    andyjt
    Participant

    On this same topic, I’m trying to get the QSPI_perfs Application to compile and struggling to get it to create a Hex or Elf file of the image’s data.
    (example here: \STM32\STM32Cube_FW_F7_V1.1.0\Projects\STM32746G-Discovery\Applications\QSPI\QSPI_perfs)
    If I compile with IMG_NO_DATA defined then the build fails with error VGDB1002: undefined reference to img6
    So, if I undef the flag then this is the code in img6.h and I’m guessing it should compile to a different text area (.textqspi)

    #ifndef IMG_NO_DATA
    #if defined ( __ICCARM__ )
    #pragma location = ".textqspi"
    #else
    __attribute__((section(".textqspi")))
    #endif
    const unsigned char img6[261120] =
    {
    0x1E, 0xC7,
    0x1E, 0xC7, etc...

    At the moment, this won’t compile either, it ignores the section name and fails because the images overflow the STM’s internal flash…
    c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/5.2.0/../../../../arm-eabi/bin/ld.exe: Debug/STM32F7QuadSPI.elf section .text will not fit in region FLASH

    How do I setup VisualGDB to compile data hex files that I can download to QuadSPI using STLink and then access those data arrays from my program ?
    Thanks in advance

    #7248
    support
    Keymaster

    Hi,

    In order to support the .textqspi section, you will need to edit the linker script:

    1. Go to the Makefile Settings of VisualGDB Project Properties, find the “linker script” field, click “create a local copy”.
    2. Find the MEMORY section and add the QSPI entry there specifying the address and size of the QSPI memory on your device
    3. Find the statement that places the .text section into FLASH. Copy it replacing .text with .textqspi and FLASH with QSPI. This will place the img6 variable into the QSPI memory.

    Note that this will make your code expect the variable to be placed into the QSPI FLASH, but won’t instruct OpenOCD to program the QSPI memory. You will need to program the QSPI memory separately using the STLink tool (you can extract the contents of the .textqspi section from the ELF file into a separately programmable binary file by running the following command:

    arm-elf-objcopy -O binary --only-section=.textqspi project.elf qspi.bin

     

    #11897
    Taisen
    Participant

    Where should I put this code?? In the makefile settings?? or Directly in the makefile?

    #11899
    support
    Keymaster

    Hi,

    You can add it to the custom post-build commands in VisualGDB Project Properties (requires Custom Edition and higher).

    #11928
    Taisen
    Participant

    Thanks for the answer, could you provide a sample  or manual for this post-build commands? If need a Custom Edition, that means, those commands could not be typed in current distribution, is that right? Like Eclipse, there is special setting just type code and makefile will generate the bin file

    • This reply was modified 6 years, 8 months ago by Taisen.
    #11934
    support
    Keymaster

    Hi,

    No problem. According to our records, you already have the Custom edition, so you should be able to use the post-build commands. Please refer to the screenshot below:

    Please select VisualGDB Project Properties -> Custom Build Steps -> Actions after building -> Edit -> Add -> Run a custom command line.

    Then locate the objcopy binary from your toolchain and enter the arguments with the adjusted input and output file paths. We recommend using variables like $(TargetPath) and $(ProjectDir) to avoid hardcoding the paths. The objcopy command will read the input ELF file (first argument after –only-section), locate the .textqspi section inside it and dump it into a .bin file (second argument after –only-section). Please ensure that the input file path matches the path of the ELF file built by your project so that objcopy can process it correctly.

    Attachments:
    You must be logged in to view attached files.
    #11966
    Taisen
    Participant

    Great, thanks for the answer! This is helpful!!

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.