Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Using Command Prompt for Building FX3 Projects - KBA229628

lock attach
Attachments are accessible only for community members.

Using Command Prompt for Building FX3 Projects - KBA229628

ChaitanyaV_61
Employee
Employee
50 questions asked 25 likes received 25 sign-ins

Version: *A

Translation - Japanese: FX3 プロジェクトのビルドにコマンドプロンプトを使用する - KBA229628 - Community Translated (JA)

Question:
Can command prompts be used to build FX3 projects?

Answer:
Do the following to use command prompts for building FX3 projects:

Step 1: Install Make for Windows

  1. The make command is used for building the project. Download Make for Windows from here. You can also use the make.exe installer available with this knowledge base article (KBA).
  2. Run the installer. After the installation is complete, Make for Windows is available at C:\Program Files (x86)\GnuWin32\bin.
  3. Now, add the path C:\Program Files (x86)\GnuWin32\bin to the PATH environment variable so that command prompt can locate make.exe.

Step 2: Create FX3 project build environment

Follow these steps to create FX3 project build environment:

1. Create a folder, for instance FX3_cmd_build, and a subfolder, for instance examples.

2. Copy the folders fw_lib, fw_build, and util from the FX3 SDK installation directory, for instance C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3 to the FX3_cmd_build folder.

The FX3_cmd_build folder will now contain the subfolders as shown in Figure 1.

Figure 1. FX3_cmd_build Folder Structure

  

3.Copy the firmware project folder from the SDK, which is to be built using command prompt, to the examples folder. In this KBA, the example project cyfxusbi2cregmode in FX3 SDK is built using command prompt, and is available in: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\

Note: The path depends on the installation directory of FX3 SDK.

Copy the entire cyfxusbi2cregmode folder to the examples subfolder.

4. Open the copied cyfxusbi2cregmode folder. This folder will contain the files as shown in Figure 2.

Figure 2. Files in cyfxusbi2cregmode Folder

   pastedImage_3.png

 

5. Modify the makefile:

    a. Change FX3FWROOT = ../../.. to FX3FWROOT = ../..

    b. Change the copy commands as listed in Table 1.

Table 1. Copy Commands to be Modified

From

To

cp $(FX3FWROOT)/fw_build/fx3_fw/cyfxtx.c

copy "$(FX3FWROOT)\fw_build\fx3_fw\cyfxtx.c"

cp $(FX3FWROOT)/fw_build/fx3_fw/cyfx_startup.S

copy "$(FX3FWROOT)\fw_build\fx3_fw\cyfx_startup.S"

cp $(FX3FWROOT)/fw_build/fx3_fw/cyfx_gcc_startup.S

copy "$(FX3FWROOT)\fw_build\fx3_fw\cyfx_gcc_startup.S"

    c. Replace all commands under clean: with the following:

   cs-rm -f ./$(MODULE).$(EXEEXT)

   cs-rm -f ./$(MODULE).map

   cs-rm -f ./*.o

   cs-rm -f cyfxtx.c cyfx_startup.S cyfx_gcc_startup.S

   d. Copy the following and paste before the line clean:

    ELF2IMG     = $(FX3FWROOT)/util/elf2img/elf2img

    GEN_IMAGE = $(ELF2IMG) -v -i $< -o $@ -imgtype 0xB0

    $(MODULE).img: $(MODULE).$(EXEEXT)

                        $(GEN_IMAGE)

e. Modify the compile: statement:

compile: $(C_OBJECT) $(A_OBJECT) $(EXES) $(MODULE).img        

6. Open makefile fx3_armgcc_config.mak from FX3_cmd_build\fw_build\fx3_fw. Make the following changes to the code under LDLIBS += \:

"$(ARMGCC_INSTALL_PATH)/arm-none-eabi/lib/libc.a"     \

"$(ARMGCC_INSTALL_PATH)/lib/gcc/arm-none-eabi/$(ARMGCC_VERSION)/libgcc.a"

7. Open command prompt and go to FX3_cmd_build\examples\cyfxusbi2cregmode. Use the make all command.

This will generate the.elf and .img files, which are available in the cyfxusbi2cregmode folder. This completes the build process.

Note: The .zip file available with this KBA contains the following:

  • The modified makefile, which needs to be copied to the cyfxusbi2cregmode folder.
  • The modified makefile fx3_armgcc_config.mak, which needs to be copied to the FX3_cmd_build\fw_build\fx3_fw folder.
  • Installer for make.exe.
Attachments
1277 Views
Contributors