How to configure a new flash device for a Layerscape board via CodeWarrior for ARMv8

Document created by Swati Gupta Employee on Oct 3, 2019Last modified by Swati Gupta Employee on Nov 14, 2019
Version 4Show Document
  • View in full screen mode

This topic explains steps to configure the “MT25QU02GCBB8E12” flash device for LX2160ARDB. The steps are common for most of the flash devices. If the procedure does not work for a particular flash device, please contact NXP Support.

 

Prerequisite: CW version 2019.01

 

In a custom design with LX2160, if you want to use the MT25QU02GCBB8E12 flash device which is not supported by the flash programmer,  you can add support for the new flash device by following these steps:

      
  1. Browse to the directory <CW4NET-Installation-Directory>/CW4NET_v2019.01/CW_ARMv8/Config/flash/
  2.   
  3. Duplicate file devices/MT25QU01GBBB.xml and rename the duplicated file as devices/MT25QU02GBBB.xml
  4.   
  5. Update devices/MT25QU02GBBB.xml as follows:   
        

    <device-file>

        

          <device>

        

                <content>

        

                      <device_parameters>

        

                            <device_type>spi</device_type>

        

                            <manufacturerid>0x20</manufacturerid>

        

                      </device_parameters>

        

                     <name>MT25QU02GBBB</name>

        

                      <sectors>

        

                           <sector count="4096" size="0x10000"/>

        

                      </sectors>

        

                      <organizations>

        

                            <organization depth="128M" width="8">

        

                                 <id>0xBB22</id>

        

                                  <algorithm>

        

                                       <fpinclude href="algorithms/MT25QU02GBBB.xml"/>

        

                                  </algorithm>

        

                            </organization>

        

                      </organizations>

        

                </content>

        

          </device>

        

    </device-file>

       
  6.   
  7. Duplicate file algorithms/MT25QU01GBBB.xml and rename the duplicated files as algorithms/MT25QU02GBBB.xml
  8.   
  9. Update algorithms/MT25QU02GBBB.xml as follows:   
        

     

        

    <algorithm-file>

        

          <architectures>

        

                <architecture type="arm" address_size="64">

        

                      <controller type="QSPI">

        

                            <format>bin</format>

        

                            <entry_point>0x100</entry_point>

        

                            <file>QSPI_64b</file>

        

                           <fpinclude href="algorithms/params/MT25QU02GBBB_QSPI_64.xml"/>

        

                            <supported_operations>

        

                                  <operation>id</operation>

        

                                  <operation>erase_sectors</operation>

        

                                  <operation>program</operation>

        

                                  <operation>dump</operation>

        

                                  <operation>protect_sectors</operation>

        

                                  <operation>unprotect_sectors</operation>

        

                            </supported_operations>

        

                      </controller>

        

                     <controller type="FSPI">

        

                           <format>bin</format>

        

                           <entry_point>0x100</entry_point>

        

                           <file>FSPI_64b</file>

        

                           <fpinclude href="algorithms/params/MT25QU02GBBB_QSPI_64.xml"/>

        

                           <supported_operations>

        

                                 <operation>id</operation>

        

                                 <operation>erase_sectors</operation>

        

                                 <operation>program</operation>

        

                                <operation>dump</operation>

        

                                 <operation>protect_sectors</operation>

        

                                 <operation>unprotect_sectors</operation>

        

                           </supported_operations>

        

                     </controller>

        

     

        

                </architecture>

        

          </architectures>

        

    </algorithm-file>

       
  10.   
  11. Duplicate algorithms/params/MT25QU01GBBB_QSPI_64.xml and rename the duplicated file as algorithms/params/MT25QU02GBBB_QSPI_64.xml
  12.   
  13. Update algorithms/params/MT25QU02GBBB_QSPI_64.xml as follows:   
        

    <params_file>

        

        <parameters_block>

        

            <param name="function" size="0x4"/>

        

            <param name="padding1" size="0x4"/>

        

            <param name="base_addr" size="0x8"/>

        

            <param name="num_items" size="0x4" type="data_size"/>

        

            <param name="result_status" size="0x4" type="result"/>

        

            <param name="items" size="0x8" type="data_inout"/>

        

            <param name="qspi_base_addr" size="0x8"/>

        

            <param name="qspi_controller_offset" size="0x4"/>

        

            <param name="bytes_per_sector" size="0x4" value="0x10000"/>

        

            <param name="bytes_per_page" size="0x4" value="0x100"/>

        

     

        

           <param name="number_of_sectors" size="0x4" value="0x1000"/>

        

            <param name="swap_enable" size="0x1"/>

        

            <param name="workaround" size="0x1" value="0"/>

        

            <param name="is_nand" size="0x1" value ="0"/>

        

            <param name="block_protect_mask" size="0x1" value="0x5C"/>

        

            <param name="top_bottom_reg_address" size="0x4" value="0"/>

        

            <param name="top_bottom_mask" size="0x1" value="0x20"/>

       
  14.   
  15. Update the target initialization file as follows:   
        

     

        

    def Config_Flash_Devices():

        

        fl = flash.create(TA)

        

     

        

        # Add FlexSPI device

        

        #fl.add_device({"alias": "xspi", "name": "MT35XU512ABA", "address": 0x0, "ws_address": 0x18000000, "ws_size": 0x1FFFF, "geometry": "8x1", "controller": "FSPI"})

        

        # Add MT25QU02GCBB8E12 flash device 

        

        fl.add_device({"alias": "xspi", "name": "MT25QU02GBBB", "address": 0x0, "ws_address": 0x18000000, "ws_size": 0x1FFFF, "geometry": "4x1", "controller": "FSPI"})

        

     

       
  16.   
  17. Restart CodeWarrior for ARMv8 and start the Flash programmer. Select  MT25QU02GBBB device from flash device list and configure the desired operations.

Attachments

    Outcomes