C Linux
Compiler and Builder
Compiler
- GNU gcc ver. 5.4.0 20160609 or higher
-
To check the version of your gcc compiler:
$ gcc -v
-
Download the required compiler:
$ sudo apt-get install gcc-5
Builder
- Build-essential pkg → make
-
Download:
$ sudo apt-get install build-essential
Dependent Packages
- Packages needed for cross-compiling
-
Download:
$ sudo apt-get install gcc-multilib g++-multilib
Build the Library
-
Choose which format (32bit or 64bit) do you want to build in.
The Makefile is located in the following folder:[DynamixelSDK folder]/c/build/linux32
OR[DynamixelSDK folder]/c/build/linux64
folder for 64-bit platforms OR[DynamixelSDK folder]/c/build/linux_sbc
folder for SBCs.
Please note that if you will be building the 32-bit example source, you should build the 32-bit library. -
Go to the Makefile’s directory located in
[DynamixelSDK folder]/c/build/linux32
OR[DynamixelSDK folder]/c/build/linux64
OR[DynamixelSDK folder]/c/build/linux_sbc
using $cd
. -
To build the library file:
$ make
-
If there is an error:
$ make clean && make
-
To delete the library file and object files:
$ make clean
Copy (Install) the Library to the Root Directory
-
To make library file and copy it to the root directory (to handle the serial port):
$ sudo make install
-
If there is an error:
$ sudo make uninstall && sudo make install
OR
$ sudo make reinstall
-
To delete the library file from the root directory:
$ sudo make uninstall
-
To recopy the library file to the root directory:
$ sudo make reinstall
-
You will see the built library file in
[DynamixelSDK folder]/c/build/[linuxXX]/libdxl_xYY_c.so
Building and Running the Sample Code
The DYNAMIXEL SDK example code for C uses a .so (Linux) library built in C.
By doing above, each released DYNAMIXEL SDK have latest library files in [DynamixelSDK folder]/c/build/[linuxXX]/libdxl_xYY_c.so
which were built by its own source code.
-
Go to the Makefile’s directory using
cd
:$ cd [DynamixelSDK folder]/c/example/protocol1.0/read_write/linux32
OR
$ cd [DynamixelSDK folder]/c/example/protocol1.0/read_write/linux64
-
Build the executable file:
$ make
-
If there is an error,
$ make clean
then$ make
again. -
To delete the executable file,
$ make clean
. -
Access the port you will be using to communicate with DYNAMIXEL:
$ sudo chmod a+rw /dev/ttyUSB0
-
Run the executable file:
$ ./read_write