Skip to content

[WIP] Update SDK to 2.0.0 (#2304) #2317

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

marvelousNinja
Copy link

@marvelousNinja marvelousNinja commented Jul 23, 2016

For those who will struggle to run this with PlatformIO (I have version 2.11.1), here is a guide:

  1. Copy and replace files from this repo to ~/.platformio/packages/framework-arduinoespressif/.
  2. Add some missing build flags to your platformio.ini (bluntly stolen from Compilation error with Ardino/master, lack of newlibc maybe? #2263):
build_flags = -I$PLATFORMFW_DIR/tools/sdk/libc/xtensa-lx106-elf/include -L$PLATFORMFW_DIR/tools/sdk/libc/xtensa-lx106-elf/lib -lc
  1. Make some manual modifications to linker scripts. Simple copy & replace won't do since target file has some PlatformIO specific changes. You need to modify this file:
    ~/.platformio/.platformio/packages/ldscripts/esp8266.flash.common.ld.

It should comply with changes from files in this repo:

  • Arduino/tools/sdk/ld/eagle.app.v6.common.ld
  • Arduino/tools/sdk/ld/eagle.rom.addr.v6.ld

In my case, I had to apply the following changes:

...

*.pioenvs/*/src/*.o(EXCLUDE_FILE (umm_malloc.o) .literal*, \
EXCLUDE_FILE (umm_malloc.o) .text*)
*libc.a:(.literal .text .literal.* .text.*)          /* <======= add this line */
*libm.a:(.literal .text .literal.* .text.*)
*libgcc.a:_umoddi3.o(.literal .text)
*libgcc.a:_udivdi3.o(.literal .text)
*libsmartconfig.a:(.literal .text .literal.* .text.*)
*libmbedtls.a:(.literal .text .literal.* .text.*)    /* <======= add this line */
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text .irom.text.*)
...

PROVIDE ( SPI_write_enable = 0x4000443c );
PROVIDE ( Wait_SPI_Idle = 0x4000448c );
PROVIDE ( Enable_QMode = 0x400044c0 );               /* <======= add this line */
PROVIDE ( SPIEraseArea = 0x40004b44 );
PROVIDE ( SPIEraseBlock = 0x400049b4 );
...

@marvelousNinja marvelousNinja changed the title Update SDK to 2.0.0 (#2304) [WIP] Update SDK to 2.0.0 (#2304) Jul 23, 2016
@codecov-io
Copy link

codecov-io commented Jul 23, 2016

Current coverage is 27.62% (diff: 100%)

Merging #2317 into master will not change coverage

@@             master      #2317   diff @@
==========================================
  Files            20         20          
  Lines          3656       3656          
  Methods         335        335          
  Messages          0          0          
  Branches        678        678          
==========================================
  Hits           1010       1010          
  Misses         2468       2468          
  Partials        178        178          

Powered by Codecov. Last update 7900132...10c16b3

@marvelousNinja marvelousNinja force-pushed the sdk-2.0.0 branch 2 times, most recently from d46b19b to d4dbbc7 Compare July 24, 2016 10:13
@marvelousNinja
Copy link
Author

@igrr, what are the next steps? Here's something from the top of my head:

  1. Update 'Upgrading SDK' doc with a couple of details. It might speed up SDK upgrades in the future.
  2. Update SDK version file, release notes & stuff.
  3. There are some new static library files in the diff (and some of them were in the previous SDK releases too). They probably should be deleted: libdriver.a, libgcc.a and liblwip_536.a (this one is new).
  4. Flash layout issue you've mentioned. To be honest, I'm not sure where to begin. I'm not a C++ expert by any means, but I find this segfaultfest a bit refreshing.

@igrr
Copy link
Member

igrr commented Jul 25, 2016

Flash layout needs to be fixed:

  • reduce irom0_0_seg length by 4096 bytes for all flash layouts, except 4m1m (see tools/sdk/ld/eagle.flash.*.ld). For 4m1m layout, there is a 2 megabyte hole between the end of irom0_0_seg and SPIFFS, so lowering irom0_0_seg size is not needed.
  • add PROVIDE( _RFCAL_start = 0x40xxxxxx ); with the address of this new 4k sector. This sector will be at the end of irom0_0_seg, 4096 bytes lower than _SPIFFS_start). Adding something like PROVIDE( _RFCAL_start = _SPIFFS_start - 0x1000 ); is also a good option to reduce the number of hardcoded constants.
  • add PROVIDE( _OTA_end = _RFCAL_start ); to make the end of code segment more explicit.
  • cores/esp8266/Updater.cpp uses _SPIFFS_start as the end address of code segment. Replace that with _OTA_end. Same probably happens in cores/esp8266/Esp.cpp. Also grep other source files in cores/ and libraries/ folder and check if _SPIFFS_start is used outside of the actual SPIFFS implementation and fix if necessary.
  • use &_RFCAL_start in user_rf_cal_sector_set (calculate sector number by subtracting 0x40200000 and dividing by 0x1000).
  • test if OTA and SPIFFS functions work with each flash layout after these changes (probably the hardest part).

Other things to do:

  • update LwIP source code (tools/sdk/lwip) and do make install in tools/sdk/lwip/src.
  • revert changes to c_types.h (it should work okay without redefining stuff from stdint.h)

@igrr
Copy link
Member

igrr commented Aug 26, 2016

Opened #2440 which addresses points outlined above.

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