Make nRF51 example work with GCC

Unfortunately it turns out Nordic's examples were able to build with GCC
just because they suppressed all warnings; I had to do the same here
because there are some macro redefinitions of arm-none-eabi-gcc and
lwip.

TODO: resolve that and do not suppress warnings.

PUBLISHED_FROM=e65c7b0f2451f85765d958d7f67eb9262f7bc929
This commit is contained in:
Dmitry Frank 2016-11-04 14:14:22 +02:00 committed by Cesanta Bot
parent 6ff49dc196
commit 0187f297d1
2 changed files with 26 additions and 2 deletions

View File

@ -0,0 +1,2 @@
target extended-remote localhost:2331
file _build/nrf51422_xxac_s1xx_iot.out

View File

@ -46,13 +46,17 @@ C_SOURCE_FILES += \
../../../../nrf51_iot_sdk/components/libraries/trace/app_trace.c \ ../../../../nrf51_iot_sdk/components/libraries/trace/app_trace.c \
../../../../nrf51_iot_sdk/components/libraries/mem_manager/mem_manager.c \ ../../../../nrf51_iot_sdk/components/libraries/mem_manager/mem_manager.c \
../../../../nrf51_iot_sdk/components/libraries/util/nrf_assert.c \ ../../../../nrf51_iot_sdk/components/libraries/util/nrf_assert.c \
../../../../nrf51_iot_sdk/components/libraries/uart/retarget.c \
../../../../nrf51_iot_sdk/external/lwip/src/port/nrf_platform_port.c \ ../../../../nrf51_iot_sdk/external/lwip/src/port/nrf_platform_port.c \
../../../../nrf51_iot_sdk/components/drivers_nrf/uart/app_uart_fifo.c \ ../../../../nrf51_iot_sdk/components/drivers_nrf/uart/app_uart_fifo.c \
../../../../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 \ ../../../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 \
@ -88,6 +92,8 @@ INC_PATHS += -I../../../../nrf51_iot_sdk/components/libraries/scheduler
INC_PATHS += -I../../../../nrf51_iot_sdk/external/lwip/src/include/netif INC_PATHS += -I../../../../nrf51_iot_sdk/external/lwip/src/include/netif
INC_PATHS += -I../../../../nrf51_iot_sdk/components/iot/include INC_PATHS += -I../../../../nrf51_iot_sdk/components/iot/include
INC_PATHS += -I../../.. INC_PATHS += -I../../..
INC_PATHS += -I../../../../../..
INC_PATHS += -I../../../rtt/RTT
INC_PATHS += -I../../../../nrf51_iot_sdk/components/iot/context_manager INC_PATHS += -I../../../../nrf51_iot_sdk/components/iot/context_manager
INC_PATHS += -I../../../../nrf51_iot_sdk/components/toolchain/gcc INC_PATHS += -I../../../../nrf51_iot_sdk/components/toolchain/gcc
INC_PATHS += -I../../../../nrf51_iot_sdk/components/drivers_nrf/gpiote INC_PATHS += -I../../../../nrf51_iot_sdk/components/drivers_nrf/gpiote
@ -105,6 +111,14 @@ OUTPUT_BINARY_DIRECTORY = $(OBJECT_DIRECTORY)
# Sorting removes duplicates # Sorting removes duplicates
BUILD_DIRECTORIES := $(sort $(OBJECT_DIRECTORY) $(OUTPUT_BINARY_DIRECTORY) $(LISTING_DIRECTORY) ) BUILD_DIRECTORIES := $(sort $(OBJECT_DIRECTORY) $(OUTPUT_BINARY_DIRECTORY) $(LISTING_DIRECTORY) )
# Mongoose features
MG_FEATURES_TINY = \
-DMG_DISABLE_HTTP_DIGEST_AUTH \
-DMG_DISABLE_MD5 \
-DMG_DISABLE_HTTP_KEEP_ALIVE \
-DMG_ENABLE_HTTP_SSI=0 \
-DMG_ENABLE_HTTP_STREAMING_MULTIPART
#flags common to all targets #flags common to all targets
CFLAGS = -D__HEAP_SIZE=512 CFLAGS = -D__HEAP_SIZE=512
CFLAGS += -DSWI_DISABLE0 CFLAGS += -DSWI_DISABLE0
@ -116,12 +130,20 @@ 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 -Werror -O3 CFLAGS += -Wall -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
CFLAGS += -fno-builtin --short-enums CFLAGS += -fno-builtin --short-enums
CFLAGS += -DCS_ENABLE_STDIO
# This macro is needed for stdout to be retargeted to either UART or RTT
CFLAGS += -DENABLE_DEBUG_LOG_SUPPORT
# Mongoose flags
CFLAGS += -DCS_PLATFORM=CS_P_NRF52 $(MG_FEATURES_TINY) -DMG_MODULE_LINES
# 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
LDFLAGS += -Xlinker -Map=$(LISTING_DIRECTORY)/$(OUTPUT_FILENAME).map LDFLAGS += -Xlinker -Map=$(LISTING_DIRECTORY)/$(OUTPUT_FILENAME).map
LDFLAGS += -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT) LDFLAGS += -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT)