Coder Social home page Coder Social logo

Comments (7)

FredrikFornstad avatar FredrikFornstad commented on June 22, 2024

The terminal script cannot change the boot partition setting that is stored in a dedicated partition (at least not without modification). The magic byte in RAM is a special libwebsocket tweak, but it does not alter the "boot indicator".
You should

  1. Install the factory using the terminal, The esp32 will then automatically boot up (factory)
  2. Then connect to the esp32 own WiFi AP from your PC or smartphone
  3. With a web browser in your connected PC/Smartphone surf to the esp32 (192.168.4.1)
    3b. If the app binary is not on the device with the browser, then configure a WiFi network that the esp32 should camp on. After that, connect to the esp32 from the PC that has the app binary on the hard drive.
  4. Go to the firmware web page, select your app-bin on your hard drive and upload.
  5. The esp32 will now boot the app (and from here on you can use the terminal script to flash either the factory-app or the test-demos-app however I prefer to always use the web).

from lws-esp32-factory.

nodi-andy avatar nodi-andy commented on June 22, 2024

hi,
i know these 5 steps, you have described. But i think a litte change in code should provide my solution, if i could set force_factory = 0; in file bootloader_start.c using the pointer
uint32_t *p_force_factory_magic = (uint32_t *)LWS_MAGIC_REBOOT_TYPE_ADS;

I would say, default behaviour should be:

is there a app.bin : yes > did app.bin ordered a return-to-factory: no == > also start the app
else start the firmware

This makes more sense, if i clean the memory, burn factory and app, than the app should started. No app, ofcourse factory

It will be also ok, if i can force it via changing the code, but settings force_factory=0 didnt help.

thanks

from lws-esp32-factory.

FredrikFornstad avatar FredrikFornstad commented on June 22, 2024

I guess you could modify the bootloader to do what you want and write data into the ota-data partition accordingly, or maybe skip reading the ota-data partition completely. But that is not how it is done now. With an empty ota-data partition, it does not matter what the force_factory_magic is set to in the current setup if I understand it correctly.

from lws-esp32-factory.

nodi-andy avatar nodi-andy commented on June 22, 2024

you are right and i want to achiev it, but it doesnt work. I override force_factory = 0; in function bootloader_main() but still factory is booted instead of ota-app. And i can not backtrace since i cannot find the code where factory ends end ota-app boots. This is exactly my problem.

from lws-esp32-factory.

FredrikFornstad avatar FredrikFornstad commented on June 22, 2024

I think you should read a bit about OTA updates and partition tables in the esp-idf documentation. Like I said, "force_factory" has nothing to do with this.

In bootloader_start_c on row 70 the program loads the stored data about preferred app to boot. However in your case, that partition is empty (since you have only flashed via terminal). So boot_index will point at the factory-partition by default. Finally at row 96 it will load Factory, independent of what you do with "force_factory".

Now if you either create the ota-data partition before row 70, or try setting boot_index to 1 (I am just guessing) in row 96, it might work.

from lws-esp32-factory.

nodi-andy avatar nodi-andy commented on June 22, 2024

here is our difference:

However in your case, that partition is empty (since you have only flashed via terminal).

no. I upload bootloader, factory and app with a single terminal command. My esp32 is ready-to-ship.

now with your hints, i searched and found the function "get_selected_boot_partition" should not return FACTORY_INDEX but a valid "ota_slot". I think, i have to trace what i have to change (except force_factory) to get a valid ota_slot. Unfortunately i have no debug environment ...

from lws-esp32-factory.

FredrikFornstad avatar FredrikFornstad commented on June 22, 2024

Your statement:

no. I upload bootloader, factory and app with a single terminal command. My esp32 is ready-to-ship.

suggests that you have not read and understood the esp-idf documentation about OTA updates and partitions. Do you realize the difference between ota-data partition and the ota_0 partition? I am sure that you have flashed the ota_0 partition, but unless you have invented something special, the ota-data partition is empty after your flashing and when the bootloader finds that the ota-data partition is empty it WILL default to factory.

from lws-esp32-factory.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.