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.

[WIP] Connect success, Try to deploy on buildkite.

Close DLTcollab#718
  • Loading branch information
splasky committed Jul 29, 2020
1 parent 556cb72 commit d93ecfd
Show file tree
Hide file tree
Showing 20 changed files with 161 additions and 348 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.

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

requires:
{
file:
{
// needed for curl itself:
/etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
/usr/bin/curl /usr/bin/curl

// needed for networking:
/lib/libnss_compat.so.2 /lib/
/lib/libnss_files.so.2 /lib/
/lib/libnss_dns.so.2 /lib/
/lib/libresolv.so.2 /lib/
/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:
{
endpoint.endpointComp.le_secStore -> secStore.le_secStore
endpoint.endpointComp.le_sim -> modemService.le_sim
endpoint.endpointComp.le_mdc -> modemService.le_mdc
endpoint.endpointComp.le_data -> dataConnectionService.le_data
}
#endif

Expand Down
9 changes: 7 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 Expand Up @@ -102,6 +105,8 @@ requires:
{
le_secStore.api
modemServices/le_sim.api
modemServices/le_mdc.api
le_data.api [manual-start]
}
}
#endif
42 changes: 22 additions & 20 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,26 +126,27 @@ 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_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;
LE_TEST_INIT;
LE_INFO("=== ENDPOINT TEST BEGIN ===");
status_t ret = send_transaction_information(host, port, ssl_seed, value, message, message_fmt, tag, address,
next_address, private_key, device_id_ptr, iv);

if (ret == SC_OK)
printf("success\n");
else
printf("failed\n");
LE_TEST_EXIT;
#else
while (true) {
// TODO: listen input from UART here
status_t ret = send_transaction_information(host, port, ssl_seed, value, message, message_fmt, tag, address,
next_address, private_key, device_id_ptr, iv);
LE_INFO("Send transaction information return: %d", ret);
sleep(10);
}
#endif
while (true) {
// TODO: listen input from UART here
status_t ret = send_transaction_information(host, port, ssl_seed, value, message, message_fmt, tag, address,
next_address, private_key, device_id_ptr, iv);
LE_INFO("Send transaction information return: %d", ret);
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 $(EP_TARGET) $(LEGATO_FLAGS) -i ${LEGATO_ROOT}/interfaces/modemServices endpoint.adef"
Loading

0 comments on commit d93ecfd

Please sign in to comment.