chmorgan / esphttpd-freertos

freertos example of libesphttpd for esp32 and esp8266
53 stars 14 forks source link

Build of the project for ESP32/EPS8266 - comments #23

Open RomkaE opened 4 years ago

RomkaE commented 4 years ago

There are a couple of comments on build the project

Initialization of submodules.

After cloning the repository and initializing the submodules:

git submodule update --init --recursive

There are no latest commits in the "espfs" and "libesphttpd" submodules (this can be seen by looking at the log of the submodules), so the project not build. If updating submodules from remote:

git submodule update --init --recursive --remote

The latest commits appear in the "espfs" and "libesphttpd" submodules. But a build error occurs on the "heatshrink" submodule. To get the necessary commits in all submodules, needed to run two commands:

git submodule update --init --recursive git submodule update --remote

After such initialization, the project for ESP32 ESP-IDF (master) is built without problems.

Build the project for ESP8266.

I managed to build and run this project for ESP8266 ESP8266_RTOS_SDK (master). But it was necessary to change the code of the project and the submodules "espfs", "libesphttpd". As I understand it, the old SDK was used for the ESP8266. For example, in the file "components/libesphttpd/include/libesphttpd/esp.h":

#ifdef ESP_PLATFORM // only set in esp-idf
#define FREERTOS 1
#define ESP32 1
...

The assumption that "ESP_PLATFORM" declared only in ESP-IDF is not true. For which version of the ESP8266 SDK is a project build expected?

phatpaul commented 4 years ago

Thanks for your testing and feedback. We welcome any improvements to the code and documentation. Please submit a PR.

Since I don't currently use ESP8266, I'll accept your fixes as long as they don't break my ESP32 build. And if anyone else can confirm it builds for ESP8266, that's a plus.

Shaopus commented 4 years ago

I followed your steps, but i could’t build.

RomkaE commented 4 years ago

For which platform? ESP8266 or ESP32? At the moment, submodules are initializing correctly. No need to use:

git submodule update --remote

ThierryC49 commented 3 years ago

Hello, I'm trying to compile for ESP8266 without success see output

$ make -f Makefile.esp8266 USE_OPENSDK=yes FREERTOS=yes -C libesphttpd
make: *** libesphttpd : No such file or directory. Arrêt.

if i remove the libesphttpd and -C I have this

$ make -f Makefile.esp8266 USE_OPENSDK=yes FREERTOS=yes
make: ***  Aucune règle pour fabriquer la cible « all », nécessaire pour « dummy ». Arrêt.

traduction : no rule to make the target "all" need for "dummy". stop (sorry my env is in frensh)

where I can search to compile ?

Thank Thierry PS : the helloword compile fine I don't think that is due to environnement PATH but...

ponpon1013 commented 3 years ago

Hello, I have the same problem to compile for ESP8266. I try make menuconfig and make flash but i have a the following problem:

In file included from /home/nicolas/esp/esphttpd-freertos/components/espfs/src/espfs.c:28:0: /home/nicolas/esp/esphttpd-freertos/components/espfs/src/espfs_priv.h:9:2: error: unknown type name 'spi_flash_mmap_handle_t' spi_flash_mmap_handle_t mmapHandle; ^ /home/nicolas/esp/esphttpd-freertos/components/espfs/src/espfs.c: In function 'espFsInit': /home/nicolas/esp/esphttpd-freertos/components/espfs/src/espfs.c:41:2: error: unknown type name 'spi_flash_mmap_handle_t' spi_flash_mmap_handle_t mmapHandle = 0; ^ /home/nicolas/esp/esphttpd-freertos/components/espfs/src/espfs.c:53:19: error: implicit declaration of function 'esp_partition_mmap' [-Werror=implicit-function-declaration] esp_err_t err = esp_partition_mmap(partition, 0, partition->size, ^ /home/nicolas/esp/esphttpd-freertos/components/espfs/src/espfs.c:54:5: error: 'SPI_FLASH_MMAP_DATA' undeclared (first use in this function) SPI_FLASH_MMAP_DATA, &memAddr, &mmapHandle); ^ /home/nicolas/esp/esphttpd-freertos/components/espfs/src/espfs.c:54:5: note: each undeclared identifier is reported only once for each function it appears in /home/nicolas/esp/esphttpd-freertos/components/espfs/src/espfs.c:64:4: error: implicit declaration of function 'spi_flash_munmap' [-Werror=implicit-function-declaration] spi_flash_munmap(mmapHandle); ^ /home/nicolas/esp/esphttpd-freertos/components/espfs/src/espfs.c: At top level: cc1: warning: unrecognized command line option '-Wno-frame-address' cc1: some warnings being treated as errors

It seems there is a problem with espfs which tries to use MMU that it is not supported by ESP8266 ( see https://github.com/espressif/ESP8266_RTOS_SDK/issues/612)

Thank you for your help

RomkaE commented 3 years ago

make -f Makefile.esp8266 USE_OPENSDK=yes FREERTOS=yes -C libesphttpd

You should use:

make

Because ESP8266 SDK was refactored and now it has styled some ESP-IDF. And file is wrong in of ESP8266 part.

You can use my fork to compile this example for ESP8266: https://github.com/RomkaE/esphttpd-freertos

RomkaE commented 3 years ago

It seems there is a problem with espfs which tries to use MMU that it is not supported by ESP8266

Yes, therefore i created a fork from the and using it without MMAP.

ThierryC49 commented 3 years ago

Thanks RomkaE, I'm testing it

Thierry,

ThierryC49 commented 3 years ago

After some compilation test I have this error

make[1]: npm: Command not found
make[1]: *** [/home/thier/esp/esphttpd-freertos/components/espfs/component.mk:66: node_modules] Error 127
make: *** [/home/thier/esp/ESP8266_RTOS_SDK//make/project.mk:571: component-espfs-build] Error 2

Do you have some idea how to cover this error ?

Thanks Thierry,

ThierryC49 commented 3 years ago

Hello RomkaE,

Now I'm able to build it, but the download on ESP07 don't work correctly, I'm testing it on "pur" espressif module (wroom-02D) and download is ok, the main difference is memory size (ESP07 = 1MB and ESP_WROOM = 2MB) Do you have some idea why ? I'm searching to memory size issue, but it seem correct to enter in 1MB flash (user1 = 530kB). In old SDK (2.0) we need flashing some extra bin in 0xFC000 and 0xFE00 it seem that in now integrated in user1.bin correct ? Thanks for you help Thierry

RomkaE commented 3 years ago

I never worked with the old ESP8266 SDK. Attach the log output of ESP8266 and your sdkconfig file.