cancel
Showing results for 
Search instead for 
Did you mean: 

Knowledge Base Articles

Configuring Keil MDK for FX3 Projects - KBA228968

ChaitanyaV_61
Employee

Configuring Keil MDK for FX3 Projects - KBA228968

Version: **

Translation - Japanese: FX3プロジェクト用のKeil MDKの構成 - KBA228968 - Community Translated (JA)

This KBA describes how to port FX3 firmware to Keil IDE. You can use similar procedures to port FX3 firmware to any other IDE.

The two zip files attached with this KBA contain Keil projects ported from the FX3 SDK. Note that these files are created following the steps detailed in this document. You can use these as reference to verify your steps.

1. Download and install the IDE:

FX3 is based on the ARM926EJ core, which is not directly supported in the latest version of the Keil uVision compiler (5.28). Therefore, you will need to add the legacy support pack after you download and install the Keil IDE.

  1. Download and install Keil uVision 5.28 from https://www.keil.com/download/product/.
  2. Download and install the legacy support pack for MDK from http://www2.keil.com/mdk5/legacy.
  3. Refer to the below link for the KEIL License Limitations: http://www.keil.com/demo/limits.asp

2. Create Project:

1.  Note that this folder will be used in the steps that follow where you copy files from the SDK to your project.

2. Open Keil uVision 5.28.

3. Select Project > New uVision Project. Browse to the location where the folder for storing project files was created. See Figure 1.

   Figure 1. Creating New uVision Project

pastedImage_181.png

4. Enter a suitable name for the project, and click Save.

5. On the window that appears, do the following as shown in Figure 2:

      • On the Device tab, select Legacy Device Database from the first drop-down menu.
      • In the search box below it, enter ARM9E-S and then select the device from the list below.
          Figure 2. Choosing the Device
        pastedImage_69.png
        pastedImage_76.png
      • Click OK.   

6. Select Project > Manage > Project Items.  

7. Do the following in the Folders/Extensions tab of the Manage Project Items dialog as shown in Figure 3:

    1. Select Use GCC Compiler (GNU) for ARM projects.
    2. Enter arm-none-eabi- in the Prefix box.
    3. Enter C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\ in the GNU-Tool Folder box.
    4. Click OK.


Figure 3. Configuring Keil to be used as GCC Compiler for ARM Projects

pastedImage_96.png

8. Do the following to build the USBBulkSrcSink project in the FX3 SDK using Keil IDE. See Figure 4

    1. Navigate to the project folder in the SDK: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxbulksrcsink.

      Figure 4. Files in the USBBulkSrcSink Project in FX3 SDK

      pastedImage_103.png
      Note that the location of the project folder depends on the installation directory of the SDK.

    2. Copy all .c, .h, .s, makefile, and makefile.init files into your Keil IDE project folder that was created at the beginning for storing project files in Step 1 (see Figure 5).


Figure 5. Keil project folder after copying the files from the project in FX3 SDK
pastedImage_122.png


9. Do the following to add the copied files into the source group (under Target 1) in the Keil IDE.

    1. Right-click on Source Group 1 and select Add Existing Files to Group.
    2. Browse to Keil project folder that you created in Step 1.
    3. Add all the files that were copied from the SDK in Step 8.b.

       
      Figure 6. Adding source files into the source group 
      pastedImage_172.png
    4. After selecting the files, click Add.

The added files will now appear in Source Group 1.

10. Select the file types for each file from the File and Type fields.
Make sure that makefile and makefile.init are of type ‘Text Document File’. Select the drop down for type as shown in Figure 7:

Figure 7. Adding file type for each source file

pastedImage_159.png

All the .c files are automatically added as ‘C source file.’ and .s files are added as ‘assembly language file’.  See Figure 8.

Figure 8. Files listed in the Source Group

pastedImage_191.png

Note: If the project has two files of the same name (such as cyfxbulksrcsink.h and cyfxbulksrcsink.c in the USBBulkSrcSink project in the SDK), make the file type of one file as c source file and the other as text document file. 

11. To change the file type, right-click the file and choose Options for File as shown in Figure 9. Select the file type as shown in Figure 10:

Figure 9. Select options for file for changing file type

pastedImage_216.png

Figure 10. Changing File type to required type

pastedImage_217.png

3. Set Target Options:

  1. Right-click on the target and select Options for Target.

Figure 11. Selecting Options for Target

pastedImage_220.png 

2. Add the following in the Linker tab. See Figure 12. Make sure that all the paths are entered within quotes.

Linker Script File:

"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\fw_build\fx3_fw\fx3.ld"

Include Libraries:

cyu3lpp -lcyfxapi -lcyu3threadx -lc -lgcc

Include Paths: Figure 11. Selecting Options for Target

Note: If there are multiple paths to be added, add “-L” (without quotes) before each path. Note also that the first path must not have this prefix.

"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\fw_lib\1_3_4\fx3_debug"

"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\lib\gcc\arm-none-eabi\4.8.1”

"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\arm-none-eabi\lib"

            Misc Controls:

            -Wl,-d -Wl,--no-wchar-size-warning -Wl,--entry,CyU3PFirmwareEntry

Figure 12. Linker Tab

pastedImage_223.png

3. In the Assembler tab, add the include paths (in quotes) as shown in Figure 13:

Include Path:

"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\fw_lib\1_3_4\inc"          

Figure 13. Assembler Tab

pastedImage_233.png

4. In the CC tab (C Compile) of the Options for Target window, add predefined symbols and include paths as shown in Figure 14.

Define :

__CYU3P_TX__=1

Include Paths (in quotes):

"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\fw_lib\1_3_4\inc”

Figure 14. CC Tab

pastedImage_237.png

5. In the Listing tab, select Linker Listing as shown in Figure 15:

Figure 15. Listing Tab

pastedImage_239.png

6. Do the following in the Output tab as shown in Figure 16.

      1. Enter the name for the executable.
      2. Select the Create Executable option.
      3. Select Debug Information.
      4. Select Create HEX file.
      5. Click Select Folder for Objects and browse to the location of the Keil project folder. See Figure 17.

Figure 16. Output Tab

pastedImage_249.png

Figure 17. Changing Output Folder for Objects

pastedImage_253.png

7. On the User tab, do the following to convert the object file to .img file.  This image file will be saved in the Keil project folder with the .img extension.

    1. Under the After Build/Rebuild group, select Run #1.
    2. Enter the following command. Note that the path must be in quotes.

"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\util\elf2img\elf2img.exe" -i BulkSourceSink.elf -o BulkSourceSink.img –v

In this example, the name of elf file generated (i.e., the name given for the executable in the Output tab of Target Options in Step 6.a) is BulkSourceSink.elf. Replace the object file name with the appropriate name you have provided in the Target Options window.

Figure 18. User settings for executing the command after build

pastedImage_262.png

8. Build the project. The .img image is created in the Keil project folder.

Attachments
0 Likes
Version history
Revision #:
1 of 1
Last update:
‎Dec 04, 2019 04:55 AM
Updated by:
 
Contributors