repository cleaned
actually noone ever needed the full contiki-ng repository, but it was just forked in order to start developing the project quickly
This commit is contained in:
parent
1fd0ba8d72
commit
d192979eb7
70
.gitignore
vendored
70
.gitignore
vendored
@ -1,69 +1 @@
|
||||
*.a
|
||||
*.bin
|
||||
*.hex
|
||||
*.map
|
||||
*.png
|
||||
*.log
|
||||
*.elf
|
||||
*.zip
|
||||
*.d
|
||||
*.o
|
||||
*.e
|
||||
*.ihex
|
||||
*.pyc
|
||||
*~
|
||||
build/*
|
||||
Makefile.target
|
||||
Makefile.*.defines
|
||||
tools/doxygen/html
|
||||
tools/readthedocs/_build
|
||||
patches-*
|
||||
tools/serial-io/tunslip6
|
||||
tools/serial-io/serialdump
|
||||
serialdump-*
|
||||
build
|
||||
tools/coffee-manager/build/
|
||||
tools/coffee-manager/coffee.jar
|
||||
COOJA.testlog
|
||||
|
||||
# platform build artifacts
|
||||
*.cc2538dk
|
||||
*.cooja
|
||||
*.jn516x
|
||||
*.native
|
||||
*.nrf52dk
|
||||
*.openmote-cc2538
|
||||
*.simplelink
|
||||
*.sky
|
||||
*.firmware
|
||||
*.cc26x0-cc13x0
|
||||
*.zoul
|
||||
|
||||
# do not ignore platform makefiles
|
||||
!Makefile.cc2538dk
|
||||
!Makefile.cooja
|
||||
!Makefile.jn516x
|
||||
!Makefile.native
|
||||
!Makefile.nrf52dk
|
||||
!Makefile.openmote-cc2538
|
||||
!Makefile.sky
|
||||
!Makefile.cc26x0-cc13x0
|
||||
!Makefile.zoul
|
||||
|
||||
# other nRF52 build artifacts
|
||||
*.jlink
|
||||
|
||||
#test artifacts
|
||||
*.testlog
|
||||
*.scriptlog
|
||||
*.coojalog
|
||||
*.summary
|
||||
*.err
|
||||
summary
|
||||
tests/[0-9][0-9]-*/org/
|
||||
tests/18-coap-lwm2m/Californium.properties
|
||||
tests/18-coap-lwm2m/leshan-server-demo*.jar
|
||||
|
||||
# x86 UEFI files
|
||||
cpu/x86/uefi/Makefile.uefi
|
||||
cpu/x86/uefi/edk2
|
||||
*.swp
|
||||
|
@ -1,3 +0,0 @@
|
||||
For contribution guidelines, see [doc:contributing].
|
||||
|
||||
[doc:contributing]: https://github.com/contiki-ng/contiki-ng/wiki/Contributing
|
30
LICENSE.md
30
LICENSE.md
@ -1,30 +0,0 @@
|
||||
Copyright (c) (Year), (Name of copyright holder)
|
||||
All rights reserved.
|
||||
|
||||
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.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
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 HOLDER 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.
|
@ -1,47 +0,0 @@
|
||||
# This Makefile contains make variables and rules that are only applicable
|
||||
# to builds for embedded devices (i.e. excluding platforms native and cooja).
|
||||
# Future extensions to the build system that are of a similar nature (for
|
||||
# embedded devices only), can be achieved by extending this Makefile here.
|
||||
|
||||
###
|
||||
### Targets using the tools/serial-io
|
||||
###
|
||||
RLWRAPGOALS = login serialdump serialview
|
||||
|
||||
.PHONY: $(RLWRAPGOALS)
|
||||
|
||||
BAUDRATE ?= 115200
|
||||
SERIALDUMP_TIME_FMT ?=
|
||||
|
||||
ifeq ($(HOST_OS),Windows)
|
||||
SERIALDUMP = $(SERIAL_DUMP_BIN)
|
||||
else
|
||||
RLWRAP = $(notdir $(shell which rlwrap))
|
||||
ifeq ($(RLWRAP),)
|
||||
ifneq ($(filter $(RLWRAPGOALS),$(MAKECMDGOALS)),)
|
||||
$(info Running serialdump without rlwrap support.)
|
||||
$(info Consider installing rlwarp in order to be able to use command history)
|
||||
endif
|
||||
endif
|
||||
SERIALDUMP = $(RLWRAP) $(SERIAL_DUMP_BIN)
|
||||
endif
|
||||
|
||||
serialdump: $(SERIAL_DUMP_BIN)
|
||||
$(SERIALDUMP) -b$(BAUDRATE) -T$(SERIALDUMP_TIME_FMT) $(PORT) | tee serialdump-`date +%Y%m%d-%H%M`
|
||||
|
||||
serialview: $(SERIAL_DUMP_BIN)
|
||||
$(SERIALDUMP) -b$(BAUDRATE) -T$(SERIALDUMP_TIME_FMT) $(PORT)
|
||||
|
||||
login: $(SERIAL_DUMP_BIN)
|
||||
$(SERIALDUMP) -b$(BAUDRATE) $(PORT)
|
||||
|
||||
###
|
||||
### Targets using tools/motelist
|
||||
###
|
||||
CONTIKI_NG_MOTELIST_DIR = $(TOOLS_DIR)/motelist
|
||||
CONTIKI_NG_MOTELIST = python $(CONTIKI_NG_MOTELIST_DIR)/motelist.py
|
||||
|
||||
.PHONY: motelist-all
|
||||
|
||||
motelist-all:
|
||||
$(CONTIKI_NG_MOTELIST)
|
@ -1,29 +0,0 @@
|
||||
usage:
|
||||
@echo "Usage:"
|
||||
@echo " make [TARGET=(TARGET)] [BOARD=(BOARD)] [DEFINES=(DEFINES)] [PORT=(PORT)] [target]"
|
||||
@echo ""
|
||||
@echo "Typical usage:"
|
||||
@echo " make [TARGET=(TARGET)] [BOARD=(BOARD)] [all]"
|
||||
@echo ""
|
||||
@echo " Will build Contiki-NG firmware(s) from the current example dir"
|
||||
@echo " for platform TARGET, board BOARD."
|
||||
@echo ""
|
||||
@echo "Miscellaneous targets:"
|
||||
@echo " targets Prints list of supported platforms"
|
||||
@echo " boards Prints a list of supported boards for TARGET"
|
||||
@echo " savetarget Saves TARGET and BOARD for future invocations of make"
|
||||
@echo " savedefines Saves DEFINES for future invocations of make"
|
||||
@echo " clean Removes all compiled files for TARGET"
|
||||
@echo " distclean Removes all compiled files for all TARGETs"
|
||||
@echo " viewconf Prints Contiki-NG build configuration for TARGET"
|
||||
@echo " %.flashprof Shows a Flash/ROM profile of a given firmware (e.g. hello-world.flashprof)"
|
||||
@echo " %.ramprof Shows a RAM profile of a given firmware (e.g. hello-world.ramprof)"
|
||||
@echo " %.o Produces an object file from a given source file (e.g. hello-world.o)"
|
||||
@echo " %.e Produces the pre-processed version of a given source file (e.g. hello-world.e)"
|
||||
@echo " %.s Produces an assembly file from a given source file (e.g. hello-world.s)"
|
||||
@echo " login View the serial output of the device connected to PORT"
|
||||
@echo " serialview Same as login, but prepend serial output with a unix timestamp"
|
||||
@echo " serialdump same as serialview, but also save the output to a file"
|
||||
@echo " motelist-all Prints a list of connected devices"
|
||||
|
||||
help: usage
|
@ -1,14 +0,0 @@
|
||||
# This Makefile can be used to identify the selected TARGET used for a
|
||||
# specific build. It can be included by example Makefiles that need to take
|
||||
# decisions based on TARGET. It is also automatically included by the
|
||||
# top-level Makefile.include.
|
||||
|
||||
ifeq ($(TARGET),)
|
||||
-include Makefile.target
|
||||
ifeq ($(TARGET),)
|
||||
${info TARGET not defined, using target 'native'}
|
||||
TARGET=native
|
||||
else
|
||||
${info using saved target '$(TARGET)'}
|
||||
endif
|
||||
endif
|
490
Makefile.include
490
Makefile.include
@ -1,490 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
|
||||
ifndef CONTIKI
|
||||
${error CONTIKI not defined! You must specify where Contiki resides}
|
||||
endif
|
||||
|
||||
# Enable Werror by default. To disable from command line, use make WERROR=0.
|
||||
# Setting this option is also important for tests on Cooja motes to check for warnings.
|
||||
WERROR ?= 1
|
||||
|
||||
include $(CONTIKI)/Makefile.identify-target
|
||||
|
||||
### Include Makefile.tools to pull in targets that allow us to build tools dir
|
||||
include $(CONTIKI)/Makefile.tools
|
||||
|
||||
ifeq ($(DEFINES),)
|
||||
-include Makefile.$(TARGET).defines
|
||||
ifneq ($(DEFINES),)
|
||||
${info using saved defines '$(DEFINES)'}
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef HOST_OS
|
||||
ifeq ($(OS),Windows_NT)
|
||||
## TODO: detect more specific Windows set-ups,
|
||||
## e.g. CygWin, MingW, VisualC, Watcom, Interix
|
||||
HOST_OS := Windows
|
||||
else
|
||||
HOST_OS := $(shell uname)
|
||||
endif
|
||||
endif
|
||||
|
||||
#More debug information when running in CI
|
||||
ifdef CI
|
||||
ifeq ($(CI),true)
|
||||
V = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
BUILD_DIR = build
|
||||
BUILD_DIR_TARGET = $(BUILD_DIR)/$(TARGET)
|
||||
BUILD_DIR_BOARD = $(BUILD_DIR_TARGET)/$(BOARD)/$(BUILD_DIR_CONFIG)
|
||||
OBJECTDIR = $(BUILD_DIR_BOARD)/obj
|
||||
|
||||
CONTIKI_NG_TARGET_LIB = $(BUILD_DIR_BOARD)/contiki-ng-$(TARGET).a
|
||||
|
||||
LOWERCASE = -abcdefghijklmnopqrstuvwxyz/
|
||||
UPPERCASE = _ABCDEFGHIJKLMNOPQRSTUVWXYZ_
|
||||
TARGET_UPPERCASE := ${strip ${shell echo $(TARGET) | sed y!$(LOWERCASE)!$(UPPERCASE)!}}
|
||||
CFLAGS += -DCONTIKI=1 -DCONTIKI_TARGET_$(TARGET_UPPERCASE)=1
|
||||
CFLAGS += -DCONTIKI_TARGET_STRING=\"$(TARGET)\"
|
||||
|
||||
CFLAGS += -Wno-unused-const-variable
|
||||
|
||||
LDFLAGS_WERROR ?= -Wl,--fatal-warnings
|
||||
|
||||
ifeq ($(WERROR),1)
|
||||
LDFLAGS += $(LDFLAGS_WERROR)
|
||||
endif
|
||||
|
||||
MODULES += os os/sys os/dev os/lib os/services
|
||||
|
||||
# Automatically include project-conf.h if found
|
||||
ifneq ("$(wildcard project-conf.h)","")
|
||||
CFLAGS += -DPROJECT_CONF_PATH=\"project-conf.h\"
|
||||
endif
|
||||
|
||||
MODULES += os os/net os/net/mac os/net/mac/framer os/net/routing os/storage
|
||||
|
||||
define oname
|
||||
${patsubst %.c,%.o, \
|
||||
${patsubst %.S,%.o, \
|
||||
${patsubst %.s,%.o, \
|
||||
$(1) \
|
||||
}}}
|
||||
endef
|
||||
|
||||
CONTIKI_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CONTIKI_SOURCEFILES)}}
|
||||
PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}}
|
||||
|
||||
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
|
||||
|
||||
### Include target makefile (TODO Unsafe?)
|
||||
|
||||
# Configurable arch path
|
||||
ARCH_PATH ?= $(CONTIKI)/arch
|
||||
|
||||
target_makefile := $(wildcard $(ARCH_PATH)/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})
|
||||
|
||||
# Check if the target makefile exists, and create the object directory if necessary.
|
||||
ifeq ($(strip $(target_makefile)),)
|
||||
${error The target platform "$(TARGET)" does not exist (maybe it was misspelled?)}
|
||||
else
|
||||
ifneq (1, ${words $(target_makefile)})
|
||||
${error More than one TARGET Makefile found: $(target_makefile)}
|
||||
endif
|
||||
include $(target_makefile)
|
||||
endif
|
||||
|
||||
# Decide whether to build or to skip this target for this platform
|
||||
ifneq ("", "$(PLATFORMS_ONLY)")
|
||||
ifeq ("","$(filter $(TARGET), $(PLATFORMS_ONLY))")
|
||||
PLATFORM_ACTION = skip
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ("", "$(PLATFORMS_EXCLUDE)")
|
||||
ifneq ("","$(filter $(TARGET), $(PLATFORMS_EXCLUDE))")
|
||||
PLATFORM_ACTION = skip
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(BOARD),)
|
||||
ifneq ("", "$(BOARDS_ONLY)")
|
||||
ifeq ("","$(filter $(BOARD), $(BOARDS_ONLY))")
|
||||
PLATFORM_ACTION = skip
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ("", "$(BOARDS_EXCLUDE)")
|
||||
ifneq ("","$(filter $(BOARD), $(BOARDS_EXCLUDE))")
|
||||
PLATFORM_ACTION = skip
|
||||
endif
|
||||
endif
|
||||
endif # $(BOARD) not empty
|
||||
|
||||
PLATFORM_ACTION ?= build
|
||||
|
||||
# Provide way to create $(OBJECTDIR) if it has been removed by make clean
|
||||
$(OBJECTDIR):
|
||||
$(TRACE_MKDIR)
|
||||
$(Q)mkdir -p $@
|
||||
|
||||
ifneq ($(BOARD),)
|
||||
TARGET_BOARD_UPPERCASE := ${strip ${shell echo $(BOARD) | sed y!$(LOWERCASE)!$(UPPERCASE)!}}
|
||||
CFLAGS += -DCONTIKI_BOARD_$(TARGET_BOARD_UPPERCASE)=1
|
||||
CFLAGS += -DCONTIKI_BOARD_STRING=\"$(BOARD)\"
|
||||
endif
|
||||
|
||||
# Configure MAC layer
|
||||
|
||||
# The different options
|
||||
MAKE_MAC_NULLMAC = 0
|
||||
MAKE_MAC_CSMA = 1
|
||||
MAKE_MAC_TSCH = 2
|
||||
MAKE_MAC_BLE = 3
|
||||
MAKE_MAC_OTHER = 4
|
||||
|
||||
# Make CSMA the default MAC
|
||||
MAKE_MAC ?= MAKE_MAC_CSMA
|
||||
|
||||
ifeq ($(MAKE_MAC),MAKE_MAC_NULLMAC)
|
||||
MODULES+=os/net/mac/nullmac
|
||||
CFLAGS += -DMAC_CONF_WITH_NULLMAC=1
|
||||
endif
|
||||
|
||||
ifeq ($(MAKE_MAC),MAKE_MAC_CSMA)
|
||||
MODULES += os/net/mac/csma
|
||||
CFLAGS += -DMAC_CONF_WITH_CSMA=1
|
||||
endif
|
||||
|
||||
ifeq ($(MAKE_MAC),MAKE_MAC_TSCH)
|
||||
MODULES += os/net/mac/tsch
|
||||
CFLAGS += -DMAC_CONF_WITH_TSCH=1
|
||||
endif
|
||||
|
||||
ifeq ($(MAKE_MAC),MAKE_MAC_BLE)
|
||||
MODULES += os/net/mac/ble
|
||||
CFLAGS += -DMAC_CONF_WITH_BLE=1
|
||||
endif
|
||||
|
||||
ifeq ($(MAKE_MAC),MAKE_MAC_OTHER)
|
||||
CFLAGS += -DMAC_CONF_WITH_OTHER=1
|
||||
endif
|
||||
|
||||
# Configure Network layer
|
||||
|
||||
MAKE_NET_NULLNET = 0
|
||||
MAKE_NET_IPV6 = 1
|
||||
MAKE_NET_OTHER = 2
|
||||
|
||||
# Make IPv6 the default stack
|
||||
MAKE_NET ?= MAKE_NET_IPV6
|
||||
|
||||
ifeq ($(MAKE_NET),MAKE_NET_NULLNET)
|
||||
CFLAGS += -DNETSTACK_CONF_WITH_NULLNET=1
|
||||
MODULES += os/net/nullnet
|
||||
endif
|
||||
|
||||
ifeq ($(MAKE_NET),MAKE_NET_IPV6)
|
||||
CFLAGS += -DNETSTACK_CONF_WITH_IPV6=1
|
||||
MODULES += os/net/ipv6
|
||||
endif
|
||||
|
||||
ifeq ($(MAKE_NET),MAKE_NET_OTHER)
|
||||
CFLAGS += -DNETSTACK_CONF_WITH_OTHER=1
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_IP64),1)
|
||||
MODULES += os/services/ip64
|
||||
endif
|
||||
|
||||
# Configure Routing protocol
|
||||
MAKE_ROUTING_NULLROUTING = 0
|
||||
MAKE_ROUTING_RPL_CLASSIC = 1
|
||||
MAKE_ROUTING_RPL_LITE = 2
|
||||
|
||||
# Default routing protocol: RPL for IPv6, None otherwise
|
||||
ifeq ($(MAKE_NET),MAKE_NET_IPV6)
|
||||
MAKE_ROUTING ?= MAKE_ROUTING_RPL_LITE
|
||||
else
|
||||
MAKE_ROUTING ?= MAKE_ROUTING_NULLROUTING
|
||||
endif
|
||||
|
||||
ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_CLASSIC)
|
||||
CFLAGS += -DROUTING_CONF_RPL_CLASSIC=1
|
||||
MODULES += os/net/routing/rpl-classic
|
||||
else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_LITE)
|
||||
CFLAGS += -DROUTING_CONF_RPL_LITE=1
|
||||
MODULES += os/net/routing/rpl-lite
|
||||
else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_NULLROUTING)
|
||||
CFLAGS += -DROUTING_CONF_NULLROUTING=1
|
||||
MODULES += os/net/routing/nullrouting
|
||||
endif
|
||||
|
||||
MODULEDIRS = $(MODULES_REL) ${wildcard ${addprefix $(CONTIKI)/, $(MODULES)}}
|
||||
UNIQUEMODULES = $(call uniq,$(MODULEDIRS))
|
||||
MODULES_SOURCES = ${foreach d, $(MODULEDIRS), ${subst ${d}/,,${wildcard $(d)/*.c}}}
|
||||
CONTIKI_SOURCEFILES += $(MODULES_SOURCES)
|
||||
|
||||
# Include module-specific makefiles
|
||||
MODULES_INCLUDES = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/Makefile.${notdir $(d)}}}
|
||||
include $(MODULES_INCLUDES)
|
||||
# Iterate once more: include the modules added from the previous include.
|
||||
# Only works with one level of nested module inclusion.
|
||||
include $(MODULES_INCLUDES)
|
||||
|
||||
# C-include module-specific macros using -imacros
|
||||
MODULES_IMACROS = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/module-macros.h}}
|
||||
ifneq ($(MODULES_IMACROS),)
|
||||
CFLAGS += ${foreach d, $(MODULES_IMACROS), -imacros $(d)}
|
||||
endif
|
||||
|
||||
### Verbosity control. Use make V=1 to get verbose builds.
|
||||
|
||||
ifeq ($(V),1)
|
||||
TRACE_CC =
|
||||
TRACE_LD =
|
||||
TRACE_AR =
|
||||
TRACE_AS =
|
||||
TRACE_OBJCOPY =
|
||||
TRACE_OBJDUMP =
|
||||
TRACE_MKDIR =
|
||||
TRACE_CP =
|
||||
Q=
|
||||
else
|
||||
TRACE_CC = @echo " CC " $<
|
||||
TRACE_LD = @echo " LD " $@
|
||||
TRACE_AR = @echo " AR " $@
|
||||
TRACE_AS = @echo " AS " $<
|
||||
TRACE_OBJCOPY = @echo " OBJCOPY " $< "-->" $@
|
||||
TRACE_OBJDUMP = @echo " OBJDUMP " $< "-->" $@
|
||||
TRACE_MKDIR = @echo " MKDIR " $@
|
||||
TRACE_CP = @echo " CP " $< "-->" $@
|
||||
Q=@
|
||||
endif
|
||||
|
||||
### Forward comma-separated list of arbitrary defines to the compiler
|
||||
|
||||
COMMA := ,
|
||||
CFLAGS += ${addprefix -D,${subst $(COMMA), ,$(DEFINES)}}
|
||||
|
||||
### Setup directory search path for source and header files
|
||||
|
||||
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix ${dir $(target_makefile)}, \
|
||||
$(CONTIKI_TARGET_DIRS)}
|
||||
CONTIKI_CPU_DIRS_CONCAT = ${addprefix $(CONTIKI_CPU)/, \
|
||||
$(CONTIKI_CPU_DIRS)}
|
||||
CONTIKI_ARCH_DIRS = ${addprefix $(CONTIKI)/, arch}
|
||||
|
||||
SOURCEDIRS = . $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) $(CONTIKI_ARCH_DIRS) \
|
||||
$(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(MODULEDIRS) $(EXTERNALDIRS) ${dir $(target_makefile)}
|
||||
|
||||
vpath %.c $(SOURCEDIRS)
|
||||
vpath %.S $(SOURCEDIRS)
|
||||
vpath %.s $(SOURCEDIRS)
|
||||
|
||||
CFLAGS += ${addprefix -I,$(SOURCEDIRS) $(CONTIKI)}
|
||||
|
||||
### Check for a git repo and pass version if found
|
||||
### git.exe in Windows cmd shells may require no stderr redirection
|
||||
ifndef RELSTR
|
||||
RELSTR:=${shell git --git-dir ${CONTIKI}/.git --work-tree ${CONTIKI} describe \
|
||||
--tags --always --dirty}
|
||||
endif
|
||||
|
||||
ifneq ($(RELSTR),)
|
||||
CFLAGS += -DCONTIKI_VERSION_STRING=\"Contiki-NG-$(RELSTR)\"
|
||||
else
|
||||
CFLAGS += -DCONTIKI_VERSION_STRING=\"Contiki-NG\"
|
||||
endif
|
||||
|
||||
### Automatic dependency generation
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
-include ${addprefix $(OBJECTDIR)/,$(CONTIKI_SOURCEFILES:.c=.d) \
|
||||
$(PROJECT_SOURCEFILES:.c=.d)}
|
||||
endif
|
||||
|
||||
### See http://make.paulandlesley.org/autodep.html#advanced
|
||||
|
||||
define FINALIZE_DEPENDENCY
|
||||
cp $(@:.o=.d) $(@:.o=.$$$$); \
|
||||
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
|
||||
-e '/^$$/ d' -e 's/$$/ :/' < $(@:.o=.$$$$) >> $(@:.o=.d); \
|
||||
rm -f $(@:.o=.$$$$)
|
||||
endef
|
||||
|
||||
### Harmonize filename of a .map file, if the platform's build system wants
|
||||
### to create one
|
||||
CONTIKI_NG_PROJECT_MAP = $(BUILD_DIR_BOARD)/$(basename $(notdir $@)).map
|
||||
|
||||
.PHONY: clean distclean usage help targets boards savetarget savedefines viewconf
|
||||
|
||||
clean:
|
||||
-$(Q)rm -f *.d *.e *.o $(CLEAN)
|
||||
-$(Q)rm -rf $(BUILD_DIR_TARGET)
|
||||
-$(Q)rm -f $(addsuffix .$(TARGET), $(CONTIKI_PROJECT))
|
||||
@echo Target $(TARGET) cleaned
|
||||
|
||||
distclean:
|
||||
@for TARG in `ls $(ARCH_PATH)/platform $(TARGETDIRS)`; do \
|
||||
echo Running: $(MAKE) TARGET=$$TARG clean; \
|
||||
$(MAKE) TARGET=$$TARG clean; \
|
||||
done
|
||||
-$(Q)rm -rf $(BUILD_DIR)
|
||||
|
||||
-include $(ARCH_PATH)/platform/$(TARGET)/Makefile.customrules-$(TARGET)
|
||||
|
||||
ifndef CUSTOM_RULE_C_TO_OBJECTDIR_O
|
||||
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
|
||||
$(TRACE_CC)
|
||||
$(Q)$(CC) $(CFLAGS) -MMD -c $< -o $@
|
||||
@$(FINALIZE_DEPENDENCY)
|
||||
endif
|
||||
|
||||
ifndef CUSTOM_RULE_S_TO_OBJECTDIR_O
|
||||
$(OBJECTDIR)/%.o: %.S | $(OBJECTDIR)
|
||||
$(TRACE_AS)
|
||||
$(Q)$(AS) $(ASFLAGS) -o $@ $<
|
||||
$(OBJECTDIR)/%.o: %.s | $(OBJECTDIR)
|
||||
$(TRACE_AS)
|
||||
$(Q)$(AS) $(ASFLAGS) -o $@ $<
|
||||
endif
|
||||
|
||||
ifndef CUSTOM_RULE_C_TO_OBJECTDIR_S
|
||||
$(OBJECTDIR)/%.s: %.c | $(OBJECTDIR)
|
||||
$(TRACE_CC)
|
||||
$(Q)$(CC) $(CFLAGS) -S $< -o $@
|
||||
endif
|
||||
|
||||
ifndef CUSTOM_RULE_C_TO_OBJECTDIR_E
|
||||
$(OBJECTDIR)/%.e: %.c | $(OBJECTDIR)
|
||||
$(TRACE_CC)
|
||||
$(Q)$(CC) $(CFLAGS) -E $< -o $@
|
||||
endif
|
||||
|
||||
ifndef CUSTOM_RULE_C_TO_O
|
||||
%.o: %.c
|
||||
$(TRACE_CC)
|
||||
$(Q)$(CC) $(CFLAGS) -c $< -o $@
|
||||
endif
|
||||
|
||||
ifndef CUSTOM_RULE_C_TO_S
|
||||
%.s: %.c
|
||||
$(TRACE_CC)
|
||||
$(Q)$(CC) $(CFLAGS) -S $< -o $@
|
||||
endif
|
||||
|
||||
ifndef CUSTOM_RULE_C_TO_E
|
||||
%.e: %.c
|
||||
$(TRACE_CC)
|
||||
$(Q)$(CC) $(CFLAGS) -E $< -o $@
|
||||
endif
|
||||
|
||||
ifndef AROPTS
|
||||
AROPTS = rcf
|
||||
endif
|
||||
|
||||
ifndef CUSTOM_RULE_ALLOBJS_TO_TARGETLIB
|
||||
$(CONTIKI_NG_TARGET_LIB): $(CONTIKI_OBJECTFILES)
|
||||
$(TRACE_AR)
|
||||
$(Q)$(AR) $(AROPTS) $@ $^
|
||||
endif
|
||||
|
||||
ifndef LD
|
||||
LD = $(CC)
|
||||
endif
|
||||
|
||||
ifndef CUSTOM_RULE_LINK
|
||||
$(BUILD_DIR_BOARD)/%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_NG_TARGET_LIB)
|
||||
$(TRACE_LD)
|
||||
$(Q)$(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} \
|
||||
${filter %.a,$^} $(TARGET_LIBFILES) -o $@
|
||||
endif
|
||||
|
||||
%.$(TARGET): $(BUILD_DIR_BOARD)/%.$(TARGET)
|
||||
$(TRACE_CP)
|
||||
$(Q)cp $< $@
|
||||
|
||||
%.ramprof: %.$(TARGET)
|
||||
$(NM) -S -td --size-sort $< | grep -i " [abdrw] " | cut -d' ' -f2,4
|
||||
|
||||
%.flashprof: %.$(TARGET)
|
||||
$(NM) -S -td --size-sort $< | grep -i " [t] " | cut -d' ' -f2,4
|
||||
|
||||
include $(CONTIKI)/Makefile.help
|
||||
|
||||
targets:
|
||||
@ls $(ARCH_PATH)/platform $(TARGETDIRS)
|
||||
|
||||
boards:
|
||||
ifdef BOARD
|
||||
@echo "$(BOARDS) (current: $(BOARD))"
|
||||
else
|
||||
@echo "Platform has no boards"
|
||||
endif
|
||||
|
||||
savetarget:
|
||||
-@rm -f Makefile.target
|
||||
@echo "saving Makefile.target"
|
||||
@echo >Makefile.target "TARGET = $(TARGET)"
|
||||
ifneq ($(BOARD),)
|
||||
@echo >>Makefile.target "BOARD = $(BOARD)"
|
||||
endif
|
||||
|
||||
savedefines:
|
||||
-@rm -f Makefile.$(TARGET).defines
|
||||
@echo "saving Makefile.$(TARGET).defines"
|
||||
@echo >Makefile.$(TARGET).defines "DEFINES = $(DEFINES)"
|
||||
|
||||
VIEWCONF = $(CONTIKI)/tools/viewconf/viewconf.c
|
||||
viewconf:
|
||||
@echo "----------------- Make variables: --------------"
|
||||
@echo "##### \"TARGET\": ________________________________ $(TARGET)"
|
||||
@echo "##### \"BOARD\": _________________________________ $(BOARD)"
|
||||
@echo "##### \"MAKE_MAC\": ______________________________ $(MAKE_MAC)"
|
||||
@echo "##### \"MAKE_NET\": ______________________________ $(MAKE_NET)"
|
||||
@echo "##### \"MAKE_ROUTING\": __________________________ $(MAKE_ROUTING)"
|
||||
ifdef MAKE_COAP_DTLS_KEYSTORE
|
||||
@echo "##### \"MAKE_COAP_DTLS_KEYSTORE\": _______________ $(MAKE_COAP_DTLS_KEYSTORE)"
|
||||
endif
|
||||
@echo "----------------- C variables: -----------------"
|
||||
$(Q)$(CC) $(CFLAGS) -E $(VIEWCONF) | grep \#\#\#\#\#
|
||||
@echo "------------------------------------------------"
|
||||
@echo "'==' Means the flag is set to a given a value"
|
||||
@echo "'->' Means the flag is unset, but will default to a given value"
|
||||
@echo "'><' Means the flag is unset and has no default value"
|
||||
@echo "To view more Make variables, edit $(CONTIKI)/Makefile.include, rule 'viewconf'"
|
||||
@echo "To view more C variables, edit $(VIEWCONF)"
|
||||
|
||||
### Include Makefile.embedded for relevant platforms, in order to pull in
|
||||
### rules for login, serialview etc
|
||||
ifeq ($(findstring $(TARGET),native cooja),)
|
||||
include $(CONTIKI)/Makefile.embedded
|
||||
endif
|
||||
|
||||
# Don't treat $(BUILD_DIR_BOARD)/%.$(TARGET) and $(TARGET) as intermediate
|
||||
# files because for many platforms they are in fact the primary target.
|
||||
.PRECIOUS: $(BUILD_DIR_BOARD)/%.$(TARGET) %.$(TARGET)
|
||||
|
||||
# Cancel the predefined implict rule for compiling and linking
|
||||
# a single C source into a binary to force GNU make to consider
|
||||
# the match-anything rule below instead.
|
||||
%: %.c
|
||||
|
||||
ifeq ($(PLATFORM_ACTION),skip)
|
||||
# Skip this target.
|
||||
$(CONTIKI_PROJECT):
|
||||
@echo "Skipping $@: not for the '$(TARGET)/$(BOARD)' platform!"
|
||||
%.$(TARGET):
|
||||
@echo "Skipping $@: not for the '$(TARGET)/$(BOARD)' platform!"
|
||||
else
|
||||
# Build this target.
|
||||
# Match-anything pattern rule to allow the project makefiles to
|
||||
# abstract from the actual binary name. It needs to contain some
|
||||
# command in order to be a rule, not just a prerequisite.
|
||||
%: %.$(TARGET)
|
||||
@
|
||||
endif
|
@ -1,17 +0,0 @@
|
||||
# Some make rules in the main build system depend on the presence of utilities
|
||||
# under the tools/ dir. For those dependencies, we use this makefile here to
|
||||
# recursively invoke the respective build under tools/.
|
||||
|
||||
TOOLS_DIR = $(CONTIKI)/tools
|
||||
SERIAL_IO_TOOL_DIR = $(TOOLS_DIR)/serial-io
|
||||
|
||||
SERIAL_IO_TOOL_DEPS = $(addprefix $(SERIAL_IO_TOOL_DIR)/, tools-utils.c tools-utils.h)
|
||||
|
||||
TUNSLIP6 = $(SERIAL_IO_TOOL_DIR)/tunslip6
|
||||
SERIAL_DUMP_BIN = $(SERIAL_IO_TOOL_DIR)/serialdump
|
||||
|
||||
$(SERIAL_DUMP_BIN): $(SERIAL_IO_TOOL_DIR)/serialdump.c $(SERIAL_IO_TOOL_DEPS)
|
||||
$(MAKE) -C $(SERIAL_IO_TOOL_DIR) serialdump
|
||||
|
||||
$(TUNSLIP6): $(SERIAL_IO_TOOL_DIR)/tunslip6.c $(SERIAL_IO_TOOL_DEPS)
|
||||
$(MAKE) -C $(SERIAL_IO_TOOL_DIR) tunslip6
|
29
README.md
29
README.md
@ -1,29 +0,0 @@
|
||||
# Contiki-NG: The OS for Next Generation IoT Devices
|
||||
|
||||
[![Build Status](https://travis-ci.org/contiki-ng/contiki-ng.svg?branch=master)](https://travis-ci.org/contiki-ng/contiki-ng/branches)
|
||||
[![license](https://img.shields.io/badge/license-3--clause%20bsd-brightgreen.svg)](https://github.com/contiki-ng/contiki-ng/blob/master/LICENSE.md)
|
||||
[![Latest release](https://img.shields.io/github/release/contiki-ng/contiki-ng.svg)](https://github.com/contiki-ng/contiki-ng/releases/latest)
|
||||
[![GitHub Release Date](https://img.shields.io/github/release-date/contiki-ng/contiki-ng.svg)](https://github.com/contiki-ng/contiki-ng/releases/latest)
|
||||
[![Last commit](https://img.shields.io/github/last-commit/contiki-ng/contiki-ng.svg)](https://github.com/contiki-ng/contiki-ng/commit/HEAD)
|
||||
|
||||
Contiki-NG is an open-source, cross-platform operating system for Next-Generation IoT devices. It focuses on dependable (secure and reliable) low-power communication and standard protocols, such as IPv6/6LoWPAN, 6TiSCH, RPL, and CoAP. Contiki-NG comes with extensive documentation, tutorials, a roadmap, release cycle, and well-defined development flow for smooth integration of community contributions.
|
||||
|
||||
Unless explicitly stated otherwise, Contiki-NG sources are distributed under
|
||||
the terms of the [3-clause BSD license](LICENSE.md). This license gives
|
||||
everyone the right to use and distribute the code, either in binary or
|
||||
source code format, as long as the copyright license is retained in
|
||||
the source code.
|
||||
|
||||
Contiki-NG started as a fork of the Contiki OS and retains some of its original features.
|
||||
|
||||
Find out more:
|
||||
|
||||
* GitHub repository: https://github.com/contiki-ng/contiki-ng
|
||||
* Documentation: https://github.com/contiki-ng/contiki-ng/wiki
|
||||
* Web site: http://contiki-ng.org
|
||||
|
||||
Engage with the community:
|
||||
|
||||
* Gitter: https://gitter.im/contiki-ng
|
||||
* Twitter: https://twitter.com/contiki_ng
|
||||
|
@ -1,82 +0,0 @@
|
||||
### Verbosity control. Use make V=1 to get verbose builds.
|
||||
### Extends what we already have in the top-level Makefile
|
||||
ifeq ($(V),1)
|
||||
TRACE_SREC_CAT =
|
||||
else
|
||||
TRACE_SREC_CAT = @echo " SREC_CAT " $< "-->" $@
|
||||
endif
|
||||
|
||||
CC = arm-none-eabi-gcc
|
||||
CPP = arm-none-eabi-cpp
|
||||
LD = arm-none-eabi-gcc
|
||||
AR = arm-none-eabi-ar
|
||||
OBJCOPY = arm-none-eabi-objcopy
|
||||
OBJDUMP = arm-none-eabi-objdump
|
||||
NM = arm-none-eabi-nm
|
||||
SIZE = arm-none-eabi-size
|
||||
SREC_CAT = srec_cat
|
||||
|
||||
CFLAGS += -mthumb -mabi=aapcs -mlittle-endian
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -std=c99
|
||||
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
|
||||
CFLAGS += -fshort-enums -fomit-frame-pointer -fno-builtin
|
||||
ifeq ($(WERROR),1)
|
||||
CFLAGS += -Werror
|
||||
endif
|
||||
|
||||
LDFLAGS += -mthumb -mlittle-endian
|
||||
|
||||
OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb
|
||||
|
||||
### Are we building with code size optimisations?
|
||||
SMALL ?= 1
|
||||
ifeq ($(SMALL),1)
|
||||
CFLAGS += -Os
|
||||
else
|
||||
CFLAGS += -O2
|
||||
endif
|
||||
|
||||
### Use CMSIS from arch/cpu/arm/common
|
||||
CONTIKI_ARM_DIRS += .
|
||||
CONTIKI_CPU_DIRS += $(addprefix ../arm/, $(CONTIKI_ARM_DIRS))
|
||||
|
||||
### Default to use os/lib/dbg-io unless configured to do otherwise
|
||||
MAKE_WITH_LIB_DBG_IO ?= 1
|
||||
|
||||
ifeq ($(MAKE_WITH_LIB_DBG_IO),1)
|
||||
MODULES += os/lib/dbg-io
|
||||
endif
|
||||
|
||||
### CPU-dependent cleanup files
|
||||
CLEAN += *.elf *.bin *.lst *.hex *.i16hex
|
||||
|
||||
OUT_HEX = $(BUILD_DIR_BOARD)/%.hex
|
||||
OUT_I16HEX = $(BUILD_DIR_BOARD)/%.i16hex
|
||||
OUT_BIN = $(BUILD_DIR_BOARD)/%.bin
|
||||
OUT_LST = $(BUILD_DIR_BOARD)/%.lst
|
||||
|
||||
### Don't treat the following files as intermediate
|
||||
.PRECIOUS: $(OUT_ELF) $(OUT_HEX) $(OUT_BIN)
|
||||
|
||||
$(OUT_I16HEX): $(OUT_ELF)
|
||||
$(TRACE_OBJCOPY)
|
||||
$(Q)$(OBJCOPY) -O ihex $< $@
|
||||
|
||||
$(OUT_HEX): $(OUT_I16HEX)
|
||||
$(TRACE_SREC_CAT)
|
||||
$(Q)$(SREC_CAT) $< -intel -o $@ -intel
|
||||
|
||||
$(OUT_BIN): $(OUT_ELF)
|
||||
$(TRACE_OBJCOPY)
|
||||
$(Q)$(OBJCOPY) -O binary $(OBJCOPY_FLAGS) $< $@
|
||||
|
||||
$(OUT_LST): $(OUT_ELF)
|
||||
$(TRACE_OBJDUMP)
|
||||
$(Q)$(OBJDUMP) $(OBJDUMP_FLAGS) $< > $@
|
||||
|
||||
### We don't really need the .hex and .bin for the .$(TARGET) but let's make
|
||||
### sure they get built
|
||||
$(BUILD_DIR_BOARD)/%.$(TARGET): $(OUT_ELF) $(OUT_HEX) $(OUT_BIN)
|
||||
$(TRACE_CP)
|
||||
$(Q)cp $< $@
|
@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, George Oikonomou - http://www.spd.gr
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* 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 HOLDER 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.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \addtogroup arm
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
* Compiler and data type definitions for all ARM-based CPUs
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef ARM_DEF_
|
||||
#define ARM_DEF_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Macros and typedefs
|
||||
*
|
||||
* Those values are not meant to be modified by the user
|
||||
* @{
|
||||
*/
|
||||
#define CLOCK_CONF_SECOND 128
|
||||
|
||||
/* Clock (time) comparison macro */
|
||||
#define CLOCK_LT(a, b) ((signed long)((a) - (b)) < 0)
|
||||
|
||||
/* Platform typedefs */
|
||||
typedef uint32_t clock_time_t;
|
||||
typedef uint32_t uip_stats_t;
|
||||
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
* The stdio.h that ships with the arm-gcc toolchain does this:
|
||||
*
|
||||
* int _EXFUN(putchar, (int));
|
||||
* [...]
|
||||
* #define putchar(x) putc(x, stdout)
|
||||
*
|
||||
* This causes us a lot of trouble: For platforms using this toolchain, every
|
||||
* time we use putchar we need to first #undef putchar. What we do here is to
|
||||
* #undef putchar across the board. The resulting code will cause the linker
|
||||
* to search for a symbol named putchar and this allows us to use the
|
||||
* implementation under os/lib/dbg-io.
|
||||
*
|
||||
* This will fail if stdio.h is included before contiki.h, but it is common
|
||||
* practice to include contiki.h first
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#undef putchar
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* ARM_DEF_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
@ -1,10 +0,0 @@
|
||||
|
||||
ifdef SDCARD
|
||||
EFSL_DIR=/home/ksb/packages/efsl/efsl-0.2.8
|
||||
EFSL_SRC= efs.c fat.c sd.c fat.c partition.c ioman.c disc.c fs.c file.c plibc.c extract.c dir.c time.c ls.c ui.c
|
||||
CONTIKI_CPU_DIRS += ../common/SD-card
|
||||
CONTIKIDIRS += $(EFSL_DIR)/src $(EFSL_DIR)/src/interfaces
|
||||
CONTIKI_TARGET_SOURCEFILES += $(EFSL_SRC) cfs-sdcard.c efs-sdcard-arch.c
|
||||
CFLAGS+= -I $(EFSL_DIR)/inc -I $(CONTIKI_CPU_ARM_COMMON)/SD-card
|
||||
|
||||
endif
|
@ -1,187 +0,0 @@
|
||||
#include <efs-sdcard.h>
|
||||
#include <sys/process.h>
|
||||
#include <cfs/cfs.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
process_event_t sdcard_inserted_event;
|
||||
|
||||
process_event_t sdcard_removed_event;
|
||||
|
||||
|
||||
|
||||
#define MAX_FDS 4
|
||||
|
||||
static File file_descriptors[MAX_FDS];
|
||||
|
||||
static int
|
||||
find_free_fd()
|
||||
{
|
||||
int fd;
|
||||
for (fd = 0; fd < MAX_FDS; fd++) {
|
||||
if (!file_getAttr(&file_descriptors[fd], FILE_STATUS_OPEN)) {
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static File *
|
||||
get_file(int fd)
|
||||
{
|
||||
if (!sdcard_ready()) return 0;
|
||||
if (fd >= MAX_FDS || fd < 0) return NULL;
|
||||
if (!file_getAttr(&file_descriptors[fd], FILE_STATUS_OPEN)) return NULL;
|
||||
return &file_descriptors[fd];
|
||||
}
|
||||
|
||||
int
|
||||
cfs_open (const char *name, int flags)
|
||||
{
|
||||
static int initialized = 0;
|
||||
eint8 mode;
|
||||
int fd;
|
||||
if (!initialized) {
|
||||
int fd;
|
||||
/* Mark all file descriptors as free */
|
||||
for (fd = 0; fd < MAX_FDS; fd++) {
|
||||
file_setAttr(&file_descriptors[fd], FILE_STATUS_OPEN,0);
|
||||
}
|
||||
}
|
||||
if (!sdcard_ready()) return -1;
|
||||
fd = find_free_fd();
|
||||
if (fd < 0) return -1;
|
||||
if (flags == CFS_READ) {
|
||||
mode = MODE_READ;
|
||||
} else {
|
||||
mode = MODE_APPEND;
|
||||
}
|
||||
if (file_fopen(&file_descriptors[fd], efs_sdcard_get_fs(),
|
||||
(char*)name, mode) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
void
|
||||
cfs_close(int fd)
|
||||
{
|
||||
File *file = get_file(fd);
|
||||
if (!file) return;
|
||||
file_fclose(file);
|
||||
fs_flushFs(efs_sdcard_get_fs());
|
||||
}
|
||||
|
||||
int
|
||||
cfs_read (int fd, void *buf, unsigned int len)
|
||||
{
|
||||
File *file = get_file(fd);
|
||||
if (!file) return 0;
|
||||
return file_read(file, len, (euint8*)buf);
|
||||
}
|
||||
|
||||
int
|
||||
cfs_write (int fd, const void *buf, unsigned int len)
|
||||
{
|
||||
File *file = get_file(fd);
|
||||
if (!file) return 0;
|
||||
return file_write(file, len, (euint8*)buf);
|
||||
}
|
||||
|
||||
cfs_offset_t
|
||||
cfs_seek (int fd, cfs_offset_t offset, int whence)
|
||||
{
|
||||
File *file;
|
||||
if (whence != CFS_SEEK_SET) return -1;
|
||||
file = get_file(fd);
|
||||
if (!file) return 0;
|
||||
if (file_setpos(file, offset) != 0) return -1;
|
||||
return file->FilePtr;
|
||||
}
|
||||
|
||||
|
||||
/* Cause a compile time error if expr is false */
|
||||
#ifdef __GNUC__
|
||||
#define COMPILE_TIME_CHECK(expr) \
|
||||
(void) (__builtin_choose_expr ((expr), 0, ((void)0))+3)
|
||||
#else
|
||||
#define COMPILE_TIME_CHECK(expr)
|
||||
#endif
|
||||
|
||||
#define MAX_DIR_LISTS 4
|
||||
DirList dir_lists[MAX_DIR_LISTS];
|
||||
|
||||
static DirList *
|
||||
find_free_dir_list()
|
||||
{
|
||||
unsigned int l;
|
||||
for(l = 0; l < MAX_DIR_LISTS; l++) {
|
||||
if (dir_lists[l].fs == NULL) {
|
||||
return &dir_lists[l];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
cfs_opendir (struct cfs_dir *dirp, const char *name)
|
||||
{
|
||||
DirList *dirs;
|
||||
COMPILE_TIME_CHECK(sizeof(DirList*) <= sizeof(struct cfs_dir));
|
||||
if (!sdcard_ready()) return -1;
|
||||
dirs = find_free_dir_list();
|
||||
if (!dirs) return -1;
|
||||
if (ls_openDir(dirs, efs_sdcard_get_fs(), (eint8*)name) != 0) {
|
||||
dirs->fs = NULL;
|
||||
return -1;
|
||||
}
|
||||
*(DirList**)dirp = dirs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
cfs_readdir (struct cfs_dir *dirp, struct cfs_dirent *dirent)
|
||||
{
|
||||
euint8 *start;
|
||||
euint8 *end;
|
||||
char *to = dirent->name;
|
||||
DirList *dirs = *(DirList**)dirp;
|
||||
if (!sdcard_ready()) return 1;
|
||||
if (ls_getNext(dirs) != 0) return 1;
|
||||
start = dirs->currentEntry.FileName;
|
||||
end = start + 7;
|
||||
while(end > start) {
|
||||
if (*end > ' ') {
|
||||
end++;
|
||||
break;
|
||||
}
|
||||
end--;
|
||||
}
|
||||
while(start < end) {
|
||||
*to++ = *start++;
|
||||
}
|
||||
start = dirs->currentEntry.FileName + 8;
|
||||
end = start + 3;
|
||||
if (*start > ' ') {
|
||||
*to++ = '.';
|
||||
*to++ = *start++;
|
||||
while(start < end && *start > ' ') {
|
||||
*to++ = *start++;
|
||||
}
|
||||
}
|
||||
*to = '\0';
|
||||
if (dirs->currentEntry.Attribute & ATTR_DIRECTORY) {
|
||||
dirent->size = 0;
|
||||
} else {
|
||||
dirent->size = dirs->currentEntry.FileSize;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
cfs_closedir (struct cfs_dir *dirp)
|
||||
{
|
||||
(*(DirList**)dirp)->fs = NULL;
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
#ifndef EFSL_CONFIG_H_
|
||||
#define EFSL_CONFIG_H_
|
||||
|
||||
/* Close enough */
|
||||
#define HW_ENDPOINT_LPC2000_SD
|
||||
|
||||
/* Memory configuration
|
||||
--------------------
|
||||
|
||||
* Here you must configure wheter your processor can access memory byte
|
||||
* oriented. All x86 processors can do it, AVR's can do it to. Some DSP
|
||||
* or other microcontrollers can't. If you have an 8 bit system you're safe.
|
||||
* If you are really unsure, leave the setting commented out, it will be slower
|
||||
* but it will work for sure.
|
||||
*/
|
||||
|
||||
/* disabled for ARM (mt): #define BYTE_ALIGNMENT */
|
||||
|
||||
/* Cache configuration
|
||||
-------------------
|
||||
|
||||
* Here you must configure how much memory of cache you can/want to use.
|
||||
* The number you put at IOMAN_NUMBUFFER is multiplied by 512. So 1 means
|
||||
* 512 bytes cache, 4 means 2048 bytes cache. More is better.
|
||||
* The number after IOMAN_NUMITERATIONS should be untouched.
|
||||
* The last field (IOMAN_DO_MEMALLOC) is to tell ioman to allocate it's
|
||||
* own memory in it's structure, or not. If you choose to do it yourself
|
||||
* you will have to pass a pointer to the memory as the last argument of
|
||||
* ioman_init.
|
||||
*/
|
||||
/*#define IOMAN_NUMBUFFER 1*/
|
||||
#define IOMAN_NUMBUFFER 6
|
||||
#define IOMAN_NUMITERATIONS 3
|
||||
#define IOMAN_DO_MEMALLOC
|
||||
|
||||
/* Cluster pre-allocation
|
||||
----------------------
|
||||
|
||||
* When writing files, the function that performs the actual write has to
|
||||
* calculate how many clusters it will need for that request. It then allocates
|
||||
* that number of new clusters to the file. Since this involves some calculations
|
||||
* and writing of the FAT, you might find it beneficial to limit the number of
|
||||
* allocations, and allow fwrite to pre-allocate a number of clusters extra.
|
||||
* This setting determines how many clusters will be extra allocated whenever
|
||||
* this is required.
|
||||
* Take in carefull consideration how large your clustersize is, putting 10 here
|
||||
* with a clustersize of 32kb means you might waste 320 kb.
|
||||
* The first option is for preallocating files, the other is used when enlarging
|
||||
* a directory to accomodate more files
|
||||
*/
|
||||
/*#define CLUSTER_PREALLOC_FILE 0*/
|
||||
#define CLUSTER_PREALLOC_FILE 2
|
||||
#define CLUSTER_PREALLOC_DIRECTORY 0
|
||||
|
||||
|
||||
/* Endianess configuration
|
||||
-----------------------
|
||||
|
||||
* Here you can configure wheter your architecture is little or big endian. This
|
||||
* is important since all FAT structures are stored in intel little endian order.
|
||||
* So if you have a big endian system the library has to convert all figures to
|
||||
* big endian in order to work.
|
||||
*/
|
||||
#define LITTLE_ENDIAN
|
||||
|
||||
|
||||
/* Date and Time support
|
||||
---------------------
|
||||
|
||||
* Here you can enable or disable date and time support. If you enable
|
||||
* it you will have to create 6 functions, that are described in the
|
||||
* EFSL manual. If the functions are not present when linking your
|
||||
* program with the library you will get unresolved dependencies.
|
||||
*/
|
||||
/*#define DATE_TIME_SUPPORT*/
|
||||
|
||||
/* Error reporting support
|
||||
-----------------------
|
||||
|
||||
* When you receive an error in userland, it usually only gives limited
|
||||
* information (most likely, fail or success). If error detection and
|
||||
* reporting is important for you, you can enable more detailed error
|
||||
* reporting here. This is optional, the costs are 1 byte per object,
|
||||
* and a small increase in code size.
|
||||
* You can enable error recording for all object, or you can select the
|
||||
* object manually.
|
||||
* For full error reporting use FULL_ERROR_SUPPORT
|
||||
* For only the base-core of the library use BASE_ERROR_SUPPORT
|
||||
* For IO/Man use ERRSUP_IOMAN
|
||||
* For Disc use ERRSUP_IOMAN
|
||||
* For Part use ERRSUP_PARTITION
|
||||
* For Fs use ERRSUP_FILESYSTEM
|
||||
* For File use ERRSUP_FILE
|
||||
*/
|
||||
|
||||
#define FULL_ERROR_SUPPORT
|
||||
/*#define BASE_ERROR_SUPPORT*/
|
||||
|
||||
/* List options
|
||||
------------
|
||||
|
||||
* In this section youcan configure what kind of data you will get from
|
||||
* directory listing requests. Please refer to the documentation for
|
||||
* more information
|
||||
*/
|
||||
|
||||
#define LIST_MAXLENFILENAME 12
|
||||
|
||||
|
||||
|
||||
|
||||
/* Debugging configuration
|
||||
-----------------------
|
||||
|
||||
* Here you can configure the debugging behaviour. Debugging is different
|
||||
* on every platform (see debug.h for more information).
|
||||
* If your hardware has no means of output (printf) dont define any anything,
|
||||
* and nothing will happen. For real world use debugging should be turned off.
|
||||
*/
|
||||
|
||||
/* #define DEBUG */
|
||||
|
||||
#define lpc2000_debug_printf dbg_blocking_printf
|
||||
|
||||
#endif
|
@ -1,27 +0,0 @@
|
||||
#ifndef SDCARD_H_KJBBKS6O57__
|
||||
#define SDCARD_H_KJBBKS6O57__
|
||||
|
||||
#include <efs.h>
|
||||
#include <ls.h>
|
||||
#include <sys/process.h>
|
||||
|
||||
PROCESS_NAME(sdcard_process);
|
||||
|
||||
void
|
||||
efs_sdcard_init();
|
||||
|
||||
FileSystem *
|
||||
efs_sdcard_get_fs();
|
||||
|
||||
/* True if a card is ready to read or write */
|
||||
int
|
||||
sdcard_ready();
|
||||
|
||||
extern process_event_t sdcard_inserted_event;
|
||||
|
||||
extern process_event_t sdcard_removed_event;
|
||||
|
||||
void
|
||||
sdcard_event_process(struct process *p);
|
||||
|
||||
#endif /* SDCARD_H_KJBBKS6O57__ */
|
@ -1,21 +0,0 @@
|
||||
#ifndef EFSL_SPI_H_6B6MX40N68__
|
||||
#define EFSL_SPI_H_6B6MX40N68__
|
||||
|
||||
#include <types.h>
|
||||
|
||||
struct hwInterface{
|
||||
eint32 sectorCount;
|
||||
};
|
||||
typedef struct hwInterface hwInterface;
|
||||
|
||||
esint8 if_initInterface(hwInterface* file,eint8* opts);
|
||||
esint8 if_readBuf(hwInterface* file,euint32 address,euint8* buf);
|
||||
esint8 if_writeBuf(hwInterface* file,euint32 address,euint8* buf);
|
||||
esint8 if_setPos(hwInterface* file,euint32 address);
|
||||
|
||||
void if_spiInit(hwInterface *iface);
|
||||
void if_spiSetSpeed(euint8 speed);
|
||||
euint8 if_spiSend(hwInterface *iface, euint8 outgoing);
|
||||
|
||||
|
||||
#endif /* EFSL_SPI_H_6B6MX40N68__ */
|
@ -1,22 +0,0 @@
|
||||
#ifndef SDCARD_H_KJBBKS6O57__
|
||||
#define SDCARD_H_KJBBKS6O57__
|
||||
|
||||
#include <sys/process.h>
|
||||
|
||||
PROCESS_NAME(sdcard_process);
|
||||
|
||||
void
|
||||
sdcard_init();
|
||||
|
||||
/* True if a card is ready to read or write */
|
||||
int
|
||||
sdcard_ready();
|
||||
|
||||
extern process_event_t sdcard_inserted_event;
|
||||
|
||||
extern process_event_t sdcard_removed_event;
|
||||
|
||||
void
|
||||
sdcard_event_process(struct process *p);
|
||||
|
||||
#endif /* SDCARD_H_KJBBKS6O57__ */
|
@ -1,60 +0,0 @@
|
||||
### Put generated sources in a separate directory
|
||||
BUILTSRCDIR = src_$(TARGET)
|
||||
ifeq (${wildcard $(BUILTSRCDIR)},)
|
||||
DUMMY := ${shell mkdir $(BUILTSRCDIR)}
|
||||
endif
|
||||
|
||||
STRUCTGEN = structgen
|
||||
|
||||
MODULES_REL += $(BUILTSRCDIR)
|
||||
|
||||
USB_STRING_DESCRIPTORS ?= $(CONTIKI_CPU_ARM)/common/usb/cdc-acm/string-descriptors.xml
|
||||
|
||||
XMLDIRS=
|
||||
|
||||
USB = usb-arch.c usb-core.c
|
||||
|
||||
ifdef USB_CDC_ACM_CLASS
|
||||
CONTIKI_CPU_DIRS += ../common/usb/cdc-acm
|
||||
USB += cdc-acm.c cdc-acm-descriptors.c cdc-acm-string-descriptors.c
|
||||
XMLDIRS += $(CONTIKI_CPU_ARM)/common/usb/cdc-acm/
|
||||
endif
|
||||
|
||||
ifdef USB_CDC_ETH_CLASS
|
||||
CONTIKI_CPU_DIRS += ../common/usb/cdc-eth
|
||||
USB += cdc-eth.c cdc-eth-descriptors.c cdc-eth-string-descriptors.c dhcps.c
|
||||
XMLDIRS += $(CONTIKI_CPU_ARM)/common/usb/cdc-eth/
|
||||
endif
|
||||
|
||||
ifdef USB_MASS_STORAGE_CLASS
|
||||
CONTIKI_CPU_DIRS += ../common/usb/msc
|
||||
USB += usb-msc-bulk.c usb-rbc.c msc-descriptors-consts.c msc-descriptors.c
|
||||
XMLDIRS += $(CONTIKI_CPU_ARM)/common/usb/msc
|
||||
endif
|
||||
|
||||
ifdef USB_MSC_QIC157
|
||||
CONTIKI_CPU_DIRS += ../common/usb/msc
|
||||
USB += usb-msc-bulk.c usb-qic157.c msc-qic157-descriptors.c msc-qic157-string-descriptors.c
|
||||
XMLDIRS += $(CONTIKI_CPU_ARM)/common/usb/msc
|
||||
endif
|
||||
|
||||
ifdef USB_MSC_STREAMING
|
||||
CONTIKI_CPU_DIRS += ../common/usb/msc
|
||||
USB += usb-msc-bulk.c usb-streaming.c msc-scsi-streaming-descriptors-consts.c msc-scsi-streaming-descriptors.c
|
||||
XMLDIRS += $(CONTIKI_CPU_ARM)/common/usb/msc
|
||||
endif
|
||||
|
||||
ifdef USB_MTP_CLASS
|
||||
CONTIKI_CPU_DIRS += ../common/usb/mtp
|
||||
USB += usb-mtp.c mtp-descriptors-consts.c mtp-descriptors.c
|
||||
STRUCTGENDIRS += $(CONTIKI_CPU_ARM)/common/usb/mtp
|
||||
endif
|
||||
|
||||
vpath %.xml $(XMLDIRS)
|
||||
vpath %.gen.c $(STRUCTGENDIRS)
|
||||
|
||||
%.c: %.xml
|
||||
$(XSLTPROC) $(CONTIKI_CPU_ARM)/common/usb/string-descriptors.xslt $^ >$(BUILTSRCDIR)/$@
|
||||
|
||||
%-consts.c: %.gen.c
|
||||
$(CPP) -I$(CFLAGS) $< | $(STRUCTGEN) --output $(BUILTSRCDIR)/$*-consts.c
|
@ -1,126 +0,0 @@
|
||||
#include "descriptors.h"
|
||||
#include <contiki-conf.h>
|
||||
#include <cdc.h>
|
||||
#include <usb-arch.h>
|
||||
|
||||
const struct usb_st_device_descriptor device_descriptor =
|
||||
{
|
||||
sizeof(struct usb_st_device_descriptor),
|
||||
DEVICE,
|
||||
0x0210,
|
||||
CDC,
|
||||
0,
|
||||
0,
|
||||
CTRL_EP_SIZE,
|
||||
0xffff,
|
||||
0xffff,
|
||||
0x0030,
|
||||
2,
|
||||
1,
|
||||
3,
|
||||
1
|
||||
};
|
||||
|
||||
const struct configuration_st {
|
||||
struct usb_st_configuration_descriptor configuration;
|
||||
struct usb_st_interface_descriptor comm;
|
||||
struct usb_cdc_header_func_descriptor header;
|
||||
struct usb_cdc_abstract_ctrl_mgmnt_func_descriptor abstract_ctrl;
|
||||
struct usb_cdc_union_func_descriptor union_descr;
|
||||
struct usb_cdc_call_mgmnt_func_descriptor call_mgmt;
|
||||
#if 1
|
||||
struct usb_st_endpoint_descriptor ep_notification;
|
||||
#endif
|
||||
struct usb_st_interface_descriptor data;
|
||||
struct usb_st_endpoint_descriptor ep_in;
|
||||
struct usb_st_endpoint_descriptor ep_out;
|
||||
} BYTE_ALIGNED configuration_block =
|
||||
{
|
||||
/* Configuration */
|
||||
{
|
||||
sizeof(configuration_block.configuration),
|
||||
CONFIGURATION,
|
||||
sizeof(configuration_block),
|
||||
2,
|
||||
1,
|
||||
0,
|
||||
0x80,
|
||||
50
|
||||
},
|
||||
{
|
||||
sizeof(configuration_block.comm),
|
||||
INTERFACE,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
CDC,
|
||||
ABSTRACT_CONTROL_MODEL,
|
||||
V_25TER_PROTOCOL,
|
||||
0
|
||||
},
|
||||
{
|
||||
sizeof(configuration_block.header),
|
||||
CS_INTERFACE,
|
||||
CDC_FUNC_DESCR_HEADER,
|
||||
0x0110
|
||||
},
|
||||
{
|
||||
sizeof(configuration_block.abstract_ctrl),
|
||||
CS_INTERFACE,
|
||||
CDC_FUNC_DESCR_ABSTRACT_CTRL_MGMNT,
|
||||
0
|
||||
},
|
||||
{
|
||||
sizeof(configuration_block.union_descr),
|
||||
CS_INTERFACE,
|
||||
CDC_FUNC_DESCR_UNION,
|
||||
0, /* Master */
|
||||
{1} /* Slave */
|
||||
},
|
||||
{
|
||||
sizeof(configuration_block.call_mgmt),
|
||||
CS_INTERFACE,
|
||||
CDC_FUNC_DESCR_CALL_MGMNT,
|
||||
0x02,
|
||||
1 /* data interface */
|
||||
},
|
||||
{
|
||||
sizeof(configuration_block.ep_notification),
|
||||
ENDPOINT,
|
||||
0x83,
|
||||
0x03,
|
||||