Skip to content

Instantly share code, notes, and snippets.

@sooorajjj
Last active December 31, 2022 23:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sooorajjj/fe2e2c999bdebe3b8fafc8d38421efcb to your computer and use it in GitHub Desktop.
Save sooorajjj/fe2e2c999bdebe3b8fafc8d38421efcb to your computer and use it in GitHub Desktop.
Stinger96
#STM32MP1
source /home/ssd/STM/STM32MP1/Developer-Package/SDK/environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi
set | grep CROSS
# CROSS_COMPILE=arm-openstlinux_weston-linux-gnueabi-
############################### Build kernel #################################
cd /home/ssd/STM/STM32MP1/Developer-Package/stm32mp1-openstlinux-4.19-thud-mp1-19-10-09/sources/arm-openstlinux_weston-linux-gnueabi/linux-stm32mp-4.19-r0/linux/
# Configure
make ARCH=arm O="$PWD/../build" multi_v7_defconfig fragment*.config
for f in `ls -1 ../fragment*.config`; do scripts/kconfig/merge_config.sh -m -r -O $PWD/../build $PWD/../build/.config $f; done
yes '' | make ARCH=arm oldconfig O="$PWD/../build"/
make ARCH=arm multi_v7_defconfig fragment*.config
for f in `ls -1 ../fragment*.config`; do scripts/kconfig/merge_config.sh -m -r .config $f; done
yes '' | make ARCH=arm oldconfig
# Build
make -j8 ARCH=arm uImage vmlinux dtbs LOADADDR=0xC2000040 O="$PWD/../build"
make -j8 ARCH=arm modules O="$PWD/../build"
make -j8 ARCH=arm INSTALL_MOD_PATH="$PWD/../build/install_artifact" modules_install O="$PWD/../build"
mkdir -p $PWD/../build/install_artifact/boot/
cp $PWD/../build/arch/arm/boot/uImage $PWD/../build/install_artifact/boot/
cp $PWD/../build/arch/arm/boot/dts/st*.dtb $PWD/../build/install_artifact/boot/
############################################ Build U-Boot ################################################
cd /home/ssd/STM/STM32MP1/Developer-Package/stm32mp1-openstlinux-4.19-thud-mp1-19-10-09/sources/arm-openstlinux_weston-linux-gnueabi/u-boot-stm32mp-2018.11-r0/u-boot/
# For Building
make -j8 stm32mp15_basic_defconfig
make -j8 DEVICE_TREE=stm32mp157c-dk2 all
#Note: DEVICE_TREE flag must be set to switch to correct board configuration.
# For flashing
subl3 board/st/stm32mp1/README
############################################ Build ARM Trusted Firmware ########################################
cd /home/ssd/STM/STM32MP1/Developer-Package/stm32mp1-openstlinux-4.19-thud-mp1-19-10-09/sources/arm-openstlinux_weston-linux-gnueabi/tf-a-stm32mp-2.0-r0/arm-trusted-firmware/
make -f $PWD/../Makefile.sdk all
make -f $PWD/../Makefile.sdk TFA_DEVICETREE=stm32mp157c-dk2 TF_A_CONFIG=trusted ELF_DEBUG_ENABLE='1' all
#Note: TFA_DEVICETREE flag must be set to switch to correct board configuration.
############################################ Build Trusted Execution Environment (TEE) ##########################################
cd /home/ssd/STM/STM32MP1/Developer-Package/stm32mp1-openstlinux-4.19-thud-mp1-19-10-09/sources/arm-openstlinux_weston-linux-gnueabi/optee-os-stm32mp-3.3.0-r0/optee_os/
make -f $PWD/../Makefile.sdk
make -f $PWD/../Makefile.sdk CFG_SECURE_DT=stm32mp157c-dk2
https://paste.ubuntu.com/p/mbFYB8R2CP/
################################################################################################################################
# Distribution package
# TODO:
# fix Boot Scheme - basic for now
DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh
bitbake st-image-weston
# dump sdcard
sudo fdisk -l /dev/mmcblk0
sudo dd if=/dev/mmcblk0 of=iotbox_sdcard.img bs=512 count=3145728
sudo dd if=/dev/mmcblk0 of=iotbox_sdcard.img bs=512 count=2252800
fdisk -l sdcard.img
# Erase sdcard
sudo dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=16
# Flash image back to sdcard
sudo dd bs=1M if=iotbox_sdcard.img of=/dev/mmcblk0
#check mounted sdcard partitions
mount | grep mmcblk0*
###i2c2####
echo 11 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio11/direction
echo 1 > /sys/class/gpio/gpio11/value
echo 12 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio12/direction
echo 0 > /sys/class/gpio/gpio12/value
##### UBOOT i2c ####
# Select the i2c bus
i2c dev <bus>
i2c dev 0
# Probe the device
i2c probe <chip>
i2c probe 0x60
# Read and Display from the device
i2c md <chip> <chip address> <length>
i2c md 0x60 0x27 1
#### CROSS_COMPILE ####
/home/ssd/STM/Stinger96/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/x86_64-openstlinux_weston_sdk-linux/usr/bin/arm-openstlinux_weston-linux-gnueabi/arm-openstlinux_weston-linux-gnueabi-gcc -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/ssd/STM/Stinger96/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi spi-led_duty_off.c -o spi-led_duty_off
cd /usr/shiratech/SPI/
./spi-led_duty25 -CHOv -D /dev/spidev5.0
export AR=/home/ssd/STM/Stinger96/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/x86_64-openstlinux_weston_sdk-linux/usr/bin/arm-openstlinux_weston-linux-gnueabi/arm-openstlinux_weston-linux-gnueabi-ar
export CC=/home/ssd/STM/Stinger96/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/x86_64-openstlinux_weston_sdk-linux/usr/bin/arm-openstlinux_weston-linux-gnueabi/arm-openstlinux_weston-linux-gnueabi-gcc
export CXX=/home/ssd/STM/Stinger96/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/x86_64-openstlinux_weston_sdk-linux/usr/bin/arm-openstlinux_weston-linux-gnueabi/arm-openstlinux_weston-linux-gnueabi-g++
export LINK=/home/ssd/STM/Stinger96/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/x86_64-openstlinux_weston_sdk-linux/usr/bin/arm-openstlinux_weston-linux-gnueabi/arm-openstlinux_weston-linux-gnueabi-g++
./configure --prefix=../install --dest-cpu=arm --cross-compiling --dest-os=linux --with-arm-float-abi=hard --with-arm-fpu=neon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment