##1. Install Eclipse & Eclipse C/C++ Development Tools $ sudo apt-get install eclipse eclipse-cdt
##2. Install GNU ARM Eclipse Plug-in The recommended way to install this plug-in is to use the Eclipse standard install/update mechanism:
- Start Eclipse (from Terminal):
$ eclipse & - Eclipse menu: Help->Install New Software
- In the Install window, click the "Add..." button (for future updates, you will be able to select the URL from the dropdown)
- Fill in Location: http://gnuarmeclipse.sourceforge.net/updates
- Click the "OK" button
- Normally the main window should list a group named "GNU ARM C/C++ Cross Development Tools" - expand it.
- Select "GNU ARM C/C++ Development Support"
- Click the Next button
- Accept the unsigned plug-in and install
Note: As we saved the update site URL in Step 3, further updates are greatly simplified via: Help->Check For Updates
##3. Setup Eclipse
- Add the following lines to the end of ~/.bashrc using a text editor (so Eclipse knows where our project and toolchain will be located):
export FX3_INSTALL_PATH=$HOME/workspace/cypress-fx3-sdk-linux
export PATH="$PATH:$FX3_INSTALL_PATH/util/arm-2011.03/bin"
export ARMGCC_INSTALL_PATH=$FX3_INSTALL_PATH/util/arm-2011.03
export ARMGCC_VERSION=4.5.2 - Start Eclipse (from a fresh instance of Terminal):
$ eclipse & - Use the default workspace path when prompted (i.e. ~/workspace)
- Clone this repository to the Eclipse workspace folder:
$ cd ~/workspace
$ git clone https://github.com/nickdademo/cypress-fx3-sdk-linux.git - Compile the included elf2img tool:
$ cd ~/workspace/cypress-fx3-sdk-linux/util/elf2img
$ gcc elf2img.c -o elf2img -Wall - Import the projects you require into Eclipse: File->Import->General->Existing Project into Workspace - select cypress-fx3-sdk-linux/firmware as the root directory.
Note 1: Ensure you DO NOT import the cyu3lpp project.
Note 2: Import CyStorBootWriter if you will be writing firmware to FX3S Storage Port 0. - Also import the following TWO (2) projects located in the "FX3_SDK_1_3_1_SRC" folder in the top-level directory:
boot_fw
sdk - Build the entire project workspace: Project->Build All
##4. Flashing ###A. Flashing the Device (using CyUSB Suite for Linux)
- Install dependencies:
$ sudo apt-get install libqt4-dev qt4-qmake libusb-1.0-0-dev - Compile and install CyUSB Suite and Cypress USB library:
$ cd ~/workspace/cypress-fx3-sdk-linux/util/cyusb_linux_1.0.4/
$ sudo ./install.sh - Restart system
- Run CyUSB Suite for Linux with the following command in Terminal:
$ cyusb_linux
###B. Flashing the Device (using Cypress command line tools through Eclipse)
- Install dependencies:
$ sudo apt-get install libusb-1.0-0-dev g++ - Compile and install Cypress USB library (if not already installed in Step 4A):
$ cd ~/workspace/cypress-fx3-sdk-linux/util/cyusb_linux_1.0.4/
$ sudo ./install_lib.sh - Compile cyusb_linux_1.0.4 command-line tools:
$ cd ~/workspace/cypress-fx3-sdk-linux/util/cyusb_linux_1.0.4/src/
$ make - Compile cyfwstorprog tool (for flashing to SD/eMMC):
$ cd ~/workspace/cypress-fx3-sdk-linux/util/cyfwstorprog_linux/
$ make - Make cyfwstorprog tool run WITHOUT a sudo password prompt in Eclipse:
$ sudo gedit /etc/sudoers
Add the following to the end of the sudoers file (replace YOUR_USERNAME with your own and ensure the path to the tool is correct):
YOUR_USERNAME ALL = (ALL) ALL
YOUR_USERNAME ALL = (root) NOPASSWD: /home/YOUR_USERNAME/workspace/cypress-fx3-sdk-linux/util/cyfwstorprog_linux/cyfwstorprog - Create a .launches directory in the Eclipse workspace:
$ mkdir -p ~/workspace/.metadata/.plugins/org.eclipse.debug.core/.launches - Copy Eclipse launch files to appropriate folder:
$ cp ~/workspace/cypress-fx3-sdk-linux/util/eclipse_launches/*.launch ~/workspace/.metadata/.plugins/org.eclipse.debug.core/.launches/ - Restart system
- Start Eclipse and program the FX3 using the External Tools menu! (Note: You may have to add the launches as favourites via "Organize Favourites" to make them visible).
IMPORTANT: The CyStorBootWriter project must be compiled and flashed to the FX3S RAM before attempting to use the cyfwstorprog tool to write firmware to the SD/eMMC.
The source for the cyfwstorprog tool can be found at https://github.com/nickdademo/cyfwstorprog_linux
##Notes
Fx3BootAppGcc:
Debug: Optimization level = OPTIMIZE MOST (O3)
Release: Optimization level = OPTIMIZE MORE (O2)
boot_fw:
Default: Optimization level = OPTIMIZE (O1)
sdk:
Debug: Optimization level = NONE (O0)
Release: Optimization level = OPTIMIZE (O1)
All other projects:
Debug: Optimization level = NONE (O0)
Release: Optimization level = OPTIMIZE MORE (O2)
In order for required libraries (.a files) to exist when they are required during building of certain projects, the build order of Eclipse projects is set via the "Project References" project option:
Fx3BootAppGcc: References "boot_fw"
boot_fw: No references
sdk: No references
All other projects: References "sdk"