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

improve release/zip targets, cleanup #100

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

binary1230
Copy link
Contributor

@binary1230 binary1230 commented Oct 30, 2021

main: improve zipfile output steps

  • new target 'zip_release' (more human-friendly alias for $(BIN_TARGET))
  • allow overriding PROJECT_NAME (useful if doing CI builds / docker and the mounted directory name is generic)
  • add new target 'build_dir' which copies stuff going into the release zip into a dir named build/ first (easier to inspect/zip)
  • for release/zip builds, create a version.txt with the makefile version#'s/date in it
  • create new variable in Makefile IS_CI_BUILD, set to 0 unless overridden on command line (useful so you can know where a build came from. shows up in version.txt and in version strings in the firmware)

other/cleanup:

  • web: clean: remove tmp/ dir (previously we just removed the directory contents and not the directory itself)
  • add to .gitignore: libgcc_stripped.a (happens if building with STRIPPED_LIBGCC)
  • split out BUILD_DATE var for easier access
  • cleanup Makefile documentation a bit
  • lint: fix syntax warnings with single quotes in "if you are on a '66 reconfigure CHIP"
  • zip command always overwrites the file completely instead of appeding
  • fix various issues with clean and purge not quite getting everything

I'm not super-familiar with how projects are using BIN_TARGET or any of the other stuff, so if anything here breaks other existing projects, let me know, I can modify. I would think it's all pretty compatible though. I'm also a little weak on my Makefile-fu, so if I'm doing anything silly, let me know.


Unrelated stuff

Figured I'd just throw this over here, in case useful for anyone.

I made the above Makefile changes as part of a docker-based CI buildsystem for esp8266 projects. It seems to be working well so far. If interested, I could try to get this setup better / documented for general use.

  1. I have a Docker build that implements the instructions from @cnlohr involving this toolchain: https://github.com/cnlohr/esp82xx_bin_toolchain/raw/master/esp-open-sdk-x86_64-20200810.tar.xz

It's available here in this branch:
https://github.com/Unit-e/esp-open-sdk-docker/blob/cnlohr-use-esp82xx-prebuilt/Dockerfile

I'll be updating the instructions soon on that, the docker image is available pre-built on github packages here for use with 'docker pull'
https://github.com/Unit-e/esp-open-sdk-docker/pkgs/container/esp-open-sdk-docker

So you can do something like this (I have some helper scripts that make this more of a one-liner)

# run the following from any host with docker installed (tested on WSL2, native windows, native linux)

# pull the image (run once)
docker pull ghcr.io/unit-e/esp-open-sdk-docker:cnlohr-use-esp82xx-prebuilt

# build an esp82xx project in the docker container.
cd SomeEsp82xxProject/

# run "make all" with Docker:
# mount the working directory from the host OS (i.e. windows) into the docker container, and run the makefile there. 
# (note: this $PWD assumes no spaces in the path). here PWD might be something like C:\projects\SomeEsp82xxProject\
docker run --rm -it -v ${PWD}:/home/build/src ghcr.io/unit-e/esp-open-sdk-docker:cnlohr-use-esp82xx-prebuilt /bin/bash -c "make all"

The big limitation to be aware of is, on WSL2 (which is what Docker Desktop on windows uses behind the scenes), serial port forwarding is broken so you can't just flash using the normal methods from inside the docker container. BUT, it's pretty simple to use pyserial's rfc2177 serial-over-ip server to deal with that:

In the makefile (or override on commandline or user.cfg), you set this:

# set serial port name to forwarding to the windows host over the internal network: (using special address host.docker.internal)
PORT  = rfc2217://host.docker.internal:4000?ign_set_control

And on the windows host you do something like this:

# listen on port 4000 and control COM7
./esp_rfc2217_server.exe -v -p 4000 COM7

Then all the "make burn" etc works from inside the docker container. pyserial's "miniterm" supports connect for serial monitor like this:

miniterm rfc2217://your-hostname-here
  1. Separately, there is a different [but totally untested and probably problematic] docker build up here that builds the latest esp-open-sdk and puts it in a docker container. That's at: https://github.com/Unit-e/esp-open-sdk-docker/tree/master

I made a few forks of the various submodules that fix some build issues with the latest build based on pfalcon/esp-open-sdk. It appears to compile correctly and produce working firmware, but, I think esp82xx would be needed to be upgraded and tested to see if everything works there.

Anyway, if anyone here was ever looking to upgrade esp82xx to the latest pfalcon-based esp-open-sdk, that might be a good starting point.


Just wanted to shoutout to @cnlohr who has been a good sport about walking my n00b self through a lot of this for the first time.

- previously we just removed the directory contents and not the directory itself
- happens if building with STRIPPED_LIBGCC
- allow overriding PROJECT_NAME (useful if doing CI builds / docker and the mounted directory name is generic)
- new target 'zip_release' (more human-friendly alias for $(BIN_TARGET))
- add new target 'build_dir' which copies stuff going into the release zip into a dir named build/ first (easier to inspect/zip)
- split out BUILD_DATE var for easier access
- for release/zip builds, create a version.txt with the makefile version#'s/date in it
- cleanup Makefile documentation a bit
- lint: fix syntax warnings with single quotes in "if you are on a '66 reconfigure CHIP"
- zip command always overwrites the file completely instead of appeding
- fix various issues with clean and purge not quite getting everything
- expose in version strings so we know if this build came from a Continous Integration build system (like Github Actions / Jenkins/etc)
- by default it's set to zero, and it's expected CI systems will set this to 1 from their command line
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

Successfully merging this pull request may close these issues.

1 participant