Using QSPI by Future Designs, Inc

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Using QSPI by Future Designs, Inc.

(Contact FDI for Design, Development and Production)

Overview
The BSP and Synergy have been designed to simplify the addition of QSPI to your projects. There are
some important things to keep in mind.

Overview: Reading QSPI


During normal operation, you will only be reading from QSPI. QSPI can be read like any other memory if
the device is in XIP (eXecute In Place) mode. This mode is set by default in the BSP on bootup. To learn
how to place symbols and GUIX generated code into QSPI, see the section “Reading QSPI”.

Overview: Writing QSPI


If the application needs to write to QSPI (for example, during a Bootload/application update), the QSPI
device must first be taken out of XIP mode. There are a few things to know about doing this:

1. Taking the QSPI device out of XIP mode is as simple as calling the Synergy QSPI module’s open
API.
2. If using GUIX out of QSPI, GUIX will crash when this is done.
3. Further work needs to be done to determine a process for shutting down and bringing back
GUIX during run time.
a. An alternative would be to perform a software reset using the built in function
NVIC_SystemReset() in order to perform QSPI programming.
4. When considering boot loading and application updates, this needs to be kept in mind.

Page 1 of 9
Using QSPI by Future Designs, Inc.
(Contact FDI for Design, Development and Production)

Reading QSPI
Understanding the Memory Organization
1. To view the Memory Organization, <Open> the S7G2.ld linker file contained in the script

directory as shown below. (Before you troubleshoot, read the next step… 😉)

2. By default, it comes up blank so make sure to then click on the “Memory” tab at the bottom of
the editor area.

Page 2 of 9
Using QSPI by Future Designs, Inc.
(Contact FDI for Design, Development and Production)
3. Take a minute to see where the QSPI Flash starts and ends.

Placing GUIX-generated constants into QSPI flash


We need to edit the linker file, adding a section for the QSPI Flash.

4. “Open With” a text editor the linker script file as shown below (in this case S7G2.ld located in
the script subdirectory).

Page 3 of 9
Using QSPI by Future Designs, Inc.
(Contact FDI for Design, Development and Production)
5. Figure out where your GUIX resources will be located. (If you have not built the project yet, look
where your GUIX source code is located compared to the root. In the below image we see the
GUIX source code is located at “<root>/src/guix_gen/*resources.o”. When you build, the
resources.o file will be located under the build directory at a similar position:
“<root>/src/guix_gen/*resources.o”.)

NOTE: Here are the locations we have seen in various Renesas demos:

<root>/src/guix_gen/*resources.o

<root>/src/gui/*resources.o

6. Add a “.qspi_guix” section into the linker file before the .text section. This will place the GUIX
resources into beginning of the QSPI Flash. (Copy and paste the below text but make sure to
edit the location of the generated code to match your location from the above step.)
.qspi_guix :
{
. = ALIGN(4);
*src/guix_gen/*resources.o (.rodata .rodata*)
. = ALIGN(4);
} > QSPI_FLASH

Page 4 of 9
Using QSPI by Future Designs, Inc.
(Contact FDI for Design, Development and Production)

7. Always perform a clean build after making changes to a linker script file:

Page 5 of 9
Using QSPI by Future Designs, Inc.
(Contact FDI for Design, Development and Production)
Placing Individual Symbols into QSPI
1. To put read-only, global variables or global functions into QSPI, define them using the
BSP_PLACE_IN_SECTION_V2() macro like shown below:

Page 6 of 9
Using QSPI by Future Designs, Inc.
(Contact FDI for Design, Development and Production)

Writing QSPI
Adding the Synergy QSPI module to the project
1. Select the HAL/Common thread (any thread really, you will just need to change which #includes
you use later)
2. Add the QSPI Driver on QSPI module

3. Generate project content

Page 7 of 9
Using QSPI by Future Designs, Inc.
(Contact FDI for Design, Development and Production)
Verifying/Configuring QSPI Pins
1. On the pins tab, select Peripherals >> Storage:QSPI >> QSPI0.

2. For each of the pins, follow the steps below:


a. Click the arrow next to the pin.
b. Verify that the Drive Capacity is set to High.
c. Click the arrow to go back to the peripheral.

3. Generate Project Content

Page 8 of 9
Using QSPI by Future Designs, Inc.
(Contact FDI for Design, Development and Production)
Using the API
Embedded below is example code for writing data to the QSPI, reading it back, and comparing it using
the Synergy API.

qspi_test.c

For further information on using the module and API, see the module guide example.

Page 9 of 9

You might also like