安装java8
sudo apt-get install openjdk-8-jdk
如果安装失败: 运行sudo apt-get update --fix-missing后再次安装
sudo nano /etc/profile
最后面添加:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-armhf/
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:JAVA_HOME/lib/dt.jar:JAVA_HOME/lib/tools.jar
source /etc/profile
安装Maven, CMake
sudo apt install maven cmake g++ file
sudo unzip jssc-2.9.2.zip
cd jssc-2.9.2/
sudo nano /usr/include/asm-generic/termbits.h
termios改为termios1(驱动中引用sudo nano /usr/include/arm-linux-gnueabihf/bits/termios.h中termios,避免冲突)
sudo nano src/main/cpp/_nix_based/jssc.cpp
#include <sys/ioctl.h>后添加
#include <asm/ioctls.h>
#include <asm/termbits.h>
替换
#ifdef __SunOS
goto methodEnd;//Solaris don't support non standart baudrates
#elif defined __linux__
//Try to calculate a divisor for setting non standart baudrate
serial_struct *serial_info = new serial_struct();
if(ioctl(portHandle, TIOCGSERIAL, serial_info) < 0){ //Getting serial_info structure
delete serial_info;
goto methodEnd;
}
else {
serial_info->flags |= ASYNC_SPD_CUST;
serial_info->custom_divisor = (serial_info->baud_base/baudRate); //Calculate divisor
if(serial_info->custom_divisor == 0){ //If divisor == 0 go to method end to prevent "division by zero" error
delete serial_info;
goto methodEnd;
}
settings->c_cflag |= B38400;
if(cfsetispeed(settings, B38400) < 0 || cfsetospeed(settings, B38400) < 0){
delete serial_info;
goto methodEnd;
}
if(ioctl(portHandle, TIOCSSERIAL, serial_info) < 0){//Try to set new settings with non standart baudrate
delete serial_info;
goto methodEnd;
}
delete serial_info;
}
#endif
为:
struct termios2 t;
if (ioctl(portHandle, TCGETS2, &t)) {
goto methodEnd;
}
t.c_cflag &= ~CBAUD;
t.c_cflag |= BOTHER;
t.c_ospeed = t.c_ispeed = baudRate;
if (ioctl(portHandle, TCSETS2, &t)) {
goto methodEnd;
}
mvn