dev create new project - XradioTech/xradiotech-wiki GitHub Wiki
中文 | EN
主页 | 产品 | 下载 | 开发指南 | FAQ | 联系我们 | 购买样品
开发指南 > 创建新工程
目录
创建工程目录
- 给工程起个名字,建议和项目相关,比如MD01(模块工程),storyteller-S1(故事机工程), 随意的名字不推荐,比如demoxxx,wlandemo1(直接拷贝wlandemo),或者audio2这样不具备标识性的名字
- 参考wlan_demo工程创建工程目录,这里假设工程名为‘prj-example’
(in Cygwin terminal or Ubuntu terminal)
#cd your-SDK-path/XR871/03_SDK/xr871sdk/
#cp -rf project/wlan_demo project/prj-example
- 修改project/prj-example/gcc/Makefile中定义的工程名
(in project/prj-example/gcc/Makefile)
17 # ----------------------------------------------------------------------------
18 # project and objects
19 # ----------------------------------------------------------------------------
20 PROJECT := prj-example
创建板级配置文件
- 修改project/prj-example/gcc/localconfig.mk中定义的板级命名
(in project/prj-example/gcc/localconfig.mk)
5 # ----------------------------------------------------------------------------
6 # board definition
7 # ----------------------------------------------------------------------------
8 __PRJ_CONFIG_BOARD := xr871_xxx
- 在project/common/board/下创建板级目录xr871-xxx
- 创建板级配置project/common/board/xr871-xxx/board_config.c
- 修改board_config.c中的GPIO映射信息, 注意不要重复定义
37 static const GPIO_PinMuxParam g_pinmux_uart0[] = {
38 { GPIO_PORT_B, GPIO_PIN_0, { GPIOB_P0_F2_UART0_TX, GPIO_DRIVING_LEVEL_1, GPIO_PULL_UP } }, /* TX */
39 { GPIO_PORT_B, GPIO_PIN_1, { GPIOB_P1_F2_UART0_RX, GPIO_DRIVING_LEVEL_1, GPIO_PULL_UP } }, /* RX */
40 };
41
42 static const GPIO_PinMuxParam g_pinmux_uart1[] = {
43 { GPIO_PORT_A, GPIO_PIN_17, { GPIOA_P17_F5_UART1_TX, GPIO_DRIVING_LEVEL_1, GPIO_PULL_UP } }, /* TX */
44 { GPIO_PORT_A, GPIO_PIN_18, { GPIOA_P18_F5_UART1_RX, GPIO_DRIVING_LEVEL_1, GPIO_PULL_UP } }, /* RX */
45 };
46
47 static const GPIO_PinMuxParam g_pinmux_dmic[] = {
48 { GPIO_PORT_A, GPIO_PIN_21, { GPIOA_P21_F3_DMIC_CLK, GPIO_DRIVING_LEVEL_1, GPIO_PULL_NONE } },
49 { GPIO_PORT_A, GPIO_PIN_22, { GPIOA_P22_F3_DMIC_DATA, GPIO_DRIVING_LEVEL_1, GPIO_PULL_NONE } },
50 };
配置工程选项
- 配置编译选项
Note: Options are in /porject/prj-xxx/gcc/localconfig.mk
- __PRJ_CONFIG_WLAN_STA_AP
- [y] 支持WLAN Station和AP两种模式
- [n] 只支持WLAN Station模式
- __PRJ_CONFIG_XPLAYER
- [y] 支持音频设备初始化及播控中间件
- [n] 默认关闭音频设备初始化
- __PRJ_CONFIG_XIP
- [y] 初始化SPI Nor Flash的XIP模式
- [n] 关闭SPI Nor Flash的XIP模式
- __PRJ_CONFIG_OTA
- [y] 支持OTA升级
- [n] 关闭OTA升级
- __CONFIG_LWIP_V1
- [y] 支持LwIP1.4
- [n] 支持LwIP2.0.3
- 注意:请去掉定义前面的注释符号‘#’
19 # set n to use lwIP 2.x.x, support dual IPv4/IPv6 stack
20 # export __CONFIG_LWIP_V1 := n
21
22 # ----------------------------------------------------------------------------
23 # override project common config options
24 # ----------------------------------------------------------------------------
25 # support both sta and ap, default to n
26 __PRJ_CONFIG_WLAN_STA_AP := y
27
28 # support xplayer, default to n
29 # __PRJ_CONFIG_XPLAYER := y
30
31 # enable XIP, default to n
32 __PRJ_CONFIG_XIP := y
33
34 # enable OTA, default to n
35 __PRJ_CONFIG_OTA := y
- 配置运行时参数
Note: Options are in project/prj-xxx/prj_config.h
- Main Thread Configurations
- PRJCONF_MAIN_THREAD_PRIO - main函数运行优先级
- PRJCONF_MAIN_THREAD_STACK_SIZE - main函数运行的线程栈大小
- System Control Configurations
- Note: 不要修改此配置
- System Image Configurations
- PRJCONF_IMG_FLASH
- PRJCONF_IMG_ADDR - 固件在FLASH中的起始地址
- PRJCONF_IMG_SIZE - 固件的预留空间大小
- System Information Configurations
- PRJCONF_SYSINFO_FLASH
- PRJCONF_SYSINFO_ADDR - sysinfo内容在FLASH中的起始地址
- PRJCONF_SYSINFO_SIZE - sysinfo的预留空间大小
- MAC Address Source Configurations
- PRJCONF_MAC_ADDR_SOURCE
- SYSINFO_MAC_ADDR_CODE - MAC地址由代码指定
- SYSINFO_MAC_ADDR_EFUSE - MAC地址来自efuse的内容
- SYSINFO_MAC_ADDR_FLASH - MAC地址来自flash的内容
- PRJCONF_MAC_ADDR_SOURCE
- Watchdog Configurations
- PRJCONF_WDG_EN - 看门狗使能开关
- PRJCONF_WDG_TIMEOUT - 看门狗超时周期
- PRJCONF_WDG_FEED_PERIOD - 看门狗的喂狗周期
- Hardware Configurations
- PRJCONF_UART_EN - UART使能开关
- PRJCONF_CE_EN - 加解密引擎
- PRJCONF_SPI_EN - SPI使能开关
- PRJCONF_MMC_EN - MMC使能开关
- PRJCONF_SOUNDCARD0_EN - AC101 codec使能开关
- PRJCONF_SOUNDCARD1_EN - DMIC使能开关
- Services Configurations
- PRJCONF_CONSOLE_EN - 控制台使能开关
- PRJCONF_PM_EN - 电源管理使能开关
- PRJCONF_NET_EN - 网络功能使能开关
- PRJCONF_NET_PM_EN - 网络系统电源管理使能开关
38 * project base config
39 */
40 #define PRJCONF_MSP_STACK_SIZE (1 * 1024) /* stack size for IRQ service */
41
42 /* main thread */
43 #define PRJCONF_MAIN_THREAD_PRIO OS_THREAD_PRIO_APP
44 #define PRJCONF_MAIN_THREAD_STACK_SIZE (1 * 1024)
45
46 /* sys ctrl */
47 #define PRJCONF_SYS_CTRL_EN 1
48 #define PRJCONF_SYS_CTRL_PRIO OS_THREAD_PRIO_SYS_CTRL
49 #define PRJCONF_SYS_CTRL_STACK_SIZE (2 * 1024)
50 #define PRJCONF_SYS_CTRL_QUEUE_LEN (6)
51
52 /* image */
53 #define PRJCONF_IMG_FLASH (0)
54 #define PRJCONF_IMG_ADDR (0x00000000)
55 #define PRJCONF_IMG_SIZE ((1 << 20) - (4 << 10))
56
57 /* sysinfo */
58 #define PRJCONF_SYSINFO_FLASH (0)
59 #define PRJCONF_SYSINFO_ADDR ((1 << 20) - (4 << 10))
60 #define PRJCONF_SYSINFO_SIZE (4 << 10)
61
62 /* MAC address source */
63 #define PRJCONF_MAC_ADDR_SOURCE SYSINFO_MAC_ADDR_CODE
64
65 /* watchdog hardware and service */
66 #define PRJCONF_WDG_EN 1
67 #define PRJCONF_WDG_TIMEOUT WDG_TIMEOUT_16SEC
68 #define PRJCONF_WDG_FEED_PERIOD (10 * 1000) /* in ms, MUST less than PRJCONF_WDG_TIMEOUT */
69
70 /*
71 * project hardware feature (enable/disable)
72 */
73 #define PRJCONF_UART_EN 1 /* uart */
74 #define PRJCONF_CE_EN 1 /* h/w crypto engine */
75 #define PRJCONF_SPI_EN 1 /* spi */
76 #define PRJCONF_MMC_EN 0 /* mmc */
77 #define PRJCONF_MMC_DETECT_MODE CARD_ALWAYS_PRESENT /* mmc detect mode */
78 #define PRJCONF_SOUNDCARD0_EN 0 /* sound card0, external audio codec */
79 #define PRJCONF_SOUNDCARD1_EN 0 /* sound card1, internal dmic */
80
81 /*
82 * project service feature
83 */
84 #define PRJCONF_CONSOLE_EN 1 /* console */
85
86 /* app pm mode
87 * - to override the default app pm mode, define PRJCONF_PM_MODE
88 */
89 #define PRJCONF_PM_EN 1 /* app pm mode enable/disable */
90 //#define PRJCONF_PM_MODE (PM_SUPPORT_SLEEP | PM_SUPPORT_STANDBY)
91
92 /* network */
93 #define PRJCONF_NET_EN 1 /* network and wlan */
94
95 /* net pm mode
96 * - to override the default net pm mode, define PRJCONF_NET_PM_MODE
97 */
98 #define PRJCONF_NET_PM_EN 1
99 //#define PRJCONF_NET_PM_MODE (PM_SUPPORT_HIBERNATION | PM_SUPPORT_POWEROFF)