Skip to content

create a new project

leafy.myeh@xradiotech.com edited this page Apr 5, 2018 · 6 revisions

Content


Create the Project

  1. Give the project a name, like MD01, storyteller-S1. Names like demoxxx, wlandemo1, audio2 are not recommended
    给工程起个名字,建议和项目相关,比如MD01(模块工程),storyteller-S1(故事机工程), 随意的名字不推荐,比如demoxxx,wlandemo1(直接拷贝wlandemo),或者audio2这样不具备标识性的名字
  2. Create the project directory, here we use 'prj-example' as the project name
    参考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
  1. modify the project name defined in project/prj-example/gcc/Makefile
    修改project/prj-example/gcc/Makefile中定义的工程名
 (in project/prj-example/gcc/Makefile)
 17 # ----------------------------------------------------------------------------
 18 # project and objects
 19 # ----------------------------------------------------------------------------
 20 PROJECT := prj-example

Create the Board Configuration

  1. modify the board name defined in project/prj-example/gcc/localconfig.mk
    修改project/prj-example/gcc/localconfig.mk中定义的板级命名
  (in project/prj-example/gcc/localconfig.mk)
  5 # ----------------------------------------------------------------------------
  6 # board definition
  7 # ----------------------------------------------------------------------------
  8 __PRJ_CONFIG_BOARD := xr871_xxx
  1. create the board directory in project/common/board/xr871-xxx
    在project/common/board/下创建板级目录xr871-xxx
  2. create the board configs in project/common/board/xr871-xxx/board_config.c
    创建板级配置project/common/board/xr871-xxx/board_config.c
  3. modify the pin multiplexing define in 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 };

Configure the Project

  1. Config Compilation Options / 配置编译选项
    Note: Options are in /porject/prj-xxx/gcc/localconfig.mk
  • __PRJ_CONFIG_WLAN_STA_AP
    • [y] Support both WLAN station and HostAP modes / 支持WLAN Station和AP两种模式
    • [n] Support only WLAN station modes / 只支持WLAN Station模式
  • __PRJ_CONFIG_XPLAYER
    • [y] Support audio device initialization and Audio middleware / 支持音频设备初始化及播控中间件
    • [n] Disable audio device initialization / 默认关闭音频设备初始化
  • __PRJ_CONFIG_XIP
    • [y] Support SPI Nor Flash eXecute In Place mode / 初始化SPI Nor Flash的XIP模式
    • [n] Disable SPI Nor Flash eXecute In Place mode / 关闭SPI Nor Flash的XIP模式
  • __PRJ_CONFIG_OTA
    • [y] Support Over The Air upgrade / 支持OTA升级
    • [n] Disable Over The Air upgrade / 关闭OTA升级
  • __CONFIG_LWIP_V1
    • [y] Support LwIP 1.4 / 支持LwIP1.4
    • [n] Support LwIP 2.0.3 / 支持LwIP2.0.3
  • NOTE:Please remove the Annotation ‘#’ before these options / 注意:请去掉定义前面的注释符号‘#’
 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
  1. Configure the Run-time Options / 配置运行时参数
    Note: Options are in project/prj-xxx/prj_config.h
  • Main Thread Configurations
    • PRJCONF_MAIN_THREAD_PRIO - the main thread priority / main函数运行优先级
    • PRJCONF_MAIN_THREAD_STACK_SIZE - main thread stack size / main函数运行的线程栈大小
  • System Control Configurations
    • Note: do not change these configurations / 不要修改此配置
  • System Image Configurations
    • PRJCONF_IMG_FLASH
    • PRJCONF_IMG_ADDR - the starting address of image in Flash / 固件在FLASH中的起始地址
    • PRJCONF_IMG_SIZE - the size of the reserved space of image in Flash / 固件的预留空间大小
  • System Information Configurations
    • PRJCONF_SYSINFO_FLASH
    • PRJCONF_SYSINFO_ADDR - the starting address of sysinfo in Flash / sysinfo内容在FLASH中的起始地址
    • PRJCONF_SYSINFO_SIZE - the size of the reserved space of sysinfo in Flash / sysinfo的预留空间大小
  • MAC Address Source Configurations
    • PRJCONF_MAC_ADDR_SOURCE
      • SYSINFO_MAC_ADDR_CODE - MAC address is pre-defined by code / MAC地址由代码指定
      • SYSINFO_MAC_ADDR_EFUSE - MAC address is sourced from efuse content / MAC地址来自efuse的内容
      • SYSINFO_MAC_ADDR_FLASH - MAC address is sourced from flash content / MAC地址来自flash的内容
  • Watchdog Configurations
    • PRJCONF_WDG_EN - enable/disable watchdog / 看门狗使能开关
    • PRJCONF_WDG_TIMEOUT - watchdog timeout period / 看门狗超时周期
    • PRJCONF_WDG_FEED_PERIOD - watchdog feeding cycle / 看门狗的喂狗周期
  • Hardware Configurations
    • PRJCONF_UART_EN - enable/disable uart / UART使能开关
    • PRJCONF_CE_EN - enable/disable hardware crypte engine / 加解密引擎
    • PRJCONF_SPI_EN - enable/disable SPI / SPI使能开关
    • PRJCONF_MMC_EN - enable/disable MMC/SDCARD / MMC使能开关
    • PRJCONF_SOUNDCARD0_EN - enable/disable AC101 codec / AC101 codec使能开关
    • PRJCONF_SOUNDCARD1_EN - enable/disable DMIC / DMIC使能开关
  • Services Configurations
    • PRJCONF_CONSOLE_EN - enable/disable console / 控制台使能开关
    • PRJCONF_PM_EN - enable/disable power management / 电源管理使能开关
    • PRJCONF_NET_EN - enable/disable network system / 网络功能使能开关 - enable/disable power management / 电源管理使能开关
    • PRJCONF_NET_PM_EN - enable/disable network system power management / 网络系统电源管理使能开关
 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)

Clone this wiki locally