2022-12-09 23:22:35 +08:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
2022-12-09 23:38:24 +08:00
|
|
|
|
export MYDIR=$PWD
|
2022-12-09 23:22:35 +08:00
|
|
|
|
export APP=mkrtos
|
2022-12-14 23:10:49 +08:00
|
|
|
|
export CMAKE_SIZE=$MYDIR/toolchains/gcc-arm-none-eabi-4_9-2014q4/bin/arm-none-eabi-size
|
|
|
|
|
|
export CMAKE_OBJCOPY=$MYDIR/toolchains/gcc-arm-none-eabi-4_9-2014q4/bin/arm-none-eabi-objcopy
|
2022-12-09 23:22:35 +08:00
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
sudo rm -f build/bin/*
|
|
|
|
|
|
cmake -G Ninja -DBOARD=stm32f205rft6 -B build/$APP .
|
|
|
|
|
|
cd build/$APP && ninja
|
|
|
|
|
|
|
|
|
|
|
|
cd ../..
|
|
|
|
|
|
# sudo mkdir build/bin
|
|
|
|
|
|
$CMAKE_SIZE build/mkrtos/mkrtos_bootstrap/mkrtos_bootstrap.elf
|
|
|
|
|
|
${CMAKE_OBJCOPY} -O binary build/mkrtos/mkrtos_bootstrap/mkrtos_bootstrap.elf build/mkrtos/mkrtos_bootstrap/mkrtos_bootstrap.bin
|
|
|
|
|
|
sudo cp build/mkrtos/mkrtos_bootstrap/mkrtos_bootstrap.bin build/bin/
|
|
|
|
|
|
|
|
|
|
|
|
export SHELL_NAME=mkrtos_shell
|
|
|
|
|
|
$CMAKE_SIZE build/mkrtos/$SHELL_NAME/$SHELL_NAME.elf
|
|
|
|
|
|
$CMAKE_OBJCOPY -O binary build/mkrtos/$SHELL_NAME/$SHELL_NAME.elf build/mkrtos/$SHELL_NAME/zh
|
|
|
|
|
|
sudo cp build/mkrtos/$SHELL_NAME/zh build/bin/
|
|
|
|
|
|
|
|
|
|
|
|
export LS_NAME=mkrtos_ls
|
|
|
|
|
|
$CMAKE_SIZE build/mkrtos/$LS_NAME/$LS_NAME.elf
|
|
|
|
|
|
$CMAKE_OBJCOPY -O binary build/mkrtos/$LS_NAME/$LS_NAME.elf build/mkrtos/$LS_NAME/ls
|
|
|
|
|
|
sudo cp build/mkrtos/$LS_NAME/ls build/bin/
|
|
|
|
|
|
|
|
|
|
|
|
export LS_NAME=mkrtos_ym
|
|
|
|
|
|
$CMAKE_SIZE build/mkrtos/$LS_NAME/$LS_NAME.elf
|
|
|
|
|
|
$CMAKE_OBJCOPY -O binary build/mkrtos/$LS_NAME/$LS_NAME.elf build/mkrtos/$LS_NAME/ym
|
|
|
|
|
|
sudo cp build/mkrtos/$LS_NAME/ym build/bin/
|
|
|
|
|
|
|
|
|
|
|
|
export TEST_NAME=mkrtos_test
|
|
|
|
|
|
$CMAKE_SIZE build/mkrtos/$TEST_NAME/$TEST_NAME.elf
|
|
|
|
|
|
$CMAKE_OBJCOPY -O binary build/mkrtos/$TEST_NAME/$TEST_NAME.elf build/mkrtos/$TEST_NAME/test
|
|
|
|
|
|
sudo cp build/mkrtos/$TEST_NAME/test build/bin/
|
|
|
|
|
|
|
2022-12-15 18:17:50 +08:00
|
|
|
|
export REBOOT_NAME=reboot
|
|
|
|
|
|
$CMAKE_SIZE build/mkrtos/mkrtos_$REBOOT_NAME/mkrtos_$REBOOT_NAME.elf
|
|
|
|
|
|
$CMAKE_OBJCOPY -O binary build/mkrtos/mkrtos_$REBOOT_NAME/mkrtos_$REBOOT_NAME.elf build/mkrtos/mkrtos_$REBOOT_NAME/$REBOOT_NAME
|
|
|
|
|
|
sudo cp build/mkrtos/mkrtos_$REBOOT_NAME/$REBOOT_NAME build/bin/
|
|
|
|
|
|
|
2022-12-09 23:22:35 +08:00
|
|
|
|
$CMAKE_SIZE build/mkrtos/mkrtos_real/mkrtos_real.elf
|
|
|
|
|
|
$CMAKE_OBJCOPY -O binary build/mkrtos/mkrtos_real/mkrtos_real.elf build/mkrtos/mkrtos_real/kernel.bin
|
|
|
|
|
|
sudo cp build/mkrtos/mkrtos_real/kernel.bin build/bin
|
|
|
|
|
|
|
|
|
|
|
|
cd build/bin
|
|
|
|
|
|
# cpio的文件名长度必须要是n*4+2,文件的长度必须是4的整数倍
|
2022-12-15 18:17:50 +08:00
|
|
|
|
ls zh ls ym test reboot | cpio -H newc -o > rootfs.cpio
|
2022-12-09 23:22:35 +08:00
|
|
|
|
srec_cat -output kernel.img -binary \
|
|
|
|
|
|
mkrtos_bootstrap.bin -binary\
|
|
|
|
|
|
kernel.bin -binary -offset 0x00004000\
|
|
|
|
|
|
rootfs.cpio -binary -offset 0x00040000
|
|
|
|
|
|
|
|
|
|
|
|
# sudo srec_cat -output kernel.img -binary build/bin/mkrtos_bootstrap.bin -binary build/bin/kernel.bin -binary -offset 0x00004000 rootfs.cpio -binary -offset 0x00040000
|
|
|
|
|
|
#sudo srec_cat -output "mm.bin" -binary kernel.bin -binary mkrtos_shell.bin -binary -offset 0x00040000
|
|
|
|
|
|
|