Skip to content

ports/esp32: Add per-board configs (same as other ports). #4991

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

Closed
wants to merge 1 commit into from

Conversation

jimmo
Copy link
Member

@jimmo jimmo commented Aug 10, 2019

Replaces the SDKCONFIG makefile variable with BOARD. Defaults to BOARD=GENERIC. spiram can be enabled with BOARD=GENERIC_SPIRAM

Add example definition for TINYPICO (currently identical to GENERIC_SPIRAM, but with custom board/mcu names for the uPy banner)

Next step is to add board pins (i.e. make-pins.py).

@mattytrentini
Copy link
Contributor

Looks good @jimmo, it'll be a useful addition to the ESP32 port!

@nevercast
Copy link
Contributor

nevercast commented Aug 11, 2019

Do we have version numbers for MicroPython releases? This is a breaking change for anyone that uses SDKCONFIG= on their make line.

Edit: I imagine the version numbers apply to the final micropython binary and not the process of building it. So there is no way to indicate that this breaks some things in the make process.

Edit2: Makefile:19: *** Use the BOARD variable instead of SDKCONFIG. Stop.

Perfect, thanks for thinking ahead on that.

@nevercast
Copy link
Contributor

@jimmo Its hard to tell what changes you made because you push forced the branch instead of just committing and pushing (which Github will track). Did you add the board prefix as intended? I am not seeing a difference.

@jimmo
Copy link
Member Author

jimmo commented Aug 14, 2019

No, I added LD_FILES (matching stm32)

If you want to use an out-of-tree board defn, use:
make BOARD=FOO BOARD_DIR=/path/to/boards/FOO

@nevercast
Copy link
Contributor

nevercast commented Aug 14, 2019

I see! Thanks for your help, this is working as I'd expect now.
make BOARD=node BOARD_DIR=$(realpath ./boards/node) FROZEN_MPY_DIR=$(realpath ./modules/node) USER_C_MODULES=$(realpath ./cmodules/node)

Where I have ./boards/custom.ld and in ./boards/node/ I have

mpconfigboard.mk

SDKCONFIG += /builder/micropython/ports/esp32/boards/sdkconfig.base
SDKCONFIG += /builder/micropython/ports/esp32/boards/sdkconfig.spiram
SDKCONFIG += $(BOARD_DIR)/../sdkconfig.crashdebug
SDKCONFIG += $(BOARD_DIR)/../sdkconfig.ipcextended
LD_FILES = $(BOARD_DIR)/../custom.ld
PART_SRC = $(BOARD_DIR)/../partitions.ident.csv

mpconfigboard.h

#define MICROPY_HW_BOARD_NAME "NODE"
#define MICROPY_HW_MCU_NAME "NODULE"
#define MODULE_DEEPSLEEP_STUB_ENABLED (1)
#define MICROPY_ESP32_MACHRTC_MEM_USER_MAXLEN (0)

Cheers!

Copy link
Member

@dpgeorge dpgeorge left a comment

Choose a reason for hiding this comment

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

Really great, thanks!

@@ -0,0 +1 @@
build-*/
Copy link
Member

Choose a reason for hiding this comment

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

How about we just add this to the top-level .gitignore? That would simplify other ports, eg could remove ports/stm32/.gitignore and simplify ports/unix/.gitignore.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -466,6 +494,7 @@ OBJ = $(OBJ_MP)

APP_LD_ARGS =
APP_LD_ARGS += $(LDFLAGS_MOD)
APP_LD_ARGS += $(addprefix -T,$(LD_FILES))
Copy link
Member

Choose a reason for hiding this comment

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

What's LD_FILES intended to be used for? The esp32 is very specific about the linking phase, although I guess the user could add some additional bits if they really need to.

Copy link
Member Author

Choose a reason for hiding this comment

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

@nevercast asked for it. My guess is that it might be related to the rtc mem stuff.

@@ -0,0 +1,2 @@
#define MICROPY_HW_BOARD_NAME "GENERIC"
Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be good to retain the existing name of "ESP32 module". a bit more user friendly.

OTOH using GENERIC signifies that the build is a generic one and then the user knows exactly where to locate the build settings for the build (ie in the boards/GENERIC dir).

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. I've changed it but kept the dir as GENERIC. A quick grep for "ESP32 module" will resolve any confusion I hope.

Replaces the `SDKCONFIG` makefile variable with `BOARD`. Defaults to BOARD=GENERIC. spiram can be enabled with `BOARD=GENERIC_SPIRAM`

Add example definition for TINYPICO (currently identical to GENERIC_SPIRAM, but with custom board/mcu names for the uPy banner)

Next step is to add board pins (i.e. make-pins.py).
@dpgeorge
Copy link
Member

I made the change to gitignore in 497683b, and merged this PR in 8db517f

@dpgeorge dpgeorge closed this Aug 15, 2019
tannewt added a commit to tannewt/circuitpython that referenced this pull request Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants