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.
- Download and install Keil uVision 5.28 from https://www.keil.com/download/product/.
- Download and install the legacy support pack for MDK from http://www2.keil.com/mdk5/legacy.
- 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
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
- 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:
- Select Use GCC Compiler (GNU) for ARM projects.
- Enter arm-none-eabi- in the Prefix box.
- Enter C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\ARM GCC\ in the GNU-Tool Folder box.
- Click OK.
Figure 3. Configuring Keil to be used as GCC Compiler for ARM Projects
8. Do the following to build the USBBulkSrcSink project in the FX3 SDK using Keil IDE. See Figure 4.
- 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
Note that the location of the project folder depends on the installation directory of the SDK.
- 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).
9. Do the following to add the copied files into the source group (under Target 1) in the Keil IDE.
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
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
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
Figure 10. Changing File type to required type
3. Set Target Options:
- Right-click on the target and select Options for Target.
Figure 11. Selecting Options for Target
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"
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"
-Wl,-d -Wl,--no-wchar-size-warning -Wl,--entry,CyU3PFirmwareEntry
Figure 12. Linker Tab
3. In the Assembler tab, add the include paths (in quotes) as shown in Figure 13:
"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\fw_lib\1_3_4\inc"
Figure 13. Assembler Tab
4. In the CC tab (C Compile) of the Options for Target window, add predefined symbols and include paths as shown in Figure 14.
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
5. In the Listing tab, select Linker Listing as shown in Figure 15:
Figure 15. Listing Tab
6. Do the following in the Output tab as shown in Figure 16.
- Enter the name for the executable.
- Select the Create Executable option.
- Select Debug Information.
- Select Create HEX file.
- Click Select Folder for Objects and browse to the location of the Keil project folder. See Figure 17.
Figure 16. Output Tab
Figure 17. Changing Output Folder for Objects
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.
- Under the After Build/Rebuild group, select Run #1.
- 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
8. Build the project. The .img image is created in the Keil project folder.