Home page
http://www.lctech-inc.com/cpzx/LCPIxl/2021/1009/532.html
Assumed that Linux Ubuntu is installed
Example application for GPIO handling
Lcd
Touchscreen
TBD
-
First make sure to following packages are installed in system
sudo apt-get install gawk wget diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm emscripten libmpc-dev libgmp3-dev
Note: More informations can be found on Yocto reference manual.
-
Download necessary Yocto packaged listed below. Be sure to be in root of home folder.
mkdir yocto
cd yocto
mkdir build
git clone git://git.yoctoproject.org/poky --depth 1 -b kirkstone
cd poky
git clone git://git.openembedded.org/meta-openembedded --depth 1 -b kirkstone
git clone https://github.com/meta-qt5/meta-qt5.git --depth 1 -b kirkstone
git clone https://github.com/voloviq/meta-cherrypi-v3s --depth 1 -b kirkstone -
Select directory to build Linux
Nano version
source oe-init-build-env ~/yocto/build/cherrypi-v3s -
Modify bblayers.conf(located in ~/yocto/build/cherrypi-v3s/conf)
BBLAYERS ?= " \
${HOME}/yocto/poky/meta \
${HOME}/yocto/poky/meta-poky \
${HOME}/yocto/poky/meta-openembedded/meta-oe \
${HOME}/yocto/poky/meta-openembedded/meta-networking \
${HOME}/yocto/poky/meta-openembedded/meta-python \
${HOME}/yocto/poky/meta-openembedded/meta-multimedia \
${HOME}/yocto/poky/meta-qt5 \
${HOME}/yocto/poky/meta-cherrypi-v3s \
"Note: Please adapt PATH of conf/bblayers.conf if necessary.
-
Modify local.conf(located in ~/yocto/build/cherrypi-v3s/conf) file
-
modify line with "MACHINE ??" to add "cherrypi-v3s-sdcard" or for SPI NOR Flash "cherrypi-v3s-spinor"
-
align DL_DIR = "${HOME}/yocto/downloads"
-
align SSTATE_DIR = "${HOME}/yocto/sstate-cache"
-
align TMPDIR = "${HOME}/yocto/tmp"
-
add at the end following records
RM_OLD_IMAGE = "1"
INHERIT += "rm_work"
MACHINEOVERRIDES .= ":use-mailine-graphics"
LICENSE_FLAGS_ACCEPTED = "commercial" -
for spi flash change DISTRO ?= "poky" to DISTRO ?= "cherrypi-v3s-tiny"
Note: Please adapt rest of conf/local.conf parameters if necessary.
-
-
Build objects
-
When using SPI NOR Flash use following image
-
core image minimal
bitbake core-image-minimal -
console image
bitbake console-image -
qt5 image
bitbake qt5-image -
qt5 toolchain sdk
bitbake meta-toolchain-qt5
-
-
After compilation images appears in
Nano version
~/yocto/tmp/deploy/images/cherrypi-v3s -
Insert SD CARD into dedicated CARD slot and issue following command to write an image
Note:
Be 100% sure to provide a valid device name (of=/dev/sde/mmcblk0). Wrong name "/dev/sde/mmcblk0" dameage Your system file !
Nano version
sudo dd if=~/yocto/tmp/deploy/images/cherrypi-v3s-sdcard/core-image-minimal-cherrypi-v3s-sdcard.sunxi-sdimg of=/dev/mmcblk0 bs=1024 -
SPI NOR Flash update tool compilation(if valid sunxi-tools installed go to point 10)
git clone https://github.com/Icenowy/sunxi-tools.git -b v3s-spi
sudo apt-get install libz libusb-1.0-0-dev
make
sudo make install -
Flash SPI NOR flash
To enter into bootlader mode it is necessary to erase u-boot section from spi nor flash.
To do this it is necessary to stop booting U-Boot and enter following commands.
sf probe 0
sf erase 0 70000
sunxi-fel -p spiflash-write 0 ~/yocto/tmp/deploy/images/cherrypi-v3s-spinor/core-image-minimal-cherrypi-v3s-spinor.sunxi-spinor
To write only u-boot...spl just type
sudo sunxi-fel -v uboot u-boot-sunxi-with-spl.bin -
How to handle GPIO from userfs - example (used PE3 as GPIO)
- Take a GPIO for instance PE3
echo 131 > /sys/class/gpio/export - Set as out or in
echo "out" > /sys/class/gpio/gpio131/direction - Set GPIO state if configured as ouput
echo 1 > /sys/class/gpio/gpio131/value
echo 0 > /sys/class/gpio/gpio131/value
- Take a GPIO for instance PE3