Quick start with ecos 3.0 on Sitara AM335x processors Version 1.0.0 Date 24 May 2013 Description The document describes quick start approach for ecos 3.0 on MTAX-MB- AM335x development board Target audience Managers and technical experts File name n Quick_start_with_eCos3_0_on_Sitara_ AM335x_processors.docx
1 Document History 1.1 Version VERSION DATE AUTHOR COMMENT 1.0.0 24-May-2013 Pavel A. First version of the document 1.2 Review and Approvals VERSION REVIEWED REVIEWED BY DATE APPROVED DATE APPROVED BY 1.0.0 10-Jan-2014 Artsiom S. 10-Jan-2014 Artsiom S.
2 Contents 1 Document History... 2 1.1 Version... 2 1.2 Review and Approvals... 2 2 Contents... 3 3 Introduction... 4 4 General information on ecos... 6 5 Preparing development environment on Windows hosts:... 6 6 Building ecos libraries and tests... 7 7 Creating new ecos configuration... 9 8 Debugging ecos application in Code Composer Studio... 11 9 Building and running RedBoot... 19
3 Introduction Described ecos port is developed to support MTAX-MB-AM335x development board with MTAX-SOM-AM335x processor module. Supported features: 1. Basic BSP package DDR3 controller Interrupt controller System timer (GPTIMER4 used) MMU Caches NEON Coprocessor UART0 for diagnostic output RedBoot (loading from SDcard with MLO) 2. Advanced BSP package MMC/SD Ethernet CPSW (MII, RMII, RGMII, GMII) LCD (16, 24- bit) TFT USB OTG SPI I2C CAN 2.0 A/B RTC ADC/Touch controller NAND controller PRU intercommunication Hardware dependent components are located in ecos/packages/hal/arm/ cortexa8 directory. It includes following subdirectories: var contains hardware initialization and interrupt controller support (am335x_misc.c), system timer (am335x_ostimer.c), diagnostic serial output (hal_diag.c). am3359 contains peripheral registers description, list of peripheral interrupts (hal_platform_ints.h) and part of startup code (hal_platform_setup.h). am3359_mtax contains MMU initialization code (am3359_mtax_mmu.c), pinmux setting macros (mux.h, pinmux.h) and memory layout files (*.ldi files). For evaluation purposes two configurations are supplied: am3359_mtax_test.ecc for building basic ecos tests.
am3359_mtax_redboot.ecc for building RedBoot ecos based bootstrap application. In order to support debugging in TI Code Composer Studio via JTAG, AM3359_MTAX.gel startup script is supplied (Startup-script-files). In order to support loading from RedBoot SD card, MLO bootloader is supplied (bootstraps folder).
4 General information on ecos Main ecos information source: http://ecos.sourceware.org/ Preparing to work with ecos: http://ecos.sourceware.org/getstart.html Recommended readings: 1. Book Embedded Software Development with ecos http://www.informit.com/content/downloads/perens/0130354732.pdf 2. Official ecos 3.0 documentation http://ecos.sourceware.org/docs-3.0/ Examples for building ecos libraries and tests are provided in chapters 12.4, 12.6 of Embedded Software Development with ecos book. 5 Preparing development environment on Windows hosts: 1. Setup Cygwin with necessary packages: http://ecos.sourceware.org/cygwin.html Copy supplied cygintl-2.dll and make.exe files from /fix into cygwin/bin folder. The version of make-utility installed with Cygwin does not work with Windows-style paths. Check that path to Cygwin utilities cygwin/bin is added to PATH system environment variable. Create system environment variable named CYGPATH and value cygpath. This will allow CodeSourcery toolchain automatically translate paths from Cygwin-style to Windows-style. 2. Unpack AM335x port sources into /cygwin/opt/ecos_am3359_mtax folder. 3. Download and launch ecos installation script: wget --passive-ftp ftp://ecos.sourceware.org/pub/ecos/ecos-install.tcl sh ecos-install.tcl While installing select arm-eabi toolchain. Default repository will be created at path \cygwin\opt\ecos\ecos-3.0\ 4. Download new set of ecos host tools: http://ecos.sourceware.org/ml/ecos-discuss/2012-04/msg00031.html Copy configtool.exe into cygwin folder. This will allow launching it from Cygwin root folder (/). 5. Download and install Sourcery CodeBench Lite toolchain: http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/liteedition/arm-eabi Check that path to installed toolchain \CodeSourcery\Sourcery_CodeBench_Lite_ for_arm_eabi\bin\ is added to PATH system environment variable. 6. Download and install Texas Instruments Code Composer Studio for debugging built applications http://softwaredl.ti.com/dsps/forms/self_cert_export.html?prod_no=ccs5.4.0.00091_win32.zip&ref_url=http:/ /software-dl.ti.com/dsps/dsps_public_sw/sdo_ccstudio/ccsv5/ccs_5_4_0/
6 Building ecos libraries and tests 1. ecos Configuration Tool is the main instrument for creating necessary ecos configuration. Run downloaded ecos Configuration Tool from Cygwin command line:./configtool.exe & Detailed setup for each ecos component is performed in Configuration Tool main window (Fig. 1): Fugure 1 ecos Configuration Tool main window 2. Set path to install Sourcery arm-none none-eabi eabi toolchain (\arm-none-eabi\bin): Tools->Path >Path->Build Tools Figure 2 Build Tools selection window
3. Set path to Cygwin utilities (\cygwin\bin): Tools->Path >Path->User >User Tools Figure 3 User Tools selection window 4. Set path to AM335x ecos repository (\ecos_am3359_mtax\ecos\packages): Build->Repository Figure 4 ecos repository selection window 5. Building test configuration Open supplied am3359_mtax_test.ecc file File->Open In ecos configuration tool, under "Configuration", "Global build options", "Global compiler flags" following options should be added: -isystem /cygdrive/c/program\ Files/Sourcery_CodeBench_Lite_for_ARM_EABI/lib/gcc/armnone-eabi/4.7.3/include -isystem /cygdrive/c/program\ Files/Sourcery_CodeBench_Lite_for_ARM_EABI/lib/gcc/armnone-eabi/4.7.3/include-fixed This assumes Sourcery CodeBench is installed to "c:\program Files\CodeSourcery\ Sourcery_CodeBench_Lite_for_ARM_EABI\" and the GCC version is 4.3.3. Update this to match your setup. Now save the configuration and select Build->Generate build tree. Do not start the build from within Configuration Tool because it will not pass environment variables to the compiler. Instead, in CygWin terminal navigate to your ecos build directory (\opt\ecos_am3359_mtax\targ et\am3359_mtax_test_build) and run following commands: make -jx build ecos libraries. Type number of CPUs on your machine instead of x. make tests build ecos tests. Built tects are located in <configuration name>_install/tests folder.
7 Creating new ecos configuration 1. Creating new configuration file File->New Build->Templates Figure 5 Create new configuration file from template Hardware select hardware platform (hardware-dependent set of components). Packages select predefined hardware-independent set of components. 2. Change selected components list Build->Packages Figure 6 Edit selecsed packages list You can add/remove only hardware-independent components.
In ecos configuration tool, under "Configuration", "Global build options", "Global compiler flags" following options should be added: -isystem /cygdrive/c/program\ Files/Sourcery_CodeBench_Lite_for_ARM_EABI/lib/gcc/armnone-eabi/4.7.3/include -isystem /cygdrive/c/program\ Files/Sourcery_CodeBench_Lite_for_ARM_EABI/lib/gcc/armnone-eabi/4.7.3/include-fixed This assumes Sourcery CodeBench is installed to "c:\program Files\CodeSourcery\ Sourcery_CodeBench_Lite_for_ARM_EABI\" and the GCC version is 4.3.3. Update this to match your setup. In ecos configuration tool, under "Configuration", "ecos HAL", "ROM monitor support", "Enable use of virtual vector calling interface": check option "Initialize whole of virtual vector table". In ecos configuration tool, under "Configuration", "ecos HAL", "Platform-independent HAL options", "Route diagnostic output to debug channel": change value of "Mangler used on diag output" option to None. Figure 7 "Initialize whole of virtual vector table" option Save the configuration and select Build->Generate build tree. Now you can build ecos libraries and tests in abovementioned manner.
8 Debugging ecos application in Code Composer Studio After installing Code Composer Studio connect evaluation board with XUSBFT1 socket to the host PC. Supply 12V to the evaluation board. JTAG and virtual COM-port driver should be installed automatically. Drivers are located in \ccsv5\ccs_base\emulation\windows\xds100_drivers\ftdi\ folder. Select: File -> Import C/C++ -> C/C++ Executable
Select GNU Elf Parser. Select executable (for example, one of the built ecos tests).
Create new Target Configuration File->New >New->Target >Target Configuration File Name the file. Select Texas Instruments XDS100v2 USB Emulator. Select AM3359 processor. Test Connection with JTAG.
Select Advanced tab. Select CortxA8 core Browse supplied AM3359_MTAX.gel file with startup configuration.
On Main tab: Select AM3359.ccxml target configuration file. Select CortxA8 core. On Program tab: Select device: CortxA8. Select created project in workspace. Select debugged executable file in workspace.
On Target tab: Check Reset the target on a connect option. Clear Auto Run Options.
On Source tab: Add Path mapping for \cygwin\opt folder.
Now you can Debug the application with Code Composer Studio.
9 Building and runni r unning ng RedBoot Open am3359_mtax_redboot.ecc configuration file with Configuration Tool. Select Build->Generate build tree. In CygWin terminal navigate to your ecos build directory (\opt\ecos_am3359_mtax\targ et\am3359_mtax_redboot_build) and run following command: make -jx build ecos libraries. Type number of CPUs on your machine instead of x. Built RedBoot binary file redboot.bin is located in \opt\ecos_am3359_mtax\target\ am3359_mtax_redboot_install\bin. Copy built redboot.bin file and supplied MLO file to SD card. Insert SD card into XMMCSIM1 slot and power up the evaluation board. Connect the evaluation board over with XUSBFT1 socket to the host PC. The board is recognized as virtual-com port. Driver is supplied with Code Composer Studio (located in \ccsv5\ccs_base\emulation\windows\xds100_drivers\ftdi\ folder). Setup terminal program (for example, Putty) to the appropriate COM-port and 115200 baud. Apply power to the board. You should see the following output in the terminal: ecos 3.0 SD sdloader for MTAX-EVM-AM335X 33X Built May 24 2013 at 12:13:50 Version AXONIM Devices MTAX-EVM-AM335X 01.00.00.01 open redboot.bin file Init HW: controller RST SDCARD: requested speed 1000000, actual speed 1000000 SDHC: command response timeout CTO! MMC::MMCCommandResponse: MMCSendCommand error, command = 8 MMC::MMCCommandResponse: Command Response Error SDCARD: requested speed 25000000, actual speed 19200000 read redboot.bin file jumping to RedBoot image AM335X ecos RedBoot(tm) bootstrap and debug environment [RAM] Non-certified release, version UNKNOWN - built 12:36:33, May 24 2013 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. RedBoot is free software, covered by the ecos license, derived from the GNU General Public License. You are welcome to change it and/or distribute copies of it under certain conditions. Under the license terms, RedBoot's source code and full license terms must have been made available to you. Redboot comes with ABSOLUTELY NO WARRANTY. Platform: TI AM3359 MTAX board (Cortex-A8) RAM: 0x01000000-0x10ffffff [0x8fe12c38-0x11000000 available] RedBoot>