mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-29 08:19:42 +08:00
Enable warnings on nRF5x examples
Now all warnings are disabled on SDK files, and enabled on our application's files. Fixed a couple of things in nRF52 which were unnoticed because all warnings were disabled there from the beginning. PUBLISHED_FROM=a33ab22d0ce85efea364b80478986b88f4b0a3a2
This commit is contained in:
parent
7f2bdc217a
commit
e69a7a1b25
@ -35,6 +35,16 @@
|
|||||||
#include "ble_6lowpan.h"
|
#include "ble_6lowpan.h"
|
||||||
#include "mem_manager.h"
|
#include "mem_manager.h"
|
||||||
#include "app_trace.h"
|
#include "app_trace.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* arm-none-eabi-gcc has BYTE_ORDER already defined, so in order to avoid
|
||||||
|
* warnings in lwip, we have to undefine it
|
||||||
|
*
|
||||||
|
* TODO: Check if in the future versions of nRF5 SDK that changes.
|
||||||
|
* Current version of nRF51 SDK: 0.8.0
|
||||||
|
* nRF5 SDK: 0.9.0
|
||||||
|
*/
|
||||||
|
#undef BYTE_ORDER
|
||||||
#include "lwip/init.h"
|
#include "lwip/init.h"
|
||||||
#include "lwip/inet6.h"
|
#include "lwip/inet6.h"
|
||||||
#include "lwip/ip6.h"
|
#include "lwip/ip6.h"
|
||||||
|
@ -36,7 +36,7 @@ SIZE := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-size"
|
|||||||
remduplicates = $(strip $(if $1,$(firstword $1) $(call remduplicates,$(filter-out $(firstword $1),$1))))
|
remduplicates = $(strip $(if $1,$(firstword $1) $(call remduplicates,$(filter-out $(firstword $1),$1))))
|
||||||
|
|
||||||
#source common to all targets
|
#source common to all targets
|
||||||
C_SOURCE_FILES += \
|
C_SOURCE_FILES_SDK = \
|
||||||
../../../../nrf51_iot_sdk/components/libraries/button/app_button.c \
|
../../../../nrf51_iot_sdk/components/libraries/button/app_button.c \
|
||||||
../../../../nrf51_iot_sdk/components/libraries/util/app_error.c \
|
../../../../nrf51_iot_sdk/components/libraries/util/app_error.c \
|
||||||
../../../../nrf51_iot_sdk/components/libraries/fifo/app_fifo.c \
|
../../../../nrf51_iot_sdk/components/libraries/fifo/app_fifo.c \
|
||||||
@ -51,12 +51,6 @@ C_SOURCE_FILES += \
|
|||||||
../../../../nrf51_iot_sdk/components/drivers_nrf/hal/nrf_delay.c \
|
../../../../nrf51_iot_sdk/components/drivers_nrf/hal/nrf_delay.c \
|
||||||
../../../../nrf51_iot_sdk/components/drivers_nrf/common/nrf_drv_common.c \
|
../../../../nrf51_iot_sdk/components/drivers_nrf/common/nrf_drv_common.c \
|
||||||
../../../../nrf51_iot_sdk/components/drivers_nrf/gpiote/nrf_drv_gpiote.c \
|
../../../../nrf51_iot_sdk/components/drivers_nrf/gpiote/nrf_drv_gpiote.c \
|
||||||
../../../main.c \
|
|
||||||
../../../bleconfig.c \
|
|
||||||
../../../rtt/RTT/SEGGER_RTT.c \
|
|
||||||
../../../rtt/RTT/SEGGER_RTT_printf.c \
|
|
||||||
../../../rtt/Syscalls/RTT_Syscalls_GCC.c \
|
|
||||||
../../../../../../mongoose.c \
|
|
||||||
../../../../nrf51_iot_sdk/components/ble/common/ble_advdata.c \
|
../../../../nrf51_iot_sdk/components/ble/common/ble_advdata.c \
|
||||||
../../../../nrf51_iot_sdk/components/ble/common/ble_srv_common.c \
|
../../../../nrf51_iot_sdk/components/ble/common/ble_srv_common.c \
|
||||||
../../../../nrf51_iot_sdk/components/iot/context_manager/iot_context_manager.c \
|
../../../../nrf51_iot_sdk/components/iot/context_manager/iot_context_manager.c \
|
||||||
@ -64,6 +58,16 @@ C_SOURCE_FILES += \
|
|||||||
../../../../nrf51_iot_sdk/components/softdevice/common/softdevice_handler/softdevice_handler.c \
|
../../../../nrf51_iot_sdk/components/softdevice/common/softdevice_handler/softdevice_handler.c \
|
||||||
../../../../nrf51_iot_sdk/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.c \
|
../../../../nrf51_iot_sdk/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.c \
|
||||||
|
|
||||||
|
C_SOURCE_FILES_APP = \
|
||||||
|
../../../main.c \
|
||||||
|
../../../bleconfig.c \
|
||||||
|
../../../rtt/RTT/SEGGER_RTT.c \
|
||||||
|
../../../rtt/RTT/SEGGER_RTT_printf.c \
|
||||||
|
../../../rtt/Syscalls/RTT_Syscalls_GCC.c \
|
||||||
|
../../../../../../mongoose.c \
|
||||||
|
|
||||||
|
C_SOURCE_FILES = $(C_SOURCE_FILES_SDK) $(C_SOURCE_FILES_APP)
|
||||||
|
|
||||||
#assembly files common to all targets
|
#assembly files common to all targets
|
||||||
ASM_SOURCE_FILES = ../../../../nrf51_iot_sdk/components/toolchain/gcc/gcc_startup_nrf51.s
|
ASM_SOURCE_FILES = ../../../../nrf51_iot_sdk/components/toolchain/gcc/gcc_startup_nrf51.s
|
||||||
|
|
||||||
@ -130,7 +134,7 @@ CFLAGS += -DBLE_STACK_SUPPORT_REQD
|
|||||||
CFLAGS += -DBSP_DEFINES_ONLY
|
CFLAGS += -DBSP_DEFINES_ONLY
|
||||||
CFLAGS += -mcpu=cortex-m0
|
CFLAGS += -mcpu=cortex-m0
|
||||||
CFLAGS += -mthumb -mabi=aapcs --std=gnu99
|
CFLAGS += -mthumb -mabi=aapcs --std=gnu99
|
||||||
CFLAGS += -Wall -g3 -O3
|
CFLAGS += -g3 -O3
|
||||||
CFLAGS += -mfloat-abi=soft
|
CFLAGS += -mfloat-abi=soft
|
||||||
# keep every function in separate section. This will allow linker to dump unused functions
|
# keep every function in separate section. This will allow linker to dump unused functions
|
||||||
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
|
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
|
||||||
@ -181,6 +185,17 @@ C_SOURCE_FILE_NAMES = $(notdir $(C_SOURCE_FILES))
|
|||||||
C_PATHS = $(call remduplicates, $(dir $(C_SOURCE_FILES) ) )
|
C_PATHS = $(call remduplicates, $(dir $(C_SOURCE_FILES) ) )
|
||||||
C_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(C_SOURCE_FILE_NAMES:.c=.o) )
|
C_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(C_SOURCE_FILE_NAMES:.c=.o) )
|
||||||
|
|
||||||
|
C_SOURCE_FILE_NAMES_SDK = $(notdir $(C_SOURCE_FILES_SDK))
|
||||||
|
C_SOURCE_FILE_NAMES_APP = $(notdir $(C_SOURCE_FILES_APP))
|
||||||
|
C_OBJECTS_SDK = $(addprefix $(OBJECT_DIRECTORY)/, $(C_SOURCE_FILE_NAMES_SDK:.c=.o) )
|
||||||
|
C_OBJECTS_APP = $(addprefix $(OBJECT_DIRECTORY)/, $(C_SOURCE_FILE_NAMES_APP:.c=.o) )
|
||||||
|
|
||||||
|
# Disable all warnings for SDK sources since we have no control of them
|
||||||
|
$(C_OBJECTS_SDK): CFLAGS += -w
|
||||||
|
|
||||||
|
# Enable all warnings for the application's files
|
||||||
|
$(C_OBJECTS_APP): CFLAGS += -Wall
|
||||||
|
|
||||||
ASM_SOURCE_FILE_NAMES = $(notdir $(ASM_SOURCE_FILES))
|
ASM_SOURCE_FILE_NAMES = $(notdir $(ASM_SOURCE_FILES))
|
||||||
ASM_PATHS = $(call remduplicates, $(dir $(ASM_SOURCE_FILES) ))
|
ASM_PATHS = $(call remduplicates, $(dir $(ASM_SOURCE_FILES) ))
|
||||||
ASM_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(ASM_SOURCE_FILE_NAMES:.s=.o) )
|
ASM_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(ASM_SOURCE_FILE_NAMES:.s=.o) )
|
||||||
|
@ -16,6 +16,16 @@
|
|||||||
#include "ble_6lowpan.h"
|
#include "ble_6lowpan.h"
|
||||||
#include "mem_manager.h"
|
#include "mem_manager.h"
|
||||||
#include "app_trace.h"
|
#include "app_trace.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* arm-none-eabi-gcc has BYTE_ORDER already defined, so in order to avoid
|
||||||
|
* warnings in lwip, we have to undefine it
|
||||||
|
*
|
||||||
|
* TODO: Check if in the future versions of nRF5 SDK that changes.
|
||||||
|
* Current version of nRF51 SDK: 0.8.0
|
||||||
|
* nRF5 SDK: 0.9.0
|
||||||
|
*/
|
||||||
|
#undef BYTE_ORDER
|
||||||
#include "lwip/init.h"
|
#include "lwip/init.h"
|
||||||
#include "lwip/inet6.h"
|
#include "lwip/inet6.h"
|
||||||
#include "lwip/ip6.h"
|
#include "lwip/ip6.h"
|
||||||
@ -63,7 +73,6 @@ typedef enum
|
|||||||
APP_TIMER_DEF(m_iot_timer_tick_src_id); /**< System Timer used to service CoAP and LWIP periodically. */
|
APP_TIMER_DEF(m_iot_timer_tick_src_id); /**< System Timer used to service CoAP and LWIP periodically. */
|
||||||
eui64_t eui64_local_iid; /**< Local EUI64 value that is used as the IID for*/
|
eui64_t eui64_local_iid; /**< Local EUI64 value that is used as the IID for*/
|
||||||
static ipv6_medium_instance_t m_ipv6_medium;
|
static ipv6_medium_instance_t m_ipv6_medium;
|
||||||
static struct tcp_pcb * mp_tcp_port; /**< TCP Port to listen on. */
|
|
||||||
static tcp_state_t m_tcp_state; /**< TCP State information. */
|
static tcp_state_t m_tcp_state; /**< TCP State information. */
|
||||||
|
|
||||||
#ifdef COMMISSIONING_ENABLED
|
#ifdef COMMISSIONING_ENABLED
|
||||||
@ -419,11 +428,12 @@ void bleconfig_init(void) {
|
|||||||
//Start execution.
|
//Start execution.
|
||||||
connectable_mode_enter();
|
connectable_mode_enter();
|
||||||
|
|
||||||
APPL_LOG(0, "BLE init done\n");
|
APPL_LOG("BLE init done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void bleconfig_poll(void) {
|
void bleconfig_poll(void) {
|
||||||
//Execute event schedule.
|
//Execute event schedule.
|
||||||
app_sched_execute();
|
app_sched_execute();
|
||||||
|
sys_check_timeouts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ SIZE := '$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-size'
|
|||||||
remduplicates = $(strip $(if $1,$(firstword $1) $(call remduplicates,$(filter-out $(firstword $1),$1))))
|
remduplicates = $(strip $(if $1,$(firstword $1) $(call remduplicates,$(filter-out $(firstword $1),$1))))
|
||||||
|
|
||||||
#source common to all targets
|
#source common to all targets
|
||||||
C_SOURCE_FILES += \
|
C_SOURCE_FILES_SDK = \
|
||||||
$(abspath ../../../../nrf5_iot_sdk/components/libraries/button/app_button.c) \
|
$(abspath ../../../../nrf5_iot_sdk/components/libraries/button/app_button.c) \
|
||||||
$(abspath ../../../../nrf5_iot_sdk/components/libraries/util/app_error.c) \
|
$(abspath ../../../../nrf5_iot_sdk/components/libraries/util/app_error.c) \
|
||||||
$(abspath ../../../../nrf5_iot_sdk/components/libraries/fifo/app_fifo.c) \
|
$(abspath ../../../../nrf5_iot_sdk/components/libraries/fifo/app_fifo.c) \
|
||||||
@ -80,12 +80,6 @@ $(abspath ../../../../nrf5_iot_sdk/components/drivers_nrf/gpiote/nrf_drv_gpiote.
|
|||||||
$(abspath ../../../../nrf5_iot_sdk/components/drivers_nrf/uart/nrf_drv_uart.c) \
|
$(abspath ../../../../nrf5_iot_sdk/components/drivers_nrf/uart/nrf_drv_uart.c) \
|
||||||
$(abspath ../../../../nrf5_iot_sdk/components/drivers_nrf/pstorage/pstorage.c) \
|
$(abspath ../../../../nrf5_iot_sdk/components/drivers_nrf/pstorage/pstorage.c) \
|
||||||
$(abspath ../../../../nrf5_iot_sdk/examples/bsp/bsp.c) \
|
$(abspath ../../../../nrf5_iot_sdk/examples/bsp/bsp.c) \
|
||||||
$(abspath ../../../main.c) \
|
|
||||||
$(abspath ../../../bleconfig.c) \
|
|
||||||
$(abspath ../../../../../../mongoose.c) \
|
|
||||||
$(abspath ../../../rtt/RTT/SEGGER_RTT.c) \
|
|
||||||
$(abspath ../../../rtt/RTT/SEGGER_RTT_printf.c) \
|
|
||||||
$(abspath ../../../rtt/Syscalls/RTT_Syscalls_GCC.c) \
|
|
||||||
$(abspath ../../../../nrf5_iot_sdk/components/ble/common/ble_advdata.c) \
|
$(abspath ../../../../nrf5_iot_sdk/components/ble/common/ble_advdata.c) \
|
||||||
$(abspath ../../../../nrf5_iot_sdk/components/ble/common/ble_conn_params.c) \
|
$(abspath ../../../../nrf5_iot_sdk/components/ble/common/ble_conn_params.c) \
|
||||||
$(abspath ../../../../nrf5_iot_sdk/components/ble/common/ble_srv_common.c) \
|
$(abspath ../../../../nrf5_iot_sdk/components/ble/common/ble_srv_common.c) \
|
||||||
@ -100,6 +94,16 @@ $(abspath ../../../../nrf5_iot_sdk/components/iot/medium/commissioning/commissio
|
|||||||
$(abspath ../../../../nrf5_iot_sdk/components/softdevice/common/softdevice_handler/softdevice_handler.c) \
|
$(abspath ../../../../nrf5_iot_sdk/components/softdevice/common/softdevice_handler/softdevice_handler.c) \
|
||||||
$(abspath ../../../../nrf5_iot_sdk/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.c) \
|
$(abspath ../../../../nrf5_iot_sdk/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.c) \
|
||||||
|
|
||||||
|
C_SOURCE_FILES_APP = \
|
||||||
|
$(abspath ../../../main.c) \
|
||||||
|
$(abspath ../../../bleconfig.c) \
|
||||||
|
$(abspath ../../../../../../mongoose.c) \
|
||||||
|
$(abspath ../../../rtt/RTT/SEGGER_RTT.c) \
|
||||||
|
$(abspath ../../../rtt/RTT/SEGGER_RTT_printf.c) \
|
||||||
|
$(abspath ../../../rtt/Syscalls/RTT_Syscalls_GCC.c) \
|
||||||
|
|
||||||
|
C_SOURCE_FILES = $(C_SOURCE_FILES_APP) $(C_SOURCE_FILES_SDK)
|
||||||
|
|
||||||
#assembly files common to all targets
|
#assembly files common to all targets
|
||||||
ASM_SOURCE_FILES = $(abspath ../../../../nrf5_iot_sdk/components/toolchain/gcc/gcc_startup_nrf52.s)
|
ASM_SOURCE_FILES = $(abspath ../../../../nrf5_iot_sdk/components/toolchain/gcc/gcc_startup_nrf52.s)
|
||||||
|
|
||||||
@ -178,7 +182,7 @@ CFLAGS += -DBLE_STACK_SUPPORT_REQD
|
|||||||
CFLAGS += -Ds1xx
|
CFLAGS += -Ds1xx
|
||||||
CFLAGS += -mcpu=cortex-m4
|
CFLAGS += -mcpu=cortex-m4
|
||||||
CFLAGS += -mthumb -mabi=aapcs --std=gnu99
|
CFLAGS += -mthumb -mabi=aapcs --std=gnu99
|
||||||
CFLAGS += -w -g3 -O3
|
CFLAGS += -g3 -O3
|
||||||
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||||
# keep every function in separate section. This will allow linker to dump unused functions
|
# keep every function in separate section. This will allow linker to dump unused functions
|
||||||
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
|
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
|
||||||
@ -230,6 +234,17 @@ C_SOURCE_FILE_NAMES = $(notdir $(C_SOURCE_FILES))
|
|||||||
C_PATHS = $(call remduplicates, $(dir $(C_SOURCE_FILES) ) )
|
C_PATHS = $(call remduplicates, $(dir $(C_SOURCE_FILES) ) )
|
||||||
C_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(C_SOURCE_FILE_NAMES:.c=.o) )
|
C_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(C_SOURCE_FILE_NAMES:.c=.o) )
|
||||||
|
|
||||||
|
C_SOURCE_FILE_NAMES_SDK = $(notdir $(C_SOURCE_FILES_SDK))
|
||||||
|
C_SOURCE_FILE_NAMES_APP = $(notdir $(C_SOURCE_FILES_APP))
|
||||||
|
C_OBJECTS_SDK = $(addprefix $(OBJECT_DIRECTORY)/, $(C_SOURCE_FILE_NAMES_SDK:.c=.o) )
|
||||||
|
C_OBJECTS_APP = $(addprefix $(OBJECT_DIRECTORY)/, $(C_SOURCE_FILE_NAMES_APP:.c=.o) )
|
||||||
|
|
||||||
|
# Disable all warnings for SDK sources since we have no control of them
|
||||||
|
$(C_OBJECTS_SDK): CFLAGS += -w
|
||||||
|
|
||||||
|
# Enable all warnings for the application's files
|
||||||
|
$(C_OBJECTS_APP): CFLAGS += -Wall
|
||||||
|
|
||||||
ASM_SOURCE_FILE_NAMES = $(notdir $(ASM_SOURCE_FILES))
|
ASM_SOURCE_FILE_NAMES = $(notdir $(ASM_SOURCE_FILES))
|
||||||
ASM_PATHS = $(call remduplicates, $(dir $(ASM_SOURCE_FILES) ))
|
ASM_PATHS = $(call remduplicates, $(dir $(ASM_SOURCE_FILES) ))
|
||||||
ASM_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(ASM_SOURCE_FILE_NAMES:.s=.o) )
|
ASM_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(ASM_SOURCE_FILE_NAMES:.s=.o) )
|
||||||
|
@ -85,7 +85,6 @@ int main(void)
|
|||||||
|
|
||||||
for (;;) { // Start infinite event loop
|
for (;;) { // Start infinite event loop
|
||||||
bleconfig_poll();
|
bleconfig_poll();
|
||||||
sys_check_timeouts();
|
|
||||||
mg_mgr_poll(&mgr, 0);
|
mg_mgr_poll(&mgr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
mongoose.h
19
mongoose.h
@ -975,10 +975,13 @@ int gettimeofday(struct timeval *tp, void *tzp);
|
|||||||
#define to64(x) strtoll(x, NULL, 10)
|
#define to64(x) strtoll(x, NULL, 10)
|
||||||
|
|
||||||
#define MG_NET_IF MG_NET_IF_LWIP_LOW_LEVEL
|
#define MG_NET_IF MG_NET_IF_LWIP_LOW_LEVEL
|
||||||
#define LWIP_PROVIDE_ERRNO 1
|
|
||||||
#define MG_LWIP 1
|
#define MG_LWIP 1
|
||||||
#define MG_ENABLE_IPV6 1
|
#define MG_ENABLE_IPV6 1
|
||||||
|
|
||||||
|
#if !defined(ENOSPC)
|
||||||
|
# define ENOSPC 28 /* No space left on device */
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For ARM C Compiler, make lwip to export `struct timeval`; for other
|
* For ARM C Compiler, make lwip to export `struct timeval`; for other
|
||||||
* compilers, suppress it.
|
* compilers, suppress it.
|
||||||
@ -1442,6 +1445,20 @@ char* inet_ntoa(struct in_addr in);
|
|||||||
|
|
||||||
#if MG_LWIP
|
#if MG_LWIP
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When compiling for nRF5x chips with arm-none-eabi-gcc, it has BYTE_ORDER
|
||||||
|
* already defined, so in order to avoid warnings in lwip, we have to undefine
|
||||||
|
* it.
|
||||||
|
*
|
||||||
|
* TODO: Check if in the future versions of nRF5 SDK that changes.
|
||||||
|
* Current version of nRF51 SDK: 0.8.0
|
||||||
|
* nRF5 SDK: 0.9.0
|
||||||
|
*/
|
||||||
|
#if CS_PLATFORM == CS_P_NRF51 || CS_PLATFORM == CS_P_NRF52
|
||||||
|
# undef BYTE_ORDER
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <lwip/opt.h>
|
#include <lwip/opt.h>
|
||||||
#include <lwip/err.h>
|
#include <lwip/err.h>
|
||||||
#include <lwip/ip_addr.h>
|
#include <lwip/ip_addr.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user