From e8de21b71a64e53de2746c2e7c695362d54b6c97 Mon Sep 17 00:00:00 2001 From: Lee Lup Yuen Date: Sun, 27 Dec 2020 14:11:50 +0800 Subject: [PATCH 01/10] Fix GCC type warning --- components/hal_drv/bl602_hal/bl_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/hal_drv/bl602_hal/bl_adc.c b/components/hal_drv/bl602_hal/bl_adc.c index 183978800..67b8ea23a 100644 --- a/components/hal_drv/bl602_hal/bl_adc.c +++ b/components/hal_drv/bl602_hal/bl_adc.c @@ -486,7 +486,7 @@ int bl_adc_start(void) int bl_adc_gpio_init(int gpio_num) { - uint8_t adc_pin = gpio_num; + GLB_GPIO_Type adc_pin = gpio_num; GLB_GPIO_Func_Init(GPIO_FUN_ANALOG, &adc_pin, 1); From 8616349d9d8823833a4ed944791484cb3dd0d30c Mon Sep 17 00:00:00 2001 From: Lee Lup Yuen Date: Sun, 27 Dec 2020 14:13:27 +0800 Subject: [PATCH 02/10] Fix missing FreeRTOS declarations --- components/hal_drv/bl602_hal/bl_dac_audio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/hal_drv/bl602_hal/bl_dac_audio.c b/components/hal_drv/bl602_hal/bl_dac_audio.c index 092584170..3db8b8c4c 100644 --- a/components/hal_drv/bl602_hal/bl_dac_audio.c +++ b/components/hal_drv/bl602_hal/bl_dac_audio.c @@ -27,6 +27,7 @@ * 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. */ +#include #include "bl_dac_audio.h" #include "bl602_common.h" From bf91d5a24fe748f3d10ad241106b2c66dc232878 Mon Sep 17 00:00:00 2001 From: Lee Lup Yuen Date: Sun, 27 Dec 2020 14:14:06 +0800 Subject: [PATCH 03/10] Fix GCC type warning --- components/hal_drv/bl602_hal/bl_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/hal_drv/bl602_hal/bl_i2c.c b/components/hal_drv/bl602_hal/bl_i2c.c index 3e74067f6..af48c8bd8 100644 --- a/components/hal_drv/bl602_hal/bl_i2c.c +++ b/components/hal_drv/bl602_hal/bl_i2c.c @@ -56,7 +56,7 @@ void i2c_set_freq(int freq, int i2cx) void i2c_gpio_init(int i2cx) { - uint8_t gpiopins[2]; + GLB_GPIO_Type gpiopins[2]; if (i2cx == I2C0) { gpiopins[0] = GLB_GPIO_PIN_4; gpiopins[1] = GLB_GPIO_PIN_3; From c6eac99b5dcd622e9d308e79d7dc237a066f47cc Mon Sep 17 00:00:00 2001 From: Lee Lup Yuen Date: Sun, 27 Dec 2020 14:15:40 +0800 Subject: [PATCH 04/10] Suppress GCC variable set but not used warning --- components/hal_drv/bl602_hal/hal_board.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/hal_drv/bl602_hal/hal_board.c b/components/hal_drv/bl602_hal/hal_board.c index 9a444189d..33165e96d 100644 --- a/components/hal_drv/bl602_hal/hal_board.c +++ b/components/hal_drv/bl602_hal/hal_board.c @@ -726,6 +726,7 @@ static int hal_board_load_fdt_info(const void *dtb) } else { pwr_table_ble = 0; } + pwr_table_ble += 0; // Suppress "variable set but not used" warning blog_info("set pwr_table_ble = %ld in dts\r\n", pwr_table_ble); #ifdef CFG_BLE_ENABLE ble_controller_set_tx_pwr(pwr_table_ble); From e529d495cfc24d02c66006f58869723346b90c10 Mon Sep 17 00:00:00 2001 From: Lee Lup Yuen Date: Sun, 27 Dec 2020 14:16:27 +0800 Subject: [PATCH 05/10] Fix GCC buffer overflow warning --- components/hal_drv/bl602_hal/hal_button.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/hal_drv/bl602_hal/hal_button.c b/components/hal_drv/bl602_hal/hal_button.c index 5ce0d7dc8..f718a95ac 100644 --- a/components/hal_drv/bl602_hal/hal_button.c +++ b/components/hal_drv/bl602_hal/hal_button.c @@ -338,7 +338,7 @@ void fdt_button_module_init(const void *fdt, int button_offset) for (i = 0; i < GPIO_MODULE_MAX; i++) { memset(gpio_node, 0, sizeof(gpio_node)); - sprintf(gpio_node, "gpio%d", i); + snprintf(gpio_node, sizeof(gpio_node), "gpio%d", i); offset1 = fdt_subnode_offset(fdt, button_offset, gpio_node); if (0 > offset1) { //log_warn("gpio[%d] %s NULL. \r\n", i, gpio_node); From 306f6a7277d609294e29af5679285e7cf2dea858 Mon Sep 17 00:00:00 2001 From: Lee Lup Yuen Date: Sun, 27 Dec 2020 14:17:32 +0800 Subject: [PATCH 06/10] Fix GCC type warning --- components/hal_drv/bl602_hal/hal_ir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/hal_drv/bl602_hal/hal_ir.c b/components/hal_drv/bl602_hal/hal_ir.c index 60bf96cb1..5479a86a1 100644 --- a/components/hal_drv/bl602_hal/hal_ir.c +++ b/components/hal_drv/bl602_hal/hal_ir.c @@ -60,7 +60,7 @@ int hal_ir_init_from_dts(uint32_t fdt_input, uint32_t dtb_offset) int ctrltype = 0; uint8_t pin = 0; - uint16_t interval = NULL; + uint16_t interval = 0; addr_prop = fdt_getprop(fdt, dtb_offset, "ctrltype", &lentmp); if (addr_prop == NULL) { From e7bfbc2e8d57afed7a468221e253cdef15d93fa9 Mon Sep 17 00:00:00 2001 From: Lee Lup Yuen Date: Sun, 27 Dec 2020 14:18:10 +0800 Subject: [PATCH 07/10] Fix GCC type warning --- components/hal_drv/bl602_hal/hal_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/hal_drv/bl602_hal/hal_spi.c b/components/hal_drv/bl602_hal/hal_spi.c index c9fa5458b..529787f20 100644 --- a/components/hal_drv/bl602_hal/hal_spi.c +++ b/components/hal_drv/bl602_hal/hal_spi.c @@ -89,7 +89,7 @@ void bl_spi0_dma_int_handler_rx(void); static void hal_gpio_init(spi_hw_t *arg) { - uint8_t gpiopins[4]; + GLB_GPIO_Type gpiopins[4]; if (!arg) { blog_error("arg err.\r\n"); From 7012a478cf00996d0b821ce1c51f1f9f1d01b0cf Mon Sep 17 00:00:00 2001 From: Lee Lup Yuen Date: Sun, 27 Dec 2020 14:19:00 +0800 Subject: [PATCH 08/10] Fix GCC buffer overflow warning --- components/hal_drv/bl602_hal/hal_sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/hal_drv/bl602_hal/hal_sys.c b/components/hal_drv/bl602_hal/hal_sys.c index 68b6bdb75..23ee76ccc 100644 --- a/components/hal_drv/bl602_hal/hal_sys.c +++ b/components/hal_drv/bl602_hal/hal_sys.c @@ -55,7 +55,7 @@ static uint32_t user_clz(uint32_t priorities) struct romapi_freertos_map* hal_sys_romapi_get(void) { - extern uint8_t __global_pointer_head$; + extern uint8_t __global_pointer_head$[0x498]; uint32_t *gp_data_start = (uint32_t*)(&__global_pointer_head$); struct romapi_freertos_map* romapi_freertos; From 92d3f91417556f04986c8467535c4c143e0429c9 Mon Sep 17 00:00:00 2001 From: Lee Lup Yuen Date: Sun, 27 Dec 2020 14:19:50 +0800 Subject: [PATCH 09/10] Fix GCC missing declaration warning --- components/hal_drv/bl602_hal/hal_wifi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/hal_drv/bl602_hal/hal_wifi.c b/components/hal_drv/bl602_hal/hal_wifi.c index 23dba59ff..3db7de338 100644 --- a/components/hal_drv/bl602_hal/hal_wifi.c +++ b/components/hal_drv/bl602_hal/hal_wifi.c @@ -27,6 +27,7 @@ * 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. */ +#include #include #include #include "hal_wifi.h" From 4988edf43abe7f441ce8c0ed6c0097b7014deb4c Mon Sep 17 00:00:00 2001 From: Lee Lup Yuen Date: Mon, 28 Dec 2020 11:58:41 +0800 Subject: [PATCH 10/10] Revert fix for variable set but not used warning --- components/hal_drv/bl602_hal/hal_board.c | 1 - 1 file changed, 1 deletion(-) diff --git a/components/hal_drv/bl602_hal/hal_board.c b/components/hal_drv/bl602_hal/hal_board.c index 33165e96d..9a444189d 100644 --- a/components/hal_drv/bl602_hal/hal_board.c +++ b/components/hal_drv/bl602_hal/hal_board.c @@ -726,7 +726,6 @@ static int hal_board_load_fdt_info(const void *dtb) } else { pwr_table_ble = 0; } - pwr_table_ble += 0; // Suppress "variable set but not used" warning blog_info("set pwr_table_ble = %ld in dts\r\n", pwr_table_ble); #ifdef CFG_BLE_ENABLE ble_controller_set_tx_pwr(pwr_table_ble);