# W600 SDK: compiler flags, include paths and the SDK object libraries. set(SDK_DIR ${CMAKE_SOURCE_DIR}/sdk) set(NL_ARCH_FLAGS "-mthumb -mcpu=cortex-m3 -march=armv7-m -mabi=aapcs") set(CMAKE_C_FLAGS "${NL_ARCH_FLAGS} --function-sections --data-sections -std=gnu99 -fno-builtin -DGCC_COMPILE=1 -D_IN_ADDR_T_DECLARED -D__MACHINE_ENDIAN_H__ -D_TIMEVAL_DEFINED -D__INSIDE_CYGWIN_NET__") set(CMAKE_C_FLAGS_RELEASE "-Os") set(CMAKE_C_FLAGS_DEBUG "-Og -g3") set(CMAKE_ASM_FLAGS "${NL_ARCH_FLAGS} -mthumb-interwork") # The SDK predates the GCC 10/14 defaults (-fno-common, implicit declarations are errors). # gcc 4.9 (the Docker build toolchain, see docker/Dockerfile) does not know these options and # already defaults to common symbols / warnings-only, so only add them for newer host compilers. # Directory-level options are inherited by the SDK subdirectories below. if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10) add_compile_options( -fcommon -Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -Wno-error=implicit-int -Wno-error=return-mismatch) endif() include_directories( ${SDK_DIR}/Include ${SDK_DIR}/Include/App ${SDK_DIR}/Include/Net ${SDK_DIR}/Include/WiFi ${SDK_DIR}/Include/OS ${SDK_DIR}/Include/Driver ${SDK_DIR}/Include/Platform ${SDK_DIR}/Src/OS/RTOS/include ${SDK_DIR}/Platform/Boot/gcc ${SDK_DIR}/Platform/Common/Params ${SDK_DIR}/Platform/Common/task ${SDK_DIR}/Platform/Common/mem ${SDK_DIR}/Platform/Common/fwup ${SDK_DIR}/Platform/Common/utils ${SDK_DIR}/Platform/Common/crypto ${SDK_DIR}/Platform/Inc ${SDK_DIR}/Platform/Sys ${SDK_DIR}/Src/App/OTA ${SDK_DIR}/Src/App/dhcpserver ${SDK_DIR}/Src/App/dnsserver ${SDK_DIR}/Src/App/httpclient ${SDK_DIR}/Src/Network/lwip2.0.3/include ${SDK_DIR}/Src/Network/api2.0.3 ${CMAKE_SOURCE_DIR}/src) foreach(dir Platform/Common Platform/Drivers Platform/Sys Src/Network Src/OS/RTOS Src/App/dhcpserver Src/App/dnsserver Src/App/httpclient Src/App/OTA) string(REPLACE "/" "_" bindir ${dir}) add_subdirectory(${SDK_DIR}/${dir} sdk_${bindir}) endforeach() set(NL_SDK_OBJECTS $ $ $ $ $ $ $ $ $) set(NL_SDK_BOOT_SOURCES ${SDK_DIR}/Platform/Boot/gcc/startup.S ${SDK_DIR}/Platform/Boot/gcc/retarget.c ${SDK_DIR}/Platform/Boot/gcc/misc.c)