mbed-os/features/nanostack/sal-stack-nanostack/Makefile

198 lines
6.5 KiB
Makefile
Raw Normal View History

#
# Makefile for NanoStack
#
# Define compiler toolchain with CC variable
# Example (GCC toolchains, default $CC and $AR are used)
# make
#
# OR (armcc/Keil)
# make CC=armcc AR=ArmAR
#
# OR (IAR-ARM)
# make CC=iccarm
LIB = libnanostack.a
# If configuration is not specified, use generic
ifeq (,$(CONFIG))
CONFIG=generic
endif
include sources.mk
include include_dirs.mk
override CFLAGS += -DNSCONFIG=$(CONFIG)
COAP_SERVICE_LIB := ../coap-service
SERVLIB_DIR := ../libService
EVENTLOOP_DIR := ../event-loop
NSDL_DIR := ../nsdl-c
COAP_DIR := ../mbed-coap
MDNS_DIR := source/Service_Libs/mdns
MDNS_SRV_DIR := source/Service_Libs/mdns/fnet/fnet_stack/services
MBEDTLS_DIR := ../mbedtls
override CFLAGS += -I$(MDNS_DIR) -I$(MDNS_DIR)/fnet -I$(MDNS_DIR)/fnet/fnet_stack -I$(MDNS_DIR)/fnet/fnet_stack/stack
override CFLAGS += -I$(MDNS_SRV_DIR) -I$(MDNS_SRV_DIR)/poll -I$(MDNS_SRV_DIR)/mdns -I$(MDNS_SRV_DIR)/serial
override CFLAGS += -I$(SERVLIB_DIR)/libService
override CFLAGS += -I$(EVENTLOOP_DIR)/nanostack-event-loop
override CFLAGS += -I$(NSDL_DIR)/nsdl-c
override CFLAGS += -I$(COAP_DIR)
override CFLAGS += -I$(COAP_SERVICE_LIB)/coap-service
override CFLAGS += -I$(MBEDTLS_DIR)/include -I$(MBEDTLS_DIR)/crypto/include
override CFLAGS += $(addprefix -I,$(INCLUDE_DIRS))
override CFLAGS += $(addprefix -D,$(FLAGS))
#
# Define compiler toolchain
#
include ../libService/toolchain_rules.mk
$(eval $(call generate_rules,$(LIB),$(SRCS)))
.PHONY: $(LIB)
# Extend default clean rule
clean: clean-extra
TEST_FOLDER := ./test/
UNITTESTS := $(sort $(dir $(wildcard $(TEST_FOLDER)*/unittest/*)))
TESTDIRS := $(UNITTESTS:%=build-%)
CLEANTESTDIRS := $(UNITTESTS:%=clean-%)
COVERAGEFILE := ./lcov/coverage.info
$(TESTDIRS):
@make -C $(@:build-%=%)
$(CLEANTESTDIRS):
@make -C $(@:clean-%=%) clean
Squashed 'features/nanostack/sal-stack-nanostack/' changes from 0345477..3c7d50e 3c7d50e Remove test files d5f5bee Merge branch 'release_internal' into release_external 72b065b Merge pull request #2133 from ARMmbed/few_updates 1da0b9f Fix unittest cleanup d173249 Adjust GC cleanup threshold and traces 26166d1 Remove ns_sw_mac_packet_ingress_rate_limit_by_mem (#2132) 5305754 Merge pull request #2130 from ARMmbed/IOTTHD-3419 038bc2e Copy ingress rate limiting API to ns_conf 940b516 Fix compiler warnings 64e6ff3 Review corrections 01e7d84 Update GC thresholds, init and traces 1acd1cc Add unit tests for monitor 64c969e Nanostack heap garbage collection d3330b2 Fix errors found by Coverity (#2131) da5d2c7 MAC, RPL and ETX trace clean. eaf8907 Limit amount of incoming packet based on memory (#2128) 0c2b383 Fixed unitest header size compare value for support brodacst shedule. 6c70262 Wi-sun LLC update 7c57343 WS PAN Config handler update 161421b Wi-sun PAN_VERSION lifetime and timeout update 43083ed Fixed broken wi-sun neigbour black list filtering. 0992ee2 Update Pan information data from all selected parent. cafc142 Fixed Pan advertisment route cost comapre for consistent and incosistent db81d02 SW MAC timestamp read update eddf91b Wi-sun neighbor generate limitation 4d6abb3 Added 15 second guarantee time for packet handler before remove link. 9ed97eb SW MAC new API for read current timestamp 6a44829 Stop advertisment RPL prefix if we not have a address and it is not 'A-flag' d37ce6a Revert "Wi-sun dublicate MPX ID filter support" d80ebf8 Fix debug trace format. b1ef0f6 Removed Address reg pending and rady mask from address. ce672ba Added trace for debugging DHCPv6 failure reason. aaf2b39 Wi-sun dublicate MPX ID filter support bd51f9f Merge pull request #2117 from ARMmbed/IOTTHD-3587 b016d52 Fixed DHCPv6 client delete when address was removed to new network discovery. 69fb24b Wi-sun address registration and RPL update 92d3a92 RPL: trace new preferred parent 9a6e4e0 disable multicast NS for wisun 6e13d81 Merge pull request #2113 from ARMmbed/IOTTHD-3577 85aaae7 Refactored the Wi-SUN BBR logic according to design 61f6f5b WS: Added ws stats empty functions ac191c3 Removed link local address verifycation and dead code. 77076d1 Negative ARO timeout use same timeout than not trusted device. c4e8735 Wi-sun DHCP solicit max to 15min from 60min. 66615e6 Updated wi-sun BBR min hop rank increase to 196. 9ce41f1 Pendig address registration will move DAO send. f54ea6b Merge pull request #2110 from ARMmbed/IOTTHD-3577 18dbac2 WS: Implemented ws statistics 3ce95fa FHSS WS: Fixed drift compensation stats b878bd9 KMP address update 7f18afe PAE controller and NVM update f692eb8 Wi-SUN border router configure update 386e5ff Wi-sun Update 05b1fe8 do not send periodic DIO messages if DAO registration is not done 6acee47 modified RSL calculation and value in messaging ee7f218 Modify discovery start timing 1ba806d Wi-SUN NUD send fix 31fb8cd Moved counter config to config.h cf18063 Added storing of MAC frame counter to NVM 68adb36 Neighbor cache update 8cdd961 Added possibility for Update DHCPv6 client server address. 2dfa536 Merge pull request #2099 from ARMmbed/IOTTHD-3231 8dc200b FHSS: Created statistics for WS 5e67f7c RPL update bbae493 wi-sun RPL param update e8567d7 MAC neighbour remove and add trace simplify. 8bb4ab5 Cleaned unnessary debug trace. 3608153 DIO prefix handler update 332735b Disabled Version number periodic update if Dodag max rank inrease is not 0. 940de0b Wi-SUN setup update: c1a89e5 Merge pull request #2095 from ARMmbed/IOTTHD-3474 f6d81b5 Review corrections 7487ca1 Fix clang-6.0 build error and warnings cce3fc7 Security protocols are no longer started second time on authenticator git-subtree-dir: features/nanostack/sal-stack-nanostack git-subtree-split: 3c7d50e9bd8f100eccf23066d0f0adba4cf9b980
2019-08-02 10:52:37 +00:00
@rm -fr results
.PHONY: release
release:
7z a nanostack_$(VERSION).zip *.a *.lib include
.PHONY: deploy_to
deploy_to: all
tar --transform 's,^,nanostack/,' --append -f $(TO) *.a
.PHONY: test
test: $(TESTDIRS)
@rm -rf lcov
@rm -rf results
@mkdir -p lcov
@mkdir -p results
@./xsl_script.sh
@cp junit_xsl.xslt results/.
@xsltproc -o results/index.html results/junit_xsl.xslt results/index.xml
@lcov -d test/. -c -o $(COVERAGEFILE)
@lcov -q -r $(COVERAGEFILE) "/usr*" -o $(COVERAGEFILE)
@lcov -q -r $(COVERAGEFILE) "/test*" -o $(COVERAGEFILE)
@lcov -q -r $(COVERAGEFILE) "/libService*" -o $(COVERAGEFILE)
@genhtml -q $(COVERAGEFILE) --show-details --prefix $(CURDIR:%/applications/nanostack=%) --output-directory lcov
@echo Nanostack unit tests built, see results/index.html and lcov/index.html
@sed -n 's/.*\(failures: [0-9]\+\).*/\1/p' results/index.html
clean-extra: $(CLEANTESTDIRS)
@rm -rf lcov/
#
# Releasing the binary for mbed module
#
# This must be runned from fully cloned Nanomesh application repository
# with all submodules.
#
# 1. `make mbed-release-build`
# You can also separate this step per toolchain:
# `make mbed-release-build-GCC`
# `make mbed-release-build-ARM`
# `make mbed-release-build-IAR`
# 2. `make mbed-release`
# 3. TBD: importing to mbed OS
TARGET_DIR:=release
Squashed 'features/nanostack/sal-stack-nanostack/' changes from 513a38e..c5ee9e4 c5ee9e4 Remove content from unit tests f7ca82a Merge branch 'release_internal' into release_external b400a6a Fix for pr #1984 (#1987) 30d25bc Fix compiler warnings (#1986) d46d7b3 Prioritise thread control messages (#1984) e59dbd8 Update domain address lifetime (#1985) 8a5cb75 Merge pull request #1980 from ARMmbed/sync_with_MbedOS bd6feab Update coding style ff14e80 (via Mbed OS) nanostack: icmpv6: fix build warning f5e3423 (via Mbed OS) Require dependencies from nanostack mbed_lib.json 3aec837 Restore ws_management_api.h to the latest version cd7ae3f (via Mbed OS) Review changes corrected 4f23008 (via Mbed OS) This is a initial version of Wi-Sun interface implementation. To get Wi-Sun mesh network working, also nanostack with Wi-Sun support is needed. ws_empty_functions.c and ws_management_api.h are temporary included here, so that wisun_tasklet will compiled without problems. They will replaced with the official versions with next nanostack release. e029444 Merge pull request #1981 from ARMmbed/iotthd-3111 d7e8aea Path control size from 5->7. a5fe76f randomise challenge tlv for parent request retries. (#1977) a1c8277 Merge pull request #1978 from ARMmbed/IOTTHD-3219 62f8b41 Fix compiler warnings 1ec7a84 Fix issues found by coverity 5fe7120 Merge pull request #1974 from ARMmbed/iotthd-3100 51358f9 Removed Unncessary debug print. 136d1b1 Merge pull request #1973 from ARMmbed/IOTTHD-3018 4e557ae DHCPv6 update: 85b33e1 Update BBR prefix assignment (#1972) 899b2c5 DHCPv6 client and server update: 9009eaf Update copyright year to test files 6a56318 Update copyright year to Nanostack files a83472e Added Wi-Sun certificate and security test interfaces 7f4ebf1 Corrected compiler warnings 52e4c3f Added supplicant PAE NVM storage 92df57b Added key data access functions to key storage 5972bc3 Merge pull request #1959 from ARMmbed/ws_eapol_ie_update 98af118 Merge pull request #1965 from ARMmbed/IOTTHD-3193 fc76d1e Merge pull request #1963 from ARMmbed/rename_socket_h ba3a649 Added WS flagging to EAP header parser 048f14a Rename address.h 5739b4a Fixed aro registration error 887d931 Rename socket.h to ns_socket.h 7ebaa8e Add Nanostack configuration for WS (#1961) ed87161 Code style fix. e20028a Fix compiler warnings (#1957) b86f885 EAPOL data flow IE update 65472de Fixed Function protype typo. f539287 Added support for write/READ EA-IE header IE Element's ce72b55 Merge pull request #1958 from ARMmbed/tls_conf_err 1e8b18c Added handling for mbed TLS configuration error bdfea40 WS: Use common channel number calc function 4802aae Merge pull request #1930 from ARMmbed/IOTTHD-3027 2b8c846 PAE BR address write/read interface 9777ad1 Remove yotta references (#1954) af8890b Merge pull request #1949 from ARMmbed/eapol_eap_and_tls c546d4f WS: Fixed EU domain channel numbers in neighbor class cff6f0b WS: Missing return value fix ebcdba5 Changed EAP-TLS identity to anonymous 34d2f15 Corrected defects and coding style 79c7157 WS: Default domain config update 0724863 Merge branch 'master' into IOTTHD-3027 65ccc41 WS: RF config set in own functions 76d235e MAC: Fixed virtual driver warnings 88641c1 Updates to PAEs and other security protocols f57138f Security key storage and certificate info updates b7177c5 TLS security protocol and mbed TLS security protocol library 9c9e3c9 EAP-TLS protocol implementation 9c5fc92 WS: Fixed code style acce0dd Added empty function for test 4b28192 Added support for ARO registration failure 9d251fa Added empty function fr new interface 61f520f Added api to configure network size parameters 4d26258 Flagged mbed TLS KW header and corrected bool definitions 3d903fa Corrected NIST AES KW flagging 2f4e099 Removed temporary KW functions and corrected ut and style 6481549 Added GKH MIC validation and encryption cc3ce58 Moved 4WH functions to library and added constants 650771c Added unit test to NIST AES KW library 6a82e7d added parent priority handling. (#1942) 7b7f1c1 Merge pull request #1945 from ARMmbed/fix_synch_parent_warn 38b28e2 Fix coverity error (#1943) c4afedc thread_mle_message_handler: fix build warning (#1940) a5be64a Follow Mbed OS coding style (#1941) 6298cef Sync mbed_lib.json with Mbed OS (#1935) afe3ec6 Added Wi-Sun flagging to eapol helper 28d10d6 Merge pull request #1901 from ARMmbed/kmp_pae_init 3f56121 Disabled EAPOL flags 97f07a9 Tuned EAPOL timers for small networks 6e063b6 added Wi-SUN neighbor table management to Wi-SUN 7f4c61d Corrected KMP api start on authenticator 91ca2e6 Corrected KMP timer active check and security protocol address get 65d983f If mbedtls NIST AES KW is not enabled defined it as null algorithm 16dbe27 Added unit test stub for PAE controller a524936 Moved EAPOL relay port and IP address configuration to bootstrap 68fa4f6 Added extra debug info flags to new security libraries c4411ea Removed extra memory frees from KMP socket and eapol if and fixed KMP comments 8088a86 Added and fixed security protocols comments cc32457 Modified PAEs to use protocol core timer function call 03469f3 Modified PAE entities to be bound to interface 369c8a0 Added 4WH integrity protection and encryption ebae1d5 Added HMAC-SHA1, IEEE 802.11 PRF and NIST AES KW libraries 2d50887 Corrected Wi-SUN security component initializations 8a8b6ef Added configuration flags for supplicant and authenticator PAEs and EAPOL relay 3868ff1 PAE and security protocols timer support c61066a Corrected GKH to set eapol-KEY message group key negotation bit correctly dfe52d9 Added 4WH,GKH and EAP-TLS module and modified kmp service 782f3fb Relay message flow optimization bbd6ee1 Integrate EAPOL new encode and decode functionality 1802ee7 EAPOL message parser and write helper function. da15653 EAPOL relay and KMP changes fad633f EAPOL relay cc97054 Unicast Shedule update a099524 EAPOL authtentication start fix 3f32a7a Fix valgrind uninitilaized data use. 6e9f6a4 Corrected memory errors and some compiler warnings c5f1af3 Initial EAPOL changes e48aa79 WS: Use Tack in Ack wait time 59a65ea Change FHSS timing defaults be06ecb FHSS WS: Fixed synch parent warning a3aa38b Thread extension commission updates (#1870) 3e89d0a Multicast registrations update (#1931) e18055a MAC: Update symbol rate when RF configuration changed 9eada28 WS: Store RF configuration 35145a3 MAC: RF configuration delivery implemented d6b2bbc Merge pull request #1928 from ARMmbed/IOTTHD-3028 80683e2 MAC/WS: Implemented Ack wait duration set 0e9ead2 Remove excess tracing (#1927) ae210cd Merge pull request #1923 from ARMmbed/IOTTHD-3080 17fad47 Merge pull request #1924 from ARMmbed/IOTTHD-1608 6fd6bd5 Update thread neighbor table initialisation (#1926) c09d38a Merge pull request #1925 from ARMmbed/fix_protocol_if_fhss 9ac5301 MAC MLME: Removed BEA TX trace which was causing stack overflow 5dee7b1 FHSS: Use debug callback in TX/RX slot switch f779fad WS/Protocol: Fixed getting interface pointer using FHSS api 4177fa4 Prevalidate CoAP msg source address 5451b1a FHSS unit tests: Updated timestamp callback a2997b1 FHSS: Removed debug trace which was causing crash 3b6a921 FHSS: Debug callback update ec1c41d FHSS: Use given TX time in synch calculation f0c0f66 MAC: Write FHSS synch info with tx time 78ea0eb FHSS: Debug callbacks added c4ef759 MAC: Write FHSS synch info before calling PHY TX function 9cca341 FHSS: Use timestamp delivered by MAC be46564 Add CoAP message validation 883eb46 Add callback for CoAP message prevalidation (#1918) 59bbe31 Merge pull request #1917 from ARMmbed/IOTTHD-3029 ac4a76e Fixed promiscuous/sniffer mode bc2fb64 FHSS WS: time convert to support negative values 7dce509 FHSS WS: Clock drift compensation implemented ac7c90a Fix Thread resolution client initialisation (#1915) b744186 Set the default unicast channel function as Direct Hash 612c4b5 Update DHCP to follow Wi-SUN specification eeb5168 IPv6 route metrics update (#1912) 1debcca Fix compilation warnings noticed in mbed-os (#1909) 0a18231 Change ARO routes to be direct route instead of on-link 7fb321e Merge pull request #1906 from ARMmbed/parent_update_fix b5afc35 Fixed missing broadcast synch information loose with default zeroes. 3dbc874 Add missing closing bracket 0d746f0 Changed Wi-SUN HW type to match specification 2804bf4 Enabled roaming and routing between multiple Wi-SUN BR git-subtree-dir: features/nanostack/sal-stack-nanostack git-subtree-split: c5ee9e4e6682c4e4c23845f7b13c02d259162c36
2019-02-25 12:23:32 +00:00
CONFIGURATIONS_TO_BUILD:=lowpan_border_router lowpan_host lowpan_router nanostack_full thread_border_router thread_router thread_end_device ethernet_host ws_border_router ws_router
TOOLCHAINS_TO_BUILD:=GCC ARM ARMC6 IAR
CORES_TO_BUILD:=Cortex-M0 Cortex-M3
CC_GCC:=arm-none-eabi-gcc
CC_ARM:=armcc
CC_ARMC6=armclang
CC_IAR:=iccarm
LIB_SUFFIX_GCC:=a
LIB_SUFFIX_ARM:=ar
LIB_SUFFIX_ARMC6:=ar
LIB_SUFFIX_IAR:=a
.PHONY: mbed-release
mbed-release: mbed-release-copy
cd release; git add -A
(TAG=$$(git describe --tag); cd release; git commit -m "$$TAG")
git add release; git commit -m "Update release pointer"
.PHONY: mbed-release-copy
mbed-release-copy: mbed-release-pre-clean
cp mbed_lib.json $(TARGET_DIR)
cp -r nanostack $(TARGET_DIR)
cp -r docs README.md $(TARGET_DIR)
cp -r Doxyfile DOXYGEN_FRONTPAGE.md doxygen $(TARGET_DIR)
cp mkdocs.yml $(TARGET_DIR)
cp binary_release_template_lisense $(TARGET_DIR)/LICENSE
cp binary_release_template_lisense_txt $(TARGET_DIR)/LICENSE-permissive-binary-license-1.0.txt
for header in `find release/nanostack -name \*.h`;do awk 'BEGIN{found=0;}{if(!found){print >"tmp-head";}else{print >"tmp-tail"}}/Copyright/{found=1;}' $$header; cat tmp-head binary_release_template_header tmp-tail > tmp && mv tmp $$header; rm tmp-head tmp-tail; done
# Template for generating rules for all configuration options
# $(1) is Toolchain, GCC, ARM or IAR
# $(2) is Configuration
# $(3) is CPU variant
#
# Here be dragons... This is dangerous territory. Touch only if you have a beard.
#
define mbed-rel-build-template
mbed-release-build: $(1)-$(2)-$(3)-build
mbed-release-build-$(1): $(1)-$(2)-$(3)-build
.PHONY: $(1)-$(2)-build
$(1)-$(2)-$(3)-build: export-headers
@echo Build $(2) on $(1) for $(3)
make CC=$(CC_$(1)) CONFIG=$(2) CPU=$(3) APPEND_LIB_NAME=1 CFLAGS="-DNS_USE_EXTERNAL_MBED_TLS -I../mbedtls/include/ -I../crypto/include/"
# Generate target directory name
# Like: FEATURE_NANOSTACK/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_CORTEX_M0P
$(1)-$(2)-$(3)-target-dir:=$(TARGET_DIR)/FEATURE_$(shell echo $(2) | tr '[:lower:]' '[:upper:]')/TOOLCHAIN_$(1)/TARGET_$(shell echo $(3) | tr '[:lower:]' '[:upper:]' | tr - _ | sed 's/CORTEX_//')
# Cortex-M3 is also used for M4...M7, there is alias for them
ifeq (Cortex-M3,$(3))
$(1)-$(2)-$(3)-alt-target-dir:=$(TARGET_DIR)/FEATURE_$(shell echo $(2) | tr '[:lower:]' '[:upper:]')/TOOLCHAIN_$(1)/TARGET_RTOS_M4_M7
endif
# M0 is used as M0 and M0+. There is alias for them
ifeq (Cortex-M0,$(3))
$(1)-$(2)-$(3)-target-dir:=$(TARGET_DIR)/FEATURE_$(shell echo $(2) | tr '[:lower:]' '[:upper:]')/TOOLCHAIN_$(1)/TARGET_LIKE_CORTEX_M0
endif
mbed-release-copy: $(1)-$(2)-$(3)-copy
$(1)-$(2)-$(3)-copy: mbed-release-pre-clean
mkdir -p $$($(1)-$(2)-$(3)-target-dir)
cp libnanostack_$(CC_$(1))_$(3)_$(2).* $$($(1)-$(2)-$(3)-target-dir)/libnanostack.$(LIB_SUFFIX_$(1))
ifneq (,$$($(1)-$(2)-$(3)-alt-target-dir))
mkdir -p $$($(1)-$(2)-$(3)-alt-target-dir)
cp libnanostack_$(CC_$(1))_$(3)_$(2).* $$($(1)-$(2)-$(3)-alt-target-dir)/libnanostack.$(LIB_SUFFIX_$(1))
endif
endef
# Now generate rules
$(foreach tool,$(TOOLCHAINS_TO_BUILD),$(foreach cpu,$(CORES_TO_BUILD),$(foreach cfg,$(CONFIGURATIONS_TO_BUILD),$(eval $(call mbed-rel-build-template,$(tool),$(cfg),$(cpu))))))
#
# End of dangerous territory
#
# Run export-headers before build
.PHONY: export-headers
export-headers:
make -C ../ -f build_external_libs.mk export-headers
.PHONY: mbed-release-pre-clean
mbed-release-pre-clean:
rm -rf $(TARGET_DIR)/*
.PHONY: mbed-release-build
mbed-release-build:
@echo Done