This is the tutorial for the installation and the setup of the AscTec SDK under Ubuntu. It was tested with Ubuntu 11.10 or 12.04. For earlier versions, you have to compile some packages by yourself (i.e. OpenOCD v0.5 is not included in older repositories).
Please download the AscTec SDK for Linux from the AscTec SDK Download wiki. If you want to go through the ACI Tutorial, please download version 2 of the AscTec SDK. The difference between Windows and Linux for AscTec SDK 2.0 are only the use of capital and small initial letters in the header files and a OpenOCD config file. In AscTec SDK 3.0, the Windows and Linux version is the same. After that, you need also OpenOCD in version 0.5 or greater. Since Ubuntu 11.10, version 0.5 is in the repository:
If you use a 64bit version of Ubuntu you also need to install:
You also need an arm-elf-gcc compiler. For its installation, please use the pre-compiled binaries with the installation script on the AscTec SDK Download wiki and run the install script as root. It will install some dependencies, which are needed and copy the binaries in /usr/local/. If you want to compile your own arm-elf-gcc, compile it with the interwork option enabled, otherwise you cannot compile the AscTec SDK code correctly.
Compiling and transfer the AscTec SDK
There is included a Makefile in the source code of the AscTe SDK. If you installed arm-elf-gcc correctly, open a terminal, switch to the AscTec SDK 2.0 directory and compile it with make. You should get an output like this:
Now, you can connect your computer to the AscTec AutoPilot via the AscTec JTAG Adapter to transfer the binary on it:
After that, check if the device is plugged in and recognized:
Now, connect to the device via OpenOCD with the command sudo openocd -f lpc2xxx_asctecusbjtag05.cfg:
If there are some warnings or errors, please restart the system and try again.
Then you have to open a telnet connection to OpenOCD:
With reset halt, you can stop the device. With flash write_image erase main.bin, you can write the compiled binary onto the device and reset run starts the device again.
Setup up the AscTec SDK in Eclipse
First of all, you have to import the AscTec SDK v2.0 in Eclipse. For that, go to File->Import... and choose in General the point Existing Projects into Workspace. Now select the folder of the SDK (i.e. ~/workspace/AutoPilot_HL_SDK_v2.0) and click on Finish.
If you are trying then to build this project, it may happen, that Eclipse doesn't find the compiler:
If that happens, right-click on the project in the Project Explorer and Properties. Go to the menu Enviroment in C/C++ Build and add a new variable with this config:
Now, the project should compile without any errors.
It is not necessary to use OpenOCD in Eclipse. You can also run OpenOCD in a terminal and than compile, run and debug your code in Eclipse.
Before you can use OpenOCD in Eclipse, you have to change the permission rights for your USB device. For that, please create a file in /etc/udev/rules.d/ and include following content:
If you now plug in your AscTec JTAG Adapter into the device, OpenOCD should work without root-rights.
The next step is to setup OpenOCD in Eclipse. For that, go to the menu Run->External Tools->External Tools Configurations and add a Program with the following settings:
- In Location: The location of OpenOCD
- In Working Directory: The path of the project
- In Arguments: -f lpc2xxx_asctecusbjtag05.cfg
- In Save as in the Tab Common should be the path of your project (and Shared File should be choosen).
- Furthermore choose External Tools and activate the point Launch in background
If everything is correct, you can now run OpenOCD in Eclipse and should get the following lines in the Eclipse terminal:
To start debugging your code through Eclipse, you have to install the Plugin Zylin for Eclipse. You can find an Instruction to install it on the following address: http://opensource.zylin.com/embeddedcdt.html
After installing it, go to the menu Run->Debug Configurations. In Zylin Embedded debug (Native), there is already a point called AutoPilot_HL_SDK_v2.0 WinARM. Click on it and configure it with the following settings:
- In the tab Main under C/C++ Application: main.elf
- In the tab Debugger under GDB debugger change arm-elf-gdb.exe to arm-elf-gdb. Also uncheck Stop on startup at.
In the tab Commands under 'Initialize' commands fill it with:
- In the tab Environment, create an new variable PATH and set its value to /usr/local/arm7/bin
- In the tab Common activate Debug and Shared file (with AutoPilot_HL_SDK_v2.0 as Parameter)
That's all. You can now debug your code in Eclipse.