11.1. 总览¶
Luban-Lite SDK 包含多种板卡的项目配置,但用户在使用和二次开发中,经常需要添加自己的项目配置。 本章节介绍如何在 Luban-Lite 下,添加新的项目配置,并 bringup 新板卡。
11.1.1. 准备工作¶
11.1.1.1. Git 仓库¶
务必使用一个版本管理工具对代码进行管理,如果没有 Git 服务器, 也强烈建议建一个本地仓库进行跟踪:
可以方便跟踪修改的历史记录,籍此进行信息记录
可以很方便的进行修改的回退,防止调试代码影响开发工作
如果是使用 git clone 获取的代码,则 git 仓库本身是存在的
如果是直接下载的代码,则可以手工建一下本地 git 仓库
git init # 创建本地仓库
git add * # 添加所有代码到本地仓库暂存区
git commit -m "init" # 将暂存区的代码提交到本地参考
11.1.2. 新板卡信息¶
拿到一块新的板卡,首先要通过原理图,确认板卡的以下基本信息:
CPU
存储介质
调试串口
11.1.2.2. 存储介质¶
确认系统运行的存储介质
- 类型
主要分为 NOR Flash、 NAND Flash、eMMC、eNAND等
- 是否支持
可在 Luban-Lite SDK 支持列表中查询到是否支持新板卡的型号
- 空间大小
添加项目阶段较少关注,主要用于后期配置分区表
11.1.3. 添加板卡配置¶
11.1.3.1. 添加项目¶
根据“新板卡信息”,使用与 SDK 已包含的最接近的项目进行添加。
例如:一块新板卡基本信息: D133CBV(D133 88pin)、XXXbond NAND Flash、UART1 。
执行 scons --add-board
$ scons --add-board
scons: Reading SConscript files ...
Chip list:
0: xxxxx
1: d12x
2: d13x
3: d21x
Select chip for new board(number):2
d13x
Reference defconfig:(Create new board base on selected defconfig):
0: d13x_demo88-nand_rt-thread_helloworld_defconfig
1: d13x_demo88-nor-xip_rt-thread_helloworld_defconfig
2: d13x_demo88-nor_baremetal_helloworld_defconfig
3: d13x_demo88-nor_rt-thread_helloworld_defconfig
4: d13x_per1-nand_baremetal_helloworld_defconfig
5: d13x_per1-nand_rt-thread_helloworld_defconfig
6: d13x_per1-nor_baremetal_helloworld_defconfig
7: d13x_per1-nor_rt-thread_helloworld_defconfig
Select reference defconfig for new board(number):0
d13x_demo88-nand_rt-thread_helloworld_defconfig
Input new board's name:test
test
Input new app's name: (default helloworld)test
test
Input manufacturer's name:test
test
Copy /home/xxxxx/luban-lite/target/configs/d13x_demo88-nand_rt-thread_helloworld_defconfig to /home/xxxxxx/luban-lite/target/configs/d13x_test_rt-thread_test_defconfig
Copy /home/xxxxx/luban-lite/target/configs/d13x_demo88-nand_baremetal_bootloader_defconfig to /home/xxxxxx/luban-lite/target/configs/d13x_test_baremetal_bootloader_defconfig
Copy /home/xxxxx/luban-lite/target/d13x/demo88-nand to /home/xxxxxx/luban-lite/target/d13x/test
Add board test for test succeed!
11.1.3.2. 修改配置¶
11.1.3.2.1. BootLoader¶
$ lunch d13x_test_baremetal_bootloader_defconfig # 选择新建项目的 BootLoader 配置
$ scons --menuconfig # 进入配置页面
修改串口配置如下:
Board options --->
[*] Using Uart1 # 改为 Uart1
Bootloader options --->
Console --->
(1) Console UART ID # 改为 Uart1
修改 NandFlash 配置如下:
Drivers options --->
Peripheral --->
-*- SPINAND Driver library
[*] Support XXXbond SPI NAND
11.1.3.2.2. RT-Thread¶
$ lunch d13x_test_rt-thread_test_defconfig # 选择新建项目的 RT-Thread 配置
$ scons --menuconfig # 进入配置页面
修改串口配置如下:
Board options --->
[*] Using Uart1 # 改为 Uart1
Rt-Thread options --->
RT-Thread Kernel --->
Kernel Device Object --->
(uart1) the device name for console # 改为 Uart1
修改 NandFlash 配置如下:
Drivers options --->
Peripheral --->
-*- SPINAND Driver library
[*] Support XXXbond SPI NAND
修改完以上配置,保存、编译、烧录之后,新板卡的最小系统即可正常工作。
注意
更改接口配置时,请确保 pinmux 没有冲突,否则可能会引起未知错误。