Hi folk,
how can I add and link an existing static library file .a to main project ?
I have a huge libwebpages-espfs.a file which contains html files packed in espfs filesystem,
comes from awesome Sprites ESP8266 HTTPD project.
I'm working on a portation to ESP-IDF and it works already well with hardcoded flash adresses.
next step will be to have filesystem on flexible addresses.
but I can't find a way to add the file to linker script
Thanks for help,
Grooves
add a static library to main in project Mainfile
-
- Posts: 9759
- Joined: Thu Nov 26, 2015 4:08 am
Re: add a static library to main in project Mainfile
You may actually be better off using the esp-idf branch of libesphttpd instead: that's already mostly adapted to the ESP32.
Re: add a static library to main in project Mainfile
Many thanks, that is exactly I was looking for, saves my time,
did just some minor changes to be able to compile it as component in IDF 3.0
in httpdesps.h
+++#include "platform.h"
in platform.h
---typedef *HttpdPlatTimer HttpdPlatTimerHandle;
+++typedef HttpdPlatTimer* HttpdPlatTimerHandle;
in cgiflash.c
comment out weird lines:
//<<<<<<< HEAD
//esp32flashSetOtaAsCurrentImage();
//=======
esp32flashSetOtaAsCurrentImage();
//>>>>>>> c08b304e8b907287af7580510db4c6323eeb052c
Regards,
Grooves
did just some minor changes to be able to compile it as component in IDF 3.0
in httpdesps.h
+++#include "platform.h"
in platform.h
---typedef *HttpdPlatTimer HttpdPlatTimerHandle;
+++typedef HttpdPlatTimer* HttpdPlatTimerHandle;
in cgiflash.c
comment out weird lines:
//<<<<<<< HEAD
//esp32flashSetOtaAsCurrentImage();
//=======
esp32flashSetOtaAsCurrentImage();
//>>>>>>> c08b304e8b907287af7580510db4c6323eeb052c
Regards,
Grooves
Re: add a static library to main in project Mainfile
Hi Sprite,
is it correct, the esp-idf branch for ESP32 doesn't support the OTA update via httpd flash page yet ?
I can't find howto build user1.bin/user2.bin
Regards,
Grooves
is it correct, the esp-idf branch for ESP32 doesn't support the OTA update via httpd flash page yet ?
I can't find howto build user1.bin/user2.bin
Regards,
Grooves
-
- Posts: 9759
- Joined: Thu Nov 26, 2015 4:08 am
Re: add a static library to main in project Mainfile
I think it does, but because the ESP32 has an MMU, user1/user2.bin are supperfluous. You should be able to just upload your build/<appname>.bin file.
Re: add a static library to main in project Mainfile
I see, due to MMU it is always mapped to the same virtual addresses,
I tried to download just the build.bin file and got some errors:
I don't know which one is important
...
Firmware upload cgi start.
checkBinHeader: e9 4008 3f400020
esp32 ota: no valid ota select sector found!
OTA part select ID: -1
Writing 4096 bytes of data to SPI pos 0xff000000...
Writing 4096 bytes of data to SPI pos 0xff001000...
....
Writing 736 bytes of data to SPI pos 0xff09c000...
Upload done. Sending response.
esp32 ota: no valid ota select sector found!
OTA part select ID: -1
esp32 ota: no valid ota select sector found!
Writing seq 1 to ota select sector 2
....
after reboot
E (9) esp_image: image at 0x210000 has invalid magic byte
W (9) esp_image: image at 0x210000 has invalid SPI mode 255
W (10) esp_image: image at 0x210000 has invalid SPI size 15
E (16) boot: OTA app partition slot 1 is not bootable
E (22) esp_image: image at 0x110000 has invalid magic byte
W (28) esp_image: image at 0x110000 has invalid SPI mode 255
W (34) esp_image: image at 0x110000 has invalid SPI size 15
E (40) boot: OTA app partition slot 0 is not bootable
I (177) cpu_start: Pro cpu up.
my partition table looks like this:
Partition table binary generated. Contents:
*******************************************************************************
# Espressif ESP32 Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
ota_0,app,ota_0,0x110000,1M,
ota_1,app,ota_1,0x210000,1M,
*******************************************************************************
Thanks for any help,
Grooves
I tried to download just the build.bin file and got some errors:
I don't know which one is important
...
Firmware upload cgi start.
checkBinHeader: e9 4008 3f400020
esp32 ota: no valid ota select sector found!
OTA part select ID: -1
Writing 4096 bytes of data to SPI pos 0xff000000...
Writing 4096 bytes of data to SPI pos 0xff001000...
....
Writing 736 bytes of data to SPI pos 0xff09c000...
Upload done. Sending response.
esp32 ota: no valid ota select sector found!
OTA part select ID: -1
esp32 ota: no valid ota select sector found!
Writing seq 1 to ota select sector 2
....
after reboot
E (9) esp_image: image at 0x210000 has invalid magic byte
W (9) esp_image: image at 0x210000 has invalid SPI mode 255
W (10) esp_image: image at 0x210000 has invalid SPI size 15
E (16) boot: OTA app partition slot 1 is not bootable
E (22) esp_image: image at 0x110000 has invalid magic byte
W (28) esp_image: image at 0x110000 has invalid SPI mode 255
W (34) esp_image: image at 0x110000 has invalid SPI size 15
E (40) boot: OTA app partition slot 0 is not bootable
I (177) cpu_start: Pro cpu up.
my partition table looks like this:
Partition table binary generated. Contents:
*******************************************************************************
# Espressif ESP32 Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
ota_0,app,ota_0,0x110000,1M,
ota_1,app,ota_1,0x210000,1M,
*******************************************************************************
Thanks for any help,
Grooves
Re: add a static library to main in project Mainfile
Is it correct that you are looking for data partitions ?
esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_OTA, NULL);
I use the predefined partitiontable from menuconfig which generates two OTA app partitions
Regards,
Grooves
esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_OTA, NULL);
I use the predefined partitiontable from menuconfig which generates two OTA app partitions
Regards,
Grooves
Re: add a static library to main in project Mainfile
Hi Sprite,
now I understand more what your code does:
esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_OTA, NULL);
is correct, you check if there is already a OTA selected partition.
The problem was, when there on OTA select partition (after make erase_flash),
the function selectedPart=getOtaSel() returns with -1.
then in esp32flashGetUpdateMem
if (selectedPart==-1) return 0;
it leads that address and size are not initalized.
I changed to:
if (selectedPart==-1) selectedPart = 1; //return 0;
and everything works fine,
Thanks again,
Grooves
now I understand more what your code does:
esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_OTA, NULL);
is correct, you check if there is already a OTA selected partition.
The problem was, when there on OTA select partition (after make erase_flash),
the function selectedPart=getOtaSel() returns with -1.
then in esp32flashGetUpdateMem
if (selectedPart==-1) return 0;
it leads that address and size are not initalized.
I changed to:
if (selectedPart==-1) selectedPart = 1; //return 0;
and everything works fine,
Thanks again,
Grooves
Who is online
Users browsing this forum: Majestic-12 [Bot] and 153 guests