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.

AM5728: QSPI flash access in baremetal

Part Number: AM5728

Hi,

Actually I want to do read write on qspi flash using jtag in bare metal scenario. Tried the same in IDK-Am4377.
There I got starterware and with the help of which created the project in CCS.

Can the same thing achieved with the process you have mentioned ?
Please let me know the same.

BR,Abhinav

  • Abhinav,

    The low level drivers that we provide in the Processor SDK RTOS, can be used in bare-metal as well as in the RTOS context. In order to achieve this we provide an OS abstraction layer called (OSAL) that has two versions, one for using with RTOS and one can be used in the context of no-OS or bare-metal code.

    You can see the QSPI driver used in bare-metal example that is included in the diagnostic tests that we provide for testing board functionality. You can locate this example at the following location in the PDK package.
    pdk_am57xx_1_0_9\packages\ti\board\diag\qspi

    Regards,
    Rahul

    PS:  Documentation for building  and running diagnostics.

    http://processors.wiki.ti.com/index.php/Processor_SDK_RTOS_DIAG 

  • Thanks Rahul for your reply.

    Now can you please help me in building the same.
    I am following the link mentioned by but the make command is not working.

    Steps followed-

    1.Copied the pdksetupenv.bat and Rules.make to pdk_am57xx_1_0_9\packages\ti\board\diag and executed the same as mentioned in the link

    2. Tried "make all" command. Below error came

    'make' is not recognized as an internal or external command,
    operable program or batch file.

    3. Then figured out there is no makefile in the dir.

    4. Moved to  pdk_am57xx_1_0_9\packages\ti\board\diag\qspi and tried the make command but still the same error.

    C:\ti\PDK_AM~2\packages\ti\board\diag\qspi>pdksetupenv.bat
    Optional parameter not configured : CG_XML_BIN_INSTALL_PATH
    REQUIRED for xdc release build
    Example: set CG_XML_BIN_INSTALL_PATH=C:/ti/cg_xml/bin
    Optional parameter not configured : DOXYGEN_INSTALL_PATH
    REQUIRED for xdc release build
    Example: set DOXYGEN_INSTALL_PATH=C:/ti/Doxygen/doxygen/1.5.1-p1/bin
    **************************************************************************
    Environment Configuration:
        LIMIT_SOCS                : am571x am572x am574x
        LIMIT_BOARDS              : evmAM572x idkAM571x idkAM572x idkAM574x
        PDK_INSTALL_PATH          : /ti/PDK_AM~2/packages/ti/board/diag/qspi
        C6X_GEN_INSTALL_PATH      : C:/ti/ti-cgt-c6000_8.2.2
        TOOLCHAIN_PATH_GCC        : C:/ti/gcc-arm-none-eabi-6-2017-q1-update
        TOOLCHAIN_PATH_A15        : C:/ti/gcc-arm-none-eabi-6-2017-q1-update
        TOOLCHAIN_PATH_A8         : C:/ti/gcc-arm-none-eabi-6-2017-q1-update
        TOOLCHAIN_PATH_A9         : C:/ti/gcc-arm-none-eabi-6-2017-q1-update
        TOOLCHAIN_PATH_M4         : C:/ti/ti-cgt-arm_16.9.3.LTS
        TOOLCHAIN_PATH_Arm9       : C:/ti/ti-cgt-arm_16.9.3.LTS
        TOOLCHAIN_PATH_EVE        : C:/ti/arp32_1.0.8
        CL_PRU_INSTALL_PATH       : C:/ti/ti-cgt-pru_2.1.5
        UTILS_INSTALL_DIR         : C:/ti/xdctools_3_50_03_33_core/bin
        HARDLIB_PATH              : C:/ti/gcc-arm-none-eabi-6-2017-q1-update/lib/
    /arm-none-eabi/6.3.1/hard
        CROSS_TOOL_PRFX           : arm-none-eabi-
        XDC_INSTALL_PATH          : C:/ti/xdctools_3_50_03_33_core
        BIOS_INSTALL_PATH         : C:/ti/bios_6_52_00_12
        IPC_INSTALL_PATH          : C:/ti/ipc_3_47_00_00
        EDMA3LLD_BIOS6_INSTALLDIR : C:/ti/edma3_lld_2_12_05_30B
        NDK_INSTALL_PATH          : C:/ti/ndk_2_26_00_08
        IMGLIB_INSTALL_PATH       : C:/ti/imglib_c66x_3_1_1_0
        DSPLIB_INSTALL_PATH       : C:/ti/dsplib_c66x_3_4_0_0
        MATHLIB_INSTALL_PATH      : C:/ti/mathlib_c66x_3_1_1_0
        UIA_INSTALL_PATH          : C:/ti/uia_2_21_02_07
    **************************************************************************
    Changing to short name to support directory names containing spaces
    current directory: /ti/PDK_AM~2/packages/ti/board/diag/qspi
    PDK BUILD ENVIRONMENT CONFIGURED
    **************************************************************************
    
    C:\ti\PDK_AM~2\packages\ti\board\diag\qspi>make all
    'make' is not recognized as an internal or external command,
    operable program or batch file.
    
    C:\ti\PDK_AM~2\packages\ti\board\diag\qspi>make
    'make' is not recognized as an internal or external command,
    operable program or batch file.

  • Abhinav,

    The make command is used on Linux. On the windows system, you need to invoke gmake so the command. If you execute gmake all, this will build diagnsotics for all support AM57xx platforms. I recommend that you use "gmake idkAM572x" from pdk_am57xx_1_0_9\packages\ti\board\diag to build for a specific evaluation platform. This builds all the diagnostic tests for this platform idkAM572x including the qspi read/write test. If you only want to QSPI test then try the same command from the directory pdk_am57xx_1_0_9\packages\ti\board\diag\qspi.

    Regards,
    Rahul
  • Part Number: AM5728

    Tool/software: TI-RTOS

    Hi,

    I am using IDK-Am5728 board and qspi diagnostic example inside C:\ti\pdk_am57xx_1_0_9\packages\ti\board\diag\qspi\src\qspi_diag.c.
    My intension is to write MLO and u-boot to flash using the utility. Converted the MLO and u-boot into header file with the big array which I included in the qspi_diag.c

    When trying to write only MLO it is writing in the flash and on reset booting the MLO from the flash (confirmed by prints at teraterm).
    But when trying to write MLO along with u-boot, then only MLO is booting not u-boot. Using below code write MLO and u-boot.

      S25FLFlash_BlockErase(flashHandle, blockNumber);
    
        /* Set the transfer length in number of 32 bit words */
        transferLength = kSize_MLO;  /*Size of MLO */
    
    
        /* Update target address based on the modes. For config mode pass the
           address of the variable containing the flash offset value.
           For memory mapped mode directly pass the flash offset value. */
        addressValue = (QSPI_OPER_MODE_CFG == hwAttrs->operMode) ?
            (uint32_t)&addrValue: addrValue;
    
    
        /* Update transaction parameters */
        flashTransaction.data       = (uint8_t *)&MLO[0];
        flashTransaction.address    = addressValue;
        flashTransaction.dataSize   = transferLength;  /* In bytes */
    
        /* Write buffer to flash */
        retVal = SF25FL_bufferWrite(flashHandle, &flashTransaction);
        UART_printf("MLO flashed successfully! \n");
        
         
        transferLength = kSize_u_boot;
        addressValue = kSize_MLO + 1;    
     
        flashTransaction.data       = (uint8_t *)&u_boot[0];
        flashTransaction.address    = addressValue;
        flashTransaction.dataSize   = transferLength;  /* In bytes */
    
        /* Write buffer to flash */
        retVal = SF25FL_bufferWrite(flashHandle, &flashTransaction);
        UART_printf("U-boot flashed successfully! \n");
    
    
        SF25FL_close(flashHandle);


    Please check whether doing something wrong here ?
    I am considering flashTransaction.address as the offset and hence in case of u-boot writing updating it from the size of MLO.
    Let me know if this has any issue ?

    BR,Abhinav

  • The RTOS team have been notified. They will respond here.
  • Abhinav,

    We request you to not open multiple threads regarding the same issue. What you are trying to do is not a supported usecase. The MLO in the Processor SDK RTOS is designed to load TI RTOS and bare-metal code provided in Processor SDK RTOS only. It expects a fixed flash memory and application memory layout.

    For loading u-boot, you need to usee Processor SDK Linux and use the SPL and uboot from that offering. We don`t test the SDK for the hybrid boot tscenario that you are trying to implement. If you are simply looking for a QSPI flash writer using bare-metal, we provide a fllashwriter utility to write the bootloader and the RTOS app to the flash, refer to the instructions here:

    processors.wiki.ti.com/.../Processor_SDK_RTOS_BOOT_AM57x

    Regards,
    Rahul
  • Hi Rahul,

    Okays, will reply here only.

    I think my last post was not clear about what we are trying to achieve.

    Here giving the context so that it will be helpful in further discussion.

    My final goal is to flash the qspi using CCS.

    Now I have the am57xx sdk and independent u-boot source code on my linux platform.
    Building the u-boot for am572x and using these binaries(MLO and u-boot.img), able to boot the board from SD card.
    Am572x sdk is also building successfully along with diag application. 

    Using qspi_diagExample_idkAM572x_armv7.out binary generated as part of building qpsi_diag.c.
    Loading this binary through CCS on the IDK-AM5728 board and on the console getting proper Qspi read-write prints.

    Now what I have done is converted the MLO into hex array using bin2header linux open source utility. Attaching the output file for reference (MLO.h).PFA
    Included the header file in qspi_diag.c file and have done some modification to write this MLO array to the flash instead of the pattern.
    Following the same procedure of loading the modified qspi_diagExample_idkAM572x_armv7.out binary to qspi through CCS and observing the prints on the Teraterm.
    Once the qspi write is complete doing the warm reset on the board and able to see the MLO logs on the console which confirms that board is now booting from qspi.
    As only MLO is flashed MLO prints are coming.

    Second step is to follow the same procedure to write the u-boot after MLO using qpsi_diag.c
    Again created the hex array of u-boot and modified the qpsi_diag.c accordingly to write u-boot after MLO. Code is shared in my last post.
    Compiling and loading this binary through CCS, able to see logs on console but when I am resetting the board only MLO is booting not u-boot.

    I am suspecting that u-boot is not properly written to the flash with my code changes.There must be some issue in my modified code.

    Hope this clears the issue.
    As part of feasibility of this approach we already confirmed it on IDK-AM4377 where we are able to write u-boot on qspi using flash write app and boot from there .

    Just want you to check above last post's code whether it is correct or not.

    BR,Abhinav
    MLO.h

  • Hi Rahul,

    Thanks for your reply.
    The issue is resolved. I am suspecting the right thing i.e flashTransaction.address. This is the offset value and was giving wrong value. When I saw my u-boot source code under path include/configs/am57xx_evm.h , there the offset value for each file (like MLO,u-boot,env.txt) is mentioned. U-boot should be written to 0x40000. Now able to boot from qspi flash.

    BR,Abhinav