Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

feat(endpoint): Support wp76xx based platforms #719

Closed
wants to merge 1 commit into from
Closed
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
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify the commands with

include endpoint/platform/$(EP_TARGET)/build.mk

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 && \
mkapp -t $(EP_TARGET) $(LEGATO_FLAGS) -i ${LEGATO_ROOT}/interfaces/modemServices endpoint.adef
Loading