summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/arch.mk18
-rw-r--r--build/config.mk5
-rw-r--r--build/macros.mk20
-rw-r--r--build/setup.mk11
-rw-r--r--build/stm32.mk4
-rw-r--r--build/stm32f1.mk2
-rw-r--r--build/stm32f4.mk2
-rwxr-xr-xbuild/tools/config-gen6
-rw-r--r--build/top.mk27
-rw-r--r--ucoo/arch/Module3
-rw-r--r--ucoo/arch/host/Module2
-rw-r--r--ucoo/arch/host/mex/Config2
-rw-r--r--ucoo/arch/host/mex/Module4
-rw-r--r--ucoo/arch/host/mex/mex_socket.host.cc4
-rw-r--r--ucoo/base/proto/Config2
-rw-r--r--ucoo/base/proto/Module2
-rw-r--r--ucoo/base/proto/proto.cc4
-rw-r--r--ucoo/base/proto/proto.hh4
-rw-r--r--ucoo/base/proto/test/Makefile2
-rw-r--r--ucoo/base/stdio/Module2
-rw-r--r--ucoo/base/test/Config4
-rw-r--r--ucoo/base/test/Module2
-rw-r--r--ucoo/base/test/test.cc4
-rw-r--r--ucoo/base/test/test/Makefile2
-rw-r--r--ucoo/dev/avrisp/Config2
-rw-r--r--ucoo/dev/avrisp/Module2
-rw-r--r--ucoo/dev/avrisp/avrisp_frame.cc2
-rw-r--r--ucoo/dev/avrisp/avrisp_frame.hh4
-rw-r--r--ucoo/dev/avrisp/avrisp_proto.cc20
-rw-r--r--ucoo/dev/avrisp/test/Makefile3
-rw-r--r--ucoo/dev/lcd/Module2
-rw-r--r--ucoo/dev/lcd/test/Makefile2
-rw-r--r--ucoo/dev/usdist/Module2
-rw-r--r--ucoo/dev/xmodem/Module2
-rw-r--r--ucoo/hal/adc/Module2
-rw-r--r--ucoo/hal/adc/test/Makefile2
-rw-r--r--ucoo/hal/gpio/Module2
-rw-r--r--ucoo/hal/gpio/test/Makefile2
-rw-r--r--ucoo/hal/i2c/Config2
-rw-r--r--ucoo/hal/i2c/Module2
-rw-r--r--ucoo/hal/i2c/i2c.host.cc10
-rw-r--r--ucoo/hal/i2c/i2c_hard.stm32.cc2
-rw-r--r--ucoo/hal/i2c/i2c_hard.stm32.hh4
-rw-r--r--ucoo/hal/i2c/test/Makefile2
-rw-r--r--ucoo/hal/spi/Module2
-rw-r--r--ucoo/hal/spi/test/Makefile2
-rw-r--r--ucoo/hal/uart/Config2
-rw-r--r--ucoo/hal/uart/Module2
-rw-r--r--ucoo/hal/uart/test/Config2
-rw-r--r--ucoo/hal/uart/test/Makefile4
-rw-r--r--ucoo/hal/uart/uart.stm32.hh6
-rw-r--r--ucoo/hal/usb/Config2
-rw-r--r--ucoo/hal/usb/Module2
-rw-r--r--ucoo/hal/usb/test/Config2
-rw-r--r--ucoo/hal/usb/test/Makefile2
-rw-r--r--ucoo/hal/usb/test/test_usb.cc12
-rw-r--r--ucoo/hal/usb/usb.stm32.cc6
-rw-r--r--ucoo/hal/usb/usb.stm32.hh6
-rw-r--r--ucoo/hal/usb/usb_desc.stm32.c38
-rw-r--r--ucoo/intf/Module2
-rw-r--r--ucoo/utils/Module2
-rw-r--r--ucoo/utils/test/Makefile2
62 files changed, 171 insertions, 134 deletions
diff --git a/build/arch.mk b/build/arch.mk
index 99f0c5f..1668bb8 100644
--- a/build/arch.mk
+++ b/build/arch.mk
@@ -40,21 +40,24 @@ elf.$1: $$($1_ELFS)
define $1_PROG_template
$$1.$1$$$$($1_ELF_SUFFIX): $$$$(patsubst %,$$(OBJDIR)/%.$1.o,\
$$$$(call filter_sources,$1,$$$$($$1_SOURCES)))
- @echo "LINK [$1] $$$$@: $$$$(notdir $$$$^)"
+ @echo "LINK [$1] $$$$@"
$$$$Q$$$$($1_LINK.$$(call iscxx,$$($$1_SOURCES))) $$$$^ $$$$($1_LDLIBS) -o $$$$@
endef
$$(foreach prog,$$($1_PROGS),$$(eval $$(call $1_PROG_template,$$(prog))))
-$$(OBJDIR)/%.$1.o: %.c $$(COMPILE_DEPS) | $$(OBJDIR) $$(COMPILE_ORDER_DEPS)
+$$(OBJDIR)/%.$1.o: %.c $$(COMPILE_DEPS) | $$(COMPILE_ORDER_DEPS)
@echo "CC [$1] $$<"
+ $$(call mkdir_if_needed,$$@)
$$Q$$($1_COMPILE.c) -o $$@ $$<
-$$(OBJDIR)/%.$1.o: %.cc $$(COMPILE_DEPS) | $$(OBJDIR) $$(COMPILE_ORDER_DEPS)
+$$(OBJDIR)/%.$1.o: %.cc $$(COMPILE_DEPS) | $$(COMPILE_ORDER_DEPS)
@echo "CXX [$1] $$<"
+ $$(call mkdir_if_needed,$$@)
$$Q$$($1_COMPILE.cc) -o $$@ $$<
-$$(OBJDIR)/%.$1.o: %.S $$(COMPILE_DEPS) | $$(OBJDIR) $$(COMPILE_ORDER_DEPS)
+$$(OBJDIR)/%.$1.o: %.S $$(COMPILE_DEPS) | $$(COMPILE_ORDER_DEPS)
@echo "AS [$1] $$<"
+ $$(call mkdir_if_needed,$$@)
$$Q$$($1_COMPILE.S) -o $$@ $$<
# Dependency checking.
@@ -115,7 +118,7 @@ bin.$1: $$($1_PROGS:%=%.$1.bin)
$$Q$$($1_OBJCOPY) -O binary $$< $$@
crc.$1: $$($1_PROGS:%=%.$1.bin)
- $Q$$(BASE)/build/tools/crc $$^
+ $$Q$$(UCOO_BASE)/build/tools/crc $$^
$1_EXTRA_CLEAN += $$($1_PROGS:%=%.$1.hex) \
$$($1_PROGS:%=%.$1.srec) \
@@ -146,6 +149,9 @@ define arch_misc_rules
clean: clean.$1
clean.$1:
- rm -f $$(OBJDIR)/*.$1.[od] $$($1_ELFS) $$($1_EXTRA_CLEAN)
+ @echo rm -f '$$(OBJDIR)/.../*.$1.[od]' $$($1_ELFS) $$($1_EXTRA_CLEAN)
+ $$Qrm -f $$(patsubst %,$$(OBJDIR)/%.$1.[od],\
+ $$(call filter_sources,$1,$$(ALL_SOURCES))) \
+ $$($1_ELFS) $$($1_EXTRA_CLEAN)
endef
diff --git a/build/config.mk b/build/config.mk
index e5be30f..460eeaa 100644
--- a/build/config.mk
+++ b/build/config.mk
@@ -3,7 +3,8 @@
# Build time configuration system.
PROJECT_CONFIG ?= Config
-MODULES_CONFIG := $(wildcard $(ALL_MODULES:%=$(BASE)/ucoo/%/Config))
+MODULES_CONFIG := $(wildcard $(ALL_UCOO_MODULES:%=$(UCOO_BASE)/%/Config)) \
+ $(wildcard $(ALL_EXT_MODULES:%=$(BASE)/%/Config))
CONFIG_LIST := $(strip $(wildcard $(PROJECT_CONFIG)) $(MODULES_CONFIG))
@@ -27,7 +28,7 @@ clean: config-clean
$(OBJDIR)/config.list: $(CONFIG_LIST) $(CONFIG_FORCE) | $(OBJDIR)
@echo "CONF $(PROJECT_CONFIG)"
- $Q$(BASE)/build/tools/config-gen -H $(OBJDIR)/config/%.hh \
+ $Q$(UCOO_BASE)/build/tools/config-gen -H $(OBJDIR)/config/%.hh \
-p $(PROJECT_CONFIG) -T '$(TARGETS_SUBTARGETS)' \
$(MODULES_CONFIG)
$Qecho "CONFIG_LIST_OLD = $(CONFIG_LIST)" > $@
diff --git a/build/macros.mk b/build/macros.mk
index 8ae3244..f06e9b3 100644
--- a/build/macros.mk
+++ b/build/macros.mk
@@ -15,3 +15,23 @@ filter_sources_sub = $(foreach t,$1 $($1_SUBTARGETS),$(filter %.$t,$2)) \
# Test if one of the source is C++, in this case, return cc, else return c.
# $(call iscxx,SOURCES)
iscxx = $(if $(filter %.cc,$1),cc,c)
+
+# Output every parent directories until root is reached.
+# $(call parents,DIRS,ROOT)
+parents = $(foreach d,$1,$(call parents_sub,$d,$2))
+parents_sub = $(if $(filter-out $2,$1),\
+ $(filter-out %/,$1) \
+ $(call parents_sub,$(patsubst %/,%,$(dir $1)),$2))
+
+# Reverse a list.
+# $(call reverse,A B C...)
+reverse = $(if $1,$(call reverse,$(wordlist 2,$(words $1),$1))) $(firstword $1)
+
+# Run mkdir if directory does not exists.
+# $(call mkdir_if_needed,FILE)
+mkdir_if_needed = $(if $(wildcard $(dir $1)),,$Qmkdir -p $(dir $1))
+
+# Try to rmdir empty directories.
+# $(call rmdir_as_needed,DIRS,ROOT)
+rmdir_as_needed = $Qrmdir $(call reverse,$(sort $(call parents,$1,$2))) \
+ $2 2>/dev/null || true
diff --git a/build/setup.mk b/build/setup.mk
index a48a4f9..178f070 100644
--- a/build/setup.mk
+++ b/build/setup.mk
@@ -4,23 +4,28 @@
TARGETS ?= host
-DEFAULT_MODULES ?= intf arch arch/host arch/host/mex
+DEFAULT_MODULES ?= ucoo/intf ucoo/arch ucoo/arch/host ucoo/arch/host/mex
ALL_PROGS := $(PROGS) $(foreach target,$(TARGETS),$($(target)_PROGS))
ALL_MODULES := $(sort $(DEFAULT_MODULES) $(MODULES) \
$(foreach prog,$(ALL_PROGS),$($(prog)_MODULES)))
+ALL_UCOO_MODULES := $(filter ucoo/%,$(ALL_MODULES))
+ALL_EXT_MODULES := $(filter-out ucoo/%,$(ALL_MODULES))
-include $(ALL_MODULES:%=$(BASE)/ucoo/%/Module)
+include $(ALL_UCOO_MODULES:%=$(UCOO_BASE)/%/Module)
+include $(ALL_EXT_MODULES:%=$(BASE)/%/Module)
define MODULES_template
$1_SOURCES += $$(foreach module,\
$$(DEFAULT_MODULES) $$(call defval,$1_MODULES,$$(MODULES)),\
- $$($$(subst /,_,$$(module))_SOURCES)\
+ $$(addprefix $$(module)/,$$($$(subst /,_,$$(module))_SOURCES))\
)
endef
$(foreach prog,$(ALL_PROGS),$(eval $(call MODULES_template,$(prog))))
ALL_SOURCES := $(foreach prog,$(ALL_PROGS),$($(prog)_SOURCES))
+OBJDIRS := $(sort $(dir $(ALL_SOURCES:%=$(OBJDIR)/%)))
+
COMPILE_DEPS :=
diff --git a/build/stm32.mk b/build/stm32.mk
index b811f0c..0bc43a1 100644
--- a/build/stm32.mk
+++ b/build/stm32.mk
@@ -7,7 +7,7 @@ stm32_once := 1
# Check for libopencm3.
-LIBOPENCM3_PATH ?= $(BASE)/lib/libopencm3
+LIBOPENCM3_PATH ?= $(UCOO_BASE)/lib/libopencm3
define stm32_libopencm3
ifneq ($$(LIBOPENCM3_PATH),)
$1_LIBOPENCM3_LIB := $$(LIBOPENCM3_PATH)/lib/libopencm3_$1.a
@@ -37,7 +37,7 @@ $1_CXXFLAGS := $$(sort $$($1_CFLAGS) $$(CXXFLAGS))
$1_ASFLAGS := $$(ASFLAGS)
$1_LDSCRIPT := $1.ld
$1_LDFLAGS := $$(LDFLAGS) -T$$($1_LDSCRIPT) \
- -L$$(BASE)/ucoo/arch/$1 \
+ -L$$(UCOO_BASE)/ucoo/arch/$1 \
$$($1_LIBOPENCM3_LDFLAGS)
$1_LDLIBS := -nostartfiles $$(LDLIBS) $$($1_LIBS) \
-lopencm3_$1
diff --git a/build/stm32f1.mk b/build/stm32f1.mk
index 6e65bef..6cd79f2 100644
--- a/build/stm32f1.mk
+++ b/build/stm32f1.mk
@@ -2,7 +2,7 @@
#
# Rules for STM32F1.
-include $(BASE)/build/stm32.mk
+include $(UCOO_BASE)/build/stm32.mk
$(eval $(call stm32_libopencm3,stm32f1))
diff --git a/build/stm32f4.mk b/build/stm32f4.mk
index 648bcab..106ef22 100644
--- a/build/stm32f4.mk
+++ b/build/stm32f4.mk
@@ -2,7 +2,7 @@
#
# Rules for STM32F4.
-include $(BASE)/build/stm32.mk
+include $(UCOO_BASE)/build/stm32.mk
$(eval $(call stm32_libopencm3,stm32f4))
diff --git a/build/tools/config-gen b/build/tools/config-gen
index 9bc578b..be3dac2 100755
--- a/build/tools/config-gen
+++ b/build/tools/config-gen
@@ -105,14 +105,14 @@ def write_header(filename, section, section_dict):
for target, value in values.iteritems():
if target is None: continue
item_fmt = ('#ifdef TARGET_{target}\n'
- '# define UCOO_CONFIG_{section}_{key} ({value})\n'
+ '# define CONFIG_{section}_{key} ({value})\n'
'#endif')
items.append(item_fmt.format(section=section, key=key.upper(),
target=target, value=value))
cond = True
- item_fmt = '#define UCOO_CONFIG_{section}_{key} ({value})'
+ item_fmt = '#define CONFIG_{section}_{key} ({value})'
if cond:
- item_fmt = '#ifndef UCOO_CONFIG_{section}_{key}\n# ' \
+ item_fmt = '#ifndef CONFIG_{section}_{key}\n# ' \
+ item_fmt[1:] + '\n#endif'
items.append(item_fmt.format(section=section, key=key.upper(),
value=values[None]))
diff --git a/build/top.mk b/build/top.mk
index 385df77..f3c6ccc 100644
--- a/build/top.mk
+++ b/build/top.mk
@@ -1,19 +1,21 @@
# ucoolib - Microcontroller object oriented library.
#
-# Build system top file. To be included with $(BASE) pointing to the ucoolib
+# Build system top file. To be included with $(BASE) pointing to the project
# root.
ifeq ($(BASE),)
$(error BASE is not defined)
endif
-include $(BASE)/build/macros.mk
+UCOO_BASE := $(patsubst %/build/top.mk,%,$(lastword $(MAKEFILE_LIST)))
+
+include $(UCOO_BASE)/build/macros.mk
# General parameters.
OBJDIR := obj
-INCLUDES := $(INCLUDES) -I$(BASE) -I$(OBJDIR)
+INCLUDES := $(INCLUDES) -I$(UCOO_BASE) -I$(BASE) -I$(OBJDIR)
CPPFLAGS := $(DEFS) $(INCLUDES) -MP -MMD
OPTIMIZE ?= -Os
CFLAGS := -g -Wall -W -Wundef -Wno-unused-parameter \
@@ -36,32 +38,33 @@ bin:
crc:
clean:
- rmdir $(OBJDIR) 2> /dev/null || true
+ @echo rmdir '$(OBJDIR)/.../'
+ $(call rmdir_as_needed,$(OBJDIRS),$(OBJDIR))
.PHONY: all lst size hex srec bin crc clean
# Modules and sources setup.
-include $(BASE)/build/setup.mk
+include $(UCOO_BASE)/build/setup.mk
-vpath %.cc $(ALL_MODULES:%=$(BASE)/ucoo/%)
-vpath %.c $(ALL_MODULES:%=$(BASE)/ucoo/%)
-vpath %.S $(ALL_MODULES:%=$(BASE)/ucoo/%)
+vpath %.cc $(UCOO_BASE) $(BASE)
+vpath %.c $(UCOO_BASE) $(BASE)
+vpath %.S $(UCOO_BASE) $(BASE)
# Configuration.
-include $(BASE)/build/config.mk
+include $(UCOO_BASE)/build/config.mk
# Objects directory.
$(OBJDIR):
- $Qmkdir -p $(OBJDIR)
+ $Qmkdir -p $@
# Arch specific.
-include $(BASE)/build/arch.mk
+include $(UCOO_BASE)/build/arch.mk
define TARGETS_template
-include $$(BASE)/build/$1.mk
+include $$(UCOO_BASE)/build/$1.mk
endef
$(foreach target,$(TARGETS),$(eval $(call TARGETS_template,$(target))))
diff --git a/ucoo/arch/Module b/ucoo/arch/Module
index 8ed9210..9a4989e 100644
--- a/ucoo/arch/Module
+++ b/ucoo/arch/Module
@@ -1,2 +1,3 @@
-arch_SOURCES := arch.host.cc arch.stm32.cc arch.stm32f1.cc arch.stm32f4.cc \
+ucoo_arch_SOURCES := arch.host.cc \
+ arch.stm32.cc arch.stm32f1.cc arch.stm32f4.cc \
syscalls.newlib.cc syscalls.cc
diff --git a/ucoo/arch/host/Module b/ucoo/arch/host/Module
index 2c7fead..f96adbf 100644
--- a/ucoo/arch/host/Module
+++ b/ucoo/arch/host/Module
@@ -1,2 +1,2 @@
-arch_host_SOURCES := host.host.cc host_stream.host.cc
+ucoo_arch_host_SOURCES := host.host.cc host_stream.host.cc
host_LIBS += -lutil
diff --git a/ucoo/arch/host/mex/Config b/ucoo/arch/host/mex/Config
index de679f0..87076f6 100644
--- a/ucoo/arch/host/mex/Config
+++ b/ucoo/arch/host/mex/Config
@@ -1,2 +1,2 @@
-[arch/host/mex]
+[ucoo/arch/host/mex]
default_address = "localhost", "2442"
diff --git a/ucoo/arch/host/mex/Module b/ucoo/arch/host/mex/Module
index 941482b..01835ed 100644
--- a/ucoo/arch/host/mex/Module
+++ b/ucoo/arch/host/mex/Module
@@ -1,2 +1,2 @@
-arch_host_mex_SOURCES := mex_msg.host.cc mex_node.host.cc mex_socket.host.cc \
- socket.host.c
+ucoo_arch_host_mex_SOURCES := mex_msg.host.cc mex_node.host.cc \
+ mex_socket.host.cc socket.host.c
diff --git a/ucoo/arch/host/mex/mex_socket.host.cc b/ucoo/arch/host/mex/mex_socket.host.cc
index 41a6e01..20fc491 100644
--- a/ucoo/arch/host/mex/mex_socket.host.cc
+++ b/ucoo/arch/host/mex/mex_socket.host.cc
@@ -25,7 +25,7 @@
#include "ucoo/common.hh"
-#include "config/arch/host/mex.hh"
+#include "config/ucoo/arch/host/mex.hh"
#include "socket.h"
#include <unistd.h>
@@ -43,7 +43,7 @@ Socket::~Socket ()
void
Socket::connect ()
{
- fd_ = socket_client UCOO_CONFIG_ARCH_HOST_MEX_DEFAULT_ADDRESS;
+ fd_ = socket_client CONFIG_UCOO_ARCH_HOST_MEX_DEFAULT_ADDRESS;
}
int
diff --git a/ucoo/base/proto/Config b/ucoo/base/proto/Config
index 4edaa6b..82174c9 100644
--- a/ucoo/base/proto/Config
+++ b/ucoo/base/proto/Config
@@ -1,2 +1,2 @@
-[base/proto]
+[ucoo/base/proto]
args_max_size = 16
diff --git a/ucoo/base/proto/Module b/ucoo/base/proto/Module
index 68f866f..ff93e67 100644
--- a/ucoo/base/proto/Module
+++ b/ucoo/base/proto/Module
@@ -1 +1 @@
-base_proto_SOURCES = proto.cc
+ucoo_base_proto_SOURCES = proto.cc
diff --git a/ucoo/base/proto/proto.cc b/ucoo/base/proto/proto.cc
index 838a79b..20d87b3 100644
--- a/ucoo/base/proto/proto.cc
+++ b/ucoo/base/proto/proto.cc
@@ -213,7 +213,7 @@ void
Proto::accept_digit (int c)
{
// Test for argument list overflow.
- if (size_ >= UCOO_CONFIG_BASE_PROTO_ARGS_MAX_SIZE)
+ if (size_ >= CONFIG_UCOO_BASE_PROTO_ARGS_MAX_SIZE)
{
handler_.proto_handle (*this, '?', 0, 0);
step_ = IDLE;
@@ -243,7 +243,7 @@ void
Proto::accept_char (int c)
{
// Test for argument list overflow or unwanted char.
- if (size_ >= UCOO_CONFIG_BASE_PROTO_ARGS_MAX_SIZE || !std::isprint (c))
+ if (size_ >= CONFIG_UCOO_BASE_PROTO_ARGS_MAX_SIZE || !std::isprint (c))
{
handler_.proto_handle (*this, '?', 0, 0);
step_ = IDLE;
diff --git a/ucoo/base/proto/proto.hh b/ucoo/base/proto/proto.hh
index a4ee999..2b1e2e2 100644
--- a/ucoo/base/proto/proto.hh
+++ b/ucoo/base/proto/proto.hh
@@ -26,7 +26,7 @@
#include "ucoo/common.hh"
#include "ucoo/intf/stream.hh"
-#include "config/base/proto.hh"
+#include "config/ucoo/base/proto.hh"
namespace ucoo {
@@ -89,7 +89,7 @@ class Proto
/// Received message current size.
int size_;
/// Message arguments being received.
- uint8_t args_[UCOO_CONFIG_BASE_PROTO_ARGS_MAX_SIZE];
+ uint8_t args_[CONFIG_UCOO_BASE_PROTO_ARGS_MAX_SIZE];
/// Command being received.
char cmd_;
};
diff --git a/ucoo/base/proto/test/Makefile b/ucoo/base/proto/test/Makefile
index f02be13..8c093f0 100644
--- a/ucoo/base/proto/test/Makefile
+++ b/ucoo/base/proto/test/Makefile
@@ -4,6 +4,6 @@ TARGETS = host stm32f4
PROGS = test_proto
test_proto_SOURCES = test_proto.cc
-MODULES = base/proto base/test hal/usb
+MODULES = ucoo/base/proto ucoo/base/test ucoo/hal/usb
include $(BASE)/build/top.mk
diff --git a/ucoo/base/stdio/Module b/ucoo/base/stdio/Module
index f9cffeb..73f11f4 100644
--- a/ucoo/base/stdio/Module
+++ b/ucoo/base/stdio/Module
@@ -1 +1 @@
-base_stdio_SOURCES := stdio.cc
+ucoo_base_stdio_SOURCES := stdio.cc
diff --git a/ucoo/base/test/Config b/ucoo/base/test/Config
index 133808b..0269ef4 100644
--- a/ucoo/base/test/Config
+++ b/ucoo/base/test/Config
@@ -1,5 +1,5 @@
-[base/test]
+[ucoo/base/test]
wait = false
-[base/test:stm32]
+[ucoo/base/test:stm32]
wait = true
diff --git a/ucoo/base/test/Module b/ucoo/base/test/Module
index 9a3c77b..7a3c57e 100644
--- a/ucoo/base/test/Module
+++ b/ucoo/base/test/Module
@@ -1 +1 @@
-base_test_SOURCES := test.cc test.host.cc test.stm32.cc
+ucoo_base_test_SOURCES := test.cc test.host.cc test.stm32.cc
diff --git a/ucoo/base/test/test.cc b/ucoo/base/test/test.cc
index 4f2e8f0..3a04209 100644
--- a/ucoo/base/test/test.cc
+++ b/ucoo/base/test/test.cc
@@ -27,7 +27,7 @@
#include "ucoo/base/stdio/stdio.hh"
#include "ucoo/utils/delay.hh"
-#include "config/base/test.hh"
+#include "config/ucoo/base/test.hh"
#include <cstdarg>
@@ -38,7 +38,7 @@ TestSuite::TestSuite (const char *test_suite)
test_nb_ (0), fail_nb_ (0), in_test_ (false)
{
test_stream_setup ();
- if (UCOO_CONFIG_BASE_TEST_WAIT)
+ if (CONFIG_UCOO_BASE_TEST_WAIT)
{
Stream &s = test_stream ();
int n;
diff --git a/ucoo/base/test/test/Makefile b/ucoo/base/test/test/Makefile
index 610c71a..64e5021 100644
--- a/ucoo/base/test/test/Makefile
+++ b/ucoo/base/test/test/Makefile
@@ -4,6 +4,6 @@ TARGETS = host stm32f4
PROGS = test_test
test_test_SOURCES = test_test.cc
-MODULES = utils base/test hal/usb
+MODULES = ucoo/utils ucoo/base/test ucoo/hal/usb
include $(BASE)/build/top.mk
diff --git a/ucoo/dev/avrisp/Config b/ucoo/dev/avrisp/Config
index cf3eb48..8233b8e 100644
--- a/ucoo/dev/avrisp/Config
+++ b/ucoo/dev/avrisp/Config
@@ -1,4 +1,4 @@
-[dev/avrisp]
+[ucoo/dev/avrisp]
frame_buffer_size = 281
proto_signature = "APBisp_2"
proto_build_number = 0x0100
diff --git a/ucoo/dev/avrisp/Module b/ucoo/dev/avrisp/Module
index d66f06f..cbec793 100644
--- a/ucoo/dev/avrisp/Module
+++ b/ucoo/dev/avrisp/Module
@@ -1 +1 @@
-dev_avrisp_SOURCES := avrisp.cc avrisp_proto.cc avrisp_frame.cc
+ucoo_dev_avrisp_SOURCES := avrisp.cc avrisp_proto.cc avrisp_frame.cc
diff --git a/ucoo/dev/avrisp/avrisp_frame.cc b/ucoo/dev/avrisp/avrisp_frame.cc
index 4cc8c98..768eaf2 100644
--- a/ucoo/dev/avrisp/avrisp_frame.cc
+++ b/ucoo/dev/avrisp/avrisp_frame.cc
@@ -101,7 +101,7 @@ AvrIspFrame::accept_char (uint8_t c)
len_ |= c;
buffer_len_ = 0;
if (len_ == 0
- || len_ > (UCOO_CONFIG_DEV_AVRISP_FRAME_BUFFER_SIZE - proto_head_
+ || len_ > (CONFIG_UCOO_DEV_AVRISP_FRAME_BUFFER_SIZE - proto_head_
- proto_tail_))
state_ = AVRISP_FRAME_STATE_START;
else
diff --git a/ucoo/dev/avrisp/avrisp_frame.hh b/ucoo/dev/avrisp/avrisp_frame.hh
index 5631122..fb32546 100644
--- a/ucoo/dev/avrisp/avrisp_frame.hh
+++ b/ucoo/dev/avrisp/avrisp_frame.hh
@@ -27,7 +27,7 @@
#include "ucoo/intf/stream.hh"
-#include "config/dev/avrisp.hh"
+#include "config/ucoo/dev/avrisp.hh"
namespace ucoo {
@@ -79,7 +79,7 @@ class AvrIspFrame
/// Checksum current value.
uint8_t cksum_;
/// Buffer to store frame until validated.
- uint8_t buffer_[UCOO_CONFIG_DEV_AVRISP_FRAME_BUFFER_SIZE];
+ uint8_t buffer_[CONFIG_UCOO_DEV_AVRISP_FRAME_BUFFER_SIZE];
/// Used buffer length.
int buffer_len_;
/// Index to first byte to send from buffer, or -1 if not sending.
diff --git a/ucoo/dev/avrisp/avrisp_proto.cc b/ucoo/dev/avrisp/avrisp_proto.cc
index bdf0457..c08dfa2 100644
--- a/ucoo/dev/avrisp/avrisp_proto.cc
+++ b/ucoo/dev/avrisp/avrisp_proto.cc
@@ -25,7 +25,7 @@
#include "ucoo/utils/bytes.hh"
-#include "config/dev/avrisp.hh"
+#include "config/ucoo/dev/avrisp.hh"
#include <cstring>
#include <algorithm>
@@ -121,10 +121,10 @@ AvrIspProto::accept (uint8_t *data, int len)
case AVRISP_PROTO_CMD_SIGN_ON:
if (len != 1) break;
data[1] = AVRISP_PROTO_STATUS_CMD_OK;
- data[2] = sizeof (UCOO_CONFIG_DEV_AVRISP_PROTO_SIGNATURE);
- memcpy (&data[3], UCOO_CONFIG_DEV_AVRISP_PROTO_SIGNATURE,
- sizeof (UCOO_CONFIG_DEV_AVRISP_PROTO_SIGNATURE));
- return 3 + sizeof (UCOO_CONFIG_DEV_AVRISP_PROTO_SIGNATURE);
+ data[2] = sizeof (CONFIG_UCOO_DEV_AVRISP_PROTO_SIGNATURE);
+ memcpy (&data[3], CONFIG_UCOO_DEV_AVRISP_PROTO_SIGNATURE,
+ sizeof (CONFIG_UCOO_DEV_AVRISP_PROTO_SIGNATURE));
+ return 3 + sizeof (CONFIG_UCOO_DEV_AVRISP_PROTO_SIGNATURE);
case AVRISP_PROTO_CMD_SET_PARAMETER:
if (len != 3) break;
status = AVRISP_PROTO_STATUS_CMD_OK;
@@ -155,19 +155,19 @@ AvrIspProto::accept (uint8_t *data, int len)
data[2] = 1;
break;
case AVRISP_PROTO_PARAM_BUILD_NUMBER_LOW:
- data[2] = bytes_unpack (UCOO_CONFIG_DEV_AVRISP_PROTO_BUILD_NUMBER, 0);
+ data[2] = bytes_unpack (CONFIG_UCOO_DEV_AVRISP_PROTO_BUILD_NUMBER, 0);
break;
case AVRISP_PROTO_PARAM_BUILD_NUMBER_HIGH:
- data[2] = bytes_unpack (UCOO_CONFIG_DEV_AVRISP_PROTO_BUILD_NUMBER, 1);
+ data[2] = bytes_unpack (CONFIG_UCOO_DEV_AVRISP_PROTO_BUILD_NUMBER, 1);
break;
case AVRISP_PROTO_PARAM_HW_VER:
- data[2] = UCOO_CONFIG_DEV_AVRISP_PROTO_HW_VERSION;
+ data[2] = CONFIG_UCOO_DEV_AVRISP_PROTO_HW_VERSION;
break;
case AVRISP_PROTO_PARAM_SW_MAJOR:
- data[2] = bytes_unpack (UCOO_CONFIG_DEV_AVRISP_PROTO_SW_VERSION, 1);
+ data[2] = bytes_unpack (CONFIG_UCOO_DEV_AVRISP_PROTO_SW_VERSION, 1);
break;
case AVRISP_PROTO_PARAM_SW_MINOR:
- data[2] = bytes_unpack (UCOO_CONFIG_DEV_AVRISP_PROTO_SW_VERSION, 0);
+ data[2] = bytes_unpack (CONFIG_UCOO_DEV_AVRISP_PROTO_SW_VERSION, 0);
break;
default:
status = AVRISP_PROTO_STATUS_CMD_FAILED;
diff --git a/ucoo/dev/avrisp/test/Makefile b/ucoo/dev/avrisp/test/Makefile
index 80a8334..8419827 100644
--- a/ucoo/dev/avrisp/test/Makefile
+++ b/ucoo/dev/avrisp/test/Makefile
@@ -4,6 +4,7 @@ TARGETS = stm32f4
PROGS = test_avrisp
test_avrisp_SOURCES = test_avrisp.cc
-MODULES = dev/avrisp hal/spi hal/gpio base/test hal/usb utils
+MODULES = ucoo/dev/avrisp ucoo/hal/spi ucoo/hal/gpio ucoo/base/test \
+ ucoo/hal/usb ucoo/utils
include $(BASE)/build/top.mk
diff --git a/ucoo/dev/lcd/Module b/ucoo/dev/lcd/Module
index 1934cc8..651bf85 100644
--- a/ucoo/dev/lcd/Module
+++ b/ucoo/dev/lcd/Module
@@ -1 +1 @@
-dev_lcd_SOURCES := lcd_spi.cc
+ucoo_dev_lcd_SOURCES := lcd_spi.cc
diff --git a/ucoo/dev/lcd/test/Makefile b/ucoo/dev/lcd/test/Makefile
index f8bef65..d11d882 100644
--- a/ucoo/dev/lcd/test/Makefile
+++ b/ucoo/dev/lcd/test/Makefile
@@ -4,6 +4,6 @@ TARGETS = stm32f1
PROGS = test_lcd
test_lcd_SOURCES = test_lcd.cc
-MODULES = intf utils hal/gpio hal/spi dev/lcd
+MODULES = ucoo/intf ucoo/utils ucoo/hal/gpio ucoo/hal/spi ucoo/dev/lcd
include $(BASE)/build/top.mk
diff --git a/ucoo/dev/usdist/Module b/ucoo/dev/usdist/Module
index bedbac4..f5c9a3d 100644
--- a/ucoo/dev/usdist/Module
+++ b/ucoo/dev/usdist/Module
@@ -1 +1 @@
-dev_usdist_SOURCES = usdist.cc
+ucoo_dev_usdist_SOURCES = usdist.cc
diff --git a/ucoo/dev/xmodem/Module b/ucoo/dev/xmodem/Module
index 37bc5eb..56c525e 100644
--- a/ucoo/dev/xmodem/Module
+++ b/ucoo/dev/xmodem/Module
@@ -1 +1 @@
-dev_xmodem_SOURCES = xmodem.cc
+ucoo_dev_xmodem_SOURCES = xmodem.cc
diff --git a/ucoo/hal/adc/Module b/ucoo/hal/adc/Module
index f633ffd..cc10647 100644
--- a/ucoo/hal/adc/Module
+++ b/ucoo/hal/adc/Module
@@ -1 +1 @@
-hal_adc_SOURCES = adc.host.cc adc_hard.stm32f4.cc
+ucoo_hal_adc_SOURCES = adc.host.cc adc_hard.stm32f4.cc
diff --git a/ucoo/hal/adc/test/Makefile b/ucoo/hal/adc/test/Makefile
index fc46e0d..c6c8a3c 100644
--- a/ucoo/hal/adc/test/Makefile
+++ b/ucoo/hal/adc/test/Makefile
@@ -4,6 +4,6 @@ TARGETS = stm32f4
stm32f4_PROGS = test_adc
test_adc_SOURCES = test_adc.cc
-MODULES = hal/adc base/test hal/usb utils
+MODULES = ucoo/hal/adc ucoo/base/test ucoo/hal/usb ucoo/utils
include $(BASE)/build/top.mk
diff --git a/ucoo/hal/gpio/Module b/ucoo/hal/gpio/Module
index e5ccdec..b6f0b42 100644
--- a/ucoo/hal/gpio/Module
+++ b/ucoo/hal/gpio/Module
@@ -1 +1 @@
-hal_gpio_SOURCES = gpio.host.cc gpio.stm32f4.cc gpio.stm32f1.cc
+ucoo_hal_gpio_SOURCES = gpio.host.cc gpio.stm32f4.cc gpio.stm32f1.cc
diff --git a/ucoo/hal/gpio/test/Makefile b/ucoo/hal/gpio/test/Makefile
index 68e4c1f..4a5c155 100644
--- a/ucoo/hal/gpio/test/Makefile
+++ b/ucoo/hal/gpio/test/Makefile
@@ -4,6 +4,6 @@ TARGETS = stm32f4 stm32f1
PROGS = test_gpio
test_gpio_SOURCES = test_gpio.stm32f4.cc test_gpio.stm32f1.cc
-MODULES = hal/gpio utils
+MODULES = ucoo/hal/gpio ucoo/utils
include $(BASE)/build/top.mk
diff --git a/ucoo/hal/i2c/Config b/ucoo/hal/i2c/Config
index 3871f5c..3bbcc3a 100644
--- a/ucoo/hal/i2c/Config
+++ b/ucoo/hal/i2c/Config
@@ -1,4 +1,4 @@
-[hal/i2c]
+[ucoo/hal/i2c]
# Size of slave buffer, used for both reception and transmission.
slave_buffer_size = 64
# Activate debug trace.
diff --git a/ucoo/hal/i2c/Module b/ucoo/hal/i2c/Module
index ae93f22..872be6f 100644
--- a/ucoo/hal/i2c/Module
+++ b/ucoo/hal/i2c/Module
@@ -1 +1 @@
-hal_i2c_SOURCES := i2c.host.cc i2c_slave_data_buffer.cc i2c_hard.stm32.cc
+ucoo_hal_i2c_SOURCES := i2c.host.cc i2c_slave_data_buffer.cc i2c_hard.stm32.cc
diff --git a/ucoo/hal/i2c/i2c.host.cc b/ucoo/hal/i2c/i2c.host.cc
index 4a2553b..6b3181b 100644
--- a/ucoo/hal/i2c/i2c.host.cc
+++ b/ucoo/hal/i2c/i2c.host.cc
@@ -23,7 +23,7 @@
// }}}
#include "i2c.host.hh"
-#include "config/hal/i2c.hh"
+#include "config/ucoo/hal/i2c.hh"
namespace ucoo {
@@ -77,7 +77,7 @@ I2cHostShared::send (uint8_t addr, const char *buf, int count)
{
if (addr == (*i)->slave_addr_)
{
- assert (count <= UCOO_CONFIG_HAL_I2C_SLAVE_BUFFER_SIZE);
+ assert (count <= CONFIG_UCOO_HAL_I2C_SLAVE_BUFFER_SIZE);
(*i)->slave_data_handler_->to_recv (buf, count);
return count;
}
@@ -99,7 +99,7 @@ I2cHostShared::recv (uint8_t addr, char *buf, int count)
{
if (addr == (*i)->slave_addr_)
{
- assert (count <= UCOO_CONFIG_HAL_I2C_SLAVE_BUFFER_SIZE);
+ assert (count <= CONFIG_UCOO_HAL_I2C_SLAVE_BUFFER_SIZE);
return (*i)->slave_data_handler_->to_send (buf, count);
}
}
@@ -125,7 +125,7 @@ I2cHostShared::handle_read (mex::Msg &msg)
{
if (addr == (*i)->slave_addr_)
{
- assert (size <= UCOO_CONFIG_HAL_I2C_SLAVE_BUFFER_SIZE);
+ assert (size <= CONFIG_UCOO_HAL_I2C_SLAVE_BUFFER_SIZE);
char buf[size];
int n = (*i)->slave_data_handler_->to_send (buf, size);
mex::Msg rsp (read_mtype_);
@@ -147,7 +147,7 @@ I2cHostShared::handle_write (mex::Msg &msg)
if (addr == (*i)->slave_addr_)
{
int size = msg.len ();
- assert (size <= UCOO_CONFIG_HAL_I2C_SLAVE_BUFFER_SIZE);
+ assert (size <= CONFIG_UCOO_HAL_I2C_SLAVE_BUFFER_SIZE);
(*i)->slave_data_handler_->to_recv (msg.pop (size), size);
break;
}
diff --git a/ucoo/hal/i2c/i2c_hard.stm32.cc b/ucoo/hal/i2c/i2c_hard.stm32.cc
index 9afe241..14a4486 100644
--- a/ucoo/hal/i2c/i2c_hard.stm32.cc
+++ b/ucoo/hal/i2c/i2c_hard.stm32.cc
@@ -32,7 +32,7 @@
namespace ucoo {
/// Local trace.
-static Trace<UCOO_CONFIG_HAL_I2C_TRACE> i2c_trace;
+static Trace<CONFIG_UCOO_HAL_I2C_TRACE> i2c_trace;
/// Information on I2C hardware structure.
struct i2c_hardware_t
diff --git a/ucoo/hal/i2c/i2c_hard.stm32.hh b/ucoo/hal/i2c/i2c_hard.stm32.hh
index 94e4259..98e4930 100644
--- a/ucoo/hal/i2c/i2c_hard.stm32.hh
+++ b/ucoo/hal/i2c/i2c_hard.stm32.hh
@@ -25,7 +25,7 @@
// }}}
#include "ucoo/intf/i2c.hh"
-#include "config/hal/i2c.hh"
+#include "config/ucoo/hal/i2c.hh"
namespace ucoo {
@@ -68,7 +68,7 @@ class I2cHard : public I2c
/// Handler called to source or sink data for slave exchanges.
DataHandler *slave_data_handler_;
/// Slave buffer.
- char slave_buf_[UCOO_CONFIG_HAL_I2C_SLAVE_BUFFER_SIZE];
+ char slave_buf_[CONFIG_UCOO_HAL_I2C_SLAVE_BUFFER_SIZE];
/// Current buffer count (bytes to send), or buffer size (available room).
int buf_count_;
/// Current buffer index (position to read byte to send or write received
diff --git a/ucoo/hal/i2c/test/Makefile b/ucoo/hal/i2c/test/Makefile
index 5046862..ca6915e 100644
--- a/ucoo/hal/i2c/test/Makefile
+++ b/ucoo/hal/i2c/test/Makefile
@@ -4,6 +4,6 @@ TARGETS = host stm32f4
PROGS = test_i2c
test_i2c_SOURCES = test_i2c.cc
-MODULES = hal/i2c utils base/test hal/usb
+MODULES = ucoo/hal/i2c ucoo/utils ucoo/base/test ucoo/hal/usb
include $(BASE)/build/top.mk
diff --git a/ucoo/hal/spi/Module b/ucoo/hal/spi/Module
index fe9737f..46a0fe2 100644
--- a/ucoo/hal/spi/Module
+++ b/ucoo/hal/spi/Module
@@ -1 +1 @@
-hal_spi_SOURCES := spi_soft.cc spi_hard.stm32.cc
+ucoo_hal_spi_SOURCES := spi_soft.cc spi_hard.stm32.cc
diff --git a/ucoo/hal/spi/test/Makefile b/ucoo/hal/spi/test/Makefile
index 76b8230..eb872a0 100644
--- a/ucoo/hal/spi/test/Makefile
+++ b/ucoo/hal/spi/test/Makefile
@@ -4,6 +4,6 @@ TARGETS = stm32f4
PROGS = test_spi
test_spi_SOURCES = test_spi.cc
-MODULES = hal/spi hal/gpio utils base/test hal/usb
+MODULES = ucoo/hal/spi ucoo/hal/gpio ucoo/utils ucoo/base/test ucoo/hal/usb
include $(BASE)/build/top.mk
diff --git a/ucoo/hal/uart/Config b/ucoo/hal/uart/Config
index 0a67d63..1229b76 100644
--- a/ucoo/hal/uart/Config
+++ b/ucoo/hal/uart/Config
@@ -1,4 +1,4 @@
-[hal/uart]
+[ucoo/hal/uart]
# Size of reception buffer.
rx_buffer = 32
# Size of transmission buffer.
diff --git a/ucoo/hal/uart/Module b/ucoo/hal/uart/Module
index a9d185e..8b1bac2 100644
--- a/ucoo/hal/uart/Module
+++ b/ucoo/hal/uart/Module
@@ -1 +1 @@
-hal_uart_SOURCES = uart.stm32.cc
+ucoo_hal_uart_SOURCES = uart.stm32.cc
diff --git a/ucoo/hal/uart/test/Config b/ucoo/hal/uart/test/Config
index 4fd7571..91c7ed5 100644
--- a/ucoo/hal/uart/test/Config
+++ b/ucoo/hal/uart/test/Config
@@ -1,4 +1,4 @@
-[hal/uart]
+[ucoo/hal/uart]
rx_buffer = 32
tx_buffer = 8
diff --git a/ucoo/hal/uart/test/Makefile b/ucoo/hal/uart/test/Makefile
index 6989dd2..b1e9c71 100644
--- a/ucoo/hal/uart/test/Makefile
+++ b/ucoo/hal/uart/test/Makefile
@@ -6,7 +6,7 @@ stm32f4_PROGS = test_uart_disc
test_uart_SOURCES = test_uart.cc
test_uart_disc_SOURCES = test_uart_disc.cc
-MODULES = hal/uart
-test_uart_disc_MODULES = $(MODULES) base/test hal/usb
+MODULES = ucoo/hal/uart
+test_uart_disc_MODULES = $(MODULES) ucoo/base/test ucoo/hal/usb
include $(BASE)/build/top.mk
diff --git a/ucoo/hal/uart/uart.stm32.hh b/ucoo/hal/uart/uart.stm32.hh
index 1dd3d54..7d74946 100644
--- a/ucoo/hal/uart/uart.stm32.hh
+++ b/ucoo/hal/uart/uart.stm32.hh
@@ -26,7 +26,7 @@
#include "ucoo/intf/stream.hh"
#include "ucoo/utils/fifo.hh"
-#include "config/hal/uart.hh"
+#include "config/ucoo/hal/uart.hh"
namespace ucoo {
@@ -64,9 +64,9 @@ class Uart : public Stream
/// UART number.
int n_;
/// RX FIFO, filled by interrupt handler.
- Fifo<char, UCOO_CONFIG_HAL_UART_RX_BUFFER> rx_fifo_;
+ Fifo<char, CONFIG_UCOO_HAL_UART_RX_BUFFER> rx_fifo_;
/// TX FIFO, emptied by interrupt handler.
- Fifo<char, UCOO_CONFIG_HAL_UART_TX_BUFFER> tx_fifo_;
+ Fifo<char, CONFIG_UCOO_HAL_UART_TX_BUFFER> tx_fifo_;
/// Error character, inserted in case of error.
char error_char_;
/// Is it enabled?
diff --git a/ucoo/hal/usb/Config b/ucoo/hal/usb/Config
index 80341e8..0ec69c3 100644
--- a/ucoo/hal/usb/Config
+++ b/ucoo/hal/usb/Config
@@ -1,4 +1,4 @@
-[hal/usb]
+[ucoo/hal/usb]
# Theses are APBTeam IDs, given by Openmoko!
vendor_id = 0x1d50
product_id = 0x6052
diff --git a/ucoo/hal/usb/Module b/ucoo/hal/usb/Module
index 433c8b2..e47e0e8 100644
--- a/ucoo/hal/usb/Module
+++ b/ucoo/hal/usb/Module
@@ -1 +1 @@
-hal_usb_SOURCES = usb.stm32.cc usb_desc.stm32.c
+ucoo_hal_usb_SOURCES = usb.stm32.cc usb_desc.stm32.c
diff --git a/ucoo/hal/usb/test/Config b/ucoo/hal/usb/test/Config
index 49b2f0b..a29fd20 100644
--- a/ucoo/hal/usb/test/Config
+++ b/ucoo/hal/usb/test/Config
@@ -1,2 +1,2 @@
-[hal/usb]
+[ucoo/hal/usb]
stream_nb = 1
diff --git a/ucoo/hal/usb/test/Makefile b/ucoo/hal/usb/test/Makefile
index 9ef0eab..95e4648 100644
--- a/ucoo/hal/usb/test/Makefile
+++ b/ucoo/hal/usb/test/Makefile
@@ -4,6 +4,6 @@ TARGETS = stm32f4
PROGS = test_usb
test_usb_SOURCES = test_usb.cc
-MODULES = hal/usb
+MODULES = ucoo/hal/usb
include $(BASE)/build/top.mk
diff --git a/ucoo/hal/usb/test/test_usb.cc b/ucoo/hal/usb/test/test_usb.cc
index a1fe362..914e084 100644
--- a/ucoo/hal/usb/test/test_usb.cc
+++ b/ucoo/hal/usb/test/test_usb.cc
@@ -31,22 +31,22 @@ main (int argc, const char **argv)
ucoo::UsbStreamControl usc ("APBTeam", "USB test");
ucoo::UsbStream us[] = {
ucoo::UsbStream (usc, 0),
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 2
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 2
ucoo::UsbStream (usc, 1),
#endif
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 3
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 3
ucoo::UsbStream (usc, 2),
#endif
};
- if (UCOO_CONFIG_HAL_USB_STREAM_NB > 1)
+ if (CONFIG_UCOO_HAL_USB_STREAM_NB > 1)
{
- for (int i = 0; i < UCOO_CONFIG_HAL_USB_STREAM_NB; i++)
+ for (int i = 0; i < CONFIG_UCOO_HAL_USB_STREAM_NB; i++)
us[i].block (false);
}
char buf[6];
while (1)
{
- for (int i = 0; i < UCOO_CONFIG_HAL_USB_STREAM_NB; i++)
+ for (int i = 0; i < CONFIG_UCOO_HAL_USB_STREAM_NB; i++)
{
int len = us[i].read (buf + 2, sizeof (buf) - 2);
if (len)
@@ -54,7 +54,7 @@ main (int argc, const char **argv)
buf[0] = i + '0';
buf[1] = '>';
len += 2;
- if (UCOO_CONFIG_HAL_USB_STREAM_NB == 1)
+ if (CONFIG_UCOO_HAL_USB_STREAM_NB == 1)
us[i].write (buf, len);
else
{
diff --git a/ucoo/hal/usb/usb.stm32.cc b/ucoo/hal/usb/usb.stm32.cc
index 37595e8..93f1782 100644
--- a/ucoo/hal/usb/usb.stm32.cc
+++ b/ucoo/hal/usb/usb.stm32.cc
@@ -31,7 +31,7 @@
#include "usb_desc.stm32.h"
#if defined (TARGET_stm32f4)
-# if UCOO_CONFIG_HAL_USB_DRIVER_HS
+# if CONFIG_UCOO_HAL_USB_DRIVER_HS
# define usb_isr otg_hs_isr
# define usb_driver otghs_usb_driver
# else
@@ -82,7 +82,7 @@ UsbStreamControl::UsbStreamControl (const char *vendor, const char *product)
strings[0] = vendor;
strings[1] = product;
#if defined (TARGET_stm32f4)
-# if UCOO_CONFIG_HAL_USB_DRIVER_HS
+# if CONFIG_UCOO_HAL_USB_DRIVER_HS
rcc_periph_clock_enable (RCC_OTGHS);
rcc_periph_clock_enable (RCC_GPIOB);
gpio_mode_setup (GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE,
@@ -103,7 +103,7 @@ UsbStreamControl::UsbStreamControl (const char *vendor, const char *product)
strings, lengthof (strings),
usb_control_buffer, sizeof (usb_control_buffer));
usbd_register_set_config_callback (usbdev, set_config);
-#if UCOO_CONFIG_HAL_USB_DRIVER_HS
+#if CONFIG_UCOO_HAL_USB_DRIVER_HS
nvic_enable_irq (NVIC_OTG_HS_IRQ);
#else
nvic_enable_irq (NVIC_OTG_FS_IRQ);
diff --git a/ucoo/hal/usb/usb.stm32.hh b/ucoo/hal/usb/usb.stm32.hh
index 118e883..11ce16c 100644
--- a/ucoo/hal/usb/usb.stm32.hh
+++ b/ucoo/hal/usb/usb.stm32.hh
@@ -26,7 +26,7 @@
#include "ucoo/intf/stream.hh"
#include "ucoo/common.hh"
-#include "config/hal/usb.hh"
+#include "config/ucoo/hal/usb.hh"
#include <libopencm3/usb/usbd.h>
@@ -54,9 +54,9 @@ class UsbStreamControl
static void rx_callback (usbd_device *usbdev, uint8_t ep);
private:
/// Size of endpoints.
- static const int ep_size_ = UCOO_CONFIG_HAL_USB_EP_SIZE;
+ static const int ep_size_ = CONFIG_UCOO_HAL_USB_EP_SIZE;
/// Number of streams (also interfaces or pair of endpoints).
- static const int stream_nb_ = UCOO_CONFIG_HAL_USB_STREAM_NB;
+ static const int stream_nb_ = CONFIG_UCOO_HAL_USB_STREAM_NB;
/// Pointer to the one and only instance.
static UsbStreamControl *instance_;
/// Whether device is currently configured.
diff --git a/ucoo/hal/usb/usb_desc.stm32.c b/ucoo/hal/usb/usb_desc.stm32.c
index 8d6fc87..ae14d14 100644
--- a/ucoo/hal/usb/usb_desc.stm32.c
+++ b/ucoo/hal/usb/usb_desc.stm32.c
@@ -23,7 +23,7 @@
* }}} */
#include "usb_desc.stm32.h"
-#include "config/hal/usb.hh"
+#include "config/ucoo/hal/usb.hh"
const struct usb_device_descriptor usb_desc_dev = {
.bLength = USB_DT_DEVICE_SIZE,
@@ -33,8 +33,8 @@ const struct usb_device_descriptor usb_desc_dev = {
.bDeviceSubClass = 0,
.bDeviceProtocol = 0,
.bMaxPacketSize0 = 64,
- .idVendor = UCOO_CONFIG_HAL_USB_VENDOR_ID,
- .idProduct = UCOO_CONFIG_HAL_USB_PRODUCT_ID,
+ .idVendor = CONFIG_UCOO_HAL_USB_VENDOR_ID,
+ .idProduct = CONFIG_UCOO_HAL_USB_PRODUCT_ID,
.bcdDevice = 0x0000,
.iManufacturer = 1,
.iProduct = 2,
@@ -48,7 +48,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_1[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x01,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
{
@@ -56,7 +56,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_1[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x81,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
};
@@ -77,7 +77,7 @@ static const struct usb_interface_descriptor usb_desc_iface_1[] = {
},
};
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 2
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 2
static const struct usb_endpoint_descriptor usb_desc_endp_2[] = {
{
@@ -85,7 +85,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_2[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x02,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
{
@@ -93,7 +93,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_2[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x82,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
};
@@ -114,9 +114,9 @@ static const struct usb_interface_descriptor usb_desc_iface_2[] = {
},
};
-#endif /* UCOO_CONFIG_HAL_USB_STREAM_NB >= 2 */
+#endif /* CONFIG_UCOO_HAL_USB_STREAM_NB >= 2 */
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 3
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 3
static const struct usb_endpoint_descriptor usb_desc_endp_3[] = {
{
@@ -124,7 +124,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_3[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x03,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
{
@@ -132,7 +132,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_3[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x83,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
};
@@ -153,9 +153,9 @@ static const struct usb_interface_descriptor usb_desc_iface_3[] = {
},
};
-#endif /* UCOO_CONFIG_HAL_USB_STREAM_NB >= 3 */
+#endif /* CONFIG_UCOO_HAL_USB_STREAM_NB >= 3 */
-#if UCOO_CONFIG_HAL_USB_STREAM_NB > 3
+#if CONFIG_UCOO_HAL_USB_STREAM_NB > 3
# error "too many streams requested"
#endif
@@ -164,13 +164,13 @@ static const struct usb_interface usb_desc_ifaces[] = {
.num_altsetting = 1,
.altsetting = usb_desc_iface_1,
},
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 2
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 2
{
.num_altsetting = 1,
.altsetting = usb_desc_iface_2,
},
#endif
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 3
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 3
{
.num_altsetting = 1,
.altsetting = usb_desc_iface_3,
@@ -182,11 +182,11 @@ const struct usb_config_descriptor usb_desc_config = {
.bLength = USB_DT_CONFIGURATION_SIZE,
.bDescriptorType = USB_DT_CONFIGURATION,
.wTotalLength = 0,
- .bNumInterfaces = UCOO_CONFIG_HAL_USB_STREAM_NB,
+ .bNumInterfaces = CONFIG_UCOO_HAL_USB_STREAM_NB,
.bConfigurationValue = 1,
.iConfiguration = 0,
- .bmAttributes = 0x80 | (UCOO_CONFIG_HAL_USB_SELF_POWERED ? 0x40 : 0),
- .bMaxPower = UCOO_CONFIG_HAL_USB_MAX_POWER / 2,
+ .bmAttributes = 0x80 | (CONFIG_UCOO_HAL_USB_SELF_POWERED ? 0x40 : 0),
+ .bMaxPower = CONFIG_UCOO_HAL_USB_MAX_POWER / 2,
.interface = usb_desc_ifaces,
};
diff --git a/ucoo/intf/Module b/ucoo/intf/Module
index fb0aec1..db0f820 100644
--- a/ucoo/intf/Module
+++ b/ucoo/intf/Module
@@ -1 +1 @@
-intf_SOURCES = stream.cc spi_master.cc lcd.cc
+ucoo_intf_SOURCES = stream.cc spi_master.cc lcd.cc
diff --git a/ucoo/utils/Module b/ucoo/utils/Module
index a37070f..1d101e4 100644
--- a/ucoo/utils/Module
+++ b/ucoo/utils/Module
@@ -1 +1 @@
-utils_SOURCES := delay.arm.cc crc.cc
+ucoo_utils_SOURCES := delay.arm.cc crc.cc
diff --git a/ucoo/utils/test/Makefile b/ucoo/utils/test/Makefile
index 01fb2ce..e490582 100644
--- a/ucoo/utils/test/Makefile
+++ b/ucoo/utils/test/Makefile
@@ -7,6 +7,6 @@ test_fifo_SOURCES = test_fifo.cc
test_delay_SOURCES = test_delay.cc
test_crc_SOURCES = test_crc.cc
-MODULES = utils base/test hal/usb
+MODULES = ucoo/utils ucoo/base/test ucoo/hal/usb
include $(BASE)/build/top.mk