mqttclient supports at framework and add gokit3 board demo...
This commit is contained in:
52
board/GoKit3_STM32F103C8T6/BSP/Inc/bsp_dwt.h
Normal file
52
board/GoKit3_STM32F103C8T6/BSP/Inc/bsp_dwt.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2020-02-15 20:51:38
|
||||
* @LastEditTime: 2020-02-16 00:07:34
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#ifndef _BSP_DWT_H
|
||||
#define _BSP_DWT_H
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
#define USE_DWT_DELAY 1 /* 使用dwt内核精确延时 */
|
||||
|
||||
#if USE_DWT_DELAY
|
||||
#define USE_TICK_DELAY 0 /* 不使用SysTick延时 */
|
||||
#else
|
||||
#define USE_TICK_DELAY 1 /* 使用SysTick延时 */
|
||||
#endif
|
||||
|
||||
#if USE_DWT_DELAY
|
||||
|
||||
/* 获取内核时钟频率 */
|
||||
#define get_cpu_clk_freq() (72000000U)
|
||||
#define system_clk_freq (72000000U)
|
||||
/* 为方便使用,在延时函数内部调用dwt_init函数初始化时间戳寄存器,
|
||||
这样每次调用函数都会初始化一遍。
|
||||
把本宏值设置为0,然后在main函数刚运行时调用dwt_init可避免每次都初始化 */
|
||||
|
||||
#define CPU_TS_INIT_IN_DELAY_FUNCTION 0
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* 函数声明
|
||||
******************************************************************************/
|
||||
uint32_t dwt_read(void);
|
||||
void dwt_init(void);
|
||||
|
||||
//使用以下函数前必须先调用dwt_init函数使能计数器,或使能宏CPU_TS_INIT_IN_DELAY_FUNCTION
|
||||
//最大延时值为60秒
|
||||
void dwt_delay_us(uint32_t us);
|
||||
#define dwt_delay_ms(ms) dwt_delay_us(ms*1000)
|
||||
#define dwt_delay_s(s) dwt_delay_ms(s*1000)
|
||||
|
||||
/* 最大延时 60s=2的32次方/72000000 */
|
||||
#define delay_ms(ms) dwt_delay_ms(ms)
|
||||
#define delay_us(us) dwt_delay_us(us)
|
||||
#define delay_s(s) dwt_delay_s(s)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _BSP_DWT_H */
|
23
board/GoKit3_STM32F103C8T6/BSP/Inc/bsp_init.h
Normal file
23
board/GoKit3_STM32F103C8T6/BSP/Inc/bsp_init.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2020-02-14 22:37:23
|
||||
* @LastEditTime : 2020-02-14 23:37:18
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#ifndef _BSP_INIT_H_
|
||||
#define _BSP_INIT_H_
|
||||
|
||||
#include "stm32f1xx.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "bsp_led.h"
|
||||
#include "bsp_dwt.h"
|
||||
#include "bsp_usart.h"
|
||||
#include "bsp_motor.h"
|
||||
|
||||
void bsp_init(void);
|
||||
void SystemClock_Config(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
34
board/GoKit3_STM32F103C8T6/BSP/Inc/bsp_led.h
Normal file
34
board/GoKit3_STM32F103C8T6/BSP/Inc/bsp_led.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2020-02-15 20:51:38
|
||||
* @LastEditTime : 2020-02-16 00:24:14
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#ifndef _BSP_LED_H
|
||||
#define _BSP_LED_H
|
||||
|
||||
#include "stm32f1xx_hal.h"
|
||||
|
||||
#define R_MAX 255
|
||||
#define G_MAX 255
|
||||
#define B_MAX 255
|
||||
|
||||
#define RGB_LED_CLK_PIN GPIO_PIN_8
|
||||
#define RGB_LED_CLK_GPIO_PORT GPIOB
|
||||
|
||||
#define RGB_LED_SDA_PIN GPIO_PIN_9
|
||||
#define RGB_LED_SDA_GPIO_PORT GPIOB
|
||||
|
||||
#define RGB_LED_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
|
||||
#define SCL_LOW HAL_GPIO_WritePin(RGB_LED_CLK_GPIO_PORT, RGB_LED_CLK_PIN, GPIO_PIN_RESET)
|
||||
#define SCL_HIGH HAL_GPIO_WritePin(RGB_LED_CLK_GPIO_PORT, RGB_LED_CLK_PIN, GPIO_PIN_SET)
|
||||
|
||||
#define SDA_LOW HAL_GPIO_WritePin(RGB_LED_SDA_GPIO_PORT, RGB_LED_SDA_PIN, GPIO_PIN_RESET)
|
||||
#define SDA_HIGH HAL_GPIO_WritePin(RGB_LED_SDA_GPIO_PORT, RGB_LED_SDA_PIN, GPIO_PIN_SET)
|
||||
|
||||
void rgb_led_init(void);
|
||||
void rgb_led_control(uint8_t r,uint8_t g,uint8_t b);
|
||||
|
||||
#endif /* _BSP_LED_H */
|
43
board/GoKit3_STM32F103C8T6/BSP/Inc/bsp_motor.h
Normal file
43
board/GoKit3_STM32F103C8T6/BSP/Inc/bsp_motor.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2020-02-16 00:02:40
|
||||
* @LastEditTime : 2020-02-16 00:31:10
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#ifndef _BSP_MOTOR_H
|
||||
#define _BSP_MOTOR_H
|
||||
|
||||
#include "stm32f1xx_hal.h"
|
||||
|
||||
#define MOTOR_FORWARD_PORT GPIOB
|
||||
#define MOTOR_FORWARD_PIN GPIO_PIN_4
|
||||
#define MOTOR_FORWARD_CHANNEL TIM_CHANNEL_1
|
||||
|
||||
|
||||
#define MOTOR_REVERSE_PORT GPIOB
|
||||
#define MOTOR_REVERSE_PIN GPIO_PIN_5
|
||||
#define MOTOR_REVERSE_CHANNEL TIM_CHANNEL_2
|
||||
|
||||
#define MOTOR_TIM TIM3
|
||||
#define MOTOR_TIM_RCC_CLK_ENABLE() __HAL_RCC_TIM3_CLK_ENABLE()
|
||||
#define MOTOR_TIM_AFIO_REMAP() __HAL_AFIO_REMAP_TIM3_PARTIAL()
|
||||
#define MOTOR_TIM_RCC_CLK_DISABLE() __HAL_RCC_TIM3_CLK_DISABLE()
|
||||
#define MOTOR_TIM_GPIO_RCC_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
|
||||
//72M/72=1M<31>ļ<EFBFBD><C4BC><EFBFBD>Ƶ<EFBFBD>ʣ<EFBFBD><CAA3>Զ<EFBFBD><D4B6><EFBFBD>װ<EFBFBD><D7B0>Ϊ500<30><30><EFBFBD><EFBFBD>ôPWMƵ<4D><C6B5>Ϊ1M/250=4kHZ
|
||||
#define MOTOR_PRESCALER 71 //<2F><>ʱ<EFBFBD><CAB1>Ԥ<EFBFBD><D4A4>Ƶ
|
||||
#define MOTOR_PERIOD 249 // <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>װ<EFBFBD><D7B0>ֵ
|
||||
|
||||
#define MOTOR_MAX_DUTY 100 // <20><><EFBFBD><EFBFBD>ռ<EFBFBD>ձ<EFBFBD>
|
||||
|
||||
typedef enum motor_mode {
|
||||
MOTOR_STOP = 0,
|
||||
MOTOR_FORWARD = 1,
|
||||
MOTOR_REVERSE = 2
|
||||
} motor_mode_t;
|
||||
|
||||
void motor_init(void);
|
||||
void motor_set_speed(motor_mode_t s, uint8_t pwm);
|
||||
|
||||
#endif /* _BSP_MOTOR_H */
|
57
board/GoKit3_STM32F103C8T6/BSP/Inc/bsp_usart.h
Normal file
57
board/GoKit3_STM32F103C8T6/BSP/Inc/bsp_usart.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef __USART_H
|
||||
#define __USART_H
|
||||
|
||||
#include "stm32f1xx.h"
|
||||
#include <stdio.h>
|
||||
|
||||
//<2F><><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define DEBUG_USART_BAUDRATE 115200
|
||||
|
||||
//<2F><><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
||||
/*******************************************************/
|
||||
#define DEBUG_USART USART1
|
||||
#define DEBUG_USART_CLK_ENABLE() __HAL_RCC_USART1_CLK_ENABLE();
|
||||
|
||||
#define DEBUG_USART_RX_GPIO_PORT GPIOA
|
||||
#define DEBUG_USART_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define DEBUG_USART_RX_PIN GPIO_PIN_10
|
||||
|
||||
#define DEBUG_USART_TX_GPIO_PORT GPIOA
|
||||
#define DEBUG_USART_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define DEBUG_USART_TX_PIN GPIO_PIN_9
|
||||
|
||||
#define DEBUG_USART_IRQHandler USART1_IRQHandler
|
||||
#define DEBUG_USART_IRQ USART1_IRQn
|
||||
/************************************************************/
|
||||
|
||||
|
||||
//<2F><><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define WIFI_USART_BAUDRATE 115200
|
||||
|
||||
//<2F><><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
||||
/*******************************************************/
|
||||
#define WIFI_USART USART2
|
||||
#define WIFI_USART_CLK_ENABLE() __HAL_RCC_USART2_CLK_ENABLE();
|
||||
|
||||
#define WIFI_USART_RX_GPIO_PORT GPIOA
|
||||
#define WIFI_USART_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define WIFI_USART_RX_PIN GPIO_PIN_3
|
||||
|
||||
#define WIFI_USART_TX_GPIO_PORT GPIOA
|
||||
#define WIFI_USART_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define WIFI_USART_TX_PIN GPIO_PIN_2
|
||||
|
||||
#define WIFI_USART_IRQHandler USART2_IRQHandler
|
||||
#define WIFI_USART_IRQ USART2_IRQn
|
||||
/************************************************************/
|
||||
|
||||
void wifi_usart_init(void);
|
||||
void debug_usart_init(void);
|
||||
void usart_send_string(UART_HandleTypeDef *huart, uint8_t *str);
|
||||
int fputc(int ch, FILE *f);
|
||||
int fgetc(FILE *f);
|
||||
|
||||
extern UART_HandleTypeDef debug_usart;
|
||||
extern UART_HandleTypeDef wifi_usart;
|
||||
|
||||
#endif /* __USART_H */
|
@@ -63,7 +63,7 @@
|
||||
/*#define HAL_SMARTCARD_MODULE_ENABLED */
|
||||
/*#define HAL_SPI_MODULE_ENABLED */
|
||||
/*#define HAL_SRAM_MODULE_ENABLED */
|
||||
/*#define HAL_TIM_MODULE_ENABLED */
|
||||
#define HAL_TIM_MODULE_ENABLED
|
||||
#define HAL_UART_MODULE_ENABLED
|
||||
/*#define HAL_USART_MODULE_ENABLED */
|
||||
/*#define HAL_WWDG_MODULE_ENABLED */
|
||||
|
460
board/GoKit3_STM32F103C8T6/BSP/Inc/tos_at.h
Normal file
460
board/GoKit3_STM32F103C8T6/BSP/Inc/tos_at.h
Normal file
@@ -0,0 +1,460 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _TOS_AT_H_
|
||||
#define _TOS_AT_H_
|
||||
|
||||
#include "tos_k.h"
|
||||
#include "tos_at_utils.h"
|
||||
#include "tos_hal.h"
|
||||
|
||||
#define AT_AGENT_ECHO_OK "OK"
|
||||
#define AT_AGENT_ECHO_FAIL "FAIL"
|
||||
#define AT_AGENT_ECHO_ERROR "ERROR"
|
||||
|
||||
#define AT_DATA_CHANNEL_NUM 1
|
||||
#define AT_DATA_CHANNEL_FIFO_BUFFER_SIZE (0 + 1024)
|
||||
|
||||
#define AT_UART_RX_FIFO_BUFFER_SIZE (0 + 1024)
|
||||
#define AT_RECV_CACHE_SIZE 1024
|
||||
|
||||
#define AT_CMD_BUFFER_SIZE 512
|
||||
|
||||
#define AT_PARSER_TASK_STACK_SIZE 1024
|
||||
#define AT_PARSER_TASK_PRIO 2
|
||||
|
||||
typedef enum at_status_en {
|
||||
AT_STATUS_OK,
|
||||
AT_STATUS_ERROR,
|
||||
AT_STATUS_INVALID_ARGS,
|
||||
} at_status_t;
|
||||
|
||||
typedef struct at_cache_st {
|
||||
uint8_t *buffer;
|
||||
size_t buffer_size;
|
||||
size_t recv_len;
|
||||
} at_cache_t;
|
||||
|
||||
typedef enum at_parse_status_en {
|
||||
AT_PARSE_STATUS_NONE,
|
||||
AT_PARSE_STATUS_NEWLINE,
|
||||
AT_PARSE_STATUS_EVENT,
|
||||
AT_PARSE_STATUS_EXPECT,
|
||||
AT_PARSE_STATUS_OVERFLOW,
|
||||
} at_parse_status_t;
|
||||
|
||||
typedef enum at_echo_status_en {
|
||||
AT_ECHO_STATUS_NONE,
|
||||
AT_ECHO_STATUS_OK,
|
||||
AT_ECHO_STATUS_FAIL,
|
||||
AT_ECHO_STATUS_ERROR,
|
||||
AT_ECHO_STATUS_EXPECT,
|
||||
} at_echo_status_t;
|
||||
|
||||
typedef enum at_channel_status_en {
|
||||
AT_CHANNEL_STATUS_NONE, /*< usually means we are try to get a channel status with invalid id */
|
||||
AT_CHANNEL_STATUS_HANGING, /*< channel is not used */
|
||||
AT_CHANNEL_STATUS_WORKING, /*< channel is being using */
|
||||
AT_CHANNEL_STATUS_BROKEN, /*< channel is broken(module link to remote server is broken) */
|
||||
} at_channel_status_t;
|
||||
|
||||
typedef struct at_data_channel_st {
|
||||
uint8_t is_free;
|
||||
k_chr_fifo_t rx_fifo;
|
||||
uint8_t *rx_fifo_buffer;
|
||||
k_mutex_t rx_lock;
|
||||
|
||||
at_channel_status_t status;
|
||||
|
||||
const char *remote_ip;
|
||||
const char *remote_port;
|
||||
} at_data_channel_t;
|
||||
|
||||
typedef struct at_echo_st {
|
||||
char *buffer;
|
||||
size_t buffer_size;
|
||||
char *echo_expect;
|
||||
int line_num;
|
||||
at_echo_status_t status;
|
||||
size_t __w_idx;
|
||||
int __is_expecting;
|
||||
k_sem_t __expect_notify;
|
||||
} at_echo_t;
|
||||
|
||||
typedef void (*at_event_callback_t)(void);
|
||||
|
||||
typedef struct at_event_st {
|
||||
const char *event_header;
|
||||
at_event_callback_t event_callback;
|
||||
} at_event_t;
|
||||
|
||||
typedef struct at_agent_st {
|
||||
at_data_channel_t data_channel[AT_DATA_CHANNEL_NUM];
|
||||
|
||||
at_event_t *event_table;
|
||||
size_t event_table_size;
|
||||
|
||||
at_echo_t *echo;
|
||||
|
||||
k_task_t parser;
|
||||
at_cache_t recv_cache;
|
||||
|
||||
at_timer_t timer;
|
||||
|
||||
k_mutex_t global_lock;
|
||||
|
||||
char *cmd_buf;
|
||||
k_mutex_t cmd_buf_lock;
|
||||
|
||||
hal_uart_t uart;
|
||||
k_mutex_t uart_tx_lock;
|
||||
k_mutex_t uart_rx_lock;
|
||||
k_sem_t uart_rx_sem;
|
||||
k_chr_fifo_t uart_rx_fifo;
|
||||
uint8_t *uart_rx_fifo_buffer;
|
||||
} at_agent_t;
|
||||
|
||||
#define AT_AGENT ((at_agent_t *)(&at_agent))
|
||||
|
||||
/**
|
||||
* @brief Write data to a channel.
|
||||
* Write data to a channel with certain id.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] channel_id id of the channel.
|
||||
* @param[in] buffer data buffer to write.
|
||||
* @param[in] buffer_len length of the buffer.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 write failed(error).
|
||||
* @retval none -1 the number of bytes written.
|
||||
*/
|
||||
__API__ int tos_at_channel_write(int channel_id, uint8_t *buffer, size_t buffer_len);
|
||||
|
||||
/**
|
||||
* @brief Read data from a channel.
|
||||
* Read data from a channel with a timeout.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] channel_id id of the channel.
|
||||
* @param[out] buffer buffer to hold the data read.
|
||||
* @param[in] buffer_len length of the buffer.
|
||||
* @param[in] timeout timeout.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 read failed(error).
|
||||
* @retval none -1 the number of bytes read.
|
||||
*/
|
||||
__API__ int tos_at_channel_read_timed(int channel_id, uint8_t *buffer, size_t buffer_len, uint32_t timeout);
|
||||
|
||||
/**
|
||||
* @brief Read data from a channel.
|
||||
* Read data from a channel.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] channel_id id of the channel.
|
||||
* @param[out] buffer buffer to hold the data read.
|
||||
* @param[in] buffer_len length of the buffer.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 read failed(error).
|
||||
* @retval none -1 the number of bytes read.
|
||||
*/
|
||||
__API__ int tos_at_channel_read(int channel_id, uint8_t *buffer, size_t buffer_len);
|
||||
|
||||
/**
|
||||
* @brief Allocate a channel.
|
||||
* Allocate a channel with certain id.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] channel_id id of the channel.
|
||||
* @param[in] ip remote ip of the channel.
|
||||
* @param[in] port remote port of the channel.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 allocate failed(error).
|
||||
* @retval none -1 the id of the channel.
|
||||
*/
|
||||
__API__ int tos_at_channel_alloc_id(int channel_id, const char *ip, const char *port);
|
||||
|
||||
/**
|
||||
* @brief Allocate a channel.
|
||||
* Allocate a channel.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] ip remote ip of the channel.
|
||||
* @param[in] port remote port of the channel.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 allocate failed(error).
|
||||
* @retval none -1 the id of the channel.
|
||||
*/
|
||||
__API__ int tos_at_channel_alloc(const char *ip, const char *port);
|
||||
|
||||
/**
|
||||
* @brief Free a channel.
|
||||
* Free a channel with certain id.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] channel_id id of the channel.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 free failed(error).
|
||||
* @retval 0 free successfully.
|
||||
*/
|
||||
__API__ int tos_at_channel_free(int channel_id);
|
||||
|
||||
/**
|
||||
* @brief Set channel broken.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] channel_id id of the channel.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 set failed(error).
|
||||
* @retval 0 set successfully.
|
||||
*/
|
||||
__API__ int tos_at_channel_set_broken(int channel_id);
|
||||
|
||||
/**
|
||||
* @brief Judge whether channel is working.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] channel_id id of the channel.
|
||||
*
|
||||
* @return at channel status(type of at_channel_status_t)
|
||||
*/
|
||||
__API__ int tos_at_channel_is_working(int channel_id);
|
||||
|
||||
/**
|
||||
* @brief Initialize the at framework.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] uart_port port number of the uart thougth which the module connect to the MCU.
|
||||
* @param[in] event_table the listened event table.
|
||||
* @param[in] event_table_size the size of the listened event table.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 initialize failed(error).
|
||||
* @retval 0 initialize successfully.
|
||||
*/
|
||||
__API__ int tos_at_init(hal_uart_port_t uart_port, at_event_t *event_table, size_t event_table_size);
|
||||
|
||||
/**
|
||||
* @brief De-initialize the at framework.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @return
|
||||
None
|
||||
*/
|
||||
__API__ void tos_at_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Create a echo struct.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] echo pointer to the echo struct.
|
||||
* @param[out] buffer buffer to hold the received message from the module.
|
||||
* @param[in] buffer_size size of the buffer.
|
||||
* @param[in] echo_expect the expected echo message.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 create failed(error).
|
||||
* @retval 0 create successfully.
|
||||
*/
|
||||
__API__ int tos_at_echo_create(at_echo_t *echo, char *buffer, size_t buffer_size, char *echo_expect);
|
||||
|
||||
/**
|
||||
* @brief Execute an at command.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] echo pointer to the echo struct.
|
||||
* @param[in] timeout command wait timeout .
|
||||
* @param[in] cmd at command.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 execute failed(error).
|
||||
* @retval 0 execute successfully.
|
||||
*/
|
||||
__API__ int tos_at_cmd_exec(at_echo_t *echo, uint32_t timeout, const char *cmd, ...);
|
||||
|
||||
/**
|
||||
* @brief Execute an at command.
|
||||
* Execute an at command and wait until the expected echo message received or timeout.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] echo pointer to the echo struct.
|
||||
* @param[in] timeout command wait timeout .
|
||||
* @param[in] cmd at command.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 execute failed(error).
|
||||
* @retval 0 execute successfully.
|
||||
*/
|
||||
__API__ int tos_at_cmd_exec_until(at_echo_t *echo, uint32_t timeout, const char *cmd, ...);
|
||||
|
||||
/**
|
||||
* @brief Send raw data througth uart.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] echo pointer to the echo struct.
|
||||
* @param[in] timeout command wait timeout .
|
||||
* @param[in] buf data to send.
|
||||
* @param[in] size size of the buf.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 execute failed(error).
|
||||
* @retval 0 execute successfully.
|
||||
*/
|
||||
__API__ int tos_at_raw_data_send(at_echo_t *echo, uint32_t timeout, const uint8_t *buf, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Send raw data througth uart.
|
||||
* Send raw data througth uart and wait until the expected echo message received or timeout.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] echo pointer to the echo struct.
|
||||
* @param[in] timeout command wait timeout .
|
||||
* @param[in] buf data to send.
|
||||
* @param[in] size size of the buf.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 execute failed(error).
|
||||
* @retval 0 execute successfully.
|
||||
*/
|
||||
__API__ int tos_at_raw_data_send_until(at_echo_t *echo, uint32_t timeout, const uint8_t *buf, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Write byte to the at uart.
|
||||
* The function called by the uart interrupt, to put the data from the uart to the at framework.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] data uart received data.
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
__API__ void tos_at_uart_input_byte(uint8_t data);
|
||||
|
||||
/**
|
||||
* @brief A global lock provided by at framework.
|
||||
* The lock usually used to make a atomic function.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 pend failed(error).
|
||||
* @retval 0 pend successfully.
|
||||
*/
|
||||
__API__ int tos_at_global_lock_pend(void);
|
||||
|
||||
/**
|
||||
* @brief A global lock provided by at framework.
|
||||
* The lock usually used to make a atomic function.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval -1 post failed(error).
|
||||
* @retval 0 post successfully.
|
||||
*/
|
||||
__API__ int tos_at_global_lock_post(void);
|
||||
|
||||
/**
|
||||
* @brief Read data from the uart.
|
||||
* Read data from the uart, usually called in listened event callback.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[out] buffer buffer to hold the data read from the uart.
|
||||
* @param[in] buffer_len length of the buffer.
|
||||
*
|
||||
* @return length of the data read from the uart.
|
||||
*/
|
||||
__API__ int tos_at_uart_read(uint8_t *buffer, size_t buffer_len);
|
||||
|
||||
/**
|
||||
* @brief Read data from the uart.
|
||||
* Read data from the uart until meet a '\n', usually called in listened event callback.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[out] buffer buffer to hold the data read from the uart.
|
||||
* @param[in] buffer_len length of the buffer.
|
||||
*
|
||||
* @return length of the data read from the uart.
|
||||
*/
|
||||
__API__ int tos_at_uart_readline(uint8_t *buffer, size_t buffer_len);
|
||||
|
||||
/**
|
||||
* @brief Read data from the uart.
|
||||
* Read data from the uart until no more incoming data, usually called in listened event callback.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[out] buffer buffer to hold the data read from the uart.
|
||||
* @param[in] buffer_len length of the buffer.
|
||||
*
|
||||
* @return length of the data read from the uart.
|
||||
*/
|
||||
__API__ int tos_at_uart_drain(uint8_t *buffer, size_t buffer_len);
|
||||
|
||||
/**
|
||||
* @brief Get the remote ip of a channel.
|
||||
* Get the remote ip of a channel with certain id.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] channel_id id of the channel.
|
||||
*
|
||||
* @return remote ip of the channel.
|
||||
*/
|
||||
__API__ const char *tos_at_agent_channel_ip_get(int channel_id);
|
||||
|
||||
/**
|
||||
* @brief Get the remote port of a channel.
|
||||
* Get the remote port of a channel with certain id.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] channel_id id of the channel.
|
||||
*
|
||||
* @return remote port of the channel.
|
||||
*/
|
||||
__API__ const char *tos_at_agent_channel_port_get(int channel_id);
|
||||
|
||||
#endif /* __AT_AGENT_H_ */
|
||||
|
23
board/GoKit3_STM32F103C8T6/BSP/Inc/tos_at_utils.h
Normal file
23
board/GoKit3_STM32F103C8T6/BSP/Inc/tos_at_utils.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _TOS_AT_UTILS_H_
|
||||
#define _TOS_AT_UTILS_H_
|
||||
|
||||
typedef struct at_timer_st {
|
||||
k_tick_t end_time;
|
||||
} at_timer_t;
|
||||
|
||||
void at_delay(k_tick_t tick);
|
||||
|
||||
void at_delay_ms(uint32_t millisec);
|
||||
|
||||
int at_timer_is_expired(at_timer_t *tmr);
|
||||
|
||||
void at_timer_countdown(at_timer_t *tmr, k_tick_t tick);
|
||||
|
||||
void at_timer_countdown_ms(at_timer_t *tmr, uint32_t millisec);
|
||||
|
||||
k_tick_t at_timer_remain(at_timer_t *tmr);
|
||||
|
||||
void at_timer_init(at_timer_t *tmr);
|
||||
|
||||
#endif
|
||||
|
129
board/GoKit3_STM32F103C8T6/BSP/Src/bsp_dwt.c
Normal file
129
board/GoKit3_STM32F103C8T6/BSP/Src/bsp_dwt.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2020-02-15 20:51:38
|
||||
* @LastEditTime : 2020-02-16 00:06:40
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
|
||||
#include "bsp_dwt.h"
|
||||
#include "stm32f1xx_hal.h"
|
||||
/*
|
||||
**********************************************************************
|
||||
* ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؼĴ<D8BC><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
**********************************************************************
|
||||
*/
|
||||
/*
|
||||
<20><>Cortex-M<><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DWT(Data Watchpoint and Trace)<29><>
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>32λ<32>ļĴ<C4BC><C4B4><EFBFBD><EFBFBD><EFBFBD>CYCCNT<4E><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ϵļ<CFB5><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>еĸ<D0B5><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD>¼<EFBFBD><C2BC>ʱ<EFBFBD><CAB1>Ϊ<EFBFBD><CEAA>
|
||||
60s=2<><32>32<33>η<EFBFBD>/72000000
|
||||
(<28><><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD>Ƶ<EFBFBD><C6B5>Ϊ72M<32><4D><EFBFBD>ں<EFBFBD><DABA><EFBFBD>һ<EFBFBD>ε<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1/72M=13.8ns)
|
||||
<20><>CYCCNT<4E><54><EFBFBD><EFBFBD>֮<EFBFBD><EFBFBD><F3A3ACBB><EFBFBD>0<EFBFBD><30><EFBFBD>¿<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>
|
||||
ʹ<><CAB9>CYCCNT<4E><54><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>裺
|
||||
1<><31><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>DWT<57><54><EFBFBD>裬<EFBFBD><E8A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ں˵<DABA><CBB5>ԼĴ<D4BC><C4B4><EFBFBD>DEMCR<43><52>λ24<32><34><EFBFBD>ƣ<EFBFBD>д1ʹ<31><CAB9>
|
||||
2<><32>ʹ<EFBFBD><CAB9>CYCCNT<4E>Ĵ<EFBFBD><C4B4><EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0
|
||||
3<><33>ʹ<EFBFBD><CAB9>CYCCNT<4E>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DWT_CTRL(<28><><EFBFBD><EFBFBD><EFBFBD>Ϻ궨<CFBA><EAB6A8>ΪDWT_CR)<29><>λ0<CEBB><30><EFBFBD>ƣ<EFBFBD>д1ʹ<31><CAB9>
|
||||
*/
|
||||
|
||||
#if USE_DWT_DELAY
|
||||
|
||||
|
||||
#define DWT_CR *(__IO uint32_t *)0xE0001000
|
||||
#define DWT_CYCCNT *(__IO uint32_t *)0xE0001004
|
||||
#define DEM_CR *(__IO uint32_t *)0xE000EDFC
|
||||
|
||||
|
||||
#define DEM_CR_TRCENA (1 << 24)
|
||||
#define DWT_CR_CYCCNTENA (1 << 0)
|
||||
|
||||
|
||||
/**
|
||||
* @brief <20><>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||
* @param <20><>
|
||||
* @retval <20><>
|
||||
* @note ʹ<><CAB9><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
void dwt_init(void)
|
||||
{
|
||||
/* ʹ<><CAB9>DWT<57><54><EFBFBD><EFBFBD> */
|
||||
DEM_CR |= (uint32_t)DEM_CR_TRCENA;
|
||||
|
||||
/* DWT CYCCNT<4E>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0 */
|
||||
DWT_CYCCNT = (uint32_t)0u;
|
||||
|
||||
/* ʹ<><CAB9>Cortex-M DWT CYCCNT<4E>Ĵ<EFBFBD><C4B4><EFBFBD> */
|
||||
DWT_CR |= (uint32_t)DWT_CR_CYCCNTENA;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief <20><>ȡ<EFBFBD><C8A1>ǰʱ<C7B0><CAB1><EFBFBD><EFBFBD>
|
||||
* @param <20><>
|
||||
* @retval <20><>ǰʱ<C7B0><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DWT_CYCCNT<4E>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
*/
|
||||
uint32_t dwt_read(void)
|
||||
{
|
||||
return ((uint32_t)DWT_CYCCNT);
|
||||
}
|
||||
|
||||
///**
|
||||
// * @brief <20><>ȡ<EFBFBD><C8A1>ǰʱ<C7B0><CAB1><EFBFBD><EFBFBD>
|
||||
// * @param <20><>
|
||||
// * @retval <20><>ǰʱ<C7B0><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DWT_CYCCNT<4E>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
// * <09>˴<EFBFBD><CBB4><EFBFBD>HAL<41><4C><EFBFBD>滻HAL_GetTick<63><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>os
|
||||
// */
|
||||
//uint32_t HAL_GetTick(void)
|
||||
//{
|
||||
// //<2F>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
||||
// return ((uint32_t)DWT_CYCCNT / system_clk_freq * 1000);
|
||||
//}
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD>CPU<50><55><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>־<EFBFBD>ȷ<EFBFBD><C8B7>ʱ<EFBFBD><CAB1>32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* @param us : <20>ӳٳ<D3B3><D9B3>ȣ<EFBFBD><C8A3><EFBFBD>λ1 us
|
||||
* @retval <20><>
|
||||
* @note ʹ<>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD>dwt_init<69><74><EFBFBD><EFBFBD>ʹ<EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<20><>ʹ<EFBFBD>ܺ<EFBFBD>CPU_TS_INIT_IN_DELAY_FUNCTION
|
||||
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱֵΪ8<CEAA>룬<EFBFBD><EBA3AC>8*1000*1000
|
||||
*/
|
||||
void dwt_delay_us(__IO uint32_t us)
|
||||
{
|
||||
uint32_t ticks;
|
||||
uint32_t told,tnow,tcnt=0;
|
||||
|
||||
/* <20>ں<EFBFBD><DABA><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD> */
|
||||
#if (CPU_TS_INIT_IN_DELAY_FUNCTION)
|
||||
/* <20><>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
dwt_init();
|
||||
#endif
|
||||
|
||||
ticks = us * (get_cpu_clk_freq() / 1000000); /* <20><>Ҫ<EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
tcnt = 0;
|
||||
told = (uint32_t)dwt_read(); /* <20>ս<EFBFBD><D5BD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ֵ */
|
||||
|
||||
while(1)
|
||||
{
|
||||
tnow = (uint32_t)dwt_read();
|
||||
if(tnow != told)
|
||||
{
|
||||
/* 32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
if(tnow > told)
|
||||
{
|
||||
tcnt += tnow - told;
|
||||
}
|
||||
/* <20><><EFBFBD><EFBFBD>װ<EFBFBD><D7B0> */
|
||||
else
|
||||
{
|
||||
tcnt += UINT32_MAX - told + tnow;
|
||||
}
|
||||
|
||||
told = tnow;
|
||||
|
||||
/*ʱ<>䳬<EFBFBD><E4B3AC>/<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD>ӳٵ<D3B3>ʱ<EFBFBD><CAB1>,<2C><><EFBFBD>˳<EFBFBD> */
|
||||
if(tcnt >= ticks)break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
56
board/GoKit3_STM32F103C8T6/BSP/Src/bsp_init.c
Normal file
56
board/GoKit3_STM32F103C8T6/BSP/Src/bsp_init.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2020-02-15 20:51:14
|
||||
* @LastEditTime: 2020-02-16 00:08:19
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#include "bsp_init.h"
|
||||
|
||||
static void system_clock_init(void)
|
||||
{
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
while(1);
|
||||
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|
||||
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
|
||||
while(1);
|
||||
|
||||
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
|
||||
|
||||
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
|
||||
|
||||
/* SysTick_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
|
||||
}
|
||||
|
||||
void bsp_init(void)
|
||||
{
|
||||
HAL_Init();
|
||||
|
||||
system_clock_init();
|
||||
|
||||
dwt_init();
|
||||
|
||||
debug_usart_init();
|
||||
|
||||
rgb_led_init();
|
||||
|
||||
motor_init();
|
||||
|
||||
}
|
||||
|
113
board/GoKit3_STM32F103C8T6/BSP/Src/bsp_led.c
Normal file
113
board/GoKit3_STM32F103C8T6/BSP/Src/bsp_led.c
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2020-02-15 20:51:38
|
||||
* @LastEditTime : 2020-02-16 00:05:59
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#include "bsp_led.h"
|
||||
#include "bsp_dwt.h"
|
||||
|
||||
|
||||
void clk_produce(void)
|
||||
{
|
||||
SCL_LOW; // SCL=0
|
||||
delay_us(50);
|
||||
|
||||
SCL_HIGH; // SCL=1
|
||||
delay_us(50);
|
||||
}
|
||||
|
||||
|
||||
void send_32bit_zero(void)
|
||||
{
|
||||
unsigned char i;
|
||||
SDA_LOW; // SDA=0
|
||||
for (i=0; i<32; i++)
|
||||
{
|
||||
clk_produce();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8_t take_anti_code(uint8_t dat)
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
|
||||
tmp=((~dat) & 0xC0)>>6;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
void send_data(uint32_t dx)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i=0; i<32; i++)
|
||||
{
|
||||
if ((dx & 0x80000000) != 0)
|
||||
SDA_HIGH; // SDA=1;
|
||||
else
|
||||
SDA_LOW; // SDA=0;
|
||||
|
||||
dx <<= 1;
|
||||
clk_produce();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void data_deal_with_send(uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
uint32_t dx = 0;
|
||||
|
||||
dx |= (uint32_t)0x03 << 30; // The front of the two bits 1 is flag bits
|
||||
dx |= (uint32_t)take_anti_code(b) << 28;
|
||||
dx |= (uint32_t)take_anti_code(g) << 26;
|
||||
dx |= (uint32_t)take_anti_code(r) << 24;
|
||||
|
||||
dx |= (uint32_t)b << 16;
|
||||
dx |= (uint32_t)g << 8;
|
||||
dx |= r;
|
||||
|
||||
send_data(dx);
|
||||
}
|
||||
|
||||
void rgb_led_init(void)
|
||||
{
|
||||
/*<2A><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>GPIO_InitTypeDef<65><66><EFBFBD>͵Ľṹ<C4BD><E1B9B9>*/
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
RGB_LED_GPIO_CLK_ENABLE();
|
||||
|
||||
/*ѡ<><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD>Ƶ<EFBFBD>GPIO<49><4F><EFBFBD><EFBFBD>*/
|
||||
GPIO_InitStruct.Pin = RGB_LED_CLK_PIN;
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>ģʽ*/
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD> */
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
|
||||
/*<2A><><EFBFBD>ÿ⺯<C3BF><E2BAAF><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>GPIO_InitStructure<72><65>ʼ<EFBFBD><CABC>GPIO*/
|
||||
HAL_GPIO_Init(RGB_LED_CLK_GPIO_PORT, &GPIO_InitStruct);
|
||||
|
||||
/*ѡ<><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD>Ƶ<EFBFBD>GPIO<49><4F><EFBFBD><EFBFBD>*/
|
||||
GPIO_InitStruct.Pin = RGB_LED_SDA_PIN;
|
||||
HAL_GPIO_Init(RGB_LED_SDA_GPIO_PORT, &GPIO_InitStruct);
|
||||
|
||||
send_32bit_zero();
|
||||
data_deal_with_send(0,0,0);
|
||||
data_deal_with_send(0,0,0);
|
||||
}
|
||||
|
||||
void rgb_led_control(uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
send_32bit_zero();
|
||||
data_deal_with_send(r, g, b);
|
||||
data_deal_with_send(r, g, b);
|
||||
}
|
||||
|
||||
/*********************************************END OF FILE**********************/
|
103
board/GoKit3_STM32F103C8T6/BSP/Src/bsp_motor.c
Normal file
103
board/GoKit3_STM32F103C8T6/BSP/Src/bsp_motor.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2020-02-16 00:02:40
|
||||
* @LastEditTime : 2020-02-16 00:23:28
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#include "bsp_motor.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
TIM_HandleTypeDef motor_tim;
|
||||
|
||||
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
|
||||
{
|
||||
MOTOR_TIM_RCC_CLK_ENABLE();
|
||||
}
|
||||
|
||||
static void motor_control(uint32_t m1, uint32_t m2)
|
||||
{
|
||||
if (m1 >= MOTOR_PERIOD)
|
||||
m1 = MOTOR_PERIOD;
|
||||
|
||||
if (m2 > MOTOR_PERIOD)
|
||||
m2 = MOTOR_PERIOD;
|
||||
|
||||
__HAL_TIM_SET_COMPARE(&motor_tim, MOTOR_FORWARD_CHANNEL, m1);
|
||||
__HAL_TIM_SET_COMPARE(&motor_tim, MOTOR_REVERSE_CHANNEL, m2);
|
||||
}
|
||||
|
||||
void motor_set_speed(motor_mode_t s, uint8_t pwm)
|
||||
{
|
||||
uint32_t pulse;
|
||||
|
||||
if (pwm > MOTOR_MAX_DUTY)
|
||||
pwm = MOTOR_MAX_DUTY;
|
||||
|
||||
pulse = (pwm * MOTOR_PERIOD) / MOTOR_MAX_DUTY;
|
||||
|
||||
if (MOTOR_STOP == s)
|
||||
motor_control(0, 0);
|
||||
else if (MOTOR_FORWARD == s)
|
||||
motor_control(pulse, 0);
|
||||
else
|
||||
motor_control(0, pulse);
|
||||
}
|
||||
|
||||
static void Error_Handler(void)
|
||||
{
|
||||
while(1);
|
||||
}
|
||||
|
||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_init;
|
||||
|
||||
if(htim->Instance == MOTOR_TIM) {
|
||||
|
||||
MOTOR_TIM_GPIO_RCC_CLK_ENABLE();
|
||||
MOTOR_TIM_AFIO_REMAP();
|
||||
|
||||
gpio_init.Pin = MOTOR_FORWARD_PIN | MOTOR_REVERSE_PIN;
|
||||
gpio_init.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_init.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(GPIOB, &gpio_init);
|
||||
}
|
||||
}
|
||||
|
||||
void motor_init(void)
|
||||
{
|
||||
TIM_OC_InitTypeDef oc_init;
|
||||
|
||||
motor_tim.Instance = MOTOR_TIM;
|
||||
motor_tim.Init.Prescaler = MOTOR_PRESCALER;
|
||||
motor_tim.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
motor_tim.Init.Period = MOTOR_PERIOD;
|
||||
motor_tim.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
|
||||
if (HAL_TIM_Base_Init(&motor_tim) != HAL_OK)
|
||||
Error_Handler();
|
||||
|
||||
HAL_TIM_Base_Start(&motor_tim);
|
||||
|
||||
if (HAL_TIM_PWM_Init(&motor_tim) != HAL_OK)
|
||||
Error_Handler();
|
||||
|
||||
HAL_TIM_MspPostInit(&motor_tim);
|
||||
|
||||
oc_init.OCMode = TIM_OCMODE_PWM1;
|
||||
oc_init.Pulse = MOTOR_PERIOD;
|
||||
oc_init.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
|
||||
if (HAL_TIM_PWM_ConfigChannel(&motor_tim, &oc_init, MOTOR_FORWARD_CHANNEL) != HAL_OK)
|
||||
Error_Handler();
|
||||
|
||||
if (HAL_TIM_PWM_ConfigChannel(&motor_tim, &oc_init, MOTOR_REVERSE_CHANNEL) != HAL_OK)
|
||||
Error_Handler();
|
||||
|
||||
HAL_TIM_PWM_Start(&motor_tim, MOTOR_FORWARD_CHANNEL);//<2F><><EFBFBD><EFBFBD>PWMͨ<4D><CDA8>1
|
||||
HAL_TIM_PWM_Start(&motor_tim, MOTOR_REVERSE_CHANNEL);//<2F><><EFBFBD><EFBFBD>PWMͨ<4D><CDA8>2
|
||||
|
||||
motor_set_speed(MOTOR_STOP, 0);
|
||||
}
|
144
board/GoKit3_STM32F103C8T6/BSP/Src/bsp_usart.c
Normal file
144
board/GoKit3_STM32F103C8T6/BSP/Src/bsp_usart.c
Normal file
@@ -0,0 +1,144 @@
|
||||
#include "bsp_usart.h"
|
||||
|
||||
UART_HandleTypeDef debug_usart;
|
||||
UART_HandleTypeDef wifi_usart;
|
||||
|
||||
/**
|
||||
* @brief DEBUG_USART GPIO <20><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ģʽ<C4A3><CABD><EFBFBD>á<EFBFBD>115200 8-N-1
|
||||
* @param <20><>
|
||||
* @retval <20><>
|
||||
*/
|
||||
void debug_usart_init(void)
|
||||
{
|
||||
|
||||
debug_usart.Instance = DEBUG_USART;
|
||||
|
||||
debug_usart.Init.BaudRate = DEBUG_USART_BAUDRATE;
|
||||
debug_usart.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
debug_usart.Init.StopBits = UART_STOPBITS_1;
|
||||
debug_usart.Init.Parity = UART_PARITY_NONE;
|
||||
debug_usart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
debug_usart.Init.Mode = UART_MODE_TX_RX;
|
||||
|
||||
HAL_UART_Init(&debug_usart);
|
||||
|
||||
/*ʹ<>ܴ<EFBFBD><DCB4>ڽ<EFBFBD><DABD>ն<EFBFBD> */
|
||||
__HAL_UART_ENABLE_IT(&debug_usart, UART_IT_RXNE);
|
||||
}
|
||||
|
||||
void wifi_usart_init(void)
|
||||
{
|
||||
|
||||
wifi_usart.Instance = WIFI_USART;
|
||||
|
||||
wifi_usart.Init.BaudRate = WIFI_USART_BAUDRATE;
|
||||
wifi_usart.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
wifi_usart.Init.StopBits = UART_STOPBITS_1;
|
||||
wifi_usart.Init.Parity = UART_PARITY_NONE;
|
||||
wifi_usart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
wifi_usart.Init.Mode = UART_MODE_TX_RX;
|
||||
|
||||
HAL_UART_Init(&wifi_usart);
|
||||
|
||||
/*ʹ<>ܴ<EFBFBD><DCB4>ڽ<EFBFBD><DABD>ն<EFBFBD> */
|
||||
__HAL_UART_ENABLE_IT(&wifi_usart, UART_IT_RXNE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief UART MSP <20><>ʼ<EFBFBD><CABC>
|
||||
* @param huart: UART handle
|
||||
* @retval <20><>
|
||||
*/
|
||||
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
if (huart->Instance == DEBUG_USART)
|
||||
{
|
||||
DEBUG_USART_CLK_ENABLE();
|
||||
|
||||
DEBUG_USART_RX_GPIO_CLK_ENABLE();
|
||||
DEBUG_USART_TX_GPIO_CLK_ENABLE();
|
||||
|
||||
/**USART1 GPIO Configuration
|
||||
PA9 ------> USART1_TX
|
||||
PA10 ------> USART1_RX
|
||||
*/
|
||||
/* <20><><EFBFBD><EFBFBD>Tx<54><78><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ù<EFBFBD><C3B9><EFBFBD> */
|
||||
GPIO_InitStruct.Pin = DEBUG_USART_TX_PIN;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(DEBUG_USART_TX_GPIO_PORT, &GPIO_InitStruct);
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD>Rx<52><78><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ù<EFBFBD><C3B9><EFBFBD> */
|
||||
GPIO_InitStruct.Pin = DEBUG_USART_RX_PIN;
|
||||
GPIO_InitStruct.Mode=GPIO_MODE_AF_INPUT; //ģʽҪ<CABD><D2AA><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ<C4A3><CABD>
|
||||
HAL_GPIO_Init(DEBUG_USART_RX_GPIO_PORT, &GPIO_InitStruct);
|
||||
//<2F><>ռ<EFBFBD><D5BC><EFBFBD>ȼ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>1
|
||||
HAL_NVIC_SetPriority(DEBUG_USART_IRQ ,6,0);
|
||||
//ʹ<><CAB9>USART1<54>ж<EFBFBD>ͨ<EFBFBD><CDA8>
|
||||
HAL_NVIC_EnableIRQ(DEBUG_USART_IRQ );
|
||||
} else if (huart->Instance == WIFI_USART)
|
||||
{
|
||||
WIFI_USART_CLK_ENABLE();
|
||||
|
||||
WIFI_USART_RX_GPIO_CLK_ENABLE();
|
||||
WIFI_USART_TX_GPIO_CLK_ENABLE();
|
||||
|
||||
/**USART1 GPIO Configuration
|
||||
PA9 ------> USART1_TX
|
||||
PA10 ------> USART1_RX
|
||||
*/
|
||||
/* <20><><EFBFBD><EFBFBD>Tx<54><78><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ù<EFBFBD><C3B9><EFBFBD> */
|
||||
GPIO_InitStruct.Pin = WIFI_USART_TX_PIN;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(WIFI_USART_TX_GPIO_PORT, &GPIO_InitStruct);
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD>Rx<52><78><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ù<EFBFBD><C3B9><EFBFBD> */
|
||||
GPIO_InitStruct.Pin = WIFI_USART_RX_PIN;
|
||||
GPIO_InitStruct.Mode=GPIO_MODE_AF_INPUT; //ģʽҪ<CABD><D2AA><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ<C4A3><CABD>
|
||||
HAL_GPIO_Init(WIFI_USART_RX_GPIO_PORT, &GPIO_InitStruct);
|
||||
//<2F><>ռ<EFBFBD><D5BC><EFBFBD>ȼ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>1
|
||||
HAL_NVIC_SetPriority(WIFI_USART_IRQ ,2,0);
|
||||
//ʹ<><CAB9>USART1<54>ж<EFBFBD>ͨ<EFBFBD><CDA8>
|
||||
HAL_NVIC_EnableIRQ(WIFI_USART_IRQ );
|
||||
}
|
||||
}
|
||||
|
||||
/***************** <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD> **********************/
|
||||
void usart_send_string(UART_HandleTypeDef *huart, uint8_t *str)
|
||||
{
|
||||
unsigned int k=0;
|
||||
do {
|
||||
HAL_UART_Transmit(huart,(uint8_t *)(str + k) ,1,1000);
|
||||
k++;
|
||||
} while(*(str + k)!='\0');
|
||||
|
||||
}
|
||||
//<2F>ض<EFBFBD><D8B6><EFBFBD>c<EFBFBD>⺯<EFBFBD><E2BAAF>printf<74><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DEBUG_USART<52><54><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>printf<74><66><EFBFBD><EFBFBD>
|
||||
int fputc(int ch, FILE *f)
|
||||
{
|
||||
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>DEBUG_USART */
|
||||
HAL_UART_Transmit(&debug_usart, (uint8_t *)&ch, 1, 1);
|
||||
|
||||
return (ch);
|
||||
}
|
||||
|
||||
//<2F>ض<EFBFBD><D8B6><EFBFBD>c<EFBFBD>⺯<EFBFBD><E2BAAF>scanf<6E><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DEBUG_USART<52><54><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>scanf<6E><66>getchar<61>Ⱥ<EFBFBD><C8BA><EFBFBD>
|
||||
int fgetc(FILE *f)
|
||||
{
|
||||
int ch;
|
||||
HAL_UART_Receive(&debug_usart, (uint8_t *)&ch, 1, 1);
|
||||
return (ch);
|
||||
}
|
||||
|
||||
int send_buff(char *buf, int len)
|
||||
{
|
||||
usart_send_string(&debug_usart, (uint8_t *)buf);
|
||||
return len;
|
||||
}
|
||||
|
||||
/*********************************************END OF FILE**********************/
|
73
board/GoKit3_STM32F103C8T6/BSP/Src/tos_hal_uart.c
Normal file
73
board/GoKit3_STM32F103C8T6/BSP/Src/tos_hal_uart.c
Normal file
@@ -0,0 +1,73 @@
|
||||
#include "tos_k.h"
|
||||
#include "tos_hal.h"
|
||||
#include "stm32f1xx.h"
|
||||
#include "bsp_usart.h"
|
||||
|
||||
__API__ int tos_hal_uart_init(hal_uart_t *uart, hal_uart_port_t port)
|
||||
{
|
||||
if (!uart) {
|
||||
return -1;
|
||||
}
|
||||
if (port == HAL_UART_PORT_1) {
|
||||
uart->private_uart = &debug_usart;
|
||||
debug_usart_init();
|
||||
} else if (port == HAL_UART_PORT_2) {
|
||||
uart->private_uart = &wifi_usart;
|
||||
wifi_usart_init();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
__API__ int tos_hal_uart_write(hal_uart_t *uart, const uint8_t *buf, size_t size, uint32_t timeout)
|
||||
{
|
||||
HAL_StatusTypeDef hal_status;
|
||||
UART_HandleTypeDef *uart_handle;
|
||||
|
||||
if (!uart || !buf) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!uart->private_uart) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
uart_handle = (UART_HandleTypeDef *)uart->private_uart;
|
||||
|
||||
hal_status = HAL_UART_Transmit(uart_handle, (uint8_t *)buf, size, timeout);
|
||||
if (hal_status != HAL_OK) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
__API__ int tos_hal_uart_read(hal_uart_t *uart, const uint8_t *buf, size_t size, uint32_t timeout)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
__API__ int tos_hal_uart_deinit(hal_uart_t *uart)
|
||||
{
|
||||
HAL_StatusTypeDef hal_status;
|
||||
UART_HandleTypeDef *uart_handle;
|
||||
|
||||
if (!uart) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!uart->private_uart) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
uart_handle = (UART_HandleTypeDef *)uart->private_uart;
|
||||
|
||||
hal_status = HAL_UART_DeInit(uart_handle);
|
||||
HAL_UART_MspDeInit(uart_handle);
|
||||
|
||||
if (hal_status != HAL_OK) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,942 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
|
||||
|
||||
<SchemaVersion>2.1</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>GoKit3_STM32F103C8T6</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>STM32F103C8</Device>
|
||||
<Vendor>STMicroelectronics</Vendor>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.2.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000-0x20004FFF) IROM(0x8000000-0x800FFFF) CLOCK(8000000) CPUTYPE("Cortex-M3")</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll></FlashDriverDll>
|
||||
<DeviceId></DeviceId>
|
||||
<RegisterFile></RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
<Linker></Linker>
|
||||
<OHString></OHString>
|
||||
<InfinionOptionDll></InfinionOptionDll>
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile>$$Device:STM32F103C8$SVD\STM32F103xx.svd</SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
<LibPath></LibPath>
|
||||
<RegisterFilePath></RegisterFilePath>
|
||||
<DBRegisterFilePath></DBRegisterFilePath>
|
||||
<TargetStatus>
|
||||
<Error>0</Error>
|
||||
<ExitCodeStop>0</ExitCodeStop>
|
||||
<ButtonStop>0</ButtonStop>
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>GoKit3_STM32F103C8T6\</OutputDirectory>
|
||||
<OutputName>GoKit3_STM32F103C8T6</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>0</BrowseInformation>
|
||||
<ListingPath></ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopA1X>0</nStopA1X>
|
||||
<nStopA2X>0</nStopA2X>
|
||||
</AfterMake>
|
||||
<SelectedForBatchBuild>0</SelectedForBatchBuild>
|
||||
<SVCSIdString></SVCSIdString>
|
||||
</TargetCommonOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>0</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments>-REMAP</SimDllArguments>
|
||||
<SimDlgDll>DCM.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM3</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments></TargetDllArguments>
|
||||
<TargetDlgDll>TCM.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM3</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
<Flash1>
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4107</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>STLink\ST-LINKIII-KEIL_SWO.dll</Flash2>
|
||||
<Flash3></Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
<GenerateListings>0</GenerateListings>
|
||||
<asHll>1</asHll>
|
||||
<asAsm>1</asAsm>
|
||||
<asMacX>1</asMacX>
|
||||
<asSyms>1</asSyms>
|
||||
<asFals>1</asFals>
|
||||
<asDbgD>1</asDbgD>
|
||||
<asForm>1</asForm>
|
||||
<ldLst>0</ldLst>
|
||||
<ldmm>1</ldmm>
|
||||
<ldXref>1</ldXref>
|
||||
<BigEnd>0</BigEnd>
|
||||
<AdsALst>1</AdsALst>
|
||||
<AdsACrf>1</AdsACrf>
|
||||
<AdsANop>0</AdsANop>
|
||||
<AdsANot>0</AdsANot>
|
||||
<AdsLLst>1</AdsLLst>
|
||||
<AdsLmap>1</AdsLmap>
|
||||
<AdsLcgr>1</AdsLcgr>
|
||||
<AdsLsym>1</AdsLsym>
|
||||
<AdsLszi>1</AdsLszi>
|
||||
<AdsLtoi>1</AdsLtoi>
|
||||
<AdsLsun>1</AdsLsun>
|
||||
<AdsLven>1</AdsLven>
|
||||
<AdsLsxf>1</AdsLsxf>
|
||||
<RvctClst>0</RvctClst>
|
||||
<GenPPlst>0</GenPPlst>
|
||||
<AdsCpuType>"Cortex-M3"</AdsCpuType>
|
||||
<RvctDeviceName></RvctDeviceName>
|
||||
<mOS>0</mOS>
|
||||
<uocRom>0</uocRom>
|
||||
<uocRam>0</uocRam>
|
||||
<hadIROM>1</hadIROM>
|
||||
<hadIRAM>1</hadIRAM>
|
||||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>0</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>1</useUlib>
|
||||
<EndSel>0</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>3</RwSelD>
|
||||
<CodeSel>0</CodeSel>
|
||||
<OptFeed>0</OptFeed>
|
||||
<NoZi1>0</NoZi1>
|
||||
<NoZi2>0</NoZi2>
|
||||
<NoZi3>0</NoZi3>
|
||||
<NoZi4>0</NoZi4>
|
||||
<NoZi5>0</NoZi5>
|
||||
<Ro1Chk>0</Ro1Chk>
|
||||
<Ro2Chk>0</Ro2Chk>
|
||||
<Ro3Chk>0</Ro3Chk>
|
||||
<Ir1Chk>1</Ir1Chk>
|
||||
<Ir2Chk>0</Ir2Chk>
|
||||
<Ra1Chk>0</Ra1Chk>
|
||||
<Ra2Chk>0</Ra2Chk>
|
||||
<Ra3Chk>0</Ra3Chk>
|
||||
<Im1Chk>1</Im1Chk>
|
||||
<Im2Chk>0</Im2Chk>
|
||||
<OnChipMemories>
|
||||
<Ocm1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm1>
|
||||
<Ocm2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm2>
|
||||
<Ocm3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocm4>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm4>
|
||||
<Ocm5>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm5>
|
||||
<Ocm6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm6>
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x5000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x8000000</StartAddress>
|
||||
<Size>0x10000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRAM>
|
||||
<OCR_RVCT1>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT1>
|
||||
<OCR_RVCT2>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT2>
|
||||
<OCR_RVCT3>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT3>
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x8000000</StartAddress>
|
||||
<Size>0x10000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT5>
|
||||
<OCR_RVCT6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT6>
|
||||
<OCR_RVCT7>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT7>
|
||||
<OCR_RVCT8>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x5000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>2</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>2</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>1</v6Lang>
|
||||
<v6LangP>1</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define>USE_HAL_DRIVER,STM32F103xB</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\..\BSP\Inc;..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Inc\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32F1xx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m3\armcc;..\..\..\..\kernel\core\include;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\TOS-CONFIG;..\..\BSP\HardWare\OLED;..\..\..\..\components\connectivity\mqttclient\common;..\..\..\..\components\connectivity\mqttclient\common\log;..\..\..\..\components\connectivity\mqttclient\mqtt;..\..\..\..\components\connectivity\mqttclient\mqttclient;..\..\..\..\components\connectivity\mqttclient\network;..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny;..\..\..\..\net\sal_module_wrapper;..\..\..\..\devices\esp8266;..\..\..\..\kernel\hal\include</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>1</interw>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<thumb>0</thumb>
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<uClangAs>0</uClangAs>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
<LDads>
|
||||
<umfTarg>1</umfTarg>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<noStLib>0</noStLib>
|
||||
<RepFail>1</RepFail>
|
||||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x08000000</TextAddressRange>
|
||||
<DataAddressRange>0x20000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile></ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc></Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>Application/MDK-ARM</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>startup_stm32f103xb.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>startup_stm32f103xb.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Application/User</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_msp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\BSP\Src\stm32f1xx_hal_msp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_it.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>.\stm32f1xx_it.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Application/Bsp</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>bsp_dwt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\BSP\Src\bsp_dwt.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>bsp_init.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\BSP\Src\bsp_init.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>bsp_led.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\BSP\Src\bsp_led.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>bsp_motor.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\BSP\Src\bsp_motor.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>bsp_usart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\BSP\Src\bsp_usart.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>examples</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>gokit3_mqttclient.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\examples\mqttclient\gokit3_mqttclient.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Drivers/STM32F1xx_HAL_Driver</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_cortex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_dma.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_exti.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_flash_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_gpio_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_pcd.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pcd.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_pcd_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pcd_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_pwr.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_rcc.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_rcc_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_tim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_tim_ex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stm32f1xx_hal_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\platform\vendor_bsp\st\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>Drivers/CMSIS</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>system_stm32f1xx.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\BSP\Src\system_stm32f1xx.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>tos/arch</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>tos_cpu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\arch\arm\arm-v7m\common\tos_cpu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>port_c.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\arch\arm\arm-v7m\cortex-m3\armcc\port_c.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>port_s.S</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\..\arch\arm\arm-v7m\cortex-m3\armcc\port_s.S</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>tos/kernel</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>tos_binary_heap.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_binary_heap.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_char_fifo.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_char_fifo.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_completion.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_completion.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_countdownlatch.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_countdownlatch.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_event.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_event.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_global.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_global.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_mail_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_mail_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_message_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_message_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_mmblk.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_mmblk.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_mmheap.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_mmheap.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_mutex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_mutex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_pend.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_pend.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_priority_mail_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_priority_mail_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_priority_message_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_priority_message_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_priority_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_priority_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_ring_queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_ring_queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_robin.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_robin.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_sched.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_sched.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_sem.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_sem.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_sys.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_sys.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_task.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_task.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_tick.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_tick.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_time.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_time.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\kernel\core\tos_timer.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>tos/cmsis</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>cmsis_os.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\osal\cmsis_os\cmsis_os.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>tos/at</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>tos_at.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\net\at\src\tos_at.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tos_at_utils.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\net\at\src\tos_at_utils.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>tos/sal</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>sal_module_wrapper.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\net\sal_module_wrapper\sal_module_wrapper.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>tos/hal</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>tos_hal_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\BSP\Src\tos_hal_uart.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>tos/devices</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>esp8266.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\devices\esp8266\esp8266.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>mqttclient</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>mqttclient.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\mqttclient\mqttclient.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>mqttclient/mqtt</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>MQTTConnectClient.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\mqtt\MQTTConnectClient.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>MQTTConnectServer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\mqtt\MQTTConnectServer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>MQTTDeserializePublish.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\mqtt\MQTTDeserializePublish.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>MQTTFormat.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\mqtt\MQTTFormat.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>MQTTPacket.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\mqtt\MQTTPacket.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>MQTTSerializePublish.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\mqtt\MQTTSerializePublish.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>MQTTSubscribeClient.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\mqtt\MQTTSubscribeClient.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>MQTTSubscribeServer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\mqtt\MQTTSubscribeServer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>MQTTUnsubscribeClient.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\mqtt\MQTTUnsubscribeClient.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>MQTTUnsubscribeServer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\mqtt\MQTTUnsubscribeServer.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>mqttclient/salof</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>fifo.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\log\fifo.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>format.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\log\format.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>salof.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\log\salof.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>arch.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\log\arch\tencentos-tiny\arch.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>salof_config.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\log\salof_config.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>mqttclient/common</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>list.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\list.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>random.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\random.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>log.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\log.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>error.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\common\error.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>mqttclient/network</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>network.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\network\network.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>mqttclient/platform</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>platform_memory.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_memory.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>platform_mutex.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_mutex.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>platform_net_socket.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_net_socket.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>platform_nettype_tcp.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_nettype_tcp.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>platform_nettype_tls.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_nettype_tls.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>platform_thread.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_thread.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>platform_timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\connectivity\mqttclient\platform\TencentOS-tiny\platform_timer.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>mqttclient/config</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>mqtt_config.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\TOS-CONFIG\mqtt_config.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>::CMSIS</GroupName>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components>
|
||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="4.3.0" condition="CMSIS Core">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.5.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="GoKit3_STM32F103C8T6"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
</components>
|
||||
<files/>
|
||||
</RTE>
|
||||
|
||||
</Project>
|
307
board/GoKit3_STM32F103C8T6/KEIL/mqttclient/startup_stm32f103xb.s
Normal file
307
board/GoKit3_STM32F103C8T6/KEIL/mqttclient/startup_stm32f103xb.s
Normal file
@@ -0,0 +1,307 @@
|
||||
;******************** (C) COPYRIGHT 2017 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32f103xb.s
|
||||
;* Author : MCD Application Team
|
||||
;* Description : STM32F103xB Devices vector table for MDK-ARM toolchain.
|
||||
;* This module performs:
|
||||
;* - Set the initial SP
|
||||
;* - Set the initial PC == Reset_Handler
|
||||
;* - Set the vector table entries with the exceptions ISR address
|
||||
;* - Configure the clock system
|
||||
;* - Branches to __main in the C library (which eventually
|
||||
;* calls main()).
|
||||
;* After Reset the Cortex-M3 processor is in Thread mode,
|
||||
;* priority is Privileged, and the Stack is set to Main.
|
||||
;******************************************************************************
|
||||
;* @attention
|
||||
;*
|
||||
;* Copyright (c) 2017 STMicroelectronics.
|
||||
;* All rights reserved.
|
||||
;*
|
||||
;* This software component is licensed by ST under BSD 3-Clause license,
|
||||
;* the "License"; You may not use this file except in compliance with the
|
||||
;* License. You may obtain a copy of the License at:
|
||||
;* opensource.org/licenses/BSD-3-Clause
|
||||
;*
|
||||
;******************************************************************************
|
||||
|
||||
; Amount of memory (in bytes) allocated for Stack
|
||||
; Tailor this value to your application needs
|
||||
; <h> Stack Configuration
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Stack_Size EQU 0x400
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp
|
||||
|
||||
|
||||
; <h> Heap Configuration
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x200
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD MemManage_Handler ; MPU Fault Handler
|
||||
DCD BusFault_Handler ; Bus Fault Handler
|
||||
DCD UsageFault_Handler ; Usage Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD DebugMon_Handler ; Debug Monitor Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD WWDG_IRQHandler ; Window Watchdog
|
||||
DCD PVD_IRQHandler ; PVD through EXTI Line detect
|
||||
DCD TAMPER_IRQHandler ; Tamper
|
||||
DCD RTC_IRQHandler ; RTC
|
||||
DCD FLASH_IRQHandler ; Flash
|
||||
DCD RCC_IRQHandler ; RCC
|
||||
DCD EXTI0_IRQHandler ; EXTI Line 0
|
||||
DCD EXTI1_IRQHandler ; EXTI Line 1
|
||||
DCD EXTI2_IRQHandler ; EXTI Line 2
|
||||
DCD EXTI3_IRQHandler ; EXTI Line 3
|
||||
DCD EXTI4_IRQHandler ; EXTI Line 4
|
||||
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
|
||||
DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
|
||||
DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
|
||||
DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
|
||||
DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
|
||||
DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
|
||||
DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
|
||||
DCD ADC1_2_IRQHandler ; ADC1_2
|
||||
DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
|
||||
DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
|
||||
DCD CAN1_RX1_IRQHandler ; CAN1 RX1
|
||||
DCD CAN1_SCE_IRQHandler ; CAN1 SCE
|
||||
DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
|
||||
DCD TIM1_BRK_IRQHandler ; TIM1 Break
|
||||
DCD TIM1_UP_IRQHandler ; TIM1 Update
|
||||
DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
|
||||
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
|
||||
DCD TIM2_IRQHandler ; TIM2
|
||||
DCD TIM3_IRQHandler ; TIM3
|
||||
DCD TIM4_IRQHandler ; TIM4
|
||||
DCD I2C1_EV_IRQHandler ; I2C1 Event
|
||||
DCD I2C1_ER_IRQHandler ; I2C1 Error
|
||||
DCD I2C2_EV_IRQHandler ; I2C2 Event
|
||||
DCD I2C2_ER_IRQHandler ; I2C2 Error
|
||||
DCD SPI1_IRQHandler ; SPI1
|
||||
DCD SPI2_IRQHandler ; SPI2
|
||||
DCD USART1_IRQHandler ; USART1
|
||||
DCD USART2_IRQHandler ; USART2
|
||||
DCD USART3_IRQHandler ; USART3
|
||||
DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
|
||||
DCD RTC_Alarm_IRQHandler ; RTC Alarm through EXTI Line
|
||||
DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
; Reset handler
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT __main
|
||||
IMPORT SystemInit
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
MemManage_Handler\
|
||||
PROC
|
||||
EXPORT MemManage_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
BusFault_Handler\
|
||||
PROC
|
||||
EXPORT BusFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
UsageFault_Handler\
|
||||
PROC
|
||||
EXPORT UsageFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
DebugMon_Handler\
|
||||
PROC
|
||||
EXPORT DebugMon_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SysTick_Handler PROC
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
|
||||
EXPORT WWDG_IRQHandler [WEAK]
|
||||
EXPORT PVD_IRQHandler [WEAK]
|
||||
EXPORT TAMPER_IRQHandler [WEAK]
|
||||
EXPORT RTC_IRQHandler [WEAK]
|
||||
EXPORT FLASH_IRQHandler [WEAK]
|
||||
EXPORT RCC_IRQHandler [WEAK]
|
||||
EXPORT EXTI0_IRQHandler [WEAK]
|
||||
EXPORT EXTI1_IRQHandler [WEAK]
|
||||
EXPORT EXTI2_IRQHandler [WEAK]
|
||||
EXPORT EXTI3_IRQHandler [WEAK]
|
||||
EXPORT EXTI4_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel1_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel2_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel3_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel4_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel5_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel6_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel7_IRQHandler [WEAK]
|
||||
EXPORT ADC1_2_IRQHandler [WEAK]
|
||||
EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
|
||||
EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
|
||||
EXPORT CAN1_RX1_IRQHandler [WEAK]
|
||||
EXPORT CAN1_SCE_IRQHandler [WEAK]
|
||||
EXPORT EXTI9_5_IRQHandler [WEAK]
|
||||
EXPORT TIM1_BRK_IRQHandler [WEAK]
|
||||
EXPORT TIM1_UP_IRQHandler [WEAK]
|
||||
EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
|
||||
EXPORT TIM1_CC_IRQHandler [WEAK]
|
||||
EXPORT TIM2_IRQHandler [WEAK]
|
||||
EXPORT TIM3_IRQHandler [WEAK]
|
||||
EXPORT TIM4_IRQHandler [WEAK]
|
||||
EXPORT I2C1_EV_IRQHandler [WEAK]
|
||||
EXPORT I2C1_ER_IRQHandler [WEAK]
|
||||
EXPORT I2C2_EV_IRQHandler [WEAK]
|
||||
EXPORT I2C2_ER_IRQHandler [WEAK]
|
||||
EXPORT SPI1_IRQHandler [WEAK]
|
||||
EXPORT SPI2_IRQHandler [WEAK]
|
||||
EXPORT USART1_IRQHandler [WEAK]
|
||||
EXPORT USART2_IRQHandler [WEAK]
|
||||
EXPORT USART3_IRQHandler [WEAK]
|
||||
EXPORT EXTI15_10_IRQHandler [WEAK]
|
||||
EXPORT RTC_Alarm_IRQHandler [WEAK]
|
||||
EXPORT USBWakeUp_IRQHandler [WEAK]
|
||||
|
||||
WWDG_IRQHandler
|
||||
PVD_IRQHandler
|
||||
TAMPER_IRQHandler
|
||||
RTC_IRQHandler
|
||||
FLASH_IRQHandler
|
||||
RCC_IRQHandler
|
||||
EXTI0_IRQHandler
|
||||
EXTI1_IRQHandler
|
||||
EXTI2_IRQHandler
|
||||
EXTI3_IRQHandler
|
||||
EXTI4_IRQHandler
|
||||
DMA1_Channel1_IRQHandler
|
||||
DMA1_Channel2_IRQHandler
|
||||
DMA1_Channel3_IRQHandler
|
||||
DMA1_Channel4_IRQHandler
|
||||
DMA1_Channel5_IRQHandler
|
||||
DMA1_Channel6_IRQHandler
|
||||
DMA1_Channel7_IRQHandler
|
||||
ADC1_2_IRQHandler
|
||||
USB_HP_CAN1_TX_IRQHandler
|
||||
USB_LP_CAN1_RX0_IRQHandler
|
||||
CAN1_RX1_IRQHandler
|
||||
CAN1_SCE_IRQHandler
|
||||
EXTI9_5_IRQHandler
|
||||
TIM1_BRK_IRQHandler
|
||||
TIM1_UP_IRQHandler
|
||||
TIM1_TRG_COM_IRQHandler
|
||||
TIM1_CC_IRQHandler
|
||||
TIM2_IRQHandler
|
||||
TIM3_IRQHandler
|
||||
TIM4_IRQHandler
|
||||
I2C1_EV_IRQHandler
|
||||
I2C1_ER_IRQHandler
|
||||
I2C2_EV_IRQHandler
|
||||
I2C2_ER_IRQHandler
|
||||
SPI1_IRQHandler
|
||||
SPI2_IRQHandler
|
||||
USART1_IRQHandler
|
||||
USART2_IRQHandler
|
||||
USART3_IRQHandler
|
||||
EXTI15_10_IRQHandler
|
||||
RTC_Alarm_IRQHandler
|
||||
USBWakeUp_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
ALIGN
|
||||
|
||||
;*******************************************************************************
|
||||
; User Stack and Heap initialization
|
||||
;*******************************************************************************
|
||||
IF :DEF:__MICROLIB
|
||||
|
||||
EXPORT __initial_sp
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
|
||||
ELSE
|
||||
|
||||
IMPORT __use_two_region_memory
|
||||
EXPORT __user_initial_stackheap
|
||||
|
||||
__user_initial_stackheap
|
||||
|
||||
LDR R0, = Heap_Mem
|
||||
LDR R1, =(Stack_Mem + Stack_Size)
|
||||
LDR R2, = (Heap_Mem + Heap_Size)
|
||||
LDR R3, = Stack_Mem
|
||||
BX LR
|
||||
|
||||
ALIGN
|
||||
|
||||
ENDIF
|
||||
|
||||
END
|
||||
|
||||
;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
|
211
board/GoKit3_STM32F103C8T6/KEIL/mqttclient/stm32f1xx_it.c
Normal file
211
board/GoKit3_STM32F103C8T6/KEIL/mqttclient/stm32f1xx_it.c
Normal file
@@ -0,0 +1,211 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_it.c
|
||||
* @brief Interrupt Service Routines.
|
||||
******************************************************************************
|
||||
*
|
||||
* COPYRIGHT(c) 2016 STMicroelectronics
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "stm32f1xx.h"
|
||||
#include "stm32f1xx_it.h"
|
||||
#include "tos_k.h"
|
||||
#include "bsp_usart.h"
|
||||
#include "tos_at.h"
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
|
||||
/******************************************************************************/
|
||||
/* Cortex-M3 Processor Interruption and Exception Handlers */
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* @brief This function handles Non maskable interrupt.
|
||||
*/
|
||||
void NMI_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 0 */
|
||||
|
||||
/* USER CODE END NonMaskableInt_IRQn 0 */
|
||||
/* USER CODE BEGIN NonMaskableInt_IRQn 1 */
|
||||
|
||||
/* USER CODE END NonMaskableInt_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Hard fault interrupt.
|
||||
*/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN HardFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END HardFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
/* USER CODE BEGIN HardFault_IRQn 1 */
|
||||
|
||||
/* USER CODE END HardFault_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Memory management fault.
|
||||
*/
|
||||
void MemManage_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
|
||||
|
||||
/* USER CODE END MemoryManagement_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
/* USER CODE BEGIN MemoryManagement_IRQn 1 */
|
||||
|
||||
/* USER CODE END MemoryManagement_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Prefetch fault, memory access fault.
|
||||
*/
|
||||
void BusFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN BusFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END BusFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
/* USER CODE BEGIN BusFault_IRQn 1 */
|
||||
|
||||
/* USER CODE END BusFault_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Undefined instruction or illegal state.
|
||||
*/
|
||||
void UsageFault_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN UsageFault_IRQn 0 */
|
||||
|
||||
/* USER CODE END UsageFault_IRQn 0 */
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
/* USER CODE BEGIN UsageFault_IRQn 1 */
|
||||
|
||||
/* USER CODE END UsageFault_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System service call via SWI instruction.
|
||||
*/
|
||||
void SVC_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN SVCall_IRQn 0 */
|
||||
|
||||
/* USER CODE END SVCall_IRQn 0 */
|
||||
/* USER CODE BEGIN SVCall_IRQn 1 */
|
||||
|
||||
/* USER CODE END SVCall_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles Debug monitor.
|
||||
*/
|
||||
void DebugMon_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DebugMonitor_IRQn 0 */
|
||||
|
||||
/* USER CODE END DebugMonitor_IRQn 0 */
|
||||
/* USER CODE BEGIN DebugMonitor_IRQn 1 */
|
||||
|
||||
/* USER CODE END DebugMonitor_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles System tick timer.
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
HAL_IncTick();
|
||||
|
||||
if (tos_knl_is_running())
|
||||
{
|
||||
tos_knl_irq_enter();
|
||||
tos_tick_handler();
|
||||
tos_knl_irq_leave();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DEBUG_USART_IRQHandler(void)
|
||||
{
|
||||
uint8_t data;
|
||||
|
||||
tos_knl_irq_enter();
|
||||
|
||||
if(__HAL_UART_GET_FLAG( &debug_usart, UART_FLAG_RXNE ) != RESET)
|
||||
{
|
||||
HAL_UART_Receive(&debug_usart, &data, 1, 1);
|
||||
HAL_UART_Transmit(&debug_usart, &data, 1, 1);
|
||||
}
|
||||
|
||||
tos_knl_irq_leave();
|
||||
}
|
||||
|
||||
void WIFI_USART_IRQHandler(void)
|
||||
{
|
||||
uint8_t data;
|
||||
|
||||
tos_knl_irq_enter();
|
||||
|
||||
if(__HAL_UART_GET_FLAG( &wifi_usart, UART_FLAG_RXNE ) != RESET)
|
||||
{
|
||||
HAL_UART_Receive(&wifi_usart, &data, 1, 1);
|
||||
tos_at_uart_input_byte(data);
|
||||
}
|
||||
|
||||
tos_knl_irq_leave();
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* STM32F1xx Peripheral Interrupt Handlers */
|
||||
/* Add here the Interrupt Handlers for the used peripherals. */
|
||||
/* For the available peripheral interrupt handler names, */
|
||||
/* please refer to the startup file (startup_stm32f1xx.s). */
|
||||
/******************************************************************************/
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
|
||||
/* USER CODE END 1 */
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
48
board/GoKit3_STM32F103C8T6/TOS-CONFIG/mqtt_config.h
Normal file
48
board/GoKit3_STM32F103C8T6/TOS-CONFIG/mqtt_config.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2019-12-15 00:42:16
|
||||
* @LastEditTime: 2020-02-25 09:25:35
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
*/
|
||||
#ifndef _MQTT_CONFIG_H_
|
||||
#define _MQTT_CONFIG_H_
|
||||
|
||||
//#define LOG_IS_SALOF
|
||||
|
||||
#define LOG_LEVEL DEBUG_LEVEL //WARN_LEVEL DEBUG_LEVEL
|
||||
|
||||
#ifdef LOG_IS_SALOF
|
||||
#define USE_LOG (1U)
|
||||
#define USE_SALOF (1U)
|
||||
#define SALOF_OS USE_TENCENTOS
|
||||
#define USE_IDLE_HOOK (0U)
|
||||
#define LOG_COLOR (0U)
|
||||
#define LOG_TS (0U)
|
||||
#define LOG_TAR (0U)
|
||||
#define SALOF_BUFF_SIZE (512U)
|
||||
#define SALOF_FIFO_SIZE (1024U)
|
||||
#define SALOF_TASK_STACK_SIZE (1024U)
|
||||
#define SALOF_TASK_TICK (50U)
|
||||
#endif
|
||||
|
||||
|
||||
#define MQTT_MAX_PACKET_ID (0xFFFF - 1)
|
||||
#define MQTT_TOPIC_LEN_MAX 64
|
||||
#define MQTT_ACK_HANDLER_NUM_MAX 64
|
||||
#define MQTT_DEFAULT_BUF_SIZE 1024
|
||||
#define MQTT_DEFAULT_CMD_TIMEOUT 4000
|
||||
#define MQTT_MAX_CMD_TIMEOUT 20000
|
||||
#define MQTT_MIN_CMD_TIMEOUT 1000
|
||||
#define MQTT_KEEP_ALIVE_INTERVAL 100 // unit: second
|
||||
#define MQTT_VERSION 4 // 4 is mqtt 3.1.1
|
||||
#define MQTT_RECONNECT_DEFAULT_DURATION 1000
|
||||
#define MQTT_THREAD_STACK_SIZE 2048
|
||||
#define MQTT_THREAD_PRIO 5
|
||||
#define MQTT_THREAD_TICK 50
|
||||
|
||||
#define MQTT_NETSOCKET_USE_AT
|
||||
|
||||
//#define MQTT_NETWORK_TYPE_TLS
|
||||
|
||||
#endif /* _MQTT_CONFIG_H_ */
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#define TOS_CFG_MMHEAP_EN 1u
|
||||
|
||||
#define TOS_CFG_MMHEAP_DEFAULT_POOL_SIZE 0x1000
|
||||
#define TOS_CFG_MMHEAP_DEFAULT_POOL_SIZE 0x2C00
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
|
@@ -10,6 +10,17 @@
|
||||
int platform_net_socket_connect(const char *host, const char *port, int proto)
|
||||
{
|
||||
int fd, ret = MQTT_SOCKET_UNKNOWN_HOST;
|
||||
#ifdef MQTT_NETSOCKET_USE_AT
|
||||
|
||||
fd = tos_sal_module_connect(host, port, TOS_SAL_PROTO_TCP);
|
||||
|
||||
if (fd < 0) {
|
||||
return MQTT_CONNECT_FAILED_ERROR;
|
||||
}
|
||||
ret = fd;
|
||||
|
||||
#else
|
||||
|
||||
struct addrinfo hints, *addr_list, *cur;
|
||||
|
||||
/* Do name resolution with both IPv6 and IPv4 */
|
||||
@@ -39,16 +50,25 @@ int platform_net_socket_connect(const char *host, const char *port, int proto)
|
||||
}
|
||||
|
||||
freeaddrinfo(addr_list);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int platform_net_socket_recv(int fd, void *buf, size_t len, int flags)
|
||||
{
|
||||
#ifdef MQTT_NETSOCKET_USE_AT
|
||||
return tos_sal_module_recv(fd, buf, len);
|
||||
#else
|
||||
return recv(fd, buf, len, flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
int platform_net_socket_recv_timeout(int fd, unsigned char *buf, int len, int timeout)
|
||||
{
|
||||
#ifdef MQTT_NETSOCKET_USE_AT
|
||||
return tos_sal_module_recv_timeout(fd, buf, len, timeout);
|
||||
#else
|
||||
int rc;
|
||||
int bytes = 0;
|
||||
struct timeval tv = {
|
||||
@@ -73,15 +93,23 @@ int platform_net_socket_recv_timeout(int fd, unsigned char *buf, int len, int ti
|
||||
}
|
||||
}
|
||||
return bytes;
|
||||
#endif
|
||||
}
|
||||
|
||||
int platform_net_socket_write(int fd, void *buf, size_t len)
|
||||
{
|
||||
#ifdef MQTT_NETSOCKET_USE_AT
|
||||
return tos_sal_module_send(fd, buf, len);
|
||||
#else
|
||||
return write(fd, buf, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
int platform_net_socket_write_timeout(int fd, unsigned char *buf, int len, int timeout)
|
||||
{
|
||||
#ifdef MQTT_NETSOCKET_USE_AT
|
||||
return tos_sal_module_send(fd, buf, len);
|
||||
#else
|
||||
struct timeval tv = {
|
||||
timeout / 1000,
|
||||
(timeout % 1000) * 1000
|
||||
@@ -95,13 +123,20 @@ int platform_net_socket_write_timeout(int fd, unsigned char *buf, int len, int t
|
||||
platform_net_socket_setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv,sizeof(struct timeval));
|
||||
|
||||
return write(fd, buf, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
int platform_net_socket_close(int fd)
|
||||
{
|
||||
#ifdef MQTT_NETSOCKET_USE_AT
|
||||
return tos_sal_module_close(fd);
|
||||
#else
|
||||
return close(fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef MQTT_NETSOCKET_USE_AT
|
||||
|
||||
int platform_net_socket_set_block(int fd)
|
||||
{
|
||||
return fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, F_GETFL) & ~O_NONBLOCK);
|
||||
@@ -117,3 +152,4 @@ int platform_net_socket_setsockopt(int fd, int level, int optname, const void *o
|
||||
return setsockopt(fd, level, optname, optval, optlen);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -11,12 +11,20 @@
|
||||
#include "network.h"
|
||||
#include "error.h"
|
||||
|
||||
#ifdef MQTT_NETSOCKET_USE_AT
|
||||
|
||||
#include "sal_module_wrapper.h"
|
||||
|
||||
#else
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/api.h"
|
||||
#include <lwip/sockets.h>
|
||||
#include "lwip/netdb.h"
|
||||
|
||||
#endif
|
||||
|
||||
#define PLATFORM_NET_PROTO_TCP 0 /**< The TCP transport protocol */
|
||||
#define PLATFORM_NET_PROTO_UDP 1 /**< The UDP transport protocol */
|
||||
|
||||
@@ -26,8 +34,11 @@ int platform_net_socket_recv_timeout(int fd, unsigned char *buf, int len, int ti
|
||||
int platform_net_socket_write(int fd, void *buf, size_t len);
|
||||
int platform_net_socket_write_timeout(int fd, unsigned char *buf, int len, int timeout);
|
||||
int platform_net_socket_close(int fd);
|
||||
|
||||
#ifndef MQTT_NETSOCKET_USE_AT
|
||||
int platform_net_socket_set_block(int fd);
|
||||
int platform_net_socket_set_nonblock(int fd);
|
||||
int platform_net_socket_setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen);
|
||||
#endif
|
||||
|
||||
#endif /* _PLATFORM_NET_SOCKET_H_ */
|
||||
|
105
examples/mqttclient/gokit3_mqttclient.c
Normal file
105
examples/mqttclient/gokit3_mqttclient.c
Normal file
@@ -0,0 +1,105 @@
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "bsp_init.h"
|
||||
#include "tos_k.h"
|
||||
#include "esp8266.h"
|
||||
#include "mqttclient.h"
|
||||
|
||||
k_task_t task;
|
||||
k_stack_t task_stack[2048];
|
||||
|
||||
mqtt_client_t client;
|
||||
client_init_params_t init_params;
|
||||
|
||||
static void tos_topic_handler(void* client, message_data_t* msg)
|
||||
{
|
||||
(void) client;
|
||||
LOG_I("-----------------------------------------------------------------------------------");
|
||||
LOG_I("%s:%d %s()...\ntopic: %s, qos: %d. \nmessage:\n\t%s\n", __FILE__, __LINE__, __FUNCTION__,
|
||||
msg->topic_name, msg->message->qos, (char*)msg->message->payload);
|
||||
LOG_I("-----------------------------------------------------------------------------------\n");
|
||||
}
|
||||
|
||||
|
||||
void mqttclient_task(void *Parameter)
|
||||
{
|
||||
int error;
|
||||
|
||||
char buf[100] = { 0 };
|
||||
|
||||
mqtt_message_t msg;
|
||||
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
|
||||
esp8266_sal_init(HAL_UART_PORT_2);
|
||||
esp8266_join_ap("wifii", "woshijiejie");
|
||||
|
||||
init_params.read_buf_size = 256;
|
||||
init_params.write_buf_size = 256;
|
||||
|
||||
#ifdef MQTT_NETWORK_TYPE_TLS
|
||||
init_params.connect_params.network_params.network_ssl_params.ca_crt = test_ca_get();
|
||||
init_params.connect_params.network_params.port = "8883";
|
||||
#else
|
||||
init_params.connect_params.network_params.port = "1883";
|
||||
#endif
|
||||
init_params.connect_params.network_params.addr = "www.jiejie01.top"; //"47.95.164.112";//"jiejie01.top"; //"129.204.201.235"; //"192.168.1.101";
|
||||
|
||||
init_params.connect_params.user_name = random_string(10); // random_string(10); //"jiejietop-acer1";
|
||||
init_params.connect_params.password = random_string(10);; //random_string(10); // "123456";
|
||||
init_params.connect_params.client_id = random_string(10);; //random_string(10); // "clientid-acer1";
|
||||
init_params.connect_params.clean_session = 1;
|
||||
|
||||
log_init();
|
||||
|
||||
mqtt_init(&client, &init_params);
|
||||
|
||||
error = mqtt_connect(&client);
|
||||
|
||||
LOG_D("mqtt connect error is %#x", error);
|
||||
|
||||
mqtt_subscribe(&client, "tos-topic", QOS0, tos_topic_handler);
|
||||
|
||||
LOG_D("mqtt subscribe error is %#x", error);
|
||||
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
|
||||
for (;;) {
|
||||
|
||||
sprintf(buf, "welcome to mqttclient, this is a publish test, a rand number: %d ...", random_number());
|
||||
|
||||
msg.qos = QOS0;
|
||||
msg.payload = (void *) buf;
|
||||
|
||||
error = mqtt_publish(&client, "tos-topic", &msg);
|
||||
|
||||
tos_task_delay(4000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
k_err_t err;
|
||||
|
||||
bsp_init();
|
||||
|
||||
printf("Welcome to TencentOS tiny\r\n");
|
||||
|
||||
tos_knl_init(); // TOS Tiny kernel initialize
|
||||
|
||||
printf("create mqttclient task\r\n");
|
||||
err = tos_task_create(&task,
|
||||
"mqttclient-task",
|
||||
mqttclient_task,
|
||||
NULL,
|
||||
3,
|
||||
task_stack,
|
||||
1024,
|
||||
20);
|
||||
if(err != K_ERR_NONE)
|
||||
printf("TencentOS Create mqttclient task fail! code : %d \r\n",err);
|
||||
|
||||
tos_knl_start(); // Start TOS Tiny
|
||||
|
||||
}
|
@@ -46,9 +46,15 @@ void application_entry(void *arg)
|
||||
|
||||
init_params.read_buf_size = 1024;
|
||||
init_params.write_buf_size = 1024;
|
||||
|
||||
#ifdef MQTT_NETWORK_TYPE_TLS
|
||||
init_params.connect_params.network_params.network_ssl_params.ca_crt = test_ca_get();
|
||||
init_params.connect_params.network_params.addr = "www.jiejie01.top";
|
||||
init_params.connect_params.network_params.port = "8883";
|
||||
#else
|
||||
init_params.connect_params.network_params.port = "1883";
|
||||
#endif
|
||||
init_params.connect_params.network_params.addr = "www.jiejie01.top"; //"47.95.164.112";//"jiejie01.top"; //"129.204.201.235"; //"192.168.1.101";
|
||||
|
||||
init_params.connect_params.user_name = random_string(10);
|
||||
init_params.connect_params.password = random_string(10);
|
||||
init_params.connect_params.client_id = random_string(10);
|
||||
@@ -69,7 +75,9 @@ void application_entry(void *arg)
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
|
||||
for (;;) {
|
||||
|
||||
|
||||
sprintf(buf, "welcome to mqttclient, this is a publish test, a rand number: %d ...", random_number());
|
||||
|
||||
msg.qos = QOS0;
|
||||
msg.payload = (void *) buf;
|
||||
|
||||
|
Reference in New Issue
Block a user