2.3. 命令详解

2.3.1. SCons

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

2.3.1.1. 项目罗列

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

scons --list-def
scons: Reading SConscript files ...
Built-in configs:
0. d21x_demo100-nand_baremetal_bootloader_defconfig - Build for d21x_demo100-nand_baremetal_bootloader
1. d21x_demo100-nand_baremetal_helloworld_defconfig - Build for d21x_demo100-nand_baremetal_helloworld
2. d21x_demo100-nand_rt-thread_helloworld_defconfig - Build for d21x_demo100-nand_rt-thread_helloworld
3. d21x_demo100-nor_baremetal_bootloader_defconfig  - Build for d21x_demo100-nor_baremetal_bootloader
4. d21x_demo100-nor_rt-thread_helloworld_defconfig  - Build for d21x_demo100-nor_rt-thread_helloworld
5. d21x_demo88-nand_baremetal_bootloader_defconfig  - Build for d21x_demo88-nand_baremetal_bootloader
6. d21x_demo88-nand_rt-thread_helloworld_defconfig  - Build for d21x_demo88-nand_rt-thread_helloworld
7. d21x_demo88-nor_baremetal_bootloader_defconfig   - Build for d21x_demo88-nor_baremetal_bootloader
8. d21x_demo88-nor_rt-thread_helloworld_defconfig   - Build for d21x_demo88-nor_rt-thread_helloworld
9. d21x_per2-nand_baremetal_bootloader_defconfig    - Build for d21x_per2-nand_baremetal_bootloader
10. d21x_per2-nand_baremetal_helloworld_defconfig   - Build for d21x_per2-nand_baremetal_helloworld
11. d21x_per2-nand_rt-thread_helloworld_defconfig   - Build for d21x_per2-nand_rt-thread_helloworld
12. d21x_per2-nor_baremetal_bootloader_defconfig    - Build for d21x_per2-nor_baremetal_bootloader
13. d21x_per2-nor_rt-thread_helloworld_defconfig    - Build for d21x_per2-nor_rt-thread_helloworld

2.3.1.2. 使用项目

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

scons --apply-def=2
scons: Reading SConscript files ...
Load config from target\configs\d21x_demo100-nand_rt-thread_helloworld_defconfig

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

2.3.1.3. 配置项目

命令 scons --menuconfig Luban-Lite 使用 menuconfig 界面进行项目的配置工作

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

2.3.1.4. 构建项目

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

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

2.3.1.5. 清理项目

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

scons --clean
scons -c

2.3.2. OneStep

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

2.3.2.1. Windows

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

2.3.2.2. Linux

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

source tools/onestep.sh

2.3.2.3. 命令列表

Luban-Lite SDK OneStep commands:
  hmm|h                     : Get this help.
  lunch          [keyword]  : Start with selected defconfig.e.g. lunch mmc
  menuconfig|me             : Config SDK with menuconfig
  m                         : Build all and generate final image
  mc                        : Clean & Build all and generate final image
  mb                        : Build bootloader & app 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.
  godir|gd       [keyword]  : Go/jump to selected 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
  addboard|ab               : Add new board *defconfig in target/configs
  aicupg                    : Burn image file to target board