Merge remote-tracking branch 'remotes/origin/zzc/dev/param_cfg' into main_f413
This commit is contained in:
51
.config
51
.config
@@ -78,7 +78,7 @@ CONFIG_RT_USING_DEVICE=y
|
||||
# CONFIG_RT_USING_INTERRUPT_INFO is not set
|
||||
CONFIG_RT_USING_CONSOLE=y
|
||||
CONFIG_RT_CONSOLEBUF_SIZE=256
|
||||
CONFIG_RT_CONSOLE_DEVICE_NAME="uart4"
|
||||
CONFIG_RT_CONSOLE_DEVICE_NAME="uart8"
|
||||
CONFIG_RT_VER_NUM=0x50000
|
||||
CONFIG_ARCH_ARM=y
|
||||
CONFIG_RT_USING_CPU_FFS=y
|
||||
@@ -255,7 +255,6 @@ CONFIG_ULOG_BACKEND_USING_CONSOLE=y
|
||||
# CONFIG_PKG_USING_KAWAII_MQTT is not set
|
||||
# CONFIG_PKG_USING_BC28_MQTT is not set
|
||||
# CONFIG_PKG_USING_WEBTERMINAL is not set
|
||||
# CONFIG_PKG_USING_LIBMODBUS is not set
|
||||
# CONFIG_PKG_USING_FREEMODBUS is not set
|
||||
# CONFIG_PKG_USING_NANOPB is not set
|
||||
|
||||
@@ -333,6 +332,7 @@ CONFIG_ULOG_BACKEND_USING_CONSOLE=y
|
||||
# CONFIG_PKG_USING_NET_SERVER is not set
|
||||
# CONFIG_PKG_USING_ZFTP is not set
|
||||
# CONFIG_PKG_USING_WOL is not set
|
||||
# CONFIG_PKG_USING_ZEPHYR_POLLING is not set
|
||||
|
||||
#
|
||||
# security packages
|
||||
@@ -401,18 +401,13 @@ CONFIG_ULOG_BACKEND_USING_CONSOLE=y
|
||||
# CONFIG_PKG_USING_MP3PLAYER is not set
|
||||
# CONFIG_PKG_USING_TINYJPEG is not set
|
||||
# CONFIG_PKG_USING_UGUI is not set
|
||||
|
||||
#
|
||||
# PainterEngine: A cross-platform graphics application framework written in C language
|
||||
#
|
||||
# CONFIG_PKG_USING_PAINTERENGINE is not set
|
||||
# CONFIG_PKG_USING_PAINTERENGINE_AUX is not set
|
||||
# CONFIG_PKG_USING_MCURSES is not set
|
||||
# CONFIG_PKG_USING_TERMBOX is not set
|
||||
# CONFIG_PKG_USING_VT100 is not set
|
||||
# CONFIG_PKG_USING_QRCODE is not set
|
||||
# CONFIG_PKG_USING_GUIENGINE is not set
|
||||
# CONFIG_PKG_USING_PERSIMMON is not set
|
||||
# CONFIG_PKG_USING_3GPP_AMRNB is not set
|
||||
|
||||
#
|
||||
# tools packages
|
||||
@@ -422,6 +417,7 @@ CONFIG_ULOG_BACKEND_USING_CONSOLE=y
|
||||
# CONFIG_PKG_USING_EASYLOGGER is not set
|
||||
# CONFIG_PKG_USING_SYSTEMVIEW is not set
|
||||
# CONFIG_PKG_USING_SEGGER_RTT is not set
|
||||
# CONFIG_PKG_USING_RTT_AUTO_EXE_CMD is not set
|
||||
# CONFIG_PKG_USING_RDB is not set
|
||||
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
|
||||
# CONFIG_PKG_USING_LOGMGR is not set
|
||||
@@ -459,6 +455,7 @@ CONFIG_ULOG_BACKEND_USING_CONSOLE=y
|
||||
# CONFIG_PKG_USING_HASH_MATCH is not set
|
||||
# CONFIG_PKG_USING_ARMV7M_DWT_TOOL is not set
|
||||
# CONFIG_PKG_USING_VOFA_PLUS is not set
|
||||
# CONFIG_PKG_USING_RT_TRACE is not set
|
||||
|
||||
#
|
||||
# system packages
|
||||
@@ -538,6 +535,7 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# CONFIG_PKG_USING_QPC is not set
|
||||
# CONFIG_PKG_USING_AGILE_UPGRADE is not set
|
||||
# CONFIG_PKG_USING_FLASH_BLOB is not set
|
||||
# CONFIG_PKG_USING_MLIBC is not set
|
||||
|
||||
#
|
||||
# peripheral libraries and drivers
|
||||
@@ -602,6 +600,7 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# CONFIG_PKG_USING_BALANCE is not set
|
||||
# CONFIG_PKG_USING_SHT2X is not set
|
||||
# CONFIG_PKG_USING_SHT3X is not set
|
||||
# CONFIG_PKG_USING_SHT4X is not set
|
||||
# CONFIG_PKG_USING_AD7746 is not set
|
||||
# CONFIG_PKG_USING_ADT74XX is not set
|
||||
# CONFIG_PKG_USING_MAX17048 is not set
|
||||
@@ -609,6 +608,7 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# CONFIG_PKG_USING_CW2015 is not set
|
||||
# CONFIG_PKG_USING_ICM20608 is not set
|
||||
# CONFIG_PKG_USING_PAJ7620 is not set
|
||||
# CONFIG_PKG_USING_STHS34PF80 is not set
|
||||
|
||||
#
|
||||
# touch drivers
|
||||
@@ -621,6 +621,7 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# CONFIG_PKG_USING_FT5426 is not set
|
||||
# CONFIG_PKG_USING_FT6236 is not set
|
||||
# CONFIG_PKG_USING_XPT2046_TOUCH is not set
|
||||
# CONFIG_PKG_USING_CST816X is not set
|
||||
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
|
||||
# CONFIG_PKG_USING_STM32_SDIO is not set
|
||||
# CONFIG_PKG_USING_ESP_IDF is not set
|
||||
@@ -633,7 +634,6 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# CONFIG_PKG_USING_LKDGUI is not set
|
||||
# CONFIG_PKG_USING_NRF5X_SDK is not set
|
||||
# CONFIG_PKG_USING_NRFX is not set
|
||||
# CONFIG_PKG_USING_WM_LIBRARIES is not set
|
||||
|
||||
#
|
||||
# Kendryte SDK
|
||||
@@ -647,6 +647,7 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# CONFIG_PKG_USING_AT24CXX is not set
|
||||
# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set
|
||||
# CONFIG_PKG_USING_PCA9685 is not set
|
||||
# CONFIG_PKG_USING_ILI9341 is not set
|
||||
# CONFIG_PKG_USING_I2C_TOOLS is not set
|
||||
# CONFIG_PKG_USING_NRF24L01 is not set
|
||||
# CONFIG_PKG_USING_RPLIDAR is not set
|
||||
@@ -690,14 +691,18 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# CONFIG_PKG_USING_MISAKA_AT24CXX is not set
|
||||
# CONFIG_PKG_USING_MISAKA_RGB_BLING is not set
|
||||
# CONFIG_PKG_USING_LORA_MODEM_DRIVER is not set
|
||||
# CONFIG_PKG_USING_BL_MCU_SDK is not set
|
||||
# CONFIG_PKG_USING_SOFT_SERIAL is not set
|
||||
# CONFIG_PKG_USING_MB85RS16 is not set
|
||||
# CONFIG_PKG_USING_RFM300 is not set
|
||||
# CONFIG_PKG_USING_IO_INPUT_FILTER is not set
|
||||
# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set
|
||||
# CONFIG_PKG_USING_LRF_NV7LIDAR is not set
|
||||
# CONFIG_PKG_USING_AIP650 is not set
|
||||
# CONFIG_PKG_USING_FINGERPRINT is not set
|
||||
# CONFIG_PKG_USING_BT_ECB02C is not set
|
||||
# CONFIG_PKG_USING_UAT is not set
|
||||
# CONFIG_PKG_USING_ST7789 is not set
|
||||
# CONFIG_PKG_USING_SPI_TOOLS is not set
|
||||
|
||||
#
|
||||
# AI packages
|
||||
@@ -716,7 +721,10 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# Signal Processing and Control Algorithm Packages
|
||||
#
|
||||
# CONFIG_PKG_USING_FIRE_PID_CURVE is not set
|
||||
# CONFIG_PKG_USING_QPID is not set
|
||||
# CONFIG_PKG_USING_UKAL is not set
|
||||
# CONFIG_PKG_USING_DIGITALCTRL is not set
|
||||
# CONFIG_PKG_USING_KISSFFT is not set
|
||||
|
||||
#
|
||||
# miscellaneous packages
|
||||
@@ -747,6 +755,7 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# CONFIG_PKG_USING_TETRIS is not set
|
||||
# CONFIG_PKG_USING_DONUT is not set
|
||||
# CONFIG_PKG_USING_COWSAY is not set
|
||||
# CONFIG_PKG_USING_MORSE is not set
|
||||
# CONFIG_PKG_USING_LIBCSV is not set
|
||||
# CONFIG_PKG_USING_OPTPARSE is not set
|
||||
# CONFIG_PKG_USING_FASTLZ is not set
|
||||
@@ -762,7 +771,6 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# CONFIG_PKG_USING_DSTR is not set
|
||||
# CONFIG_PKG_USING_TINYFRAME is not set
|
||||
# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
|
||||
# CONFIG_PKG_USING_DIGITALCTRL is not set
|
||||
# CONFIG_PKG_USING_UPACKER is not set
|
||||
# CONFIG_PKG_USING_UPARAM is not set
|
||||
# CONFIG_PKG_USING_HELLO is not set
|
||||
@@ -788,8 +796,9 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# CONFIG_PKG_USING_RTDUINO is not set
|
||||
|
||||
#
|
||||
# Projects
|
||||
# Projects and Demos
|
||||
#
|
||||
# CONFIG_PKG_USING_ARDUINO_MSGQ_C_CPP_DEMO is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ULTRASOUND_RADAR is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_SENSOR_KIT is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_MATLAB_SUPPORT is not set
|
||||
@@ -936,13 +945,20 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
#
|
||||
# Display
|
||||
#
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_GFX_LIBRARY is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_U8G2 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ST7735 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SSD1306 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_ILI9341 is not set
|
||||
# CONFIG_PKG_USING_SEEED_TM1637 is not set
|
||||
|
||||
#
|
||||
# Timing
|
||||
#
|
||||
# CONFIG_PKG_USING_ARDUINO_RTCLIB is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_MSTIMER2 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_TICKER is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_TASKSCHEDULER is not set
|
||||
|
||||
#
|
||||
# Data Processing
|
||||
@@ -966,10 +982,16 @@ CONFIG_PKG_RT_VSNPRINTF_FULL_VER="latest"
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_PCF8574 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_PCA9685 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_SEEED_PCF85063TP is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_TPA2016 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DRV2605 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DS1841 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_DS3502 is not set
|
||||
|
||||
#
|
||||
# Other
|
||||
#
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_MFRC630 is not set
|
||||
# CONFIG_PKG_USING_ARDUINO_ADAFRUIT_SI5351 is not set
|
||||
|
||||
#
|
||||
# Signal IO
|
||||
@@ -1063,6 +1085,11 @@ CONFIG_BSP_USING_CAPTURE2=y
|
||||
# CONFIG_BSP_USING_CAPTURE2_CH2 is not set
|
||||
CONFIG_BSP_USING_CAPTURE2_CH3=y
|
||||
CONFIG_BSP_USING_CAPTURE2_CH4=y
|
||||
CONFIG_BSP_USING_CAPTURE12=y
|
||||
CONFIG_BSP_USING_CAPTURE12_CH1=y
|
||||
CONFIG_BSP_USING_CAPTURE12_CH2=y
|
||||
# CONFIG_BSP_USING_CAPTURE12_CH3 is not set
|
||||
# CONFIG_BSP_USING_CAPTURE12_CH4 is not set
|
||||
CONFIG_BSP_USING_ADC=y
|
||||
CONFIG_BSP_USING_ADC1=y
|
||||
# CONFIG_BSP_USING_ONCHIP_RTC is not set
|
||||
|
@@ -317,6 +317,24 @@ menu "On-chip Peripheral Drivers"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_CAPTURE12
|
||||
bool "Enable capture12"
|
||||
default n
|
||||
if BSP_USING_CAPTURE12
|
||||
config BSP_USING_CAPTURE12_CH1
|
||||
bool "Enable capture12 channel1"
|
||||
default n
|
||||
config BSP_USING_CAPTURE12_CH2
|
||||
bool "Enable capture12 channel2"
|
||||
default n
|
||||
config BSP_USING_CAPTURE12_CH3
|
||||
bool "Enable capture12 channel3"
|
||||
default n
|
||||
config BSP_USING_CAPTURE12_CH4
|
||||
bool "Enable capture12 channel4"
|
||||
default n
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_ADC
|
||||
|
220
iap/iap.c
220
iap/iap.c
@@ -6,6 +6,7 @@
|
||||
#define IAP_FLASH_APP_SEC "app"
|
||||
#define IAP_FLASH_BOOT_SEC "boot"
|
||||
|
||||
static rt_device_t console_dev;
|
||||
struct rt_completion _wait;
|
||||
|
||||
#define IS_AF(c) ((c >= 'A') && (c <= 'F'))
|
||||
@@ -122,6 +123,7 @@ rt_err_t port_rx_ind(rt_device_t dev, rt_size_t size)
|
||||
* 作用 & 说明
|
||||
* - 记录固件对应硬件 & 版本信息
|
||||
* - 简便起见,不包含校验信息
|
||||
* - 允许 iap 升级不含 header 的普通固件
|
||||
*
|
||||
* index len desc
|
||||
* 0 4 'XYFC'
|
||||
@@ -136,14 +138,14 @@ static int _check_head(const rt_uint8_t *buf, rt_size_t len)
|
||||
{
|
||||
if (len < 8)
|
||||
{
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < sizeof(FIXED_HEAD); i++)
|
||||
{
|
||||
if (FIXED_HEAD[i] != buf[i])
|
||||
{
|
||||
return -2;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,56 +318,44 @@ static const rt_uint8_t *_pack_cmd(enum iap_v5_cmd cmd)
|
||||
return _cmd_line;
|
||||
}
|
||||
|
||||
#define _response_cmd(console_dev, cmd) \
|
||||
#define _response_cmd(cmd) \
|
||||
rt_device_write(console_dev, 0, _pack_cmd(cmd), IAP_V5_CMD_SIZE)
|
||||
|
||||
static rt_bool_t iap_v5_req_char(rt_device_t console_dev,
|
||||
struct rt_completion *_wait,
|
||||
rt_uint8_t want,
|
||||
rt_tick_t wait)
|
||||
{
|
||||
rt_uint8_t ch;
|
||||
rt_tick_t start = rt_tick_get();
|
||||
rt_bool_t rt = RT_FALSE;
|
||||
|
||||
while (rt_tick_get() - start < wait)
|
||||
{
|
||||
if (rt_device_read(console_dev, 0, &ch, 1) == 1)
|
||||
{
|
||||
if (ch == want)
|
||||
{
|
||||
rt = RT_TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rt_completion_wait(_wait, wait - (rt_tick_get() - start))
|
||||
!= RT_EOK)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return rt;
|
||||
}
|
||||
|
||||
static void jump_to_app(void);
|
||||
extern const uint32_t IapAppAddr;
|
||||
|
||||
#define PORTS_NUM (10) // uart1 - uart10
|
||||
|
||||
static rt_device_t _read_ports(rt_device_t ports[], rt_uint8_t *pch)
|
||||
{
|
||||
for (int i = 0; i < PORTS_NUM; i++)
|
||||
{
|
||||
while (ports[i])
|
||||
{
|
||||
if (rt_device_read(ports[i], 0, pch, 1) != 1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (*pch == '1' || *pch == 'q')
|
||||
{
|
||||
return ports[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
static void _print_ports(rt_device_t ports[], const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char line_buf[128] = { 0 };
|
||||
rt_size_t real;
|
||||
|
||||
va_start(args, fmt);
|
||||
real = rt_vsnprintf(line_buf, sizeof(line_buf), fmt, args);
|
||||
va_end(args);
|
||||
|
||||
for (int i = 0; i < PORTS_NUM; i++)
|
||||
{
|
||||
if (ports[i] == RT_NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
rt_device_write(ports[i], 0, line_buf, real);
|
||||
}
|
||||
}
|
||||
|
||||
static int _iap_entry(rt_bool_t is_boot);
|
||||
|
||||
int iap_main_entry(void)
|
||||
@@ -387,123 +377,31 @@ static int _iap_entry(rt_bool_t is_boot)
|
||||
finsh_set_prompt("msh (IAP)");
|
||||
}
|
||||
|
||||
rt_err_t (*odev_rx_ind)(rt_device_t dev, rt_size_t size);
|
||||
rt_err_t err = RT_EOK;
|
||||
struct custom_ctx *ctx = RT_NULL;
|
||||
rt_device_t console = rt_console_get_device();
|
||||
RT_ASSERT(console);
|
||||
|
||||
rt_device_t ports[10] = {0};
|
||||
char name[RT_NAME_MAX] = {0};
|
||||
console_dev = rt_console_get_device();
|
||||
RT_ASSERT(console_dev);
|
||||
|
||||
rt_completion_init(&_wait);
|
||||
odev_rx_ind = console_dev->rx_indicate;
|
||||
rt_device_set_rx_indicate(console_dev, port_rx_ind);
|
||||
|
||||
rt_bool_t _wait_mode = RT_FALSE;
|
||||
rt_bool_t _continue_run = RT_FALSE;
|
||||
rt_err_t (*odev_rx_ind)(rt_device_t dev, rt_size_t size);
|
||||
|
||||
for (int i = 0; i < 10 && is_boot; i++)
|
||||
if (!iap_v5_req_char(console_dev, &_wait, '1', is_boot? 1000: 100000))
|
||||
{
|
||||
rt_snprintf(name, RT_NAME_MAX, "uart%d", i+1);
|
||||
ports[i] = rt_device_find(name);
|
||||
RT_ASSERT(ports[i]);
|
||||
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
config.baud_rate = BAUD_RATE_460800;
|
||||
rt_device_control(ports[i], RT_DEVICE_CTRL_CONFIG, &config);
|
||||
|
||||
rt_device_set_rx_indicate(ports[i], port_rx_ind);
|
||||
rt_device_open(ports[i], RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX);
|
||||
goto _exit;
|
||||
}
|
||||
_response_cmd(IAP_V5_CMD_ONE_REPLY);
|
||||
|
||||
if (!is_boot)
|
||||
rt_thread_mdelay(200);
|
||||
if (!iap_v5_req_char(console_dev, &_wait, 'c', 1000))
|
||||
{
|
||||
ports[0] = rt_console_get_device();
|
||||
RT_ASSERT(ports[0]);
|
||||
|
||||
odev_rx_ind = ports[0]->rx_indicate;
|
||||
rt_device_set_rx_indicate(ports[0], port_rx_ind);
|
||||
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
config.baud_rate = BAUD_RATE_460800;
|
||||
rt_device_control(ports[0], RT_DEVICE_CTRL_CONFIG, &config);
|
||||
|
||||
rt_device_open(ports[0], RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX);
|
||||
}
|
||||
|
||||
rt_device_t get_port = RT_NULL;
|
||||
rt_uint8_t wait_cnt = 3;
|
||||
rt_uint8_t ch;
|
||||
|
||||
_print_ports(ports, "iap loop ...");
|
||||
|
||||
while (wait_cnt > 0 || !is_boot)
|
||||
{
|
||||
get_port = _read_ports(ports, &ch);
|
||||
|
||||
if (get_port != RT_NULL)
|
||||
{
|
||||
if (ch == 'q')
|
||||
{
|
||||
_continue_run = RT_TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ch == '1')
|
||||
{
|
||||
_wait_mode = RT_TRUE;
|
||||
_response_cmd(get_port, IAP_V5_CMD_ONE_REPLY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wait_cnt--;
|
||||
}
|
||||
|
||||
rt_completion_wait(&_wait, rt_tick_from_millisecond(100));
|
||||
}
|
||||
|
||||
if (get_port == RT_NULL)
|
||||
{
|
||||
get_port = console;
|
||||
}
|
||||
|
||||
for (int i = 0; i < PORTS_NUM && is_boot; i++)
|
||||
{
|
||||
if (ports[i] == get_port)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
rt_device_set_rx_indicate(ports[i], RT_NULL);
|
||||
rt_device_close(ports[i]);
|
||||
}
|
||||
|
||||
if (get_port != console)
|
||||
{
|
||||
rt_console_set_device(get_port->parent.name);
|
||||
}
|
||||
|
||||
if (_continue_run)
|
||||
{
|
||||
rt_device_close(get_port);
|
||||
if (!is_boot)
|
||||
{
|
||||
rt_device_set_rx_indicate(ports[0], odev_rx_ind);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_wait_mode)
|
||||
{
|
||||
err = RT_EOK;
|
||||
err = RT_ENOSYS;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
rt_device_set_rx_indicate(get_port, port_rx_ind);
|
||||
|
||||
rt_thread_mdelay(200);
|
||||
_response_cmd(get_port, IAP_V5_CMD_C_REPLY);
|
||||
_response_cmd(IAP_V5_CMD_C_REPLY);
|
||||
|
||||
ctx = rt_calloc(1, sizeof(*ctx));
|
||||
if (!ctx)
|
||||
@@ -522,7 +420,7 @@ static int _iap_entry(rt_bool_t is_boot)
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
err = rym_recv_on_device(&ctx->parent, get_port, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
err = rym_recv_on_device(&ctx->parent, console_dev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
_rym_recv_begin, _rym_recv_data, _rym_recv_end, 1000);
|
||||
rt_free(ctx);
|
||||
|
||||
@@ -530,22 +428,11 @@ static int _iap_entry(rt_bool_t is_boot)
|
||||
|
||||
if (err == RT_EOK)
|
||||
{
|
||||
rt_device_close(get_port);
|
||||
_response_cmd(get_port, IAP_V5_CMD_UPDATE_SUCCEED);
|
||||
if (!is_boot)
|
||||
{
|
||||
rt_device_set_rx_indicate(ports[0], odev_rx_ind);
|
||||
}
|
||||
_response_cmd(IAP_V5_CMD_UPDATE_SUCCEED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
_exit:
|
||||
rt_device_close(get_port);
|
||||
if (!is_boot)
|
||||
{
|
||||
rt_device_set_rx_indicate(ports[0], odev_rx_ind);
|
||||
}
|
||||
|
||||
if (err == RT_EOK && is_boot)
|
||||
{
|
||||
rt_kprintf("jump to app ...\n");
|
||||
@@ -553,9 +440,10 @@ _exit:
|
||||
return 0;
|
||||
}
|
||||
|
||||
_response_cmd(get_port, IAP_V5_CMD_UPDATE_FAILED);
|
||||
_response_cmd(get_port, IAP_V5_CMD_POWER_ON_AGAIN);
|
||||
_response_cmd(IAP_V5_CMD_UPDATE_FAILED);
|
||||
_response_cmd(IAP_V5_CMD_POWER_ON_AGAIN);
|
||||
|
||||
rt_device_set_rx_indicate(console_dev, odev_rx_ind);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -28,6 +28,13 @@
|
||||
.timerx = 2, \
|
||||
}
|
||||
|
||||
#define CAPTURE12_CONFIG \
|
||||
{ \
|
||||
.timer.Instance = TIM12, \
|
||||
.iqrn = TIM8_BRK_TIM12_IRQn, \
|
||||
.timerx = 12, \
|
||||
}
|
||||
|
||||
#define LOG_TAG "drv.tcap"
|
||||
#include <drv_log.h>
|
||||
|
||||
@@ -93,6 +100,12 @@ enum
|
||||
#ifdef BSP_USING_CAPTURE10
|
||||
CAPTURE10_INDEX,
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE11
|
||||
CAPTURE11_INDEX,
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE12
|
||||
CAPTURE12_INDEX,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct stm32_capture stm32_capture_obj[] =
|
||||
@@ -127,6 +140,12 @@ static struct stm32_capture stm32_capture_obj[] =
|
||||
#ifdef BSP_USING_CAPTURE10
|
||||
CAPTURE10_CONFIG,
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE11
|
||||
CAPTURE11_CONFIG,
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE12
|
||||
CAPTURE12_CONFIG,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct stm32_capture_device
|
||||
@@ -261,6 +280,12 @@ static struct stm32_capture_device stm32_capture_devices[] =
|
||||
#ifdef BSP_USING_CAPTURE10_CH4
|
||||
{{0}, &stm32_capture_obj[CAPTURE10_INDEX], 4, {0}},
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE12_CH1
|
||||
{{0}, &stm32_capture_obj[CAPTURE12_INDEX], 1, {0}},
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE12_CH2
|
||||
{{0}, &stm32_capture_obj[CAPTURE12_INDEX], 2, {0}},
|
||||
#endif
|
||||
};
|
||||
|
||||
static rt_uint64_t get_timer_clock(TIM_HandleTypeDef *htim)
|
||||
@@ -437,6 +462,15 @@ void TIM1_CC_IRQHandler(void)
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
void TIM8_BRK_TIM12_IRQHandler(void)
|
||||
{
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
HAL_TIM_IRQHandler(&stm32_capture_obj[CAPTURE12_INDEX].timer);
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
||||
{
|
||||
int i = 0;
|
||||
|
@@ -311,12 +311,12 @@
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<FileType>8</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>rt-thread\components\libc\cplusplus\cxx_crt_init.c</PathWithFileName>
|
||||
<FilenameWithoutPath>cxx_crt_init.c</FilenameWithoutPath>
|
||||
<PathWithFileName>rt-thread\components\libc\cplusplus\cxx_Semaphore.cpp</PathWithFileName>
|
||||
<FilenameWithoutPath>cxx_Semaphore.cpp</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@@ -327,18 +327,6 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>rt-thread\components\libc\cplusplus\cxx_Mutex.cpp</PathWithFileName>
|
||||
<FilenameWithoutPath>cxx_Mutex.cpp</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>8</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>rt-thread\components\libc\cplusplus\cxx_crt.cpp</PathWithFileName>
|
||||
<FilenameWithoutPath>cxx_crt.cpp</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -346,13 +334,25 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>8</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>rt-thread\components\libc\cplusplus\cxx_Semaphore.cpp</PathWithFileName>
|
||||
<FilenameWithoutPath>cxx_Semaphore.cpp</FilenameWithoutPath>
|
||||
<PathWithFileName>rt-thread\components\libc\cplusplus\cxx_Mutex.cpp</PathWithFileName>
|
||||
<FilenameWithoutPath>cxx_Mutex.cpp</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>rt-thread\components\libc\cplusplus\cxx_crt_init.c</PathWithFileName>
|
||||
<FilenameWithoutPath>cxx_crt_init.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@@ -744,7 +744,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>Fal</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
@@ -779,8 +779,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>rt-thread\components\fal\src\fal_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal_flash.c</FilenameWithoutPath>
|
||||
<PathWithFileName>rt-thread\components\fal\src\fal.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@@ -791,8 +791,8 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>rt-thread\components\fal\src\fal.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal.c</FilenameWithoutPath>
|
||||
<PathWithFileName>rt-thread\components\fal\src\fal_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal_flash.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
@@ -856,7 +856,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>IAP</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<TargetName>rt-thread</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
|
||||
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
@@ -54,7 +54,7 @@
|
||||
<CreateLib>1</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<BrowseInformation>0</BrowseInformation>
|
||||
<ListingPath>.\build\keil\List\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
@@ -434,14 +434,9 @@
|
||||
<FilePath>rt-thread\components\libc\cplusplus\cxx_Thread.cpp</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cxx_crt_init.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>rt-thread\components\libc\cplusplus\cxx_crt_init.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cxx_Mutex.cpp</FileName>
|
||||
<FileName>cxx_Semaphore.cpp</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>rt-thread\components\libc\cplusplus\cxx_Mutex.cpp</FilePath>
|
||||
<FilePath>rt-thread\components\libc\cplusplus\cxx_Semaphore.cpp</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cxx_crt.cpp</FileName>
|
||||
@@ -449,9 +444,14 @@
|
||||
<FilePath>rt-thread\components\libc\cplusplus\cxx_crt.cpp</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cxx_Semaphore.cpp</FileName>
|
||||
<FileName>cxx_Mutex.cpp</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>rt-thread\components\libc\cplusplus\cxx_Semaphore.cpp</FilePath>
|
||||
<FilePath>rt-thread\components\libc\cplusplus\cxx_Mutex.cpp</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cxx_crt_init.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>rt-thread\components\libc\cplusplus\cxx_crt_init.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
@@ -633,16 +633,16 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>rt-thread\components\fal\src\fal_partition.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>rt-thread\components\fal\src\fal_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>rt-thread\components\fal\src\fal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>rt-thread\components\fal\src\fal_flash.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@@ -189,6 +189,6 @@ void rt_hw_inputcapture_isr(struct rt_inputcapture_device *inputcapture, rt_bool
|
||||
{
|
||||
/* indicate to upper layer application */
|
||||
if (inputcapture->parent.rx_indicate != RT_NULL)
|
||||
inputcapture->parent.rx_indicate(&inputcapture->parent, receive_size);
|
||||
inputcapture->parent.rx_indicate(&inputcapture->parent, data.is_high);
|
||||
}
|
||||
}
|
||||
|
11
rtconfig.h
11
rtconfig.h
@@ -45,7 +45,7 @@
|
||||
#define RT_USING_DEVICE
|
||||
#define RT_USING_CONSOLE
|
||||
#define RT_CONSOLEBUF_SIZE 256
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart4"
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart8"
|
||||
#define RT_VER_NUM 0x50000
|
||||
#define ARCH_ARM
|
||||
#define RT_USING_CPU_FFS
|
||||
@@ -170,9 +170,6 @@
|
||||
/* u8g2: a monochrome graphic library */
|
||||
|
||||
|
||||
/* PainterEngine: A cross-platform graphics application framework written in C language */
|
||||
|
||||
|
||||
/* tools packages */
|
||||
|
||||
|
||||
@@ -222,7 +219,7 @@
|
||||
/* Arduino libraries */
|
||||
|
||||
|
||||
/* Projects */
|
||||
/* Projects and Demos */
|
||||
|
||||
|
||||
/* Sensors */
|
||||
@@ -247,6 +244,7 @@
|
||||
|
||||
/* Other */
|
||||
|
||||
|
||||
/* Signal IO */
|
||||
|
||||
|
||||
@@ -313,6 +311,9 @@
|
||||
#define BSP_USING_CAPTURE2
|
||||
#define BSP_USING_CAPTURE2_CH3
|
||||
#define BSP_USING_CAPTURE2_CH4
|
||||
#define BSP_USING_CAPTURE12
|
||||
#define BSP_USING_CAPTURE12_CH1
|
||||
#define BSP_USING_CAPTURE12_CH2
|
||||
#define BSP_USING_ADC
|
||||
#define BSP_USING_ADC1
|
||||
#define BSP_USING_ON_CHIP_FLASH
|
||||
|
Reference in New Issue
Block a user