Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate XPCC system_tools from :build:scons module #58

Merged
merged 5 commits into from
Aug 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
command: |
python2 tools/scripts/authors.py --handles --count --shoutout --since 2017-01-01
python3 tools/scripts/authors.py --handles --count --shoutout --since 2017-01-01
python2 tools/system_design/builder/system_layout.py examples/communication/xml/communication.xml -o /tmp
python3 tools/system_design/builder/system_layout.py examples/communication/xml/communication.xml -o /tmp
python2 tools/xpcc_generator/builder/system_layout.py examples/xpcc/xml/communication.xml -o /tmp
python3 tools/xpcc_generator/builder/system_layout.py examples/xpcc/xml/communication.xml -o /tmp

stm32f0-f1-examples:
docker:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ CMakeLists.txt
examples/**/modm
examples/**/SConstruct
examples/**/Makefile
examples/**/generated
1 change: 0 additions & 1 deletion examples/avr/communication/receiver/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion examples/avr/communication/sender/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <modm/communication/xpcc/abstract_component.hpp>

#include "communication/packets.hpp"
#include <packets.hpp>

namespace component
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ using systemClock = SystemClock;

#include "component_receiver/receiver.hpp"

#include "communication/postman.hpp"
#include "communication/identifier.hpp"
#include <postman.hpp>
#include <identifier.hpp>

// ----------------------------------------------------------------------------
// Logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<options>
<option name=":target">atmega644</option>
<option name=":platform:clock:f_cpu">14745600</option>
<option name=":build:build.path">../../../../build/avr/communication/sender</option>
<option name=":build:scons:xpcc.source">../../../communication/xml/communication.xml</option>
<option name=":build:scons:xpcc.container">sender</option>
<option name=":build:build.path">../../../../build/avr/xpcc/receiver</option>
<option name="::xpcc:generator:source">../../../xpcc/xml/communication.xml</option>
<option name="::xpcc:generator:container">receiver</option>
</options>
<modules>
<module>:communication:xpcc</module>
<module>:communication:xpcc:generator</module>
<module>:debug</module>
<module>:driver:mcp2515</module>
<module>:platform:clock</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#undef MODM_LOG_LEVEL
#define MODM_LOG_LEVEL modm::log::DEBUG

#include "communication/identifier.hpp"
#include "communication/packets.hpp"
#include <identifier.hpp>
#include <packets.hpp>

#include "sender.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <modm/communication/xpcc/abstract_component.hpp>
#include <modm/processing/timer.hpp>

#include "communication/packets.hpp"
#include <packets.hpp>

namespace component
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ using systemClock = SystemClock;

#include "component_sender/sender.hpp"

#include "communication/postman.hpp"
#include "communication/identifier.hpp"
#include <postman.hpp>
#include <identifier.hpp>

// ----------------------------------------------------------------------------
// Logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<options>
<option name=":target">atmega644</option>
<option name=":platform:clock:f_cpu">14745600</option>
<option name=":build:build.path">../../../../build/avr/communication/receiver</option>
<option name=":build:scons:xpcc.source">../../../communication/xml/communication.xml</option>
<option name=":build:scons:xpcc.container">receiver</option>
<option name=":build:build.path">../../../../build/avr/xpcc/sender</option>
<option name="::xpcc:generator:source">../../../xpcc/xml/communication.xml</option>
<option name="::xpcc:generator:container">sender</option>
</options>
<modules>
<module>:communication:xpcc</module>
<module>:communication:xpcc:generator</module>
<module>:debug</module>
<module>:driver:mcp2515</module>
<module>:platform:clock</module>
Expand Down
1 change: 0 additions & 1 deletion examples/linux/communication/basic/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <modm/communication/xpcc/abstract_component.hpp>

#include "communication/packets.hpp"
#include <packets.hpp>

namespace component
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
#undef MODM_LOG_LEVEL
#define MODM_LOG_LEVEL modm::log::DEBUG

#include "communication/identifier.hpp"
#include "communication/packets.hpp"
#include <identifier.hpp>

#include "sender.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <modm/communication/xpcc/abstract_component.hpp>
#include <modm/processing/timer.hpp>

#include "communication/packets.hpp"
#include <packets.hpp>

namespace component
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include "component_receiver/receiver.hpp"
#include "component_sender/sender.hpp"

#include "communication/postman.hpp"
#include "communication/identifier.hpp"
#include <postman.hpp>
#include <identifier.hpp>

// Use TIPC on Linux only
// xpcc::TipcConnector connector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

<options>
<option name=":target">hosted-linux</option>
<option name=":build:build.path">../../../../build/linux/communication/basic</option>
<option name=":build:scons:xpcc.source">../../../communication/xml/communication.xml</option>
<option name=":build:scons:xpcc.container">sender receiver</option>
<option name=":build:build.path">../../../../build/linux/xpcc/basic</option>
<option name=":communication:xpcc:generator:source">../../../xpcc/xml/communication.xml</option>
<option name=":communication:xpcc:generator:container">sender receiver</option>
</options>
<modules>
<module>:platform:core</module>
<module>:communication:xpcc</module>
<module>:communication:xpcc:generator</module>
<module>:debug</module>
<module>:build:scons</module>
</modules>
Expand Down
1 change: 0 additions & 1 deletion examples/zmq/1_stm32/.gitignore

This file was deleted.

6 changes: 3 additions & 3 deletions examples/zmq/1_stm32/component_odometry/odometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#undef MODM_LOG_LEVEL
#define MODM_LOG_LEVEL modm::log::DISABLED

#include "communication/identifier.hpp"
#include "communication/packets.hpp"
#include "communication/communication.hpp"
#include <identifier.hpp>
#include <packets.hpp>
#include <communication.hpp>

#include "odometry.hpp"

Expand Down
2 changes: 1 addition & 1 deletion examples/zmq/1_stm32/component_odometry/odometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <modm/communication/xpcc/abstract_component.hpp>
#include <modm/processing/timer.hpp>

#include "communication/packets.hpp"
#include <packets.hpp>

namespace component
{
Expand Down
4 changes: 2 additions & 2 deletions examples/zmq/1_stm32/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

#include "component_odometry/odometry.hpp"

#include "communication/postman.hpp"
#include "communication/identifier.hpp"
#include <postman.hpp>
#include <identifier.hpp>

using namespace Board;

Expand Down
6 changes: 3 additions & 3 deletions examples/zmq/1_stm32/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<extends>../../../src/modm/board/disco_f407vg/board.xml</extends>
<options>
<option name=":build:build.path">../../../build/zmq/1_stm32</option>
<option name=":build:scons:xpcc.source">../../communication/xml/communication.xml</option>
<option name=":build:scons:xpcc.container">odometry</option>
<option name=":communication:xpcc:generator:source">../../xpcc/xml/communication.xml</option>
<option name=":communication:xpcc:generator:container">odometry</option>
</options>
<modules>
<module>:communication:xpcc</module>
<module>:communication:xpcc:generator</module>
<module>:platform:can:1</module>
<module>:platform:gpio</module>
<module>:platform:timer:1</module>
Expand Down
1 change: 0 additions & 1 deletion examples/zmq/3_zmq_app/.gitignore

This file was deleted.

6 changes: 3 additions & 3 deletions examples/zmq/3_zmq_app/component_gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

#include <modm/debug/logger.hpp>

#include "communication/identifier.hpp"
#include "communication/packets.hpp"
#include "communication/communication.hpp"
#include <identifier.hpp>
#include <packets.hpp>
#include <communication.hpp>

#include "gui.hpp"

Expand Down
2 changes: 1 addition & 1 deletion examples/zmq/3_zmq_app/component_gui/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <modm/communication/xpcc/abstract_component.hpp>
#include <modm/processing/timer.hpp>

#include "communication/packets.hpp"
#include <packets.hpp>

namespace component
{
Expand Down
4 changes: 2 additions & 2 deletions examples/zmq/3_zmq_app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

#include "component_gui/gui.hpp"

#include "communication/postman.hpp"
#include "communication/identifier.hpp"
#include <postman.hpp>
#include <identifier.hpp>

/**
* Simple subscriber with zeromq.
Expand Down
6 changes: 3 additions & 3 deletions examples/zmq/3_zmq_app/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<options>
<option name=":target">hosted-linux</option>
<option name=":build:build.path">../../../build/zmq/3_zmq_app</option>
<option name=":build:scons:xpcc.source">../../communication/xml/communication.xml</option>
<option name=":build:scons:xpcc.container">gui</option>
<option name=":communication:xpcc:generator:source">../../xpcc/xml/communication.xml</option>
<option name=":communication:xpcc:generator:container">gui</option>
</options>
<modules>
<module>:communication:xpcc</module>
<module>:communication:xpcc:generator</module>
<module>:debug</module>
<module>:platform:core</module>
<module>:build:scons</module>
Expand Down
31 changes: 12 additions & 19 deletions tools/build_script_generator/scons/module.lb
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,6 @@ def prepare(module, options):
module.add_option(
StringOption(name="image.source", default="",
description="Path to the image folder"))
module.add_option(
StringOption(name="xpcc.source", default="",
description="Path to the XPCC source file"))
module.add_option(
StringOption(name="xpcc.container", default="",
description="Name of the XPCC container to generate for"))
module.add_option(
StringOption(name="xpcc.generate", default="communication",
description="Path to the XPCC generated folder"))
module.add_option(
StringOption(name="xpcc.namespace", default="robot",
description="Namespace of the generated XPCC communications"))

module.add_option(
EnumerationOption(name="info.git", default="Disabled",
enumeration=["Disabled", "Info", "Info+Status"],
Expand Down Expand Up @@ -76,6 +63,8 @@ def build(env):

def post_build(env, buildlog):
is_unittest = env.has_module(":test")
has_xpcc_generator = env.has_module(":communication:xpcc:generator")
has_image_source = len(env[":::image.source"])

target = env["modm:target"]
subs = common_target(target)
Expand All @@ -88,9 +77,9 @@ def post_build(env, buildlog):
"cmake_wrapper",
"qtcreator",
]
if len(env[":::xpcc.source"]):
build_tools += ["system_design"]
if len(env[":::image.source"]):
if has_xpcc_generator:
build_tools += ["xpcc_generator"]
if has_image_source:
build_tools += ["bitmap"]
if env[":::info.git"] != "Disabled" or env[":::info.build"]:
build_tools += ["info"]
Expand All @@ -116,6 +105,13 @@ def post_build(env, buildlog):
"metadata": buildlog.metadata,
"build_tools": build_tools,
"is_unittest": is_unittest,
"has_image_source": has_image_source,
"image_source": env[":::image.source"],
"has_xpcc_generator": has_xpcc_generator,
"generator_source": env.get_option(":communication:xpcc:generator:source", ""),
"generator_container": env.get_option(":communication:xpcc:generator:container", ""),
"generator_path": env.get_option(":communication:xpcc:generator:path", ""),
"generator_namespace": env.get_option(":communication:xpcc:generator:namespace", ""),
})
# Set these substitutions for all templates
env.substitutions = subs
Expand All @@ -137,9 +133,6 @@ def post_build(env, buildlog):
# Copy the scons-build-tools
env.copy(repopath("ext/dlr/scons-build-tools"), "ext/dlr/scons-build-tools")
env.copy("site_tools", "scons/site_tools")
# Copy XPCC tools
if "system_design" in build_tools:
env.copy(repopath("tools/system_design"), "tools/system_design")

# these are the ONLY files that are allowed to NOT be namespaced with modm!
env.outbasepath = "."
Expand Down
2 changes: 1 addition & 1 deletion tools/build_script_generator/scons/resources/SConscript.in
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ env.SetDefault(CONFIG_OPENOCD_COMMANDS = [
%% endif

# XPCC generator tool path
env["XPCC_SYSTEM_DESIGN"] = join(abspath("."), "tools", "system_design")
env["XPCC_SYSTEM_DESIGN"] = join(abspath("."), "tools", "xpcc_generator")

# Toolchain configuration
%% macro generate_flags_for_profile(name, profile, append=False)
Expand Down
35 changes: 22 additions & 13 deletions tools/build_script_generator/scons/resources/SConstruct.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,43 @@ env.InfoBuild()
headers = env.FindHeaderFiles(join(modm_path, "test"))
sources = env.UnittestRunner(target="main.cpp", source=headers, template="modm/test/runner.cpp.in")
%% else
# Finding application sources
env.Append(CPPPATH=".")
sources = env.FindSourceFiles(".", ignorePaths=["modm", "cmake-build-*", "build"])
ignored = ["modm", "cmake-build-*", "build"]
sources = []
%% endif

%% if options[":::image.source"] != ""
# Finding image sources
for image in env.FindFiles("{{ options[":::image.source"] }}", ".pbm"):
%% if has_image_source
# Generating image sources
env.Append(CPPPATH="{{ image_source }}")
ignored.append("{{ image_source }}")
for image in env.FindFiles("{{ image_source }}", ".pbm"):
source, _ = env.Bitmap(str(image))
sources.append(source)
%% endif
%% if options[":::xpcc.source"] != ""
%% if has_xpcc_generator
# Generating XPCC sources
env.Append(CPPPATH="{{ generator_path }}")
ignored.append("{{ generator_path }}")
sources += env.XpccCommunication(
xmlfile=abspath("{{ options[":::xpcc.source"] }}"),
container="{{ options[":::xpcc.container"] }}",
path=abspath("{{ options[":::xpcc.generate"] }}"),
namespace="{{ options[":::xpcc.namespace"] }}")
xmlfile=abspath("{{ generator_source }}"),
container="{{ generator_container }}",
path=abspath("{{ generator_path }}"),
namespace="{{ generator_namespace }}")
%% endif

%% if not is_unittest
# Finding application sources
sources += env.FindSourceFiles(".", ignorePaths=ignored)
%% endif

# Building application
program = env.Program(target=project_name+".elf", source=sources)

%% if openocd_file != ""
# Using a custom OpenOCD script
env.Append(CONFIG_OPENOCD_SEARCHDIRS=[abspath("{{openocd_base_dir}}")])
env.Append(CONFIG_OPENOCD_CONFIGFILES=["{{openocd_file}}"])
%% endif
%#
# Building application
program = env.Program(target=project_name+".elf", source=sources)

# SCons functions
env.Alias("cmakewrapper", env.CMakeWrapper())
Expand Down
Loading