Boost ipv43_0 compiled in arm-Linux

Source: Internet
Author: User

Download
1 boost_000043_0.tar.gz
2 tar-zxvf boost_000043_0.tar.gz
3. Set Environment Variables

Export Path = $ path:/opt/timesys/toolchains/armv5l-linux/bin/

3. Enter the directory to execute./Bootstrap. Sh, and then form the bjam file and project-config.jam
4. Edit the project-config.jam and modify only the using gcc line. Because I am using ARM-Linux-GCC, just change it to the following:
Using GCC: arm51v-linux-gcc;
5. Execute./bjam stage and compile ASIO
./Bjam -- With-System -- With-thread -- with-date_time -- With-RegEx -- With-serialization stage
6. The static and dynamic library files are stored in the stage directory.
If all the compilation is as follows:
-Chrono: Building
-Date_time: Building
-Exception: building
-Filesystem: building
-Graph: building
-Graph_parallel: building
-Iostreams: building
-Locale: building
-Math: building
-Mpi: building
-Program_options: building
-Python: not building
-Random: building
-Regex: building
-Serialization: Building
-Signals: Building
-System: Building
-Test: Building
-Thread: Building
-Timer: Building
-Wave: building

7 usage:
Vi boost_test.cpp: Enter the serial port code
Compile:
Arm-linux-g ++-g boost_test.cpp-I/home/neo/tools/boost-1.4-L/home/neo/tools/boost-1.4/stage/lib /- lboost_system-lboost_thread-lboost_chrono-lboost_wserialization-lpthread
/Home/neo/tools/boost-1.4

Run the command on PC Linux: arm-linux-readelf-a "your binary" | grep "Shared"

0x00000001 (NEEDED) Shared library: [libstdc ++. so.6]
0x00000001 (NEEDED) Shared library: [libm. so.6]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc. so.6]

# Include <stdio. h>
# Include <boost/asio. hpp>
# Include <boost/bind. hpp>

Using namespace boost: asio;

Int main ()
{
Io_service iosev;
// Serial port COM1, "/dev/ttyS0" in Linux"
Serial_port sp (iosev, "/dev/ttyS4 ");
// Set parameters
Sp. set_option (serial_port: baud_rate (9600 ));
Sp. set_option (serial_port: flow_control: None ));
Sp. set_option (serial_port: parity: None ));
Sp. set_option (serial_port: stop_bits: One ));
Sp. set_option (serial_port: character_size (8 ));
// Write data to the serial port
// 0C 02 00 20 00 08 79 1b
// 0C, 02,00, 20,00, 08,79, 1B
Unsigned char msg [] = {0x0c, 0 x, 0x20, 0 x, 0 x, 0x79, 0x1B };
Write (sp, buffer (msg, 8 ));
// Read data from the serial port
Printf ("begin recv data \ n ");
Unsigned char buf [2];
Read (sp, buffer (buf ));
Int I = 0;
// Printf ("recv data: % s \ n", buf );
For (I = 0; I <2; I ++ ){
Printf ("recv data: % d \ n", buf [I]);
}
Iosev. run ();
Return 0;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.