khoih-prog / AsyncWebServer_STM32

AsyncWebServer for STM32 using builtin LAN8742A Ethernet. This AsyncWebServer Library for STM32 is currently working on STM32 boards, such as Nucleo-144 F767ZI, etc., using builtin LAN8742A Ethernet. Now support using CString to save heap to send very large data
GNU Lesser General Public License v3.0
21 stars 5 forks source link

how to run one of the examples? #2

Closed jcw closed 4 years ago

jcw commented 4 years ago

Hello - I'm trying out your project with PlatformIO and a Nucleo-F767ZI. I've adjusted the settings in platformio.ini for PIO v5, but can't seem to figure out how to run any of the examples. The dependencies are fetched and compile properly, but then the link fails due to missing setup/loop functions.

What's the proper way to compile one of the hello examples? It tried copying the platformio.ini file one level up, and copying it into an example folder, but that doesn't work.

Cheers -jcw

khoih-prog commented 4 years ago

@jcw

Thanks for your interest in the library. It's difficult to know what's wrong in your PlatformIO installation and/or settings/usage. I really don't have much experience in solving that to help you out now.

I suggest you to post the question on PlatformIO Forum to ask for support from experienced people specialized in PIO.

Hopefully you'll post your experience on how to fix the issue here to help other library's users.

Regards,

jcw commented 4 years ago

Ehm ... there's nothing wrong with my PIO setup. I've been using it for years. I was merely asking how to try out your sample code. I don't think people in the PlatformIO community can help figure out how you've intended your examples to the used. But hey, thanks anyway. All the best -jcw.

jcw commented 4 years ago

Looks like the problem is here:

In file included from src/Async_HelloServer.cpp:88:
.pio/libdeps/STM32/AsyncWebServer_STM32/src/AsyncWebServer_STM32.h:27:10: fatal error: STM32AsyncTCP.h: No such file or directory

***********************************************************************
* Looking for STM32AsyncTCP.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:STM32AsyncTCP.h"
* Web  > https://platformio.org/lib/search?query=header:STM32AsyncTCP.h
*
***********************************************************************

   27 | #include <STM32AsyncTCP.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.

Adding philbowles/STM32AsyncTCP as dependency does not help, due to this line: https://github.com/philbowles/STM32AsyncTCP/blob/master/library.json#L18

Also here: https://github.com/khoih-prog/STM32AsyncTCP/blob/master/library.json#L18

khoih-prog commented 4 years ago

So the Phil Bowles' STM32AsyncTCP very-new library has not been included into PIO Library Manager.

You can copy/install it manually or post an issue on STM32AsyncTCP to ask the Author to fix the issue as we can't do that.

There is one issue posted there relating to your issue:

library.json has wrong platform

jcw commented 4 years ago

Aha, yep. I'll try this. BTW, since you have a fork, you could also fix it there - for the time being anyway ...

khoih-prog commented 4 years ago

Aha, yep. I'll try this. BTW, since you have a fork, you could also fix it there - for the time being anyway ...

I'm a litlte bit hesitant to do so as this is his right to his library to make it included into PIO Library Manager.

In the mean time, just download a copy of STM32AsyncTCP Library, then copy the whole library directory onto ~/.platformio/lib for Ubuntu/Linux machine.

jcw commented 4 years ago

That's what I did. I had to make one more change, see philbowles/STM32AsyncTCP#1 - now your hello example builds and works properly \o/

There's no need to wait for him to make the change, you can simply adjust your own platformio.ini to this:

lib_deps =
  khoih-prog/STM32AsyncTCP
  AsyncWebServer_STM32

PIO will then go directly to your fork to fetch the library (because the library is named "abc/def", i.e. with a slash). Use of the PIO library registry is optional. You're not interfering with Phil's right, as author, to be listed in PIO's registry.

The other dependencies can be dropped, PIO will find them.

So to summarise: if you adjust your fork and platformio.ini file, then to run one of your examples, copy that ini file to a new folder, create a subdir named "src" with the example .ino in it, and that's it, pio run will do the rest.

PS. No need to copy the library to a global area. Here's my test setup, which compiles and runs properly:

$ tree
.
├── lib
│   └── STM32AsyncTCP
│       ├── LICENSE.txt
│       ├── README.md
│       ├── library.json
│       ├── library.properties
│       ├── src
│       │   ├── AsyncPrinter.cpp
│       │   ├── AsyncPrinter.h
│       │   ├── DebugPrintMacros.h
│       │   ├── STM32AsyncTCP.cpp
│       │   ├── STM32AsyncTCP.h
│       │   ├── STM32AsyncTCPbuffer.cpp
│       │   ├── STM32AsyncTCPbuffer.h
│       │   ├── SyncClient.cpp
│       │   ├── SyncClient.h
│       │   ├── async_config.h
│       │   ├── c_types.h
│       │   ├── cbuf.cpp
│       │   ├── cbuf.h
│       │   ├── debug.cpp
│       │   ├── debug.h
│       │   ├── tcp_axtls.c
│       │   └── tcp_axtls.h
│       └── stm32asynctcp.code-workspace
├── platformio.ini
└── src
    └── Async_HelloServer.cpp
jcw commented 4 years ago

One more note: I had to add this setting as well:

build_flags = -DSTM32F7

And fix the #if !( defined(STM32F0) || defined(STM32F1) || etc... in the example, which was missing STM32F7.

khoih-prog commented 3 years ago

Hi @jcw

Thanks for your contribution. As the issue is spanning across several libraries, I have to take over to modify and release the new version.

Your and chris007de contributions have been noted in Contributions and Thanks

Please check to see if there still any other issue.


Releases v1.2.6

  1. Fix dependency on unpublished STM32AsyncTCP Library. Check Compilation broken due to error in STM32AsyncTCP dependency and how to run one of the examples?.