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.

CCS/TMDSICE3359: Issue running project from SPI flash

Part Number: TMDSICE3359

Tool/software: Code Composer Studio

Hi,

I am starting with sitara and TI-RTOS.

Using rtos pdk 1.0.6, I have developed a simple project which uses uart to control on board leds. It works fine when I load it throught USB using ccs 6, but I am having some problems to flash it on SPI memory.

Steps I have followed:

  1. Enable GNU Objcopy Utility to generate a .bin output of my project
  2. Convert this .bin to _ti.bin file using tiimage.exe from {PDK_PATH}\packages\ti\starterware\tools\ti_image. Based on ti_image wiki.

    Running: tiimage.exe   0x80000000   NONE   path_to_my_project\debug\MyProject.bin   path_to_my_project\debug\MyProject_ti.bin 

  3. Using CCS, load {PDK_PATH}\packages\ti\starterware\tools\flash_writer\spi_flash_writer_AM335X.out on the board. As said in SDK RTOS boot wiki
    1. Flash "bootloader_boot_mcspi_a8host_release_ti.bin" in offset 0x0 from {PDK_PATH}\packages\ti\starterware\binary\bootloader\bin\am335x-evm\gcc
    2. Flash "MyProject_ti.bin " in offset 0x20000

After this proces uart output is:

StarterWare Boot Loader
BOARDInit status [0x0]
SoC : [AM335X]
Core : [A8]
Board Detected : [ICE Ver 2]
Base Board Revision : [UNKNOWN]
Daughter Card Revision: [UNKNOWN]
GPIO Instance number: 0
Pin number: 18
MCSPI Instance number: 0
Channel/Chip Select number: 0
The instance address is 48030000

Copying Header of the image
Copying image from flash to DDR
Jumping to StarterWare Application...

But my program never starts running...

I have succesfully flashed a binary file from {PDK_PATH}\packages\ti\starterware\binary  using spi_flash_writer_AM335X.out so I guess something is going wrong with "MyProject_ti.bin".

Could you please tell me if the process I am following is correct?

I have read that sometimes is necessary to include gel file code to initialize board. Is that what I am missing? If so, how can I add this to my project?

How can I modify bootloader to print more info thought the uart?

I have also tried using "bootloader_boot_mmcsd_a8host_release_ti.bin" and again "MyProject_ti.bin " to boot it from SD card and serial output is:

*** StarterWare  Boot Loader. Build - 1.0.4-NOR BOOT
Copying application image from MMCSD to RAM
Unable to open application file from MMCSD

 The same ouput appears when I try with an example .bin instead of my project. Is it an error meaning the MLO file is correct and again the app is the problem??

Thanks.

Flashing process:

[CortxA8] AM335X part detected.
SF: Got idcode ef 40 17
Checking if Winbond flash writer can be used..
SF: Detected W25Q64 with page size 256, total 8388608 bytes
Flash page size: 256 bytes
Flash sector size: 4096 bytes
Starting SPIWriter.

Choose Operation:
Enter 1 ----> To FLASH an Image
Enter 2 ----> To ERASE Flash
Enter 3 ----> To EXIT

1
Enter the File Name

C:\ti\pdk_am335x_1_0_6\packages\ti\starterware\binary\bootloader\bin\am335x-evm\gcc\bootloader_boot_mcspi_a8host_release_ti.bin
Enter the Offset in bytes (in HEX)
0x0
Erasing flash at byte offset: 0, byte length: 36864
SE: cmd = { 0x20 0x000000 }
SE: cmd = { 0x20 0x001000 }
SE: cmd = { 0x20 0x002000 }
SE: cmd = { 0x20 0x003000 }
SE: cmd = { 0x20 0x004000 }
SE: cmd = { 0x20 0x005000 }
SE: cmd = { 0x20 0x006000 }
SE: cmd = { 0x20 0x007000 }
SE: cmd = { 0x20 0x008000 }
SF: Successfully erased 36864 bytes @ 0x9000
Writing flash at page offset: 0, number of pages: 134

Flashing is in progress...
Verifying... Success.

AM335X part detected.
SF: Got idcode ef 40 17
Checking if Winbond flash writer can be used..
SF: Detected W25Q64 with page size 256, total 8388608 bytes
Flash page size: 256 bytes
Flash sector size: 4096 bytes
Starting SPIWriter.

Choose Operation:
Enter 1 ----> To FLASH an Image
Enter 2 ----> To ERASE Flash
Enter 3 ----> To EXIT
1
Enter the File Name

C:\ti\blink_ICE_test\Uart_Output_Test\Debug\Uart_Output_Test_ti.bin
Enter the Offset in bytes (in HEX)

0x20000
Erasing flash at byte offset: 131072, byte length: 274432
SE: cmd = { 0x20 0x020000 }
SE: cmd = { 0x20 0x021000 }
SE: cmd = { 0x20 0x022000 }
SE: cmd = { 0x20 0x023000 }
SE: cmd = { 0x20 0x024000 }
SE: cmd = { 0x20 0x025000 }
SE: cmd = { 0x20 0x026000 }
SE: cmd = { 0x20 0x027000 }
SE: cmd = { 0x20 0x028000 }
SE: cmd = { 0x20 0x029000 }
SE: cmd = { 0x20 0x02a000 }
SE: cmd = { 0x20 0x02b000 }
SE: cmd = { 0x20 0x02c000 }
SE: cmd = { 0x20 0x02d000 }
SE: cmd = { 0x20 0x02e000 }
SE: cmd = { 0x20 0x02f000 }
SE: cmd = { 0x20 0x030000 }
SE: cmd = { 0x20 0x031000 }
SE: cmd = { 0x20 0x032000 }
SE: cmd = { 0x20 0x033000 }
SE: cmd = { 0x20 0x034000 }
SE: cmd = { 0x20 0x035000 }
SE: cmd = { 0x20 0x036000 }
SE: cmd = { 0x20 0x037000 }
SE: cmd = { 0x20 0x038000 }
SE: cmd = { 0x20 0x039000 }
SE: cmd = { 0x20 0x03a000 }
SE: cmd = { 0x20 0x03b000 }
SE: cmd = { 0x20 0x03c000 }
SE: cmd = { 0x20 0x03d000 }
SE: cmd = { 0x20 0x03e000 }
SE: cmd = { 0x20 0x03f000 }
SE: cmd = { 0x20 0x040000 }
SE: cmd = { 0x20 0x041000 }
SE: cmd = { 0x20 0x042000 }
SE: cmd = { 0x20 0x043000 }
SE: cmd = { 0x20 0x044000 }
SE: cmd = { 0x20 0x045000 }
SE: cmd = { 0x20 0x046000 }
SE: cmd = { 0x20 0x047000 }
SE: cmd = { 0x20 0x048000 }
SE: cmd = { 0x20 0x049000 }
SE: cmd = { 0x20 0x04a000 }
SE: cmd = { 0x20 0x04b000 }
SE: cmd = { 0x20 0x04c000 }
SE: cmd = { 0x20 0x04d000 }
SE: cmd = { 0x20 0x04e000 }
SE: cmd = { 0x20 0x04f000 }
SE: cmd = { 0x20 0x050000 }
SE: cmd = { 0x20 0x051000 }
SE: cmd = { 0x20 0x052000 }
SE: cmd = { 0x20 0x053000 }
SE: cmd = { 0x20 0x054000 }
SE: cmd = { 0x20 0x055000 }
SE: cmd = { 0x20 0x056000 }
SE: cmd = { 0x20 0x057000 }
SE: cmd = { 0x20 0x058000 }
SE: cmd = { 0x20 0x059000 }
SE: cmd = { 0x20 0x05a000 }
SE: cmd = { 0x20 0x05b000 }
SE: cmd = { 0x20 0x05c000 }
SE: cmd = { 0x20 0x05d000 }
SE: cmd = { 0x20 0x05e000 }
SE: cmd = { 0x20 0x05f000 }
SE: cmd = { 0x20 0x060000 }
SE: cmd = { 0x20 0x061000 }
SE: cmd = { 0x20 0x062000 }
SF: Successfully erased 274432 bytes @ 0x63000
Writing flash at page offset: 512, number of pages: 1065

Flashing is in progress... 
Verifying... Success.

  • The RTOS team have been notified. They will respond here.
  • Can you provide your test files(.out, .map and binaries) here so that I can reproduce this issue at my end. when creating the application make sure that you don`t use the OCMC memory region that the bootloader is using.

    OCMCRAM          start : 0x402f0400         length: 0x0001fbff

    Recently in one of our internal training session, we used the following binaries to demonstrate SPI boot on this platform, that you can try. In this case the app is the GPIO LED blink example for this platform that is provided in the Processor SDK RTOS.

    Bootloader.zip

    Please give this a try and let us know if they work for you.

    A gel file is only required when you are flashing the images to flash and not when you are booting. Let me create a document for you to follow

    SD MMC boot on this device will only work when the SPI flash is completely erased, this is due to the boot sequence on the EVM

    Boot sequence:

  • Hi Rahul,

    thanks for your fast reply!

    I will try to boot using your files and I will come back with the results.

    In the meantime, I attach the .out, .map, .bin and _ti.bin files I use to boot my program. Memory config looks as follow:

    Memory Configuration
    Name             Origin             Length             Attributes
    SRAM             0x402f0400         0x0000fc00
    L3OCMC0          0x40300000         0x00010000
    M3SHUMEM         0x44d00000         0x00004000
    M3SHDMEM         0x44d80000         0x00002000
    DDR0             0x80000000         0x40000000
    SRAM_LO          0x402f0000         0x00000400         xrw
    SRAM_HI          0x402f0400         0x0000fc00         xrw
    OCMC_SRAM        0x40300000         0x00010000         xrw
    DDR3             0x80000000         0x20000000
    *default*        0x00000000         0xffffffff
    My SRAM is defined quite as you mention but not my OCMC_SRAM. Whats the diference between those two?

    I am sure this is a basic issue, but I am a beginer and this file info is not so clear for me. Is there a document which explains .map file organization and sections?? I would like to understand propertly the content of this file.

    A gel file is only required when you are flashing the images to flash and not when you are booting. Let me create a document for you to follow

    In the future I would like to flash my programs in spi memory without using ccs, maybe with a SD card or another SPI flash writer program. In this case it would be necessary to include the gel file, correct??

    I am looking forward your explaining file!

    Thanks!

    Output_files.zip

  • Hi Rahul,

    I come back with some news

    First of all I have succeed in flashing my program in SPI memory! The problem was related with memory configuration. As you can see in my old .map, memory regions were duplicated so I guess this was causing some conflicts. Thanks for the hint with this!

    I found the file "AM335x.lds" containing memory regions definition, I excluded it from build and done!. My new memory configuration looks as follows:

    Memory Configuration
    Name             Origin             Length             Attributes
    SRAM_LO          0x402f0000         0x00000400         xrw
    SRAM_HI          0x402f0400         0x0000fc00         xrw
    OCMC_SRAM        0x40300000         0x00010000         xrw
    DDR3             0x80000000         0x20000000
    *default*        0x00000000         0xffffffff

    Now my question is: where are those definitions made? In case that I want to customice this map which file should I modify?

    On the other hand, I have tried the bootloader + app files you sent me.

    Spi boot worked fine but I still have some problems to boot from SD card.

    I got a different output than whe I use "bootloader_boot_mmcsd_a8host_release_ti.bin" as MLO file. Now it succeed on copying the image but apps are never executed (I tried almost all of them). 

    *** StarterWare  Boot Loader. Build - 1.0.4-NOR BOOT

    Copying application image from MMCSD to RAM

     

    Copying to RAM completed successfully

    Image Copy Successful, Executing Application..

    Any suggestion about that?

    What is the difference between this MLO and the one provided in the starterware? Can I have the source code?

    Thank you again!

  • For the boot loader build the AM335x_boot.lds file is used. This is where all the boot loader memory sections are defined. You need to make sure there is no overlap between the bootloader and the app memory sections. To customize you need to modify the sections in the .lds files for app and bootloader.

    To get SD boot to work on ICEAM3359, you need to erase the flash and make sure that you create the SD card and FAT format it. to confirm that it booted, you can either see that the LED is blinking or connect to the core and see that the core is executing in OCMC memory by looking at the Program Counter (PC) for the ARM using Register View in CCS.

    Regards,
    Rahul