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

Order of inclusion #19

Closed
cnlohr opened this issue Aug 23, 2016 · 15 comments
Closed

Order of inclusion #19

cnlohr opened this issue Aug 23, 2016 · 15 comments
Assignees

Comments

@cnlohr
Copy link
Owner

cnlohr commented Aug 23, 2016

The top of the makefiles read:

include user.cfg
-include esp82xx/common.mf
-include esp82xx/main.mf

Shouldn't user be after common, that way it can override things like SDK?

@con-f-use
Copy link
Collaborator

Nope, common.mf needs some of the variables in user.cfg.

@cnlohr
Copy link
Owner Author

cnlohr commented Aug 23, 2016

How can they override things like SDK then? Or other variables within it. I guess I am just having trouble specifying specific Espressif SDK versions.

@con-f-use
Copy link
Collaborator

con-f-use commented Aug 23, 2016

How can they override things like SDK then?

There are so many ways, but I understand the confusion. Much of it is because I wanted an optional shell variable to specify the path (which is SOOOOO useful). To answer your question:

Possibility 1: SDK_DEFAULT

The most frequently used is probably just changing the value of SDK_DEFAULT in ./user.cfg. The default value that comes with the repository is

SDK_DEFAULT  = $(HOME)/esp8266/esp-open-sdk 

Change that to

SDK_DEFAULT  = $(HOME)/esp8266/esp-open-sdk2.0.0

if you want to use the 2.0.0 version. The value of SDK_DEFAULT is used for ESP_ROOT if

  • No shell environment variable ESP_ROOT is set AND
  • The top-level Makefile doesn't change the value AND
  • No other value is passed to make via command line argument END OF LIST

Possibility 2: Make Argument

For a one-off build, just to see if it compiles, you can also pass the variable to Make as an argument:

make all ESP_ROOT=~/esp8266/esp-open-sdk2.0.0

Possibility 3: Top-Level Overwrite

The third alternative is to edit the top-level of any project Makefile (the one that is derived from ./esp82xx/Makefile.example) and override ESP_ROOT or, for fine control, the other variables (meaning XLIB, SDK, FOLDERPREFIX, ESPTOOL_PY and the such).

Possibility 4: Shell variable

I myself specify the shell variable ESP_ROOT in my ~/.bashrc so I don't have to edit Makefiles every time I do a git pull or git clone and then edit them back before committing (which I forget to easily).

@cnlohr
Copy link
Owner Author

cnlohr commented Aug 23, 2016

So, the big deal here isn't the location of the pfalcon esp-open-sdk, it's the location of the espressif esp-nonos-sdk... Which I think you know, sorry, the fact they're both SDKs is hard.

Anyway, the problem isn't even which version someone wants to use, which yes, it would absolutely make sense to do in shell variables, or make arguments.

The problem is that /some/ projects will be dependent on specific versions of the SDK. For instance, until last night, colorchord was incompatible with 1.5.4, so I had to specify a specific version. So, things that would be done per-user or per-environment are right out. Per-project is the only way to go.

@con-f-use
Copy link
Collaborator

con-f-use commented Aug 23, 2016

Then the top-level Makefile would be the best place.

# In Top-Level Makefile (projectspecific)
include user.cfg
-include esp82xx/common.mf
-include eps82xx/main.mf

SRCS += whatever.c \
  stuff.S

ESP_ROOT=~/esp8266/esp-open-sdk1.5.4   # Override  defaults - can still be overwritten as make arument

But ultimately it's the user's responsibility to have the right SDK ready and set the right path, unless you ship the right sdk with the top-level project, this will always be a problem. For colorchord I mean this Makefile.

@cnlohr
Copy link
Owner Author

cnlohr commented Aug 23, 2016

Where in the makefile? Hmm, sorry, you just gave such a beautiful explanation up there... I guess where would be the idea place in a Makefile?

@con-f-use
Copy link
Collaborator

con-f-use commented Aug 23, 2016

Np. See my edit.

P.S. I often give a quick answer as soon as possible, then edit my post to elaborate.

@cnlohr
Copy link
Owner Author

cnlohr commented Aug 24, 2016

Hmm, that totally doesn't work. It tries pulling GCC and all its friends from there, too.

@con-f-use
Copy link
Collaborator

con-f-use commented Aug 24, 2016

Now I'm con-f-used. Don't you want to use the GCC that comes with the SDK? You could also set the SDKvariable in the Makefile.

Here is my setup:

I have different versions of the SDK (all build from @pfalcons Makefile) at:

  • /home/confus/build/esp-open-sdk1.5.0
  • /home/confus/build/esp-open-sdk1.5.2
  • /home/confus/build/esp-open-sdk1.5.4
  • /home/confus/build/esp-open-sdk2.0.0
  • /home/confus/build/esp-open-sdk -> /home/confus/build/esp-open-sdk1.5.2 softlink to the version that usually works best

In my .bashrc I have export ESP_ROOT=/home/confus/build/esp-open-sdk

I test if stuff compiles with on other SDK version (e.g. 2.0.0) with:

make burn ESP_ROOT=/home/confus/build/esp-open-sdk2.0.0

What is your setup and what exactly do you want to do?

@cnlohr
Copy link
Owner Author

cnlohr commented Aug 24, 2016

I want the GCC that comes with esp-open-sdk on all of my projects. There is no need to tie the Espressif SDK to any esp-open-sdk version, as they are completely independent.

I want to be able to select a specific Espressif NonOS SDK version separate from the esp-open-sdk.

I really wish we had better words for these things.

@con-f-use
Copy link
Collaborator

con-f-use commented Aug 24, 2016

Ah, now I got you. Have you tried redefining the following stuff in the top-level Makefile?

GCC_FOLDER = $(ESP_ROOT)/xtensa-lx106-elf
ESPTOOL_PY = $(ESP_ROOT)/esptool/esptool.py
SDK        = $(ESP_ROOT)/sdk

XTLIB        = $(SDK)/lib
XTGCCLIB     = $(GCC_FOLDER)/lib/gcc/xtensa-lx106-elf/$(ESP_GCC_VERS)/libgcc.a
FOLDERPREFIX = $(GCC_FOLDER)/bin
PREFIX       = $(FOLDERPREFIX)/xtensa-lx106-elf-
CC           = $(PREFIX)gcc
LD           = $(PREFIX)ld
AR           = $(PREFIX)ar

@cnlohr
Copy link
Owner Author

cnlohr commented Aug 24, 2016

But, but... but..... I am asking you if I wanted to override that one specific component, what would I make my Makefile, or user.cfg look like?

@con-f-use
Copy link
Collaborator

con-f-use commented Aug 24, 2016

# In Top-Level Makefile
include user.cfg
-include esp82xx/common.mf
-include eps82xx/main.mf

SRCS += whatever.c \
  stuff.S

SDK = ~/path/to/NonOS/sdk   # Only relevant line, maybe

Maybe? Didn't try it. Or am I being stupid?

@cnlohr
Copy link
Owner Author

cnlohr commented Aug 24, 2016

I must be going crazy. I though I tried exactly that, but I guess I didn't. Indeed. This is precisely the thing I wanted. I'm really sorry, thanks for dealing with my slowness on these issues. I thought last time I tried it it was trying to pull the compiler from there.

@cnlohr cnlohr closed this as completed Aug 24, 2016
@con-f-use
Copy link
Collaborator

No worries. Believe me, I've been there. We all have.

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