2.2. 命令详解

2.2.1. SCons

SCons 是跨平台的构建系统,因此在 Windows 和 Linux 上的用法相同,常用的命令有

2.2.1.1. 项目罗列

命令: scons –list-def: 罗列 SDK 中发布的项目名称

scons --list-def
scons: Reading SConscript files ...
Built-in configs:
0. ZX4D3_bootloader_defconfig     - Build for ZX4D3_bootloader
1. ZX4D3_rt-thread_defconfig      - Build for ZX4D3_rt-thread
2. ZX7D0_bootloader_defconfig     - Build for ZX7D0_bootloader
3. ZX7D0_rt-thread_defconfig      - Build for ZX7D0_rt-thread
4. ZXM37D0_bootloader_defconfig   - Build for ZXM37D0_bootloader
5. ZXM37D0_rt-thread_defconfig    - Build for ZXM37D0_rt-thread
6. ZXM3C3D95_bootloader_defconfig - Build for ZXM3C3D95_bootloader
7. ZXM3C3D95_rtt_defconfig        - Build for ZXM3C3D95_rtt
8. ZXM47D0N_bootloader_defconfig  - Build for ZXM47D0N_bootloader
9. ZXM47D0N_rt-thread_defconfig   - Build for ZXM47D0N_rt-thread

2.2.1.2. 使用项目

命令:scons –apply-def:设置使用某一个项目, 可以用项目名称,也可以用项目的索引

scons --apply-def=8
scons: Reading SConscript files ...
Load config from target\configs\ZXM47D0N_bootloader_defconfig

scons --apply-def=ZXM47D0N_bootloader_defconfig
scons: Reading SConscript files ...
Load config from target\configs\ZXM47D0N_bootloader_defconfig

2.2.1.3. 配置项目

命令:scons –menuconfig:ZX-RTT 使用 menuconfig 界面进行项目的配置工作

scons --menuconfig
../../_images/lbl-menuconfig.png

2.2.1.4. 构建项目

命令:scons:进行构建,默认是简洁模式,不会输出编译选项等信息, 调试时可以使用 scons –verbose 打印编译器选项等辅助信息

scons
scons: Reading SConscript files ...
>>> Extract toolchain Xuantie-900-gcc-elf-newlib-mingw ...

2.2.1.5. 清理项目

命令:scons –clean:清除上一次编译的临时文件。执行该命令后,下一次编译将能保证所有源文件都会被重新编译

scons --clean
scons -c

2.2.2. OneStep

OneStep 是为了简化 SDK 的使用而开发的一系列易用性命令

2.2.2.1. Windows

在 Windows 系统中,OneStep 自动集成到 win_cmd.bat 和 win_env.bat 批处理脚本中

2.2.2.2. Linux

在 Linux 系统中需要加入到当前路径中

source tools/onestep.sh

2.2.2.3. 命令列表

SDK OneStep commands:

h             : Get this help.
lunch [No.]   : Start with selected defconfig, .e.g. lunch 3
me            : Config SDK with menuconfig
m             : Build all and generate final image
c             : Clean all
croot/cr      : cd to SDK root directory.
cout/co       : cd to build output directory.
cbuild/cb     : cd to build root directory.
ctarget/ct    : cd to target board directory.
list          : List all SDK defconfig.
i             : Get current project's information.
buildall      : Build all the *defconfig in target/configs
rebuildall    : Clean and build all the *defconfig in target/configs