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

Fixes for esp-open-sdk #37

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion glue-lwip/arch/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ void sntp_set_system_time (uint32_t t);

#include "mem.h" // useful for os_malloc used in esp-arduino's mDNS

#include "glue.h" // include assembly locking macro used below
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the defines in this file to avoid duplication because they are needed on both sides.
What was the issue when using glue.h ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I traced down the issue. It's that ARDUINO gets defined in glue.h. This causes an issue for my project that has another cross-platform library that also uses ARDUINO as a build select.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can change like this, what do you think ?

#define ARDUINO 0
#endif

#ifndef OPENSDK
#define OPENSDK 0
#endif

#if !ARDUINO && !OPENSDK
#error Must defined ARDUINO or OPENSDK
#endif

to

#if (!defined(ARDUINO) || !ARDUINO) && (!defined(OPENSDK) || !OPENSDK)
#error Must defined ARDUINO or OPENSDK
#endif

Copy link
Contributor Author

@someburner someburner Sep 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't mind changing ARDUINO to BLD_LWIP_ARDUINO and OPENSDK to BLD_LWIP_OPENSDK, that would resolve the issue for my project. I feel a bit silly requesting to change it just for my project, but the other library is huge and used by several developers and in other projects. If you're OK with that, I can make the changes and re-do the PR, and would make it easier for me to submit PRs in the future

// fixed definitions from esp8266/arduino
// renamed with lwip_ to avoid name collisision
// reference and credits: https://github.com/esp8266/Arduino/pull/6301
#define lwip_xt_rsil(level) (__extension__({uint32_t state; __asm__ __volatile__("rsil %0," __STRINGIFY(level) : "=a" (state) :: "memory"); state;}))
#define lwip_xt_wsr_ps(state) __asm__ __volatile__("wsr %0,ps; isync" :: "a" (state) : "memory")
typedef uint32_t sys_prot_t;
#define SYS_ARCH_DECL_PROTECT(lev) sys_prot_t lev
#define SYS_ARCH_PROTECT(lev) lev = lwip_xt_rsil(15)
Expand Down
6 changes: 6 additions & 0 deletions glue-lwip/open/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -3540,6 +3540,12 @@
#error LWIP_FEATURES must be defined
#endif


/**
* TCP_RANDOM_PORT: randomize port instead of simply increasing
*/
#define TCP_RANDOM_PORT 1

/*
--------------------------------------------------
------------------ SNTP options ------------------
Expand Down
2 changes: 1 addition & 1 deletion makefiles/Makefile.build-lwip2
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ endif

clean:
rm -rf $(BUILD) $(LWIP_LIB) $(AUTO)
cd lwip2-src; rm -f src/.patched src/core/*.c.orig src/core/ipv6/*.c.orig; git checkout -- src;
cd lwip2-src; rm -f src/.patched src/core/*.c.orig src/core/ipv6/*.c.orig src/include/lwip/napt.h; git checkout -- src;
5 changes: 4 additions & 1 deletion makefiles/Makefile.lwip2
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ patches: .patched
.patched:
for p in ../../patches/*.patch; do echo "--------- APPLY PATCH $${p#../../}:"; patch -d .. -p1 < $$p; done
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for p in ../../patches/*.patch ../../patches/$(target)/*.patch; do ... ?

ifeq ($(target),open)
patch -d .. -p1 < ../../patches/open/sdk-mem-macros.patch
for p in ../../patches/open/*.patch; do echo "--------- APPLY PATCH $${p#../../}:"; patch -d .. -p1 < $$p; done
endif
ifeq ($(target),arduino)
for p in ../../patches/arduino/*.patch; do echo "--------- APPLY PATCH $${p#../../}:"; patch -d .. -p1 < $$p; done
endif
touch .patched

Expand Down