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

added support for platformio #7

Closed
wants to merge 9 commits into from
Closed

Conversation

pinkit-cwa
Copy link

CovidBracelet was moved to platformio.

PlatformIO is a framework that supports a lot of embedded development platforms, inluding esp-idf as well as zephyr.

One drawback is that PlaformIO is using esp-idf v4.0.1 instead of v4.1. That is why I had to downgrade wifi.c to esp-idf v4.0 API. I am not sure if my implementation is correct - cannot test because I do not yet have a suitable board.

I implemented this switch by converting wifi.c into a directory with various implementations - in this case two different esp-idf versions. I intend to do the same for bluetooth support for esp-idf vs. zephyr.

@@ -1,3 +1,4 @@
.pio
Copy link
Author

Choose a reason for hiding this comment

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

.pio is PlatformIO's build directory

.local
Copy link
Author

Choose a reason for hiding this comment

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

added line feed at EOF

)
Copy link
Author

Choose a reason for hiding this comment

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

added line feed at EOF

@@ -1,8 +1,8 @@
idf_component_register(
SRCS
"wifi-controller.c"
"espidf-v4.1.c"
Copy link
Author

Choose a reason for hiding this comment

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

created two versions of wifi-controller.c: one using API version 4.0 and one using API version 4.1.
4.1 is identical to wifi-controller.c and used for "latest" esp-idf.
4.0 is used for PlatformIO, as PlatformIOuses esp-idf 4.0.1

return &current_wifi_ap;
}
return NULL;
}
Copy link
Author

Choose a reason for hiding this comment

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

Please compare this files contents with espidf-v4.1.c, and confirm that there are no unintentional changes.
Intention was to build a version for API version 4.0.

}
Copy link
Author

Choose a reason for hiding this comment

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

added line feed at EOF

* Once-Only Headers
* Computed Includes

https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
Copy link
Author

Choose a reason for hiding this comment

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

automaticallly generated by "platformio init"

*/
#ifndef MBEDTLS_HKDF_C
#define MBEDTLS_HKDF_C
#endif
Copy link
Author

Choose a reason for hiding this comment

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

Used to turn on HKDF in esp-idf 4.0 contained mbedTLS.

This is included at the end of mbedtls/esp_config.h via
-DMBEDTLS_USER_CONFIG_FILE=\"mbedtls+HKDF.h\"
. See platformio.ini .

libraries scanning project source files.

More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html
Copy link
Author

Choose a reason for hiding this comment

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

automaticallly generated by "platformio init"

; https://docs.platformio.org/page/projectconf.html

[platformio]
src_dir = main
Copy link
Author

Choose a reason for hiding this comment

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

platformio default source directory is "src". This is used to adjust to esp-idf preference of "main".

[env]
build_flags =
-Iinclude/tls_config
-DFRAMEWORK_$PIOFRAMEWORK
Copy link
Author

Choose a reason for hiding this comment

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

[env] section contains defaults for all platforms; must still be explicitly referenced using ${env. ... }, see below.

-DMBEDTLS_USER_CONFIG_FILE=\"mbedtls+HKDF.h\"
board_build.embed_files =
components/ena/test/export.bin
components/ena-cwa/certs/telekom.pem
Copy link
Author

Choose a reason for hiding this comment

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

CMakeLists.txt are parsed differently than in esp-idf. This is compensated here.

-Iinclude -DMBEDTLS_USER_CONFIG_FILE="mbedtls+HKDF.h"
is used to enable HKDF.

board_build.embed_files is PlatformIOs way for including verbatim file contents into build result.

# For testing: -DUNITY_EXCLUDE_SETJMP_H=1
-DEN_INCLUDE_ZEPHYR_DEPS=1
-DEN_INIT_MBEDTLS_ENTROPY=0
lib_deps = exposure-notification
Copy link
Author

Choose a reason for hiding this comment

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

does not work yet, and probably will be hard to implement. This platform is a 15EUR nRF51822 based over-the-air-flashable fitness tracker bracelet.
Just 32kBytes of RAM and 256kBytes of flash. Might be enough for a "tracking only" device for a few days, with off-loading to and risk calculation on smartphone.

# For testing: -DUNITY_EXCLUDE_SETJMP_H=1
-DEN_INCLUDE_ZEPHYR_DEPS=1
-DEN_INIT_MBEDTLS_ENTROPY=0
lib_deps = exposure-notification
Copy link
Author

Choose a reason for hiding this comment

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

This is the platform used for CovidBracelet

-Wno-nullability-completeness
-DMBEDTLS_USER_CONFIG_FILE='"user-tls.conf"'
src_filter = --<.src/>
targets = test
Copy link
Author

Choose a reason for hiding this comment

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

This is for unit-tests on the local machine.

in the development cycle.

More information about PIO Unit Testing:
- https://docs.platformio.org/page/plus/unit-testing.html
Copy link
Author

Choose a reason for hiding this comment

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

automaticallly generated by "platformio init"

@Lurkars
Copy link
Owner

Lurkars commented Sep 12, 2020

merged into new branch 'zephyr'

@Lurkars Lurkars closed this Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants