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

Undeclared variable makes the OTA update compile fail. #413

Closed
burtonkent opened this issue May 21, 2022 · 3 comments
Closed

Undeclared variable makes the OTA update compile fail. #413

burtonkent opened this issue May 21, 2022 · 3 comments

Comments

@burtonkent
Copy link

Steps to reproduce if you already have Lua-RTOS-ESP32 set up to 'make':

  1. make clean to clear out past makes.
  2. make
  3. choose 8 (Espressif Systems ESP-WROVER-KIT)
  4. choose 2 (Espressif Systems ESP-WROVER-KIT with OTA)
  5. Will warn about not being able to remove directories because they're not empty. It's fine.
  6. Fails in components/sys/drivers/net.c because the variable total isn't declared before use on line 513.
    The error given is:
Lua-RTOS-ESP32/components/sys/drivers/net.c: In function 'net_ota':
<development path I'm using>/Lua-RTOS-ESP32/components/sys/drivers/net.c:513:78: error: 'total' undeclared (first use in this function)
                 int pct = (int)(((float)(address-update_partition->address))/total*100);

It's strange because git blame shows:
b22ddc9 components/sys/drivers/net.c (the0ne 2020-01-09 07:43:20 +0100 513) int pct = (int)(((float)(address-update_partition->address))/*100);
Note the 2020 commit date. I'm surprised this wasn't found as a bug before. I have to wonder if this is my error somehow.

@burtonkent
Copy link
Author

Also I did try searching back through the commit history to see if total's declaration was somehow deleted, causing the bug. I used:

git log -Gtotal components/sys/drivers/net.c

And it was added at the one commit and never changed.

@the0ne
Copy link
Collaborator

the0ne commented May 24, 2022

Oh, that's sad.
This probably has to do with the discussion around #238 that has lead to not merging it yet.
Despite that, it shouldn't have happened of cause.

Please try to cherry-pick/merge the corresponding commits into your source tree. Will it build afterwards?

Alternatively, you could just comment out the two lines:

                int pct = (int)(((float)(address-update_partition->address))/total*100);
                if (0 == pct%10) esp_task_wdt_reset();

@the0ne
Copy link
Collaborator

the0ne commented Dec 2, 2022

Fixed with 6b455df - closing.
Thanks for reporting the issue!

@the0ne the0ne closed this as completed Dec 2, 2022
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

No branches or pull requests

2 participants