Commit be876dd0 authored by Joseph Morrow's avatar Joseph Morrow Committed by William R. Dieter

M1 final touches for build & documentation.

Edited makefiles to build for Mega, Due, and Linux in in staging-m1
branch. Also added patches (with documentation) for patching the arduino
framework's bugs.

Change-Id: I357c045dc2794068a0841abc57f5bc471831752c
parent 8012293a
******************************************************************
Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
===============================================================================
== Rich Stack & Lite Stack ==
===============================================================================
The directory "resource" in IOTIVITY repository (referred as "<iotivity>")
contains two SDKs with underlying code (i.e. "stack"). The two SDKs are
referred to as "Rich SDK" (or "C++ SDK") and "Lite SDK" (or "C SDK"). The
associated stacks are referred to as "Rich Stack" (or "C++ Stack") and "Lite
Stack" (or "C Stack"), respectively. The Rich Stack-SDK pair requires that the
Lite Stack-SDK pair is built under it.
===============================================================================
The Rich Stack is intended ONLY for Linux Ubuntu 12.04 operating system. To
build Rich Stack, please follow these requirements:
- GCC compiler version is 4.6
- Pre-install the "gnu-libc" libraries package.
The Lite Stack is intended ONLY for Linux Ubuntu 12.04, Arduino ATMega 2560
with Arduino Framework 1.0.5, and Arduino Due with Arduino Framework 1.5.7.
Tip: Use Cutecom in Ubuntu 12.04 to view logs from Arduino ATMega 2560 and
Arduino Due.
To build Lite Stack, please follow these requirements for Linux Ubuntu 12.04:
- GCC compiler version is 4.6
- Pre-install the "gnu-libc" libraries package.
NOTE: The Arduino patches mentioned below are required to use the Arduino
Ethernet or WiFi shield. They are not currently included in the IoTivity
repository. Please contact the IoTivity support forum for more information.
To build Lite Stack, please follow these requirements for Arduino ATMega 2560:
- Arduino Framework 1.0.5 is installed.
- AVR-GCC compiler version is 4.5.3 (Distributed with Arduino 1.0.5, no further
action necessary if framework was obtained from
http://arduino.cc/en/Main/OldSoftwareReleases. Note: Frameworks obtained from
apt-get have had different compiler versions.)
- Unzip the Time Library from here to your Arduino Directory Structure:
http://playground.arduino.cc/code/time
- Apply patch "arduino-1.0.5_linux.patch" at <iotivity>/tools/arduino/patches
to your Arduino Directory Structure at location <Arduino 1.0.5>.
- Create/Append "local.properties" file at location <iotivity>/resource/csdk/
with the following specified:
ARDUINO_DIR := <arduino-1.0.5>
ARDUINO_TOOLS_DIR := $(ARDUINO_DIR)/hardware/tools/avr/bin
To build Lite Stack, please follow these requirements for Arduino Due:
- Arduino Framework 1.5.7 is installed.
- AVR-GCC compiler version is 4.8.3 (Distributed with Arduino 1.5.7, no further
action necessary if framework was obtained from
http://arduino.cc/en/Main/OldSoftwareReleases. Note: Frameworks obtained from
apt-get have had different compiler versions.)
- Unzip the Time Library from here to your Arduino Directory Structure:
http://www.pjrc.com/teensy/td_libs_Time.html
- Apply patch "arduino-1.5.7_linux.patch" at <iotivity>/tools/arduino/patches
to your Arduino Directory Structure at location <Arduino 1.5.7>.
- Create/Append "local.properties" file at location <iotivity>/resource/csdk/
with the following specified:
ARDUINO_DIR := <arduino-1.5.7>
ARDUINO_TOOLS_DIR := $(ARDUINO_DIR)/hardware/tools/avr/bin
Note: If you are building for Arduino Mega and building for Arduino Due you may
find it useful to set the "local.properties" file to look like this:
ifeq ($(PLATFORM), arduinomega)
#Location of arduino sdk for Arduino Mega
ARDUINO_DIR := <arduino-1.0.5>
ARDUINO_TOOLS_DIR := $(ARDUINO_DIR)/hardware/tools/avr/bin
else
#Location of arduino sdk for Arduino Due
ARDUINO_DIR := <arduino-1.5.7>
ARDUINO_TOOLS_DIR := $(ARDUINO_DIR)/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin
endif
===============================================================================
Instructions for Common Build Processes:
Please use the following GNU make targets to build for the specific platform(s)
you wish to build. Please review "makefile" at the same directory level as this
README document to find the build output locations.
NOTE: 'GNU Make' is required to utilize the makefile at location:
<iotivity>/makefile.
NOTE: In release "M1" the build process only allows for single platforms to be
built at a time. For instance, you may only build successfully when building
either Lite modules for Arduino ATMega 2560, building Lite modules for Arduino Due,
or building Lite modules and/or Rich modules for Linux. Also, you may only build
either a RELEASE or a DEBUG revision at this time. Later releases will support
building for any and all platforms' modules with a single 'makefile' command.
=======================================
== All Targets - Linux Only ==
=======================================
- All Modules, without OCICUC, in Release (Lite Stack, Lite Examples, Rich
Stack, Rich Examples) for linux:
make linux
- All Modules, without OCICUC, in Debug (Lite Stack, Lite Examples, Rich Stack,
Rich Examples) for linux:
make linux_debug
- All Rich Stack Modules in Release, without OCICUC, (Lite Stack, Rich Stack,
Rich Examples) for Linux:
make linux_ub
- All Rich Stack Modules in Debug, without OCICUC, (Lite Stack, Rich Stack,
Rich Examples) for Linux:
make linux_ub_debug
- All Rich Stack Modules, including OCICUC, in Release & Debug (Lite Stack,
Rich Stack, Rich Examples, Rich OCICUC) for linux:
make linux_ub_dev
- All Lite Stack Modules in Release (Lite Stack, Lite Examples) for Linux:
make linux_tb
- All Lite Stack Modules in Debug (Lite Stack, Lite Examples) for Linux:
make linux_tb_debug
=======================================
== All Targets - Mega Only ==
=======================================
- All Lite Stack Modules in Release (Lite Stack, Lite Examples) for Arduino
ATMega 2560 with Ethernet Shield:
make arduinomega
- All Lite Stack Modules in Debug (Lite Stack, Lite Examples) for Arduino ATMega
2560 with Ethernet Shield:
make arduinomega_debug
Note: To install to Arduino ATMega 2560, see README at the following location:
<iotivity>/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/
=======================================
== All Targets - Due Only ==
=======================================
- All Lite Stack Modules in Release (Lite Stack, Lite Examples) for Arduino Due
with Ethernet Shield:
make arduinodue_all
- All Lite Stack Modules in Debug (Lite Stack, Lite Examples) for Arduino Due
with Ethernet Shield:
make arduinodue_all_debug
Note: To install to Arduino Due, see README at the following location:
<iotivity>/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/
=======================================
== Clean All Targets ==
=======================================
- Clean All:
make clean
This diff is collapsed.
Builds with g++ 4.6, 4.8, 4.9.
Run "make" to build OCLib.a, the examples, and TBStack in RELEASE mode.
Run "make BUILD=debug" to build OCLib.a, the examples, and TBStack in DEBUG mode.
OCProject/
├── csdk
│   ├── examples :: TODO :: Unused remove??
│   │   ├── occlient.c
│   │   └── ocserver.c
│   ├── ocstack.h
│   └── ocstack_stub.c
├── examples
│   ├── client
│   │   ├── MyMultiResourceHandler.cpp
│   │   ├── MyMultiResourceHandler.h
│   │   ├── MyObserverHandler.cpp
│   │   ├── MyObserverHandler.h
│   │   ├── MyResourceHandler.cpp
│   │   ├── MyResourceHandler.h
│   │   └── OCClient.cpp
│   ├── Makefile
│   ├── OCWrapper :: TODO :: Unused remove??
│   │   ├── Makefile
│   │   ├── parsetest.cpp
│   │   ├── testClient.cpp
│   │   ├── testServerApp.cpp
│   │   └── testServer.cpp
│   ├── server
│   │   ├── multiple_resources.cpp
│   │   └── single_resource.cpp
│   ├── test_OCClient.cpp
│   ├── test_OCReflect.cpp
│   └── test_properties.cpp
├── include - TODO : Seperate what we expose and what we don't
│   ├── IClientWrapper.h
│   ├── InitializeException.h
│   ├── InProcClientWrapper.h
│   ├── InProcServerWrapper.h
│   ├── IServerWrapper.h
│   ├── OCApi.h
│   ├── OCException.h
│   ├── OCObject.h
│   ├── OCObserver.h
│   ├── OCObserverHandler.h
│   ├── OCPlatform.h
│   ├── OCPlatformHandler.h
│   ├── OCProperties.h
│   ├── OCReflect.h
│   ├── OCResource.h
│   ├── OCResourceHandler.h
│   ├── OCSecurityModel.h
│   ├── OCServer.h :: TODO :: Unused remove??
│   ├── OutOfProcClientWrapper.h
│   ├── OutOfProcServerWrapper.h
│   ├── ResourceInitException.h
│   └── WrapperFactory.h
├── Makefile
├── OCLib
│   ├── InProcClientWrapper.cpp
│   ├── InProcServerWrapper.cpp
│   ├── OCApi.cpp
│   ├── OCObject.cpp
│   ├── OCObserver.cpp
│   ├── OCPlatform.cpp
│   ├── OCProperties.cpp
│   ├── OCReflect.cpp
│   ├── OCResource.cpp
│   ├── OCSecurityModel.cpp
│   └── OCServer.cpp :: TODO :: Unused remove??
└── README - You are reading this.
......@@ -6,10 +6,12 @@ SDIR_ARD_CORE_4 = $(ARDUINO_DIR)/hardware/arduino/sam/cores/arduino/avr
SDIR_ARD_SPI = $(ARDUINO_DIR)/hardware/arduino/sam/libraries/SPI
SDIR_ARD_ETH = $(ARDUINO_DIR)/libraries/Ethernet/src
SDIR_ARD_ETH_UTIL = $(ARDUINO_DIR)/libraries/Ethernet/src/utility
SDIR_ARD_WIFI = $(ARDUINO_DIR)/libraries/WiFi/src
SDIR_ARD_WIFI_UTIL = $(ARDUINO_DIR)/libraries/WiFi/src/utility
SDIR_ARD_TIME = $(ARDUINO_DIR)/libraries/Time/Time
SDIR_ARD_PLATFORM = $(SDIR_ARD_CORE_1):$(SDIR_ARD_CORE_2):$(SDIR_ARD_CORE_3):$(SDIR_ARD_CORE_4):$(SDIR_ARD_SPI):\
$(SDIR_ARD_ETH):$(SDIR_ARD_ETH_UTIL):$(SDIR_ARD_TIME)
$(SDIR_ARD_TIME)
#include directories
IDIR_ARD_CORE_1 = $(ARDUINO_DIR)/hardware/arduino/sam/cores/arduino
......@@ -20,11 +22,13 @@ IDIR_ARD_CORE_5 = $(ARDUINO_DIR)/hardware/arduino/sam/variants/arduino_due_x
IDIR_ARD_SPI = $(ARDUINO_DIR)/hardware/arduino/sam/libraries/SPI
IDIR_ARD_ETH = $(ARDUINO_DIR)/libraries/Ethernet/src
IDIR_ARD_ETH_UTIL = $(ARDUINO_DIR)/libraries/Ethernet/src/utility
INCD_ARD_WIFI = $(ARDUINO_DIR)/libraries/WiFi/src
INCD_ARD_WIFI_UTIL = $(ARDUINO_DIR)/libraries/WiFi/src/utility
INCD_ARD_TIME = $(ARDUINO_DIR)/libraries/Time/Time
INC_DIR_PLATFORM = -I$(IDIR_ARD_CORE_1) -I$(IDIR_ARD_CORE_2) -I$(IDIR_ARD_CORE_3) -I$(IDIR_ARD_CORE_4) -I$(IDIR_ARD_CORE_5) \
-I$(IDIR_ARD_SPI) -I$(IDIR_ARD_ETH) -I$(IDIR_ARD_ETH_UTIL) -I$(INCD_ARD_TIME)
-I$(IDIR_ARD_SPI) -I$(INCD_ARD_TIME)
#Compiler/Linker flags
CFLAGS_PLATFORM = -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions \
......@@ -33,20 +37,34 @@ CFLAGS_PLATFORM = -ffunction-sections -fdata-sections -nostdlib --param max-inli
-DWITH_ARDUINO -DNDEBUG
#Compilers
CCPLUS=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-g++
CXX=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-g++
CC=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-gcc
AR=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-ar
RANLIB=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-ranlib
AVR_PROGRAMMER=$(ARDUINO_TOOLS_DIR)/bossac
#Needed object files
CORE_COBJ = hooks.o dtostrf.o iar_calls_sam3.o WInterrupts.o wiring.o wiring_digital.o wiring_analog.o wiring_shift.o\
wiring_pulse.o USARTClass.o USBCore.o RingBuffer.o cortex_handlers.o
CORE_CPPOBJ = itoa.o main.o Stream.o WMath.o WString.o Print.o IPAddress.o HID.o UARTClass.o CDC.o Reset.o cxxabi-compat.o
ETH_CPPOBJ = Dhcp.o Dns.o Ethernet.o EthernetUdp.o EthernetClient.o
ETH_UTIL_CPPOBJ = socket.o w5100.o
WIFI_COBJ = WiFi.o WiFiClient.o WiFiServer.o WiFiUdp.o server_drv.o spi_drv.o wifi_drv.o
VARIANT_OBJ = variant.o
SPI_OBJ = SPI.o
SYSCALLS_SAM3_OBJ = syscalls_sam3.o
PLATFORM_OBJS = $(SYSCALLS_SAM3_OBJ) $(SPI_OBJ) $(ETH_CPPOBJ) $(ETH_UTIL_CPPOBJ) $(VARIANT_OBJ) $(CORE_COBJ) $(CORE_CPPOBJ)
PLATFORM_OBJS = $(SYSCALLS_SAM3_OBJ) $(SPI_OBJ) $(VARIANT_OBJ) $(CORE_COBJ) $(CORE_CPPOBJ)
#Include sources/objects corresponding to WiFi or Ethernet shield
ifeq ($(ARDUINOWIFI),1)
INC_DIR_PLATFORM += -I$(INCD_ARD_WIFI) -I$(INCD_ARD_WIFI_UTIL)
SDIR_ARD_PLATFORM += :$(SDIR_ARD_WIFI):$(SDIR_ARD_WIFI_UTIL)
PLATFORM_OBJS += $(WIFI_COBJ)
else
INC_DIR_PLATFORM += -I$(IDIR_ARD_ETH) -I$(IDIR_ARD_ETH_UTIL)
SDIR_ARD_PLATFORM += :$(SDIR_ARD_ETH):$(SDIR_ARD_ETH_UTIL)
PLATFORM_OBJS += $(ETH_CPPOBJ) $(ETH_UTIL_CPPOBJ)
endif
......@@ -4,11 +4,10 @@ SDIR_ARD_CORE = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
SDIR_ARD_SPI = $(ARDUINO_DIR)/libraries/SPI
SDIR_ARD_ETH = $(ARDUINO_DIR)/libraries/Ethernet
SDIR_ARD_ETH_UTIL = $(ARDUINO_DIR)/libraries/Ethernet/utility
SDIR_ARD_WIFI = $(ARDUINO_DIR)/libraries/WiFi/src
SDIR_ARD_WIFI_UTIL = $(ARDUINO_DIR)/libraries/WiFi/src/utility
SDIR_ARD_WIFI = $(ARDUINO_DIR)/libraries/WiFi
SDIR_ARD_WIFI_UTIL = $(ARDUINO_DIR)/libraries/WiFi/utility
SDIR_ARD_TIME = $(ARDUINO_DIR)/libraries/Time/Time
SDIR_ARD_PLATFORM = $(SDIR_ARD_CORE):$(SDIR_ARD_SPI):$(SDIR_ARD_ETH):$(SDIR_ARD_ETH_UTIL):$(SDIR_ARD_TIME) \
:$(SDIR_ARD_WIFI):$(SDIR_ARD_WIFI_UTIL)
SDIR_ARD_PLATFORM = $(SDIR_ARD_CORE):$(SDIR_ARD_SPI):$(SDIR_ARD_TIME)
#include directories
INCD_ARD_CORE = -I$(ARDUINO_DIR)/hardware/arduino/cores/arduino
......@@ -16,26 +15,25 @@ INCD_ARD_VARIANT = -I$(ARDUINO_DIR)/hardware/arduino/variants/mega
INCD_ARD_SPI = -I$(ARDUINO_DIR)/libraries/SPI
INCD_ARD_ETH = -I$(ARDUINO_DIR)/libraries/Ethernet
INCD_ARD_ETH_UTIL = -I$(ARDUINO_DIR)/libraries/Ethernet/utility
INCD_ARD_WIFI = -I$(ARDUINO_DIR)/libraries/WiFi/src
INCD_ARD_WIFI_UTIL = -I$(ARDUINO_DIR)/libraries/WiFi/src/utility
INCD_ARD_WIFI = -I$(ARDUINO_DIR)/libraries/WiFi
INCD_ARD_WIFI_UTIL = -I$(ARDUINO_DIR)/libraries/WiFi/utility
INCD_ARD_TIME = -I$(ARDUINO_DIR)/libraries/Time/Time
INC_DIR_PLATFORM = $(INCD_ARD_CORE) $(INCD_ARD_VARIANT) $(INCD_ARD_SPI) $(INCD_ARD_ETH) $(INCD_ARD_ETH_UTIL) \
$(INCD_ARD_TIME) $(INCD_ARD_WIFI) $(INCD_ARD_WIFI_UTIL)
INC_DIR_PLATFORM = $(INCD_ARD_CORE) $(INCD_ARD_VARIANT) $(INCD_ARD_SPI) $(INCD_ARD_TIME)
#Compiler/Linker flags
CFLAGS_PLATFORM = -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=156 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DWITH_ARDUINO \
-MMD -std=c++0x -Wno-write-strings -ffunction-sections -fdata-sections -fno-exceptions -felide-constructors -DATMEGA2560 -DNDEBUG
#Compilers
CCPLUS=$(ARDUINO_TOOLS_DIR)/avr-g++
CXX=$(ARDUINO_TOOLS_DIR)/avr-g++
CC=$(ARDUINO_TOOLS_DIR)/avr-gcc
AR=$(ARDUINO_TOOLS_DIR)/avr-ar
RANLIB=$(ARDUINO_TOOLS_DIR)/avr-ranlib
AVR_OBJCOPY=$(ARDUINO_TOOLS_DIR)/avr-objcopy
AVR_PROGRAMMER=$(ARDUINO_TOOLS_DIR)/../../avrdude
#Needed object files
CORE_COBJ = WInterrupts.o wiring.o wiring_digital.o
CORE_CPPOBJ = main.o Stream.o WMath.o WString.o HardwareSerial.o Print.o SPI.o IPAddress.o
ETH_CPPOBJ = Dhcp.o Dns.o Ethernet.o EthernetUdp.o
......@@ -43,5 +41,16 @@ ETH_UTIL_CPPOBJ = socket.o w5100.o
WIFI_COBJ = WiFi.o WiFiClient.o WiFiServer.o WiFiUdp.o server_drv.o spi_drv.o wifi_drv.o
OCDEPENDENT_CPPOBJ = wiring_analog.o
PLATFORM_OBJS = $(CORE_COBJ) $(CORE_CPPOBJ) $(ETH_CPPOBJ) $(ETH_UTIL_CPPOBJ) $(OCDEPENDENT_CPPOBJ) $(WIFI_COBJ)
PLATFORM_OBJS = $(CORE_COBJ) $(CORE_CPPOBJ) $(OCDEPENDENT_CPPOBJ)
#Include sources/objects corresponding to WiFi or Ethernet shield
ifeq ($(ARDUINOWIFI),1)
INC_DIR_PLATFORM += $(INCD_ARD_WIFI) $(INCD_ARD_WIFI_UTIL)
SDIR_ARD_PLATFORM += :$(SDIR_ARD_WIFI):$(SDIR_ARD_WIFI_UTIL)
PLATFORM_OBJS += $(WIFI_COBJ)
else
INC_DIR_PLATFORM += $(INCD_ARD_ETH) $(INCD_ARD_ETH_UTIL)
SDIR_ARD_PLATFORM += :$(SDIR_ARD_ETH):$(SDIR_ARD_ETH_UTIL)
PLATFORM_OBJS += $(ETH_CPPOBJ) $(ETH_UTIL_CPPOBJ)
endif
......@@ -77,7 +77,7 @@ prep_dirs:
$(CC) -c $(CC_FLAGS.$(BUILD)) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $(OBJ_DIR)/$@
%.o: %.cpp
$(CCPLUS) -c $(CC_FLAGS.$(BUILD)) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $(OBJ_DIR)/$@
$(CXX) -c $(CC_FLAGS.$(BUILD)) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $(OBJ_DIR)/$@
libcoap.a: $(OBJECTS) $(OBJECTSCPP)
$(AR) rcs $(OUT_DIR)/$@ $(addprefix $(OBJ_DIR)/,$^)
......
......@@ -9,7 +9,7 @@ PLATFORM := linux
ARDUINOWIFI := 0
ifeq ($(ROOT_DIR), )
ROOT_DIR = $(PWD)
ROOT_DIR = .
endif
ifeq ($(OBJ_DIR), )
......@@ -86,7 +86,9 @@ SOURCES := $(CJSON_SOURCES)
SOURCES += $(OCCOAP_SOURCES)
SOURCES += $(OCTBSTACK_SOURCES)
all: make_lcoap objdirs obj_build liboctbstack.a #print_vars
all: make_lcoap objdirs obj_build liboctbstack.a
buildScript_all: objdirs obj_build liboctbstack.a
make_lcoap:
$(MAKE) -C $(LCOAP_DIR) "BUILD=$(BUILD)" "PLATFORM=$(PLATFORM)" "ARDUINOWIFI=$(ARDUINOWIFI)"
......@@ -103,7 +105,7 @@ obj_build:
liboctbstack.a:
@echo "Building $@"
# Unpackage libcoap.a to $(OBJ_DIR)/$(BUILD). The output objects from OCStack and OCCoap are already at this location
@cd $(BUILD)/$(OBJ_DIR) && $(AR) -x $(LCOAP_DIR)/$(BUILD)/libcoap.a
@cd $(BUILD)/$(OBJ_DIR) && $(AR) -x ../../$(LCOAP_DIR)/$(BUILD)/libcoap.a
# Repackage all the objects at this location into a single archive. This is OCStack, OCCoap, and LibCoap (LibCoap contains OCRandom, OCLogger, and OCSocket.).
$(AR) -r $(BUILD)/$@ $(BUILD)/$(OBJ_DIR)/*.o
......
......@@ -8,18 +8,18 @@ location "/dev/ttyACM0", you must define ARDUINO_PORT to the location it is
installed at. This location will be referred to as <DEV_PORT>.
This makefile relies on "local.properties" at the directory level of the
makefile that generates octbstack.a. Please refer to the README at that level
root of the repository. Please refer to the README at that level
to determine what definitions are needed for your environment.
To make ocserver in release mode:
make (arduinomega)
make -f makefiledue (arduinodue)
make -f makefiledue (arduinodue)
To make & install ocserver in release mode, with <DEV_PORT> NOT specified:
make install (arduinomega)
make -f makefiledue install (arduinodue)
make -f makefiledue install (arduinodue)
To make & install ocserver in release mode, with <DEV_PORT> specified:
......@@ -32,6 +32,7 @@ To make & install ocserver in debug mode, with <DEV_PORT> specified:
To make ocserver_wifi with Arduino WiFi Shield support:
make ARDUINOWIFI=1 (arduinomega)
-------------------------------------------------------------------------------
**Clean-Up**
-------------------------------------------------------------------------------
......
......@@ -46,7 +46,7 @@ prep_dirs:
$(CC) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
%.o: %.cpp
$(CCPLUS) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
$(CXX) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
$(APP_NAME).elf: $(APP_NAME).o core.a
$(CC) -Os -Wl,--gc-sections,--relax $(CFLAGS_PLATFORM) $^ -lm -o $@
......
......@@ -27,29 +27,29 @@ all: prep_dirs core.a $(APP_NAME).o $(APP_NAME).elf $(APP_NAME).bin
core.a: $(PLATFORM_OBJS)
@cd $(OBJ_DIR) && $(AR) -x $(ROOT_DIR)/../$(BUILD)/liboctbstack.a
$(AR) rcs $@ $(CORE_COBJ) $(CORE_CPPOBJ) $(OBJ_DIR)/*.o
$(RANLIB) $@
$(AR) rcs $(OBJ_DIR)/$@ $(foreach obj, $^, $(OBJ_DIR)/$(obj)) $(OBJ_DIR)/*.o
@cd $(OBJ_DIR) && $(RANLIB) $@
prep_dirs:
-mkdir $(OBJ_DIR)
%.o: %.c
$(CC) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
$(CC) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $(OBJ_DIR)/$@
%.o: %.cpp
$(CCPLUS) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $@
$(CXX) $(CFLAGS) $(CFLAGS_PLATFORM) $(INC_DIRS) $(INC_DIR_PLATFORM) $< -o $(OBJ_DIR)/$@
$(APP_NAME).elf: $(APP_NAME).o core.a
$(CCPLUS) -Os -Wl,--gc-sections -mcpu=cortex-m3 -T/$(SDIR_ARD_CORE_3)/linker_scripts/gcc/flash.ld -Wl,-Map,$(APP_NAME).map -o $@ -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group $(APP_NAME).o $(SYSCALLS_SAM3_OBJ) $(SPI_OBJ) $(ETH_CPPOBJ) $(ETH_UTIL_CPPOBJ) $(VARIANT_OBJ) $(SDIR_ARD_CORE_3)/libsam_sam3x8e_gcc_rel.a core.a -Wl,--end-group
$(CXX) -Os -Wl,--gc-sections -mcpu=cortex-m3 -T/$(SDIR_ARD_CORE_3)/linker_scripts/gcc/flash.ld -Wl,-Map,$(APP_NAME).map -o $(OBJ_DIR)/$@ -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group $(foreach obj, $(APP_NAME).o $(SYSCALLS_SAM3_OBJ) $(SPI_OBJ) $(TRANSPORT_OBJS) $(VARIANT_OBJ) core.a, $(OBJ_DIR)/$(obj)) $(SDIR_ARD_CORE_3)/libsam_sam3x8e_gcc_rel.a -Wl,--end-group
$(APP_NAME).bin: $(APP_NAME).elf
$(ARDUINO_TOOLS_DIR)/arm-none-eabi-objcopy -O binary $< $@
$(ARDUINO_TOOLS_DIR)/arm-none-eabi-objcopy -O binary $(OBJ_DIR)/$< $(OBJ_DIR)/$@
install: all
#Due needs Serial port speed to be set to 1200bps for uploading
stty -F /dev/$(ARDUINO_PORT) speed 1200 cs8 -cstopb -parenb
$(ARDUINO_DIR)/hardware/tools/bossac -i -d --port=$(ARDUINO_PORT) -U false -e -w -v -b $(APP_NAME).bin -R
$(ARDUINO_DIR)/hardware/tools/bossac -i -d --port=$(ARDUINO_PORT) -U false -e -w -v -b $(OBJ_DIR)/$(APP_NAME).bin -R
.PHONY: clean
......
......@@ -3,14 +3,14 @@
BUILD := release
PLATFORM := linux
CC := g++
OUT_DIR := $(PWD)/$(BUILD)
OUT_DIR := ./$(BUILD)
OBJ_DIR := $(OUT_DIR)/obj
ifeq ($(ROOT_DIR), )
ROOT_DIR = $(PWD)/../../../..
ROOT_DIR = ./../../../..
endif
OUT_DIR = $(PWD)
OUT_DIR = .
OCLOGGER_DIR = $(ROOT_DIR)/logger
OCRANDOM_DIR = $(ROOT_DIR)/ocrandom
......
......@@ -5,7 +5,7 @@ PLATFORM := linux
CC := g++
ifeq ($(ROOT_DIR), )
ROOT_DIR = $(PWD)/../..
ROOT_DIR = ./../..
endif
# You must create the file "local.properties" on your local machine which contains any local paths, etc
......@@ -18,11 +18,11 @@ include $(ROOT_DIR)/local.properties
# NOTE: to run app, make sure that LD_LIBRARY_PATH env variable
# contains $(GTEST_DIR)/lib/.libs
OUT_DIR := $(PWD)/$(BUILD)
OUT_DIR := ./$(BUILD)
OBJ_DIR := $(OUT_DIR)/obj
OUT_DIR := $(PWD)
OUT_DIR := .
OCLOGGER_DIR = $(ROOT_DIR)/logger
OCRANDOM_DIR = $(ROOT_DIR)/ocrandom
......
......@@ -3,7 +3,7 @@
BUILD := release
CXX := g++
#CXX := clang
OUT_DIR := $(PWD)/$(BUILD)
OUT_DIR := ./$(BUILD)
CXX_FLAGS.debug := -O0 -g3 -std=c++0x -Wall -pthread
......@@ -17,9 +17,13 @@ CXX_INC += -I../csdk/logger/include
CXX_INC += -I../csdk/libcoap
# Force metatargets to build:
.PHONY: prep_dirs simpleserver simpleclient simpleclientserver roomserver roomclient presenceserver presenceclient ocicuc
all.PHONY: prep_dirs simpleserver simpleclient simpleclientserver roomserver roomclient presenceserver presenceclient ocicuc_target
all: .PHONY
apps.PHONY: prep_dirs simpleserver simpleclient simpleclientserver roomserver roomclient presenceserver presenceclient
all: all.PHONY
apps: apps.PHONY
prep_dirs:
-mkdir -p $(OUT_DIR)
......@@ -45,10 +49,11 @@ roomserver: roomserver.cpp
roomclient: roomclient.cpp
$(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ roomclient.cpp $(CXX_INC) ../$(BUILD)/obj/liboc.a ../csdk/$(BUILD)/liboctbstack.a
ocicuc:
ocicuc_target:
cd ocicuc && $(MAKE)
clean:
rm -rf $(OUT_DIR)/*
rm -rf debug
rm -rf release
cd ocicuc && $(MAKE) clean
......@@ -17,9 +17,13 @@ CXX_INC += -I./csdk/logger/include
CXX_INC += -I./csdk/libcoap
# Force metatargets to build:
.PHONY: prep_dirs c_sdk liboc.a examples
all.PHONY: prep_dirs c_sdk liboc.a examples
all: .PHONY
buildScript_all.PHONY: prep_dirs liboc.a
all: all.PHONY
buildScript_all: buildScript_all.PHONY
prep_dirs:
-mkdir -p $(OUT_DIR)
......@@ -31,11 +35,8 @@ c_sdk:
examples:
cd examples && $(MAKE) "BUILD=$(BUILD)"
liboc.a: OCPlatform.o OCResource.o OCReflect.o OCUtilities.o InProcServerWrapper.o InProcClientWrapper.o
ar -cvq $(OBJ_DIR)/liboc.a $(OBJ_DIR)/OCPlatform.o $(OBJ_DIR)/OCResource.o $(OBJ_DIR)/OCReflect.o $(OBJ_DIR)/OCUtilities.o $(OBJ_DIR)/InProcServerWrapper.o $(OBJ_DIR)/InProcClientWrapper.o
OCReflect.o: src/OCReflect.cpp
$(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCReflect.cpp $(CXX_INC)
liboc.a: OCPlatform.o OCResource.o OCUtilities.o InProcServerWrapper.o InProcClientWrapper.o
ar -cvq $(OBJ_DIR)/liboc.a $(OBJ_DIR)/OCPlatform.o $(OBJ_DIR)/OCResource.o $(OBJ_DIR)/OCUtilities.o $(OBJ_DIR)/InProcServerWrapper.o $(OBJ_DIR)/InProcClientWrapper.o
OCPlatform.o: src/OCPlatform.cpp
$(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCPlatform.cpp $(CXX_INC)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment