# ------------------------------------------------------------# 【注 意】# # 以下代码需要在实验室电脑运行。# # 如果你希望在自己的电脑上运行,需要拷贝实验室虚拟机中# 的下列内容:# # qeum及linux ARM镜像:/home/book/ubuntu-18.04_imx6ul_qemu_system/# 案例程序及驱动:/home/book/nfs_rootfs# 编译工具链:/home/book/100ask_imx6ull-qemu/ToolChain/# # -------------------------------------------------------------
1. Set up the embedded software cross-compilation tool
# =================1. Set up the embedded software cross-compilation tool=================# The programs in the lab except for question 4 have been compiled, you can skip this step. If you need to compile, the compilation steps will be explained separately later.# export ARCH=arm# export CROSS_COMPILE=arm-linux-gnueabihf-# export PATH=$PATH:/home/book/100ask_imx6ull-qemu/ToolChain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin
Led Device Driver and Application
# ===================2-1. Compile the Led driver program========================# The programs in the lab have been compiled, you can skip this step.# cd /home/book/nfs_rootfs/led_driver_qemu/# make all# =============2-2. Enter the QEMU virtual machine, mount the host NFS directory===============cd /home/book/ubuntu-18.04_imx6ul_qemu_system/./qemu-imx6ull-gui.sh# After the following content is loaded, first enter the user root and press enter, then continue to execute:mount -t nfs -o nolock,vers=3 10.0.2.2:/home/book/nfs_rootfs /mnt# ================2-3. LED device driver loading and application=====================# The following commands are executed in the above window.# The contents already compiled in QEMU can be used without the mapped files.# cd /mnt/led_driver_qemu/cd /root/insmod ./100ask_led.ko# cd ./led_driver_qemu/./ledtest /dev/100ask_led0 off./ledtest /dev/100ask_led0 on
Button Device Driver and Application
# ================3. Button device driver loading and application=====================# The following commands are executed in the above window.# If the previous question has been executed, there is no need to repeat it.# cd ./led_driver_qemu/# insmod ./100ask_led.ko# cd /root/button_driver_qemu/# insmod ./button_drv.koinsmod board_100ask_qemu_imx6ull.ko./button_led_test# Here you need to click buttons in the window menu to open the button virtual interface. To exit, simply press Ctrl+C on the console.
Framerbuffer Based BMP Bitmap Display
# =====================4-1. BMP Bitmap Display========================# The lab has compiled it, no need to compile again. Just run it.# cd /home/book/nfs_rootfs/# arm-linux-gnueabihf-gcc ./bmp_show.c -o ./bmp_show# cd /mnt/lcd/./bmp_show ./image.bmp# =====================4-2. LCD Drawing Lines=============================# Open another terminal to execute the following commands, do not close the original one as it will be used later.export PATH=$PATH:/home/book/100ask_imx6ull-qemu/ToolChain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bincd /home/book/nfs_rootfs/lcd/arm-linux-gnueabihf-gcc ./lcd_test.c -o ./lcd_test# The following commands are executed in the original window.cd /mnt/lcd/./lcd_test
Framerbuffer Based Character Display
# =====================5-1. ASCII Character Display========================# The lab has compiled it, no need to compile again. Just run it.# cd /home/book/nfs_rootfs/# arm-linux-gnueabihf-gcc ./show_ascii.c -o ./show_ascii# cd /mnt/show_ascii/./show_ascii# =====================5-2. Chinese Character Display========================# The lab has compiled it, no need to compile again. Just run it.# cd /home/book/nfs_rootfs/# arm-linux-gnueabihf-gcc ./show_font.c -o ./show_font# Note that the program provided by the lab computer must be used here, the one in QEMU will not display Chinese.# cd /mnt/show_font/./show_font# Execute the following command to exit (you can also close the window, the command below is for shutdown)shutdown -h now