This tutorial will be based on the M5Stack Linux application development framework programming control of peripheral hardware on the CoreMP135.
1.Visit
https://www.python.org/
, install
python3
, and during the installation process , check the Add Path
option to add it to the environment variable.
2.Open the command line, enter the following instructions, and install the compilation and build tools and related dependencies through the pip management tool
pip install parse windows-curses scons pexpect paramiko scp
3.Get access to
M5Stack_Linux_Libs Github
to obtain the development framework and case source code, which can be obtained by downloading the zip package or through git clone
.
git clone https://github.com/m5stack/M5Stack_Linux_Libs
4.Click the link below to download the gcc-linaro-7.5.0-2019.12-i686-mingw32_arm-linux-gnueabihf
cross-compilation tool chain for the Windows platform, save it to a custom working directory, and unzip it. (Note: Special characters are not allowed in the path)
1.Execute the following instructions to install related dependencies
sudo apt install make cmake pexpect
pip install parse windows-curses scons pexpect paramiko scp
2.Get access to
M5Stack_Linux_Libs Github
to obtain the development framework and case source code, which can be obtained by downloading the zip package or through git clone
.
git clone https://github.com/m5stack/M5Stack_Linux_Libs
3.Click the link below to download the gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf
cross-compilation tool chain for the Linux platform, save it to a custom working directory, and unzip it. (Note: Special characters are not allowed in the path)
scons menuconfig
command for compilation and configuration. (Note: For Windows users, if the cmd terminal opens the configuration interface and cannot move the cursor normally, please use powershell to access)cd M5Stack_Linux_Libs/examples/lcd_hello_world
scons menuconfig
2.Press Enter to enter Toolchain Configuration
3.Press Enter to open the configuration, fill in the absolute path of the cross-compilation tool chain and the prefix of the tool chain, and press Esc to exit saving.
4.Under the current case project, enter the following instructions to compile. After the compilation is completed, the executable file will be output to the dist directory of the current path.
scons -j4
ifconfig
command to obtain the IP address of the current device.115200bps
. The following operations are based on putty. Please click the link below to download the putty installation package and follow the instructions to log in.root
, and the password is root
.useradd
command to create a new user. The configuration file setup.ini
used to push program configuration should also be entered based on actual user information.ssh root@192.168.2.212
3.The setup.ini
configuration file in the case project directory can be used to configure the IP address of the remote push device and the push directory, and modify it to the IP address and user information of the actual device.
[ssh]
local_file_path = dist
remote_file_path = /root
remote_host = 192.168.2.212
remote_port = 22
username = root
password = root
ifconfig
4.And execute the following scons push
command to push.
scons push
#log
#scons: Reading SConscript files ...
#...
#push dist\lcd_hello_world /root/lcd_hello_world success!
3.Go back to the command line terminal of CoreMP135, enter the directory where we just pushed the program, find the executable file sent, give the file execution permission, and then run it.
chmod +x lcd_hello_world
./lcd_hello_world
4.Since this case calls the screen driver, if you are using the default factory firmware of CoreMP135, you need to manually close the GUI process to prevent conflicts.
ps | grep "start_ui"
#239 root /usr/local/m5stack/dist/core135_start_ui
#312 root grep start_ui
kill 239
Edit the /etc/rc.local
startup script file and add the startup instructions of our compiled program at the end of the file.
vi /etc/rc.local
sleep 2
/root/lcd_hello_world &