AnsweredAssumed Answered

how to burn program into spi flash in right way

Question asked by samuel_zhang@jabil.com on Dec 20, 2013
Latest reply on Jan 29, 2014 by davidf@phasetronics.com

Hi,

Dear all:

 

About the former issue - DSP is not running in right way after burning image into SPI flash, I take some experiments to diagnose.

 

Finally, I found out that the process of burning is no problem - I have written a spi flash reading program so that I can compare data captured from SPI flash with the binary file (ADSP21469_PBLED.ldr - building in binary format, not Hex).

 

Of course, it's done after burning the file into spi flash and reset. In the end, I find no difference  between captured data and binary file.

 

So the only root cause can only locate in procedure after reset:

1) Bootrom read BOOT_CFGx - should be spi master mode

2) Load image from SPI flash into memory (base address: 0x8c005, right?)

3) Execute kernel part of image starting from base address

4) In the end of kernel part, it will copy 2nd part of image - application part to base address(0x8c005) and run it.

 

But unfortunately, I can't make program stays in "main" function entry through breakpoint setting which proves that the program has run away.

 

Afterwards, I use another way to observe what happens: reset mcu after burning and trace PC flow.

1) Reset DSP after burning

2) And now PC (register) will halt in address (0x8c005).

 

Inline image 1

 

3) Load symbol file (ADSP21469_PBLED.ldr.dxe) to help debug

 

Inline image 2

 

4) type "f11" to step in, and PC will jump to "___lib_start".

 

Inline image 3

 

5) Now you can see the instruction address "0x126041" is invalid which can't be found in symbol file. If you keep on running (F11), PC will run away - to somewhere I don't know.

 

Inline image 4

 

6) Meanwhile, If you watch address of main function - it should be 0x124504 which is got form project map file (ADSP21469_PBLED.ldr.map.xml), you will also find the instruction block is fully wrong.

 

Inline image 5

 

Inline image 6

 

And you can also prove this since you can't find binary bytes "000059BE" in binary file (ADSP21469_PBLED.ldr).

 

Above is the experiment result in snapshot, I will also attach pictures and projects for your reference.

 

In the other hand, right instructions for both "main" function and "___lib_start" can be easily retrieved if you download "ADSP21469_PBLED.dxe" through JTAG emulator.

1) Main function instruction block

 

Inline image 7

 

You can also find that breakpoint woks in place.

 

Inline image 10

 

In addition, you can find instruction "0x00001804" of main function in "ADSP21469_PBLED.ldr".

 

 

2) "___lib_start" instruction block

 

 

Inline image 9

Inline image 8

 

 

After all, I suspect the process of building "ADSP21469_PBLED.ldr" is somewhere wrong or the kernel  file "C:\Program Files\Analog Devices\VisualDSP 5.0\214xx\ldr\469_spi.dxe" is not the right one.

 

But I can't debug on this file since I don't understand how kernel file should be linked as header of final loader file "ADSP21469_PBLED.ldr". This may need ADI engineer's help.

 

Below is description of loader file building process and burning process.

1) Building process:

I choose these options in "Project:Load:General" page:

A. Boot Type - SPI master

B. Format: Binary

C. Width: 8-bit

D. User default kernel - direct to "C:\Program Files\Analog Devices\VisualDSP 5.0\214xx\ldr\469_spi.dxe"

 

Inline image 11

 

2) Burning process:

1) Driver: "21469EzFlashDriver_Serial.dxe" which is generated from 21469 start-kit example project under folder "C:\Program Files\Analog Devices\VisualDSP 5.0\214xx\Examples\ADSP-21469 EZ-Board\Flash Programmer\Serial".

 

We use same flash with EZ-Board - m25p16.

2) Programming:

A. Erase all

B. Binary (start from 0x0)

C. Data - ADSP21469_PBLED.ldr

D. Verify while programming

 

Inline image 12

 

So that'all, please help to find out what's the matter.

By the way, the flash programmer I used to read spi flash is also attached.

 

Thanks very much!

Outcomes