About the example of Qspi_XIP.

For SAMA5D2 Xplained, SAMA5D3 Xplained and SAMA5D4 Xplained

Moderator: nferre

xzp114
Posts: 23
Joined: Thu Mar 16, 2017 12:30 pm

About the example of Qspi_XIP.

Wed Apr 05, 2017 10:01 am

hi,
I have compiled the example of qspi_xip, it worked normally on my SamA5D2 Xplained board. This example is about the demo of getting_started bin code, but i want to run my own project. When i copy my own project bin code(Compiled .bin files with IAR) to Qspi flash, it doesnot work. So i have some questions blow.
1、How to generate the bin code(Compiled with IAR) ?
2、How to set the address of bin code?
Thank you very much!
blue_z
Location: USA
Posts: 1560
Joined: Thu Apr 19, 2007 10:15 pm

Re: About the example of Qspi_XIP.

Wed Apr 05, 2017 9:06 pm

xzp114 wrote:When i copy my own project bin code(Compiled .bin files with IAR) to Qspi flash, it doesnot work.
That's a low-quality description of the problem that provides no information as to the cause.
You could at least provide the salient console output like the TESTING.md document.
xzp114 wrote:So i have some questions blow.
If you compiled the original example, then why not use the same build procedure for your code?

Regards
xzp114
Posts: 23
Joined: Thu Mar 16, 2017 12:30 pm

Re: About the example of Qspi_XIP.

Thu Apr 06, 2017 2:22 am

blue_z wrote:That's a low-quality description of the problem that provides no information as to the cause.
You could at least provide the salient console output like the TESTING.md document.
This is the information of the concole output.

-- QSPI XIP Example --
Softpack v2.3
Built for sama5d2-xult
Processor: SAMA5D27-CU
Processor clock: 498 MHz
Master clock: 166 MHz
MMU is disabled
I-Cache is disabled
D-Cache is disabled

Initializing QSPI drivers...
QSPI drivers initialized.
QSPI baudrate set to 41500000Hz
Configuring QSPI Flash...
-D- F:\Workspace\Atmel\sama5_softpack_ewarm_2.3.1\softpack_sama5_2.3.1\drivers\memories\qspiflash.c:678 Trying protocol 0 opcode 0x9f
-D- F:\Workspace\Atmel\sama5_softpack_ewarm_2.3.1\softpack_sama5_2.3.1\drivers\memories\qspiflash.c:693 Found memory with JEDEC ID 0x001920c2.
-D- F:\Workspace\Atmel\sama5_softpack_ewarm_2.3.1\softpack_sama5_2.3.1\drivers\memories\qspiflash.c:713 Found supported memory with JEDEC ID 0x001920c2 (MX25L25673G).
-D- F:\Workspace\Atmel\sama5_softpack_ewarm_2.3.1\softpack_sama5_2.3.1\drivers\memories\qspiflash.c:395 QSPI Flash: Macronix Quad mode already enabled
QSPI Flash configured.
Data at the beginning of QSPI: e59ff018 e59ff018 e59ff018 e59ff018
Valid application already in QSPI, will run it using QSPI XIP

Do you want to Run it or Flash a new one (R/F): f
Erasing beginning of memory...
Erase done (49152 bytes).
Writing to QSPI...
Example code written to memory (49128 bytes).
Verifying...
Starting continuous read mode to enter in XIP mode
Verification OK

Running code from QSPI flash
============================

####################
Prefetch Fault reason is: synchronous external abort
prefetch Fault occured at address: 0xe59ff018

Prefetch Fault status register value: 0x8
####################
blue_z wrote:If you compiled the original example, then why not use the same build procedure for your code?
1、When i flash my own project bin code with SAM-BA 3.14,it works well.
2、I just replace the "CACHE_ALIGNED_CONST static const uint8_t xip_program[]" with my own bin code, an exception occured.
3、I used the original example bin code, also appear the same phenomenon.
blue_z
Location: USA
Posts: 1560
Joined: Thu Apr 19, 2007 10:15 pm

Re: About the example of Qspi_XIP.

Thu Apr 06, 2017 9:10 pm

Your second post makes little sense (what is already in flash, what are you writing, what happens if you don't `flash` but `run`), and contradicts your first post.
xzp114 wrote:I have compiled the example of qspi_xip, it worked normally on my SamA5D2 Xplained board.
versus
xzp114 wrote:I used the original example bin code, also appear the same phenomenon.
xzp114 wrote:When i copy my own project bin code(Compiled .bin files with IAR) to Qspi flash, it doesnot work.
versus
xzp114 wrote:When i flash my own project bin code with SAM-BA 3.14,it works well.
xzp114 wrote: 1、How to generate the bin code(Compiled with IAR) ?
I don't know. (I haven't used IAR since their buggy 8051 compiler 16 years ago.)
If you can execute the original Softpack example (e.g. start tracing from run_xip_program()), then debug the XIP code to see what location it executes from, and where the stack is allocated .
I.E. you might not be able to use generic C initialization code that presumes that the stack can be allocated in the same memory region as the code (i.e. SRAM versus QSPI memory).
xzp114 wrote: 2、How to set the address of bin code?
According to the SAMA5D2 datasheet, QSPI0 memory is mapped to 0xD0000000.

Code: Select all

./target/sama5d2/sama5d26.h:#define QSPIMEM0_ADDR   (0xD0000000u) /**< QSPI Memory 0 base address */
./target/sama5d2/sama5d27.h:#define QSPIMEM0_ADDR   (0xD0000000u) /**< QSPI Memory 0 base address */
./target/sama5d2/sama5d21.h:#define QSPIMEM0_ADDR   (0xD0000000u) /**< QSPI Memory 0 base address */
./target/sama5d2/sama5d28.h:#define QSPIMEM0_ADDR   (0xD0000000u) /**< QSPI Memory 0 base address */
./target/sama5d2/sama5d23.h:#define QSPIMEM0_ADDR   (0xD0000000u) /**< QSPI Memory 0 base address */
./target/sama5d2/sama5d22.h:#define QSPIMEM0_ADDR   (0xD0000000u) /**< QSPI Memory 0 base address */
Regards

Return to “SAMA5 Xplained”

Who is online

Users browsing this forum: No registered users and 2 guests