-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Esp insights library support #7566
Conversation
Tagging @shahpiyushv and @vikramdattu |
1a9a9f4
to
8210dd3
Compare
lib-builder changes are merged in master (and pulled here) |
6b88ede
to
2456199
Compare
The errors are coming from esp-insights repo. Some changes are required in esp-insights for this pipeline to pass. MR for these changes has been raised. |
Then this means that even the changes in lib-builder were too early to post. When will that MR get merged and changes available on github? |
The MR should get merged in this week. |
@sanketwadekar after a couple of minor fixes, CI is passing. Onto review :) |
@@ -0,0 +1,767 @@ | |||
############ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pedrominatel PTAL
if (s_reset_count > MAX_CRASHES) { | ||
ESP_DIAG_EVENT(TAG, "[count][%d]", count); | ||
} else { | ||
log_e("[count][%d] [crash_count][%"PRIu32"] [excvaddr][0x0f] Crashing...", count, s_reset_count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warnings are generated if there is no space between quoted text/defines.
log_e("[count][%d] [crash_count][%" PRIu32 "] [excvaddr][0x0f] Crashing...", count, s_reset_count);
void *p = malloc(size); | ||
if (p) { | ||
memset(p, size, 'A' + (esp_random() % 26)); | ||
log_i("Allocated %"PRIu32" bytes", size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same note as above
libraries/Insights/examples/DiagnosticsSmokeTest/DiagnosticsSmokeTest.ino
Show resolved
Hide resolved
Serial.begin(115200); | ||
WiFi.mode(WIFI_STA); | ||
WiFi.begin(WIFI_SSID, WIFI_PASSPHRASE); | ||
if(!WiFi.isConnected()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same note about how to wait for WiFi connect
platform.txt
Outdated
@@ -24,6 +24,9 @@ tools.esp_ota.cmd.windows="{runtime.platform.path}/tools/espota.exe" -r | |||
tools.gen_esp32part.cmd=python3 "{runtime.platform.path}/tools/gen_esp32part.py" | |||
tools.gen_esp32part.cmd.windows="{runtime.platform.path}/tools/gen_esp32part.exe" | |||
|
|||
tools.gen_insights_pkg.cmd = python3 {runtime.platform.path}/tools/gen_insights_package.py | |||
tools.gen_insights_pkg.cmd.windows = {runtime.platform.path}/tools/gen_insights_package.exe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you quote and format the commands as the ones above in order to prevent possible path/etc issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get errors if I add quotes
/var/folders/0l/c75rh0953fng_6ccdgnm48gr0000gn/T/arduino_build_640628: -c: line 0: unexpected EOF while looking for matching `"'
/var/folders/0l/c75rh0953fng_6ccdgnm48gr0000gn/T/arduino_build_640628: -c: line 1: syntax error: unexpected end of file
Can you please help me out with this?
Also, I need some help to test this on Windows.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SuGlider please help with testing on Windows
@@ -211,10 +214,15 @@ recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-Wl,--Map={build | |||
recipe.objcopy.partitions.bin.pattern={tools.gen_esp32part.cmd} -q "{build.path}/partitions.csv" "{build.path}/{build.project_name}.partitions.bin" | |||
|
|||
## Create bin | |||
recipe.objcopy.bin.pattern_args=--chip {build.mcu} elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf" | |||
recipe.objcopy.bin.pattern_args=--chip {build.mcu} elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" --elf-sha256-offset 0xb0 -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--elf-sha256-offset 0xb0
Is this change necessary? What does it do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @me-no-dev the sha256
of firmware is needed for debugging by ESP-Insights backend.
esptool.py
from ESP-IDF inserts sha256 by default and is implicit. In case of Arduino however this change was not present. Maybe it was not found useful to add this at the point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ivankravets @valeros PTAL. This is needed for elf2bin part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it will suffice to add a hot fix directly to the PlatformIO build script in this repo until a new version of the core with this feature is released.
@sanketwadekar Please add the following snippet somewhere at the bottom of https://github.com/espressif/arduino-esp32/blob/master/tools/platformio-build.py:
#
# Adjust the `esptoolpy` command in the `ElfToBin` builder with firmware checksum offset
#
action = deepcopy(env["BUILDERS"]["ElfToBin"].action)
action.cmd_list = env["BUILDERS"]["ElfToBin"].action.cmd_list.replace(
"-o", "--elf-sha256-offset 0xb0 -o"
)
env["BUILDERS"]["ElfToBin"].action = action
Also, an extra import should be added at the top of the same file:
from copy import deepcopy
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
platform.txt
Outdated
recipe.objcopy.bin.pattern="{tools.esptool_py.path}/{tools.esptool_py.cmd}" {recipe.objcopy.bin.pattern_args} | ||
recipe.objcopy.bin.pattern.linux=python3 "{tools.esptool_py.path}/{tools.esptool_py.cmd}" {recipe.objcopy.bin.pattern_args} | ||
|
||
## Create Insights Firmware Package | ||
recipe.hooks.objcopy.postobjcopy.1.pattern_args={build.path} {build.project_name} {build.path} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it make more sense to output the zip to the sketch folder instead?
boards.txt
Outdated
@@ -672,6 +672,9 @@ esp32.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 | |||
esp32.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) | |||
esp32.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB | |||
esp32.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 | |||
esp32.menu.PartitionScheme.insights=Insights | |||
esp32.menu.PartitionScheme.insights.build.partitions=insights | |||
esp32.menu.PartitionScheme.insights.upload.maximum_size=3145728 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be added to the other dev boards as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
libraries/Insights/src/Diagnostics.h
Outdated
@@ -0,0 +1,28 @@ | |||
// Copyright 2015-2022 Espressif Systems (Shanghai) PTE LTD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the license header to SPDX format and attribute year 2022 only.
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
libraries/Insights/src/Diagnostics.h
Outdated
}; | ||
|
||
extern DiagnosticsClass Diagnostics; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: new lines missing at multiple places
libraries/Insights/src/Metrics.cpp
Outdated
@@ -0,0 +1,139 @@ | |||
#include "sdkconfig.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add license header to all files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
7e20e56
to
98ae75c
Compare
@@ -4,4 +4,5 @@ otadata, data, ota, 0xe000, 0x2000, | |||
app0, app, ota_0, 0x10000, 0x300000, | |||
app1, app, ota_1, 0x310000,0x300000, | |||
ffat, data, fat, 0x610000,0x9F0000, | |||
# to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage | |||
coredump, data, coredump, , 64K, | |||
# to create/use ffat, see https://github.com/marcmerlin/esp32_fatfsimage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you do not lower the size of the last partition, coredump will end up outside of the flash chip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would leaving it blank cause it to automatically take up the rest of the space?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afraid not. You do need to subtract 64K from the size
tools/partitions/insights.csv
Outdated
nvs, data, nvs, 0x9000, 0x5000, | ||
otadata, data, ota, 0xe000, 0x2000, | ||
ota_0, app, ota_0, 0x10000, 0x1E0000, | ||
coredump, data, coredump, , 64K, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not need this anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested any Insights examples with other partitions? If it works well, then this can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not tried because look at my previous comment: "if you do not lower the size of the last partition, coredump will end up outside of the flash chip"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are my comments and suggestions, otherwise LGTM.
After upgrading Wokwi to arduino-esp32 2.0.6, users started getting the following errors in the serial monitor:
the code still runs successfully. I'm not sure if we should add a core dump partition to the default partition table that Wokwi generates? |
Hi @urish . I guess github does not remove the string "Draft:" even thou it added it. Anyway, this is already a part of 2.0.6, so please add a 64KB coredump partition to wokwi |
Thanks! Now getting:
Should we also initialize the partition somehow? |
Never mind, it turns out the partition offset was incorrect. Now it works well! |
Description of Change
This PR brings library support for ESP Insights in Arduino.
Tests scenarios
I have tested this library on esp32 dev module.
Related links
Depends on other PRs
espressif/esp32-arduino-lib-builder#100
#7567