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

1st Tranch of SDK 3.0 follow up changes #2732

Merged
merged 9 commits into from
May 1, 2019
Merged

Conversation

TerryE
Copy link
Collaborator

@TerryE TerryE commented Apr 20, 2019

Fixes #2689

  • This PR is for the dev branch rather than for master.
  • This PR is compliant with the other contributing guidelines as well (if not, please describe why).
  • I have thoroughly tested my contribution.
  • The code changes are reflected in the documentation at docs/*.

This is a fairly large change, with a summary of the details below

  • app/platform/platform.c. Add support for R/W of Reboot Config Records (RCRs) to store configuration changes that persist across reboots using flash NAND writing rules. See inline comments for documentation. Flash erase is only carried out when GC of the RCR is required.
    📙 Note: IMO, it would be well worthwhile using this API to store the TLS certificates.
  • app/platform/platform.h. Header changes to support the above.
  • app/user/user_main.c. This declares a static initial partition table RCR. A fairly major rework of the user_pre_init() code; this reads the current PT RTR and if this is the compiled one does calculation to work out the actual PT in RAM for the SDK to use. It then writes this updated RCR back for use on subsequent boots, so this calculation is one-time only.
    Note that this is designed to interoperate with the tools/nodemcu-partition.py utility and the node API so that you can configure the LFS or SPIFFS partitions at compile time, over UART configuration, or at runtime.
  • app/include/user_config.h. Following review feedback, I have changed this so that you can still set the compile-time default partition sizes for LFS and SPIFFS here.
  • tools/nodemcu-partition.py. Supports simple configuration of the LFS or SPIFFS partitions and downloading of LFS and SPIFFS images via this script. For example the following commands download a firmware image, then sets the LFS partition to 128KB and loads it with an LFS image over the UART:
  esptool -p /dev/ttyUSB0 -b 460800 --after no_reset write_flash \
    -fs 4MB --flash_mode=dio 0x00000  bin/0x00000.bin 0x10000 bin/0x10000.bin
  nodemcu-partition.py -ls 128K -lf bin/lfs.img
  • app/modules/node.c. Addition of node.readrcr() and node.writercr() if the macro DEVELOPMENT_TOOLS is defined.
    🔴 Not documented since these functions are only available for development.
    🔴 the extra functions to query and to update the PT need to be added.
  • app/libc/c_string.h. Minor change to add c_memmove mapping to ets_memmove.
  • ld/nodemcu.ld. Force KEEP() on the RCR page.

@TerryE
Copy link
Collaborator Author

TerryE commented Apr 30, 2019

The issue with the Makefile is that the sdk_pruned target uses xtensa-lx106-elf-ar but is not explicitly dependent on toolchain. I needed to add this. Something bizarre seems to be going on since the make works fine under Docker on my PC but fails in Travis. This is something to do with how Travis implements caching.

@TerryE
Copy link
Collaborator Author

TerryE commented Apr 30, 2019

OK, the penny has dropped re the make failure. I dropped the use of $(OS) because this isn't defined in standalone make, and used GNU make builtin $(MAKE_HOST) instead -- except that the Travis make uses OS and MAKE_HOST is blank. Ooops. Some conditional magic is needed to use OS if defined and MAKE_HOST otherwise so the conditional logic works properly.

@TerryE
Copy link
Collaborator Author

TerryE commented Apr 30, 2019

Damn, ci-build-linux.sh doesn't pass in the OS environment variable either. So I will default to linux if neither $(OS) or $(MAKE_HOST) are set.

@HHHartmann
Copy link
Member

Maybe it makes sense to export the OS variable in travis. yml then.
Travis uses $TRAVIS_OS_NAME which should be set in the script too.
In fact I only set $OS as shorthand in the first place to make the code clearer.
So setting $MAKE_HOST in travis also Sounds like a way to go.

@TerryE
Copy link
Collaborator Author

TerryE commented Apr 30, 2019

@HHHartmann Gregor, to be honest it doesn't really matter which way. I find debugging the predicate logic in Makefiles a bit of a PITA, but the real lightbulb moment was just that there is something subtly different about the Travis make environment, and that I needed to do a couple of commit / pushes just to work out exactly what. They'll get rolled up in the "squash and merge" anyway. I'll add the node API calls today and merge this into dev.

@TerryE
Copy link
Collaborator Author

TerryE commented May 1, 2019

I have now added the get / set partition table calls to the node library, and documented these in node.md. This tranche is ready for pushing to dev.

@TerryE TerryE merged commit bc61528 into nodemcu:dev May 1, 2019
@marcelstoer marcelstoer added this to the Next release milestone May 21, 2019
@TerryE TerryE deleted the sdk-3.0-follow-up branch July 23, 2019 17:27
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.

3 participants