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

esphttpd OTA makfile problem? #20

Open
iivancev opened this issue Aug 26, 2019 · 2 comments
Open

esphttpd OTA makfile problem? #20

iivancev opened this issue Aug 26, 2019 · 2 comments

Comments

@iivancev
Copy link

Hi,

First of all I would like to thank you for esphttpd project. It's a great project and I learned a lot from it.

I have created my own application based on esphttpd and I compile it against NONOS SDK v2.2.0
I am also using the SDK's latest default.bin and bootloader.bin.
My application has just slightly more web-pages than original esphttpd
In makefile, I choose separate mode, and application works perfectly.

However, when I build project as a OTA, some problems arise:
(I am putting user1.bin to 0x01000 and user2bin to 0x81000.)
(I am using 32mbit ESP board)
(I am compiling with ESP_FLASH_SIZE=1024)

  1. Code compiles and gets executed but webpages are not displayed. reported error is "Magic Mismatch. EspFs image is broken" and 404 not found is displayed in the browser.

I've then decided to take a look into makefile and found that when i change this line:
[code]ldscript_memspecific.ld:
$(vecho) "GEN $@"
$(Q) echo "MEMORY { irom0_0_seg : org = 0x40240000, len = "$$(printf "0x%X" $$(($(ESP_SPI_FLASH_SIZE_K)*1024-0x4000)))" }"> ldscript_memspecific.ld[/code]

to something like this:

[code]ldscript_memspecific.ld:
$(vecho) "GEN $@"
$(Q) echo "MEMORY { irom0_0_seg : org = 0x40240000, len = 0x6B000 }"> ldscript_memspecific.ld[/code]

Suddenly if user2.bin is flashed. The code works and pages are displayed correctly.
However if I flash only user1.bin, the webpages are again not displayed, but code is working.

What is happening here? Can you please help. I've lost 3 days and have no more clues what can i try. I only have elementary knowledge on makefiles, and can't do much without further help.

Thank you very much for any help.

@mharizanov
Copy link

Obviously, your code is looking for the espfs at the wrong offset. Flashing user2.bin provides the espfs data at that address, so it works.

Check what webpages_espfs_start or ESPFS_POS is being provided and adjust for this memory map.

I had the opposite situation where bin1 worked, and bin2 not, fixed it this way:

	char * espfs = webpages_espfs_start;
	if(system_upgrade_userbin_check()) {
		espfs+=0x100000; //offset for user2.bin, only needed for flash map 5 (1024+1024)
	}
	espFsInit((void*)(espfs));

@iivancev
Copy link
Author

EspFsInitResult res = espFsInit(webpages_espfs_start); os_printf("espFsInit %s\n", res?"ERR":"ok"); os_printf("ESPFS_START: %d,ESPFS_END: %d,ESPFS_SIZE: %d\n",(int)webpages_espfs_start,(int)webpages_espfs_end,(int)webpages_espfs_size);

I Get unexpected results:
"ESPFS_START: 1076604932,ESPFS_END: 1076700236,ESPFS_SIZE: 2"

Interesting thing is that original esphttpd's webpages.espfs has 129kB
and my webpages.espfs is 94kB (lacking cat pictures but few more html files)

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