This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problem writing Application to SPI-Flash - ICE AM3359

Other Parts Discussed in Thread: SYSBIOS

Board TMDXICE3359
Code Composer Studio 5.2.1.00018
SDK am335x_sysbios_ind_sdk_1.0.0.4

Hi all

I was trying to write an Application (i2c_led) to the SPI. I've loaded the Program over JTAG and SD-Card and it worked well. Now i tried to flash it on the SPI (Start Address 0x20000) using precompiled SPI_Flashing_Tool.out. I've tested this tool to flash the Bootloader and it worked.

But when I try to run the ICE, nothing happens. Also it gives a fault by verifying the Flash. I've used the self built i2c_led_SPI.bin.

Console

[CortxA8] AM335X part detected.. SF: Got idcode ef 40 17
[CortxA8] Checking if Winbond flash writer can be used..
[CortxA8] SF: Detected W25Q64 with page size 256, total 8388608 bytes
[CortxA8] Starting SPIWriter.
[CortxA8] Enter the File Name
D:\i2c_led_SPI.bin
[CortxA8] Enter the Offset in bytes (in HEX)
0x20000
[CortxA8] Load .bin file to 0x80100000 and Enter 0 to continue (<- loaded D:\i2c_led_SPI.bin to memory)
0
[CortxA8] Erasing flash at byte offset: 131072, byte length: 98304
[CortxA8] SF: Winbond: Successfully erased 98304 bytes @ 0x38000
[CortxA8] Writing flash at page offset: 512, number of pages: 371
[CortxA8] Verifying...
[CortxA8] Did not match @ page 102

UART

*** StarterWare  Boot Loader. Build -  ***
Copying application image from MMCSD to RAM
 Unable to open application file from MMCSD
Copying application image from SPI to RAM
 Image Copy Successful, Executing Application..

I guess it has a problem with the SPI, is that rigth? What can I do now?

Regards
Cyril Mülller

  • Hello Cyril Muller,

    We have seen this issue on certain ICE boards and its being investigated. Meanwhile, there are two ways in which you can proceed.

    1. Load application binary on a Micro SD card and execute the application from SD card.
    2. Use the Starterware flasher tool  found in $IA_SDK_HOME\starterware\tools\flash_writer( Flashing could be slow with this tool)

    Regards,

    Shahid

  • Hello Shahid

    Shahid AC said:
    Load application binary on a Micro SD card and execute the application from SD card.

    Would do this, but I need an application that runs from SPI if no SD-Card is inserted.

    Shahid AC said:
    Use the Starterware flasher tool  found in $IA_SDK_HOME\starterware\tools\flash_writer( Flashing could be slow with this tool)

    Worked well, even if it was really really slow... (1min erasing, 20min writing, 10min verifying) Hoping for an update!

    Thank you very much!
    Cyril

  • Hello, 

    I have a quite similar problem: I want to boot from SPI the full ethercat application.

    While booting from SD card everything is ok, booting from SPI gets the following error on the serial console:

    "Application image not found, Aborting"

    Looking deeper in the bootloader I modified it with further debug on the serial console to see why it failed. It failed the test of the magic number and I saw that he looks at the address 0x20000 searching for magic number in the first 4 bytes and image size in the next 4.

    It fails because at that address my application doesn't have the right number. In fact the magic number of my application (that is by default  0xEE3355AA instead of 0xEE3355BB, but this won't be a problem because it's modifiable) is at offset (0x20000 +) 0x12604 (looking at the ecat_appl.bin with hex editor)

    Looking at the file ecat_appl.map in fact I see that file am335x_indcomm_startup.obj is mapped in that zone.

    So it seems it's a problem of generation of application image. How can I solve it?

    Thanks

    Luca

  • Luca -

    First, I'm not sure why your application's magic number ix 0xEE3355AA because tiimage.exe should be setting it to 0xEE3355BB (unless you've created a custom version of tiimage.exe?)  But the header itself is of the following structure:

    typedef struct _ti_header_

    {

    unsigned int magic_number;

    unsigned int image_size;

    unsigned int load_addr;

    unsigned int run_addr;

    }ti_header;

     

    and is prepended to the file by tiimage.exe via post_build.bat: so don't go looking in the map file of your application to try to find this, as it is inserted after build has already been completed.

     

    Perhaps your post_build.bat is not completing properly?  Use your hex editor to inspect the image after tiimage.exe has run, and ensure that the beginning of the file conforms to the ti_header format as shown above.

     

    Darrin

  • Hello Luca,

    Industrial sdk includes a post-built script which generates binary from .out file. This is explained in the following link

    http://processors.wiki.ti.com/index.php/AM335x_SYSBIOS_Industrial_SDK_01.00.00.04_User_Guide#Generating_Executable_Binary_-_Post_Build_Script

    Please refer to build properties ( project properties->Build->Steps->Post-build steps ) of industrial sdk sample projects to know how this is used in CCS environment.

    Regards,

    Shahid

  • Thanks for the advice.

    Now it works.

    I knew about the post_build generator but I think that using it by prompt was very confusing.

    Using it inside CCS ( Project properties->CCS Build->Steps->Post-build steps ) it's very easy.

    Hope to see this advice also on the AM335x SYSBIOS Industrial SDK User Guide

  • Luca -

    If you are using any of the standard example projects that are provided with the Industrial SDK, then the post_build call is already set up and automatically runs every time you build (so there's probably no specific mention of it in the user's guide because it's part of the "standard" project).  But of course if you start your own project from scratch then you would have to add that call in yourself.

    Darrin

  • Cyril M��ller said:

    Hello Shahid

    Load application binary on a Micro SD card and execute the application from SD card.

    Would do this, but I need an application that runs from SPI if no SD-Card is inserted.

    Shahid AC said:
    Use the Starterware flasher tool  found in $IA_SDK_HOME\starterware\tools\flash_writer( Flashing could be slow with this tool)

    Worked well, even if it was really really slow... (1min erasing, 20min writing, 10min verifying) Hoping for an update!

    Thank you very much!
    Cyril

    [/quote]

     

    Had the same problem, with SPI_Flashing_Tool.out verify failes almost always, sometimes I get even errors on load to 0x8010000. Flashing an ethercat program of about 200 k with the starterware flash writer takes about one hour. Hoping for an update too.

    Frank