diff --git a/common.mk b/common.mk
index bdec87a..b35dbd9 100644
--- a/common.mk
+++ b/common.mk
@@ -89,8 +89,9 @@ all: $(PROGRAM_OUT) $(FW_FILE_1) $(FW_FILE_2) $(FW_FILE)
 # $(1)_INC_DIR = List of include directories specific for the component
 #
 #
-# Each call appends to COMPONENT_ARS which is a list of archive files for compiled components
+# Each call appends to COMPONENT_ARS or WHOLE_ARCHIVES which are lists of archive files for compiled components
 COMPONENT_ARS =
+WHOLE_ARCHIVES =
 define component_compile_rules
 $(1)_DEFAULT_ROOT := $(dir $(lastword $(MAKEFILE_LIST)))
 $(1)_ROOT ?= $$($(1)_DEFAULT_ROOT)
@@ -136,9 +137,12 @@ $$($(1)_OBJ_DIR)%.o: $$($(1)_REAL_ROOT)%.S $$($(1)_MAKEFILE) $(wildcard $(ROOT)*
 
 $(1)_AR_IN_FILES = $$($(1)_OBJ_FILES)
 
-# the component is shown to depend on both obj and source files so we get
-# a meaningful error message for missing explicitly named source files
-ifeq ($(INCLUDE_SRC_IN_AR),1)
+# The component is shown to depend on both obj and source files so we get
+# a meaningful error message for missing explicitly named source files.
+# But do not include source files into a static library because when adding this
+# library with '--whole-archive' linker gives error that archive contains
+# unknown objects (source files)
+ifndef $(1)_WHOLE_ARCHIVE
    $(1)_AR_IN_FILES += $$($(1)_SRC_FILES)
 endif
 
@@ -147,7 +151,11 @@ $$($(1)_AR): $$($(1)_AR_IN_FILES)
 	$(Q) mkdir -p $$(dir $$@)
 	$(Q) $(AR) cru $$@ $$^
 
-COMPONENT_ARS += $$($(1)_AR)
+ifdef $(1)_WHOLE_ARCHIVE
+   WHOLE_ARCHIVES += $$($(1)_AR)
+else
+   COMPONENT_ARS += $$($(1)_AR)
+endif
 
 -include $$($(1)_OBJ_FILES:.o=.d)
 endef
@@ -200,9 +208,9 @@ $(foreach component,$(COMPONENTS), 					\
 )
 
 # final linking step to produce .elf
-$(PROGRAM_OUT): $(COMPONENT_ARS) $(SDK_PROCESSED_LIBS) $(LINKER_SCRIPTS)
+$(PROGRAM_OUT): $(WHOLE_ARCHIVES) $(COMPONENT_ARS) $(SDK_PROCESSED_LIBS) $(LINKER_SCRIPTS)
 	$(vecho) "LD $@"
-	$(Q) $(LD) $(LDFLAGS) -Wl,--start-group $(COMPONENT_ARS) $(LIB_ARGS) $(SDK_LIB_ARGS) -Wl,--end-group -o $@
+	$(Q) $(LD) $(LDFLAGS) -Wl,--whole-archive $(WHOLE_ARCHIVES) -Wl,--no-whole-archive -Wl,--start-group $(COMPONENT_ARS) $(LIB_ARGS) $(SDK_LIB_ARGS) -Wl,--end-group -o $@
 
 $(BUILD_DIR) $(FIRMWARE_DIR) $(BUILD_DIR)sdklib:
 	$(Q) mkdir -p $@
diff --git a/extras/stdin_uart_interrupt/component.mk b/extras/stdin_uart_interrupt/component.mk
index ba16484..b71150f 100644
--- a/extras/stdin_uart_interrupt/component.mk
+++ b/extras/stdin_uart_interrupt/component.mk
@@ -8,8 +8,6 @@ INC_DIRS += $(stdin_uart_interrupt_ROOT)
 
 # args for passing into compile rule generation
 stdin_uart_interrupt_SRC_DIR = $(stdin_uart_interrupt_ROOT)
-
-INCLUDE_SRC_IN_AR = 0
-EXTRA_LDFLAGS = -Wl,--whole-archive $(stdin_uart_interrupt_AR) -Wl,--no-whole-archive
+stdin_uart_interrupt_WHOLE_ARCHIVE = yes
 
 $(eval $(call component_compile_rules,stdin_uart_interrupt))
diff --git a/open_esplibs/component.mk b/open_esplibs/component.mk
index 23c8b6a..e63e979 100644
--- a/open_esplibs/component.mk
+++ b/open_esplibs/component.mk
@@ -5,11 +5,47 @@ INC_DIRS += $(open_esplibs_ROOT)include
 $(eval $(call component_compile_rules,open_esplibs))
 
 # args for passing into compile rule generation
-open_esplibs_libmain_ROOT = $(open_esplibs_libmain_DEFAULT_ROOT)libmain
+open_esplibs_libmain_ROOT = $(open_esplibs_ROOT)libmain
 open_esplibs_libmain_INC_DIR = 
 open_esplibs_libmain_SRC_DIR = $(open_esplibs_libmain_ROOT)
 open_esplibs_libmain_EXTRA_SRC_FILES = 
-
 open_esplibs_libmain_CFLAGS = $(CFLAGS)
+open_esplibs_libmain_WHOLE_ARCHIVE = yes
 
 $(eval $(call component_compile_rules,open_esplibs_libmain))
+
+open_esplibs_libnet80211_ROOT = $(open_esplibs_ROOT)libnet80211
+open_esplibs_libnet80211_INC_DIR = 
+open_esplibs_libnet80211_SRC_DIR = $(open_esplibs_libnet80211_ROOT)
+open_esplibs_libnet80211_EXTRA_SRC_FILES = 
+open_esplibs_libnet80211_CFLAGS = $(CFLAGS)
+open_esplibs_libnet80211_WHOLE_ARCHIVE = yes
+
+$(eval $(call component_compile_rules,open_esplibs_libnet80211))
+
+open_esplibs_libphy_ROOT = $(open_esplibs_ROOT)libphy
+open_esplibs_libphy_INC_DIR = 
+open_esplibs_libphy_SRC_DIR = $(open_esplibs_libphy_ROOT)
+open_esplibs_libphy_EXTRA_SRC_FILES = 
+open_esplibs_libphy_CFLAGS = $(CFLAGS)
+open_esplibs_libphy_WHOLE_ARCHIVE = yes
+
+$(eval $(call component_compile_rules,open_esplibs_libphy))
+
+open_esplibs_libpp_ROOT = $(open_esplibs_ROOT)libpp
+open_esplibs_libpp_INC_DIR = 
+open_esplibs_libpp_SRC_DIR = $(open_esplibs_libpp_ROOT)
+open_esplibs_libpp_EXTRA_SRC_FILES = 
+open_esplibs_libpp_CFLAGS = $(CFLAGS)
+open_esplibs_libpp_WHOLE_ARCHIVE = yes
+
+$(eval $(call component_compile_rules,open_esplibs_libpp))
+
+open_esplibs_libwpa_ROOT = $(open_esplibs_ROOT)libwpa
+open_esplibs_libwpa_INC_DIR = 
+open_esplibs_libwpa_SRC_DIR = $(open_esplibs_libwpa_ROOT)
+open_esplibs_libwpa_EXTRA_SRC_FILES = 
+open_esplibs_libwpa_CFLAGS = $(CFLAGS)
+open_esplibs_libwpa_WHOLE_ARCHIVE = yes
+
+$(eval $(call component_compile_rules,open_esplibs_libwpa))
diff --git a/open_esplibs/include/open_esplibs.h b/open_esplibs/include/open_esplibs.h
index 8db3127..fce49a1 100644
--- a/open_esplibs/include/open_esplibs.h
+++ b/open_esplibs/include/open_esplibs.h
@@ -36,4 +36,83 @@
 #define OPEN_LIBMAIN_USER_INTERFACE (OPEN_LIBMAIN)
 #endif
 
+#ifndef OPEN_LIBNET80211
+#define OPEN_LIBNET80211 (OPEN_ESPLIBS)
+#endif
+#ifndef OPEN_LIBNET80211_ETS
+#define OPEN_LIBNET80211_ETS (OPEN_LIBNET80211)
+#endif
+#ifndef OPEN_LIBNET80211_HOSTAP
+#define OPEN_LIBNET80211_HOSTAP (OPEN_LIBNET80211)
+#endif
+#ifndef OPEN_LIBNET80211_INPUT
+#define OPEN_LIBNET80211_INPUT (OPEN_LIBNET80211)
+#endif
+#ifndef OPEN_LIBNET80211_STA
+#define OPEN_LIBNET80211_STA (OPEN_LIBNET80211)
+#endif
+#ifndef OPEN_LIBNET80211_WL_CNX
+#define OPEN_LIBNET80211_WL_CNX (OPEN_LIBNET80211)
+#endif
+
+#ifndef OPEN_LIBPHY
+#define OPEN_LIBPHY (OPEN_ESPLIBS)
+#endif
+
+#ifndef OPEN_LIBPHY_PHY_ANA
+#define OPEN_LIBPHY_PHY_ANA (OPEN_LIBPHY)
+#endif
+
+#ifndef OPEN_LIBPHY_PHY_CAL
+#define OPEN_LIBPHY_PHY_CAL (OPEN_LIBPHY)
+#endif
+
+#ifndef OPEN_LIBPHY_PHY_CHIP_V6
+#define OPEN_LIBPHY_PHY_CHIP_V6 (OPEN_LIBPHY)
+#endif
+
+#ifndef OPEN_LIBPHY_PHY
+#define OPEN_LIBPHY_PHY (OPEN_LIBPHY)
+#endif
+
+#ifndef OPEN_LIBPHY_PHY_SLEEP
+#define OPEN_LIBPHY_PHY_SLEEP (OPEN_LIBPHY)
+#endif
+
+#ifndef OPEN_LIBPP
+#define OPEN_LIBPP (OPEN_ESPLIBS)
+#endif
+
+#ifndef OPEN_LIBPP_ESF_BUF
+#define OPEN_LIBPP_ESF_BUF (OPEN_LIBPP)
+#endif
+
+#ifndef OPEN_LIBPP_IF_HWCTRL
+#define OPEN_LIBPP_IF_HWCTRL (OPEN_LIBPP)
+#endif
+
+#ifndef OPEN_LIBPP_LMAC
+#define OPEN_LIBPP_LMAC (OPEN_LIBPP)
+#endif
+
+#ifndef OPEN_LIBPP_PM
+#define OPEN_LIBPP_PM (OPEN_LIBPP)
+#endif
+
+#ifndef OPEN_LIBPP_PP
+#define OPEN_LIBPP_PP (OPEN_LIBPP)
+#endif
+
+#ifndef OPEN_LIBPP_WDEV
+#define OPEN_LIBPP_WDEV (OPEN_LIBPP)
+#endif
+
+#ifndef OPEN_LIBWPA
+#define OPEN_LIBWPA (OPEN_ESPLIBS)
+#endif
+
+#ifndef OPEN_LIBWPA_WPA_MAIN
+#define OPEN_LIBWPA_WPA_MAIN (OPEN_LIBWPA)
+#endif
+
 #endif /* _OPEN_ESPLIBS_H */
diff --git a/open_esplibs/libnet80211/ieee80211_ets.c b/open_esplibs/libnet80211/ieee80211_ets.c
new file mode 100644
index 0000000..7d0620d
--- /dev/null
+++ b/open_esplibs/libnet80211/ieee80211_ets.c
@@ -0,0 +1,10 @@
+/* Recreated Espressif libnet80211 ieee80211_ets.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBNET80211_ETS
+// The contents of this file are only built if OPEN_LIBNET80211_ETS is set to true
+
+#endif /* OPEN_LIBNET80211_ETS */
diff --git a/open_esplibs/libnet80211/ieee80211_hostap.c b/open_esplibs/libnet80211/ieee80211_hostap.c
new file mode 100644
index 0000000..fbe7f49
--- /dev/null
+++ b/open_esplibs/libnet80211/ieee80211_hostap.c
@@ -0,0 +1,10 @@
+/* Recreated Espressif libnet80211 ieee80211_hostap.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBNET80211_HOSTAP
+// The contents of this file are only built if OPEN_LIBNET80211_HOSTAP is set to true
+
+#endif /* OPEN_LIBNET80211_HOSTAP */
diff --git a/open_esplibs/libnet80211/ieee80211_input.c b/open_esplibs/libnet80211/ieee80211_input.c
new file mode 100644
index 0000000..0880463
--- /dev/null
+++ b/open_esplibs/libnet80211/ieee80211_input.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libnet80211 ieee80211_input.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBNET80211_INPUT
+// The contents of this file are only built if OPEN_LIBNET80211_INPUT is set to true
+
+
+#endif /* OPEN_LIBNET80211_INPUT */
diff --git a/open_esplibs/libnet80211/ieee80211_sta.c b/open_esplibs/libnet80211/ieee80211_sta.c
new file mode 100644
index 0000000..0352b1e
--- /dev/null
+++ b/open_esplibs/libnet80211/ieee80211_sta.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libnet80211 ieee80211_sta.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBNET80211_STA
+// The contents of this file are only built if OPEN_LIBNET80211_STA is set to true
+
+
+#endif /* OPEN_LIBNET80211_STA */
diff --git a/open_esplibs/libnet80211/wl_cnx.c b/open_esplibs/libnet80211/wl_cnx.c
new file mode 100644
index 0000000..563bcbc
--- /dev/null
+++ b/open_esplibs/libnet80211/wl_cnx.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libnet80211 wl_cnx.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBNET80211_WL_CNX
+// The contents of this file are only built if OPEN_LIBNET80211_WL_CNX is set to true
+
+
+#endif /* OPEN_LIBNET80211_WL_CNX */
diff --git a/open_esplibs/libphy/phy.c b/open_esplibs/libphy/phy.c
new file mode 100644
index 0000000..4e27fdb
--- /dev/null
+++ b/open_esplibs/libphy/phy.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libphy phy.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBNET80211_WL_CNX
+// The contents of this file are only built if OPEN_LIBPHY_PHY is set to true
+
+
+#endif /* OPEN_LIBPHY_PHY */
diff --git a/open_esplibs/libphy/phy_chip_v6.c b/open_esplibs/libphy/phy_chip_v6.c
new file mode 100644
index 0000000..096258d
--- /dev/null
+++ b/open_esplibs/libphy/phy_chip_v6.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libphy phy_chip_v6.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBNET80211_WL_CNX
+// The contents of this file are only built if OPEN_LIBPHY_PHY_CHIP_V6 is set to true
+
+
+#endif /* OPEN_LIBPHY_PHY_CHIP_V6 */
diff --git a/open_esplibs/libphy/phy_sleep.c b/open_esplibs/libphy/phy_sleep.c
new file mode 100644
index 0000000..db10250
--- /dev/null
+++ b/open_esplibs/libphy/phy_sleep.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libphy phy_chip_sleep.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBNET80211_WL_CNX
+// The contents of this file are only built if OPEN_LIBPHY_PHY_CHIP_SLEEP is set to true
+
+
+#endif /* OPEN_LIBPHY_PHY_CHIP_SLEEP */
diff --git a/open_esplibs/libpp/esf_buf.c b/open_esplibs/libpp/esf_buf.c
new file mode 100644
index 0000000..f6d0bc9
--- /dev/null
+++ b/open_esplibs/libpp/esf_buf.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libpp esf_buf.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBPP_ESF_BUF
+// The contents of this file are only built if OPEN_LIBPHY_PHY_CHIP_SLEEP is set to true
+
+
+#endif /* OPEN_LIBPP_ESF_BUF */
diff --git a/open_esplibs/libpp/if_hwctrl.c b/open_esplibs/libpp/if_hwctrl.c
new file mode 100644
index 0000000..c023a4e
--- /dev/null
+++ b/open_esplibs/libpp/if_hwctrl.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libpp if_hwctrl.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBPP_IF_HWCTRL
+// The contents of this file are only built if OPEN_LIBPHY_PHY_CHIP_SLEEP is set to true
+
+
+#endif /* OPEN_LIBPP_IF_HWCTRL */
diff --git a/open_esplibs/libpp/lmac.c b/open_esplibs/libpp/lmac.c
new file mode 100644
index 0000000..d80d560
--- /dev/null
+++ b/open_esplibs/libpp/lmac.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libpp lmac.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBPP_LMAC
+// The contents of this file are only built if OPEN_LIBPHY_PHY_CHIP_SLEEP is set to true
+
+
+#endif /* OPEN_LIBPP_LMAC */
diff --git a/open_esplibs/libpp/pm.c b/open_esplibs/libpp/pm.c
new file mode 100644
index 0000000..232b248
--- /dev/null
+++ b/open_esplibs/libpp/pm.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libpp pm.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBPP_PM
+// The contents of this file are only built if OPEN_LIBPHY_PHY_CHIP_SLEEP is set to true
+
+
+#endif /* OPEN_LIBPP_PM */
diff --git a/open_esplibs/libpp/pp.c b/open_esplibs/libpp/pp.c
new file mode 100644
index 0000000..e619fd9
--- /dev/null
+++ b/open_esplibs/libpp/pp.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libpp pp.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBPP_PP
+// The contents of this file are only built if OPEN_LIBPHY_PHY_CHIP_SLEEP is set to true
+
+
+#endif /* OPEN_LIBPP_PP */
diff --git a/open_esplibs/libpp/wdev.c b/open_esplibs/libpp/wdev.c
new file mode 100644
index 0000000..1564a59
--- /dev/null
+++ b/open_esplibs/libpp/wdev.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libpp wdev.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBPP_WDEV
+// The contents of this file are only built if OPEN_LIBPHY_PHY_CHIP_SLEEP is set to true
+
+
+#endif /* OPEN_LIBPP_WDEV */
diff --git a/open_esplibs/libwpa/wpa_main.c b/open_esplibs/libwpa/wpa_main.c
new file mode 100644
index 0000000..c1133e6
--- /dev/null
+++ b/open_esplibs/libwpa/wpa_main.c
@@ -0,0 +1,11 @@
+/* Recreated Espressif libwpa wpa_main.o contents.
+
+   Copyright (C) 2015 Espressif Systems. Derived from MIT Licensed SDK libraries.
+   BSD Licensed as described in the file LICENSE
+*/
+#include "open_esplibs.h"
+#if OPEN_LIBWPA_WPA_MAIN
+// The contents of this file are only built if OPEN_LIBWPA_WPA_MAIN is set to true
+
+
+#endif /* OPEN_LIBWPA_WPA_MAIN */
diff --git a/parameters.mk b/parameters.mk
index ddf2580..8c6a8a3 100644
--- a/parameters.mk
+++ b/parameters.mk
@@ -42,9 +42,6 @@ PRINTF_SCANF_FLOAT_SUPPORT ?= 1
 
 FLAVOR ?= release # or debug
 
-# Include source files into a static library. It improves error messages.
-INCLUDE_SRC_IN_AR ?= 1
-
 # Compiler names, etc. assume gdb
 CROSS ?= xtensa-lx106-elf-
 
diff --git a/tests/Makefile b/tests/Makefile
index 599253c..9f0fc41 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -16,12 +16,7 @@ PROGRAM_EXTRA_SRC_FILES = ./unity/src/unity.c ./fs-test/fs_test.c
 
 TESTCASE_SRC_FILES = $(wildcard $(PROGRAM_DIR)cases/*.c)
 
-# Do not include source files into a static library because when adding this
-# library with '--whole-archive' linker gives error that archive contains
-# unknown objects (source files)
-INCLUDE_SRC_IN_AR = 0
-
 # Link every object in the 'program' archive, to pick up constructor functions for test cases
-EXTRA_LDFLAGS = -Wl,--whole-archive $(BUILD_DIR)program.a -Wl,--no-whole-archive
+PROGRAM_WHOLE_ARCHIVE = yes
 
 include ../common.mk