forked from espressif/ESP8266_RTOS_SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/factory_test' into 'master'
factory-test: add factory test code and document See merge request sdk/ESP8266_RTOS_SDK!890
- Loading branch information
Showing
18 changed files
with
1,230 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
Factory Test | ||
************ | ||
|
||
1. Overview | ||
=========== | ||
|
||
The document introduces how to develop, compile, download and run the factory test firmware. | ||
|
||
The factory test software development kit is also an example of the SDK, and it is located at :example:`examples/system/factory-test`. | ||
|
||
2. Development | ||
============== | ||
|
||
Users can use ready-to-use applications directly, or can also add custom application code into the factory test software development kit. | ||
|
||
More details of adding customer components, please refer to :doc:`Documentation for the GNU Make based build system <build-system>`. | ||
|
||
Users can just develop the factory test application as normal examples of the SDK. | ||
|
||
2.1 Application code | ||
-------------------- | ||
|
||
Just like other applications, the entry function of factory test application is ``app_main``. It should be added into the source code file of users. | ||
For example, users can add the ``app_main`` into ``main.c`` of the above sample project. | ||
|
||
Users can refer to the source code in file :idf_file:`/examples/system/factory-test/main/main.c` to build custom project. | ||
|
||
|
||
2.2 Linking address | ||
------------------- | ||
|
||
The SDK's partition only supports two applications that named as ``ota_0`` and ``ota_1``. | ||
|
||
In this case, we link the factory test firmware to the partition of ``ota_1``. | ||
So, please do not flash the factory test firmware into the partition of ``ota_0``. | ||
|
||
|
||
3. Compile | ||
========== | ||
|
||
To make the bootloader run the ``ota_1(factory test firmware)``, | ||
please enable the ``GPIO triggers boot from test app partition`` and set the ``correct`` GPIO of your development board in menuconfig:: | ||
|
||
Bootloader config ---> | ||
[*] GPIO triggers boot from test app partition | ||
(12) Number of the GPIO input to boot TEST partition | ||
|
||
Using the partition table file which has two "OTA" definitions partition:: | ||
|
||
Partition Table ---> | ||
Partition Table (Factory app, two OTA definitions) ---> | ||
(X) Factory app, two OTA definitions | ||
|
||
Enable the console which is used for human-computer interaction:: | ||
|
||
Component config ---> | ||
Virtual file system ---> | ||
[*] Using espressif VFS | ||
|
||
Enable pthread for this function:: | ||
|
||
Component config ---> | ||
PThreads ---> | ||
[*] Enable pthread | ||
|
||
Then call command ``make app2`` in the terminal to compile the firmware which is able to run at ``ota_1`` partition. | ||
The ``Make System`` will start compiling bootloader, partition table file, factory test firmware and so on one by one. | ||
|
||
|
||
3.1 Special Commands | ||
==================== | ||
|
||
1. ``make app2``: only compile factory test firmware which is able to run at ``ota_1``, ``with`` bootloader, partition table file and so on | ||
|
||
2. ``make app2-flash``: flash(download) only the factory test firmware which is able to run at ``ota_1``, ``without`` bootloader, partition table file and so on | ||
|
||
3. ``make app2-flash-all``: flash(download) the factory test firmware which is able to run at ``ota_1``, ``with`` bootloader, partition table file and so on | ||
|
||
|
||
4. Download | ||
=========== | ||
|
||
Input command ``make app2-flash-all`` in the terminal to download bootloader, partition table file and factory test firmware which is located at ``ota_1`` one by one. | ||
|
||
If users only want to download factory test firmware, please use command ``make app2-flash`` instead. | ||
|
||
|
||
5. Run | ||
====== | ||
|
||
Please hold the ``correct`` GPIO, which is configured in the menuconfig in Section 3 ``Compile``, to be low level and power on. | ||
Input command ``make monitor`` in the terminal, and then logs will appear like following:: | ||
|
||
ets Jan 8 2013,rst cause:1, boot mode:(3,6) | ||
|
||
load 0x40100000, len 7872, room 16 | ||
0x40100000: _stext at ??:? | ||
|
||
tail 0 | ||
chksum 0xf1 | ||
load 0x3ffe8408, len 24, room 8 | ||
tail 0 | ||
chksum 0x78 | ||
load 0x3ffe8420, len 3604, room 8 | ||
tail 12 | ||
chksum 0x1b | ||
I (64) boot: ESP-IDF v3.2-dev-354-gba1f90cd-dirty 2nd stage bootloader | ||
I (64) boot: compile time 13:56:17 | ||
I (72) qio_mode: Enabling default flash chip QIO | ||
I (73) boot: SPI Speed : 40MHz | ||
I (80) boot: SPI Mode : QIO | ||
I (86) boot: SPI Flash Size : 2MB | ||
I (92) boot: Partition Table: | ||
I (98) boot: ## Label Usage Type ST Offset Length | ||
I (109) boot: 0 nvs WiFi data 01 02 00009000 00004000 | ||
I (120) boot: 1 otadata OTA data 01 00 0000d000 00002000 | ||
I (132) boot: 2 phy_init RF data 01 01 0000f000 00001000 | ||
I (144) boot: 3 ota_0 OTA app 00 10 00010000 000f0000 | ||
I (155) boot: 4 ota_1 OTA app 00 11 00110000 000f0000 | ||
I (167) boot: End of partition table | ||
I (173) boot: No factory image, trying OTA 0 | ||
I (5180) boot: Detect a boot condition of the test firmware | ||
I (5180) esp_image: segment 0: paddr=0x00110010 vaddr=0x40210010 size=0x37b18 (228120) map | ||
I (5263) esp_image: segment 1: paddr=0x00147b30 vaddr=0x3ffe8000 size=0x00718 ( 1816) load | ||
I (5264) esp_image: segment 2: paddr=0x00148250 vaddr=0x3ffe8718 size=0x0019c ( 412) load | ||
I (5275) esp_image: segment 3: paddr=0x001483f4 vaddr=0x40100000 size=0x084b0 ( 33968) load | ||
0x40100000: _stext at ??:? | ||
|
||
I (5299) boot: Loaded app from partition at offset 0x110000 | ||
I (5340) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE | ||
I (5340) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE | ||
I (5530) phy_init: phy ver: 1055_12 | ||
I (5530) reset_reason: RTC reset 1 wakeup 0 store 0, reason is 1 | ||
I (5530) factory-test: SDK factory test firmware version:v3.2-dev-354-gba1f90cd-dirty | ||
|
||
Then users can input test commands to start factory testing. | ||
|
||
6. Test Commands | ||
================ | ||
|
||
1. ``rftest_init``:: | ||
|
||
parameters: no | ||
function: initialize RF to prepare for test | ||
|
||
2. ``tx_contin_func <parameter 1>``:: | ||
|
||
parameter 1: value 1 means that chip transmits packets continuously with 92% duty cycle, | ||
value 0 means that "iqview" test mode | ||
|
||
function: set test mode | ||
|
||
3. ``esp_tx <parameter 1> <parameter 2> <parameter 3>``:: | ||
|
||
parameter 1: transmit channel which ranges from 1 to 14 | ||
parameter 2: transmit rate which ranges from 0 to 23 | ||
parameter 2: transmit power attenuation which ranges from -127 to 127, unit is 0.25dB | ||
|
||
function: start transmitting Wi-Fi packets | ||
|
||
note 1: command "wifitxout" is the same as "esp_tx" | ||
note 2: the function can be stopped by command "cmdstop" | ||
|
||
4. ``esp_rx <parameter 1> <parameter 2>``:: | ||
|
||
parameter 1: transmit channel which ranges from 1 to 14 | ||
parameter 2: transmit rate which ranges from 0 to 23 | ||
|
||
function: start receiving Wi-Fi packets | ||
|
||
note 1: the function can be stopped by command "cmdstop" | ||
|
||
5. ``wifiscwout <parameter 1> <parameter 2> <parameter 3>``:: | ||
|
||
parameter 1: enable signal, value 1 means enable, value 0 means disable | ||
parameter 2: transmit channel which ranges from 1 to 14 | ||
parameter 3: transmit power attenuation which ranges from -127 to 127, unit is 0.25dB | ||
|
||
function: start transmitting single carrier Wi-Fi packets | ||
|
||
note 1: the function can be stopped by command "cmdstop" | ||
|
||
6. ``cmdstop``:: | ||
|
||
parameters: no | ||
|
||
function: stop transmitting or receiving Wi-Fi packets | ||
|
||
note 1: command "CmdStop" is the same as "cmdstop" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
menu "Factory-test config" | ||
|
||
config FACTORY_TEST | ||
bool "Enable factory test" | ||
default n | ||
select BOOTLOADER_INIT_SPI_FLASH | ||
help | ||
Enable this option, project compiling script will generate factory test firmware. | ||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PROJECT_NAME := factory-test | ||
|
||
include $(IDF_PATH)/make/project.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
# Important | ||
|
||
Please refer to the document at *docs/en/api-guides/factory-test.rst*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
menu "Nano Console" | ||
|
||
config NC_ECHO_CMD | ||
bool "echo input command" | ||
default y | ||
help | ||
Enable this option, the console terminal will echo the input command. | ||
|
||
endmenu |
2 changes: 2 additions & 0 deletions
2
examples/system/factory-test/components/rf_test/Makefile.projbuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
CFLAGS += -DESP_DPORT_CLOSE_NMI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# | ||
# Component Makefile | ||
# | ||
|
||
LIBS := rftest | ||
|
||
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/lib $(addprefix -l,$(LIBS)) | ||
COMPONENT_ADD_LINKER_DEPS += $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) |
81 changes: 81 additions & 0 deletions
81
examples/system/factory-test/components/rf_test/include/esp_rftest.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright 2019-2020 Espressif Systems (Shanghai) PTE LTD | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Initialize RF test module | ||
*/ | ||
void rftest_init(void); | ||
|
||
/** | ||
* @brief Set TX testing mode | ||
* | ||
* @param mode testing mode, 1 means continuous Wi-Fi packets transmission with 92% duty cycle | ||
* 0 means default mode for iqview testing | ||
*/ | ||
void tx_contin_func(uint8_t mode); | ||
|
||
/** | ||
* @brief TX testing function, continuously sending Wi-Fi packets at "while(1)" loop | ||
* | ||
* @param channel Wi-Fi TX channel, it ranges from 1 to 14 | ||
* @param rate Wi-Fi TX rate, it ranges from 1 to 23 | ||
* @param attenuation Wi-Fi TX power attenuation, it ranges from 1 to 127 and its unit is 0.25dB. | ||
* For example, 1 means 0.25dB, 2 means 0.5 dB and so on. | ||
*/ | ||
void esp_tx_func(uint32_t channel, uint32_t rate, uint32_t attenuation); | ||
|
||
/** | ||
* @brief RX testing function, continuously receiving Wi-Fi packets at "while(1)" loop | ||
* | ||
* @param channel Wi-Fi RX channel, it ranges from 1 to 14 | ||
* @param rate Wi-Fi RX rate, it ranges from 1 to 23 | ||
*/ | ||
void esp_rx_func(uint32_t channel, uint32_t rate); | ||
|
||
/** | ||
* @brief Single carrier TX testing function | ||
* | ||
* @param enable enable signal, 1 means starting sending, 0 means stopping sending | ||
* @param channel Wi-Fi RX channel, it ranges from 1 to 14 | ||
* @param attenuation Wi-Fi TX power attenuation, it ranges from 1 to 127 and its unit is 0.25dB. | ||
* For example, 1 means 0.25dB, 2 means 0.5 dB and so on. | ||
*/ | ||
void wifiscwout_func(uint32_t enable, uint32_t channel, uint32_t attenuation); | ||
|
||
/** | ||
* @brief Stop sending or recieving Wi-Fi packets | ||
* | ||
* @return | ||
* - 0 receiving stop TX commands "cmdstop" or "CmdStop" and TX is stopped | ||
* - 2 receiving error commands and TX will not stop | ||
* - 3 receiving no commands | ||
*/ | ||
int cmdstop_callback(void); | ||
|
||
/** | ||
* @brief Register RF test command for console | ||
*/ | ||
void esp_console_register_rftest_command(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
Oops, something went wrong.