Skip to content

Commit

Permalink
feat(endpoint): Port endpoint onto WP76xx platform
Browse files Browse the repository at this point in the history
This commit implement the WP76xx platform for the endpoint.

Close DLTcollab#718
  • Loading branch information
splasky committed Jul 28, 2020
1 parent 24f7021 commit 81d1576
Show file tree
Hide file tree
Showing 20 changed files with 134 additions and 342 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,6 @@ _build_endpoint/
endpoint.*.update
.repo
legato/
leaf-data
leaf-workspace.json
*.tgz
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ LEGATO_FLAGS += -DEP_TARGET=$(EP_TARGET)
LEGATO_FLAGS := $(foreach flags, $(LEGATO_FLAGS), -C $(flags))

# Include the build command from the specific target
include endpoint/platform/$(EP_TARGET)/build.mk
ifeq ($(EP_TARGET), simulator)
include endpoint/platform/simulator/build.mk
else
include endpoint/platform/default/build.mk
endif

export EP_TARGET

all: $(DEPS) cert
Expand Down
91 changes: 0 additions & 91 deletions docs/endpoint-hal.md

This file was deleted.

21 changes: 21 additions & 0 deletions endpoint/endpoint.adef
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ processes:
}
}

requires:
{
file:
{
// needed for networking:
/etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
/etc/nsswitch.conf /etc/
/etc/hosts /etc/
/etc/resolv.conf /etc/

/bin/sh /bin/sh
/bin/date /bin/date
}
device:
{
[rw] /dev/null /dev/null
[r] /dev/urandom /dev/urandom
[r] /dev/random /dev/random
}
}

#if ${LEGATO_TARGET} = localhost
#else
bindings:
Expand Down
7 changes: 5 additions & 2 deletions endpoint/endpointComp/Component.cdef
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
sources:
{
${CURDIR}/../endpoint_core.c
${CURDIR}/../hal/device.c

// include the specific platform
${CURDIR}/../platform/${EP_TARGET}/impl.c
#if ${LEGATO_TARGET} = localhost
${CURDIR}/../platform/simulator/impl.c
#else
${CURDIR}/../platform/default/impl.c
#endif

${CURDIR}/../../output_base/external/org_iota_common/utils/logger_helper.c

Expand Down
15 changes: 6 additions & 9 deletions endpoint/endpointComp/endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
*/

#include "endpoint.h"
#include "hal/device.h"

#include "common/ta_errors.h"
#include "endpoint/cipher.h"
#include "endpoint/endpoint_core.h"
#include "endpoint/platform/impl.h"

#include "le_test.h"
#include "legato.h"

Expand Down Expand Up @@ -125,15 +126,12 @@ COMPONENT_INIT {
memcpy(iv, test_iv, AES_IV_SIZE);
srand(time(NULL));

device_t* device = ta_device(STRINGIZE(EP_TARGET));
if (device == NULL) {
LE_ERROR("Can not get specific device");
} else {
device->op->get_key(private_key);
device->op->get_device_id(device_id);
get_device_key(private_key);
get_device_id(device_id);

#ifdef ENABLE_ENDPOINT_TEST
LE_TEST_INIT;
LE_TEST_INFO("=== ENDPOINT TEST BEGIN ===");
LE_INFO("=== ENDPOINT TEST BEGIN ===");
LE_TEST(SC_OK == send_transaction_information(host, port, ssl_seed, value, message, message_fmt, tag, address,
next_address, private_key, device_id_ptr, iv));
LE_TEST_EXIT;
Expand All @@ -146,5 +144,4 @@ COMPONENT_INIT {
sleep(10);
}
#endif
}
}
10 changes: 0 additions & 10 deletions endpoint/hal/BUILD

This file was deleted.

62 changes: 0 additions & 62 deletions endpoint/hal/device.c

This file was deleted.

9 changes: 0 additions & 9 deletions endpoint/platform/BUILD

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
# "LICENSE" at the root of this distribution.

platform-build-command = \
cd endpoint && leaf shell -c "mkapp -v -t wp77xx $(LEGATO_FLAGS) endpoint.adef"
cd endpoint && \
leaf shell -c "mkapp -t $(LEGATO_TARGET) $(LEGATO_FLAGS) endpoint.adef"
Loading

0 comments on commit 81d1576

Please sign in to comment.