open_esplibs: add a skeleton for code in more libraries. (#266)

This commit is contained in:
Our Air Quality 2016-11-13 05:54:24 +11:00 committed by sheinz
parent 7c702d7f09
commit bc50c7c2fc
21 changed files with 297 additions and 21 deletions

View file

@ -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 $@

View file

@ -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))

View file

@ -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))

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

11
open_esplibs/libphy/phy.c Normal file
View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

11
open_esplibs/libpp/lmac.c Normal file
View file

@ -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 */

11
open_esplibs/libpp/pm.c Normal file
View file

@ -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 */

11
open_esplibs/libpp/pp.c Normal file
View file

@ -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 */

11
open_esplibs/libpp/wdev.c Normal file
View file

@ -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 */

View file

@ -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 */

View file

@ -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-

View file

@ -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