Note: This tutorial assumes that you have completed the previous tutorials: ROS Tutorials. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
TivaWare Setup for catkin build
Description: This tutorial shows step-by-step how to setup up TI's Tivaware SDKTutorial Level: INTERMEDIATE
Next Tutorial: Hello world publisher for EK-TM4C123GXL
Contents
Introduction
Energia IDE is great for quick development of TivaC applications. However on bigger projects it can become cumbersome or unmanageable.
This tutorial assumes you already have set up a cross-compilation environment based on arm-none-eabi GNU toolchain and TivaWare libraries on Linux, and already are completly comfortable compiling and flashing your applications.
Compatible with SW-TM4C-2.1.1.71 onwards
Only the following boards are compatible with rosserial_tivac:
- EK-TM4C123GXL
- EK-TM4C1294XL
Setting up cross-compilation environment
Here are some quick steps to configure your toolchain if you haven't already. These instruction are not extensive by any means. You may run into problems, errors and incompatibilities.
Obtain your GNU toolchain for ARM Cortex-M & Cortex-R processors.
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa sudo apt-get update sudo apt-get install gcc-arm-embedded
Get the flashing tool
Build and install
git clone https://github.com/utzig/lm4tools.git cd lm4tools/lm4flash make sudo cp lm4flash /usr/local/bin
Add rules for USB devices
If you haven't already done so, you have to add device rules.
echo 'ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", GROUP="users", MODE="0660"' | \ sudo tee /etc/udev/rules.d/99-stellaris-launchpad.rules
Download and extract TivaWare
Download SW-TM4C: TivaWare for C Series Software (Complete) from TI's website.
Extract it to directory of your choosing. Example:
mkdir <TivaWarePah> cd <TivaWarePah> mv <directory_downloaded>/SW-TM4C-2.1.1.71.exe unzip SW-TM4C-2.1.1.71.exe rm SW-TM4C-2.1.1.71.exe
Test cross-compilation and flashing
Navigate into one of the example projects and build a test project.
cd <path_to_tivaware>/examples/boards/ek-tm4c123gxl/blinky make lm4flash gcc/blinky.bin
If no error occurred so far, you can continue the guide.
Set up environment variables
rosserial_tivac uses two environment variables to find Tivaware path and the flash tool.
In your .bashrc set the variables:
export TIVA_WARE_PATH=$HOME/<path_to_tivaware_root> export TIVA_FLASH_EXECUTABLE=lm4flash
And run:
source .bashrc
Install rosserial_tivac
You can install rosserial_tivac from source, either using the remaining rosserial pacakges from debs or from source.
Follow one of the two options:
- rosserial_tivac from binaries
- rosserial_tivac from source + rosserial binaries
rosserial and rosserial_tivac from ROS repositories
Example of how to install rosserial packages in binary form for Jade.
sudo apt-get install ros-jade-rosserial ros-jade-rosserial-msgs ros-jade-rosserial-client ros-jade-rosserial-python ros-jade-rosserial-tivac
rosserial_tivac from source + rosserial binaries
rosserial_tivac can be found on the repository: https://github.com/vmatos/rosserial_tivac
Make sure you have rosserial package installed, either from binaries or source.
Installing rosserial binaries
Example of how to install rosserial packages in binary form for Jade.
sudo apt-get install ros-jade-rosserial ros-jade-rosserial-msgs ros-jade-rosserial-client ros-jade-rosserial-python
Download and build rosserial_tivac
Navigate to your ROS workspace. Clone the git repository. Then build and install the package.
cd <workspace_dir>/src git clone https://github.com/vmatos/rosserial_tivac.git cd <workspace_dir> catkin_make catkin_make install
Next tutorials
If you've reach this point without encountering any error, you can now proceed to get hold of the rosserial_tivac_tutorials package.
Install from source rosserial_tivac_tutorials
Build the package.
cd <workspace_dir>/src git clone https://github.com/vmatos/rosserial_tivac_tutorials.git cd <workspace_dir> catkin_make rosserial_tivac_tutorials_generate_messages source devel/setup.bash catkin_make
Carry on with the remaining tutorials: Hello world publisher.
Addendum: Tivaware USB library bug
At time of writing, Tivaware contains a known bug on its USB libraries. The author of this guide is not aware to what extent the bug affects the communication abilities with ROS.
On the file which implements the USB ring buffer: usblib/usbbuffer.c, one reads:
USBBufferInfoGet(const tUSBBuffer *psBuffer, tUSBRingBufObject *psRingBuf) (...) psRingBuf->ui32Size = psBufVars->sRingBuf.ui32ReadIndex;
And should be:
psRingBuf->ui32Size = psBufVars->sRingBuf.ui32Size;