Skip to content
Snippets Groups Projects
Commit 72048b60 authored by Vivek Dutta's avatar Vivek Dutta
Browse files

meshcomms: Optimise meshcomms library

parent fc8ae5dc
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
ifndef PLATFORM ifndef PLATFORM
PLATFORM := linux PLATFORM := linux
FLAVOUR := x86_generic FLAVOUR := iopsys
#FLAVOUR := arm_wrt1900acx #FLAVOUR := arm_wrt1900acx
#FLAVOUR := x86_windows_mingw #FLAVOUR := x86_windows_mingw
...@@ -134,13 +134,6 @@ ifeq ($(PLATFORM),linux) ...@@ -134,13 +134,6 @@ ifeq ($(PLATFORM),linux)
endif endif
CCFLAGS += -g -O0 -Wall -Werror #-Wextra CCFLAGS += -g -O0 -Wall -Werror #-Wextra
CCFLAGS += -DMAX_NETWORK_SEGMENT_SIZE=1500
CCFLAGS += -DINT8U="unsigned char"
CCFLAGS += -DINT16U="unsigned short int"
CCFLAGS += -DINT32U="unsigned int"
CCFLAGS += -DINT8S="signed char"
CCFLAGS += -DINT16S="signed short int"
CCFLAGS += -DINT32S="signed int"
CCFLAGS += -D_GNU_SOURCE CCFLAGS += -D_GNU_SOURCE
else else
$(error "'PLATFORM' variable was not set to a valid value") $(error "'PLATFORM' variable was not set to a valid value")
......
...@@ -2,27 +2,18 @@ ...@@ -2,27 +2,18 @@
#define _MESHCOMMS_H_ #define _MESHCOMMS_H_
// Include common header files // Include common header files
#include <meshcomms/common/packet_tools.h> #include "platform_datatypes.h"
#include <meshcomms/common/platform.h> #include "packet_tools.h"
#include <meshcomms/common/utils.h> #include "platform.h"
#include "utils.h"
// Include factory header files // Include factory header files
#include <meshcomms/factory/1905_alme.h> #include "1905_alme.h"
#include <meshcomms/factory/1905_cmdus.h> #include "1905_cmdus.h"
#include <meshcomms/factory/1905_l2.h> #include "1905_l2.h"
#include <meshcomms/factory/1905_tlvs.h> #include "1905_tlvs.h"
#include <meshcomms/factory/lldp_payload.h> #include "lldp_payload.h"
#include <meshcomms/factory/lldp_tlvs.h> #include "lldp_tlvs.h"
#include <meshcomms/factory/media_specific_blobs.h> #include "media_specific_blobs.h"
// Include al header files
#include <meshcomms/al/al.h>
#include <meshcomms/al/platform_alme_server.h>
#include <meshcomms/al/platform_crypto.h>
#include <meshcomms/al/platform_interfaces.h>
#include <meshcomms/al/platform_os.h>
// Include bbf header files
#include <meshcomms/bbf/bbf_tlvs.h>
#endif //_MESHCOMMS_H_ #endif //_MESHCOMMS_H_
...@@ -90,6 +90,8 @@ SRC_PLATFORM := $(wildcard src_$(PLATFORM)/*.c) ...@@ -90,6 +90,8 @@ SRC_PLATFORM := $(wildcard src_$(PLATFORM)/*.c)
OBJ_INDEPENDENT := $(patsubst %.c,$(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o,$(SRC_INDEPENDENT)) OBJ_INDEPENDENT := $(patsubst %.c,$(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o,$(SRC_INDEPENDENT))
OBJ_PLATFORM := $(patsubst %.c,$(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o,$(SRC_PLATFORM)) OBJ_PLATFORM := $(patsubst %.c,$(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o,$(SRC_PLATFORM))
LIB_OBJ := $(shell find $(OUTPUT_FOLDER)/tmp/ -name '*.o')
INTERNAL_INC_INDEPENDENT := src_independent internal_interfaces INTERNAL_INC_INDEPENDENT := src_independent internal_interfaces
INTERNAL_INC_INDEPENDENT += $(sort $(dir $(wildcard interfaces/extensions/*/))) $(sort $(dir $(wildcard src_independent/extensions/*/))) INTERNAL_INC_INDEPENDENT += $(sort $(dir $(wildcard interfaces/extensions/*/))) $(sort $(dir $(wildcard src_independent/extensions/*/)))
INTERNAL_INC_PLATFORM := src_$(PLATFORM) internal_interfaces INTERNAL_INC_PLATFORM := src_$(PLATFORM) internal_interfaces
...@@ -103,41 +105,22 @@ HDR_PLATFORM := $(shell find $(INTERNAL_INC_PLATFORM) $(EXTERNA ...@@ -103,41 +105,22 @@ HDR_PLATFORM := $(shell find $(INTERNAL_INC_PLATFORM) $(EXTERNA
################################################################################ ################################################################################
# Targets # Targets
################################################################################ ################################################################################
ifeq ($(FLAVOUR), iopsys)
OBJ_WMAIN := $(filter-out %/al_entity_main.o,$(OBJ_PLATFORM))
OBJ_MAIN := $(filter %/al_entity_main.o,$(OBJ_PLATFORM))
endif
.PHONY: all .PHONY: all
all: $(EXE) all: $(EXE) $(MLIB)
ifeq ($(FLAVOUR), iopsys) $(MLIB):
$(EXE): $(OBJ_MAIN) $(MLIB) $(CC) -shared -Wl,-soname,libmeshcomms.so $(LIB_OBJ) -o $@
$(CC) $^ $(LDFLAGS) -o $@
$(MLIB): $(OBJ_INDEPENDENT) $(OBJ_WMAIN)
$(CC) -L $(OUTPUT_FOLDER) -shared -Wl,-soname,libmeshcomms.so -o $@ $^ -lc -lcommon -lfactory
else
$(EXE): $(OBJ_INDEPENDENT) $(OBJ_PLATFORM) $(FACTORY_LIB) $(COMMON_LIB) $(EXE): $(OBJ_INDEPENDENT) $(OBJ_PLATFORM) $(FACTORY_LIB) $(COMMON_LIB)
$(CC) $^ $(LDFLAGS) -o $@ $(CC) $^ $(LDFLAGS) -o $@
endif
$(OBJ_INDEPENDENT) : $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o : %.c $(HDR_INDEPENDENT) $(OBJ_INDEPENDENT) : $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o : %.c $(HDR_INDEPENDENT)
$(foreach directory, $(sort $(dir $(wildcard $(SRC_INDEPENDENT)))), $(MKDIR) $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/$(directory);) $(foreach directory, $(sort $(dir $(wildcard $(SRC_INDEPENDENT)))), $(MKDIR) $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/$(directory);)
$(CC) $(CCFLAGS) -c $(addprefix -I,$(INTERNAL_INC_INDEPENDENT) $(EXTERNAL_INC)) $< -o $@ $(CC) $(CCFLAGS) -c $(addprefix -I,$(INTERNAL_INC_INDEPENDENT) $(EXTERNAL_INC)) $< -o $@
ifeq ($(FLAVOUR), iopsys)
$(OBJ_WMAIN) : $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o : %.c $(HDR_PLATFORM)
$(foreach directory, $(sort $(dir $(wildcard $(SRC_PLATFORM)))), $(MKDIR) $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/$(directory);)
$(CC) $(CCFLAGS) -c $(addprefix -I,$(INTERNAL_INC_PLATFORM) $(EXTERNAL_INC)) $< -o $@
$(OBJ_MAIN) : $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o : %.c $(HDR_PLATFORM)
$(foreach directory, $(sort $(dir $(wildcard $(SRC_PLATFORM)))), $(MKDIR) $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/$(directory);)
$(CC) $(CCFLAGS) -c $(addprefix -I,$(INTERNAL_INC_PLATFORM) $(EXTERNAL_INC)) $< -o $@
else
$(OBJ_PLATFORM) : $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o : %.c $(HDR_PLATFORM) $(OBJ_PLATFORM) : $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o : %.c $(HDR_PLATFORM)
$(foreach directory, $(sort $(dir $(wildcard $(SRC_PLATFORM)))), $(MKDIR) $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/$(directory);) $(foreach directory, $(sort $(dir $(wildcard $(SRC_PLATFORM)))), $(MKDIR) $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/$(directory);)
$(CC) $(CCFLAGS) -c $(addprefix -I,$(INTERNAL_INC_PLATFORM) $(EXTERNAL_INC)) $< -o $@ $(CC) $(CCFLAGS) -c $(addprefix -I,$(INTERNAL_INC_PLATFORM) $(EXTERNAL_INC)) $< -o $@
endif
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf $(EXE) rm -rf $(EXE)
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#ifndef _PLATFORM_INTERFACES_WRT1900ACX_PRIV_H_ #ifndef _PLATFORM_INTERFACES_WRT1900ACX_PRIV_H_
#define _PLATFORM_INTERFACES_WRT1900ACX_PRIV_H_ #define _PLATFORM_INTERFACES_WRT1900ACX_PRIV_H_
#include "platform_datatypes.h"
// Fill the "interfaceInfo" structure (associated to the provided // Fill the "interfaceInfo" structure (associated to the provided
// "interface_name") by obtaining information from the OpenWRT UCI subsystem. // "interface_name") by obtaining information from the OpenWRT UCI subsystem.
......
...@@ -67,48 +67,7 @@ ...@@ -67,48 +67,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Hardware stuff // Hardware stuff
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "platform_datatypes.h"
// The following preprocessor macros must be defined to a platform-dependent
// value:
//
// MAX_NETWORK_SEGMENT_SIZE --------> This is the maximum packet size that
// is allowed in your platform. It is
// used to 'fragment' CMDUs. Note that
// even if your platform supports packets
// bigger than 1500 bytes, this macro
// must never be bigger than that. This
// macro is only present in this file for
// those special cases where, for some
// platform related reason, packets must
// be smaller than 1500.
//
// INT8U | These types must be adjusted to that
// INT16U |---------------------------> they represent 1, 2 and 4 bytes
// INT32U | unsigned integers respectively.
//
// INT8S | These types must be adjusted to that
// INT16S |---------------------------> they represent 1, 2 and 4 bytes signed
// INT32S | integers respectively.
//
//
// In the next few lines we are just going to check that these are defined,
// nothing else.
// In order to actually define them use the "root" Makefile where these MACROS
// are sent to the compiler using the "-D flag" (open the "root" Makefile and
// search for "CCFLAGS" to understand how to do this)
#ifndef MAX_NETWORK_SEGMENT_SIZE
# error "You must define 'MAX_NETWORK_SEGMENT_SIZE' to some value (for example, '1500')"
#endif
#if !defined(INT8U) || !defined(INT16U) || !defined(INT32U)
# error "You must define 'INT8U', 'INT16U' and 'INT32U' to represent 8, 16 and 32 bit unsigned integers respectively"
#endif
#if !defined(INT8S) || !defined(INT16S) || !defined(INT32S)
# error "You must define 'INT8S', 'INT16S' and 'INT32S' to represent 8, 16 and 32 bit signed integers respectively"
#endif
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Typical libc stuff // Typical libc stuff
......
/*
* Broadband Forum IEEE 1905.1/1a stack
*
* Copyright (c) 2017, Broadband Forum
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Subject to the terms and conditions of this license, each copyright
* holder and contributor hereby grants to those receiving rights under
* this license a perpetual, worldwide, non-exclusive, no-charge,
* royalty-free, irrevocable (except for failure to satisfy the
* conditions of this license) patent license to make, have made, use,
* offer to sell, sell, import, and otherwise transfer this software,
* where such license applies only to those patent claims, already
* acquired or hereafter acquired, licensable by such copyright holder or
* contributor that are necessarily infringed by:
*
* (a) their Contribution(s) (the licensed copyrights of copyright holders
* and non-copyrightable additions of contributors, in source or binary
* form) alone; or
*
* (b) combination of their Contribution(s) with the work of authorship to
* which such Contribution(s) was added by such copyright holder or
* contributor, if, at the time the Contribution is added, such addition
* causes such combination to be necessarily infringed. The patent
* license shall not apply to any other combinations which include the
* Contribution.
*
* Except as expressly stated above, no rights or licenses from any
* copyright holder or contributor is granted under this license, whether
* expressly, by implication, estoppel or otherwise.
*
* DISCLAIMER
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
#ifndef _PLATFORM_DATATYPES_H_
#define _PLATFORM_DATATYPES_H_
typedef unsigned char INT8U;
typedef unsigned short int INT16U;
typedef unsigned int INT32U;
typedef signed char INT8S;
typedef signed short int INT16S;
typedef signed int INT32S;
#define MAX_NETWORK_SEGMENT_SIZE 1500
#endif
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#ifndef _UTILS_H_ #ifndef _UTILS_H_
#define _UTILS_H_ #define _UTILS_H_
#include "platform_datatypes.h"
// This is an auxiliary function which is used when calling the "visit_*()" // This is an auxiliary function which is used when calling the "visit_*()"
// family of functions so that the contents of the memory structures can be // family of functions so that the contents of the memory structures can be
// printed on screen for debugging/logging purposes. // printed on screen for debugging/logging purposes.
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#ifndef _MEDIA_SPECIFIC_BLOBS_H_ #ifndef _MEDIA_SPECIFIC_BLOBS_H_
#define _MEDIA_SPECIFIC_BLOBS_H_ #define _MEDIA_SPECIFIC_BLOBS_H_
#include "platform_datatypes.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Structure type used for generic interfaces // Structure type used for generic interfaces
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment