Setup ARM Development Environment

From molecubes
Jump to navigation Jump to search

Installation Procedure

Download Source Code & Development Environment

Step 1: Clone Molecubes GitHub repository - Follow directions here. If you are familiar with Github, the repository is located here:

Step 2: Download Modified ARMlib - Download Here. Minor modifications to Procyon ARMlib were necessary to support all functionality.

Step 3: Download WinARM - Download Here. Version 20060606 is tested and working.

Step 4: Download GNUARM arm-elf - Download Here. These files are necessary to replace the defaults in WinARM. The source of this problem hasn't been determined yet.

Step 5: Download Rowley Crossworks - Download Here.

Install Development Environment

Step 1: Install WinARM - Suggested location: C:\WinARM

Step 2: Unzip Modified ARMLib downloaded above - Suggested location: WinARM\armlib

Step 3: Replace default arm-elf directory - Unzip the arm-elf directory downloaded above. In your WinARM installation directory, C:\WinARM move or rename the original arm-elf and replace it with the downloaded version.

Step 4: Install Rowley Crossworks

Step 5: Register for Evaluation version or enter license number - In Crossworks go to License Manager. (Tools -> License Manager)

Step 6: Download Crossworks LPC2000 Support Package - here, same as (Tools -> Download Packages From Web). Select CPU Support Packages -> NXP -> LPC2000, download NXP_LPC2000.hzq

Step 7: Install Crossworks LPC2000 Support Package - (Tools -> Install Package) direct it at the hqz file downloaded in step 6.

Environment Variables

Step 1: Setup Environment Variables, these correspond to installation paths of steps above. (set in My Computer -> Properities -> Advanced System Settings -> Environment Variables):

ARM       C:\WinARM\bin
ARMLIB    C:\WinARM\armlib

Step 2: Setup Path, Append ;C:\WinARM\bin to your Path environment variable.

Compile and Load Binary

Step 1: Compile runtime, Open the Base Controller Test .sln file located in the cloned repository software\controller\runtime. Execute Rebuild Solution (Build -> Rebuild Solution)

Note: If you see the following error:

------ Rebuild All started: Project: Runtime, Configuration: Debug Win32 ------
Performing Makefile project actions
'make' is not recognized as an internal or external command,
operable program or batch file.

This has occurred because the make application has not been found on the path. The easiest way to fix this is to perform steps 2-4 in the Actuator Development Environment Configuration. The installation of WinAVR (not WinARM) places make on the path and resolves this dependency.

Step 2: Install ARM-USB-OCD Drivers, Plug in ARM-USB-OCD and install these drivers. The drivers are for the Olimex ARM-JTAG. Windows will prompt for a driver location when this device is first plugged in. Direct Windows to the folder where this zip file was extracted.

Step 3: Create empty project in CrossWorks, (File -> New -> New Project -> NXP LPC2000 -> Generic LPC21xx Board -> Externally Built Executable) Click ok and Configure the following:

Oscillator Frequency: 12MHz

Target Processor: LPC2148

If debugging, Executable file at main_serial.elf compiled in step 1.

Click Finish, this step should not need to be repeated, it should be loaded by Crossworks on startup.

Step 4: Connect to ARM-USB-OCD, In Targets window click on Olimex ARM-USB-OCD, in Properties Window verify the following properties:

Identify Target: Yes

JTAG Clock Divider: 4

nTRST Open Drain: No

Step 5: Load Binary File, Right Click on ARM-USB-OCD in Targets window and click Connect. Right click again and select (Download File -> elf) and point it to the main_serial.elf compile in step 1.

Step 6: Setup Driver, Right Click on ARM-USB-OCD in Targets window and click Reset. A new device should now be discovered by Windows and a driver should be requested. Point driver search to runtime directory, software\controller\runtime. The driver of interest is usbser.inf

Step 7: Connect with Terminal, Connect with your favorite terminal application to the new emulated serial port, baud rate does not matter. Transmit an 'e' to see a test message returned.

Permanently Load Binary

The above process requires Rowley Crossworks to reset the controller for every use. This is acceptable during development but not during normal use. Use the following procedure to setup your application to start immediately when power is applied.

Step 1: Copy compiled binary *.bin file - to the following repository directory software\controller\lpc2xxx_openocd_bin_loader and rename to main.bin.

Step 2: Verify Rowley is closed - and the jtag is connected to the LPC-H2148.

Step 3: Verify LPC-H2148 is powered - via usb or external power supply.

Step 4: Run openocd_go_flash.bat - This will load the binary in a slightly different manner than Rowley such that the program starts when power is applied.

Step 5: Unplug JTAG from LPC-H2148, and cycle the power source (usb or external power supply). If powered over usb the yellow usb connectivity led should be lit. This indicates the device is powered and the software is running.

Development Suite Notes

Windows is required. Feel free to prove us wrong.

Hardware Target

NXP LPC2148 ARM Processor: Datasheet

Olimex LPC-P2148 Development Board

Development Hardware

Both of the following devices have been tested:

Olimex ARM-USB-OCD Programmer / JTAG (~$72)

Rowley CrossConnect for ARM Programmer / JTAG (~$140)

Development Environment

ARMlib by Pascal Stang provides high level support for many features (A2D, I2C, SPI, UART, etc)

LPCUSB and here by Bertrik provides USB to Serial driver support. With the included driver for Windows, Mac OSX (10.4.x), and Linux (Kernel 2.6+) are supported.

WinARM - Comes bundled with GNU Toolchain and much more (such as Programmers Notepad and a HyperTerminal replacement located in ..WinARM\utils\bin\terminal.exe).

WinARM provides a version of the GNU ARM Toolchain. Although for this configuration to work some modification is necessary.

Binary Download / JTAG Debug Software

CrossWorks by Rowley. Supports both JTAG devices listed above and many more. Unfortunately, an Educational License currently costs $299. Evaluation license enables free use for 1 month

OpenOCD is a free alternative which is promising but currently does not work. OpenOCD Documentation is helpful].

Other Environment Notes

Virtual COM Port Notes