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

Cannot flash LWM2M example for ESP32 #17135

Closed
mutrack opened this issue Jun 28, 2019 · 5 comments
Closed

Cannot flash LWM2M example for ESP32 #17135

mutrack opened this issue Jun 28, 2019 · 5 comments
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@mutrack
Copy link

mutrack commented Jun 28, 2019

I am trying to run the LWM2M sample on an ESP32 board. It builds fine but fails to flash with an "Invalid segment count 17 (max 16)" error.
Other samples e.g. hello_world, mqtt build and flash without problem.

Build environment : Ubuntu 4.18.0
ESP-IDF Version : v4.0-dev-1018-gbbafd5066
Zephyr version: 1.14.99

Full output:

steve@ubuntu:~/zephyrproject/zephyr$ cmake -Bbuild -GNinja -DBOARD=esp32 -DCONF_FILE=prj.conf samples/net/lwm2m_client
Zephyr version: 1.14.99
-- Selected BOARD esp32
-- Found west: /home/steve/.local/bin/west (found suitable version "0.5.7", minimum required is "0.5.6")
-- Loading /home/steve/zephyrproject/zephyr/boards/xtensa/esp32/esp32.dts as base
-- Overlaying /home/steve/zephyrproject/zephyr/dts/common/common.dts
Parsing Kconfig tree in /home/steve/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/steve/zephyrproject/zephyr/build/zephyr/.config'
No change to '/home/steve/zephyrproject/zephyr/build/zephyr/.config'
-- Cache files will be written to: /home/steve/.cache/zephyr
CMake Warning at /home/steve/zephyrproject/zephyr/boards/common/esp32.board.cmake:7 (message):
  Setting ESP_IDF_PATH in the environment is deprecated.  Use cmake
  -DESP_IDF_PATH=...  instead.
Call Stack (most recent call first):
  /home/steve/zephyrproject/zephyr/boards/xtensa/esp32/board.cmake:3 (include)
  /home/steve/zephyrproject/zephyr/cmake/app/boilerplate.cmake:463 (include)
  CMakeLists.txt:4 (include)


Including module: esp-idf in path: /home/steve/zephyrproject/modules/hal/esp-idf/zephyr
Including module: fatfs in path: /home/steve/zephyrproject/modules/fs/fatfs
Including module: qmsi in path: /home/steve/zephyrproject/modules/hal/qmsi
Including module: cypress in path: /home/steve/zephyrproject/modules/hal/cypress
Including module: silabs in path: /home/steve/zephyrproject/modules/hal/silabs
Including module: st in path: /home/steve/zephyrproject/modules/hal/st
Including module: stm32 in path: /home/steve/zephyrproject/modules/hal/stm32
Including module: libmetal in path: /home/steve/zephyrproject/modules/hal/libmetal
Including module: mbedtls in path: /home/steve/zephyrproject/modules/crypto/mbedtls
Including module: mcumgr in path: /home/steve/zephyrproject/modules/lib/mcumgr
Including module: nffs in path: /home/steve/zephyrproject/modules/fs/nffs
Including module: open-amp in path: /home/steve/zephyrproject/modules/lib/open-amp
Including module: segger in path: /home/steve/zephyrproject/modules/debug/segger
Including module: tinycbor in path: /home/steve/zephyrproject/modules/lib/tinycbor
-- Configuring done
-- Generating done
-- Build files have been written to: /home/steve/zephyrproject/zephyr/build
steve@ubuntu:~/zephyrproject/zephyr$ ninja -Cbuild flash
ninja: Entering directory `build'
[121/126] Linking C executable zephyr/zephyr_prebuilt.elf
Memory region         Used Size  Region Size  %age Used
     iram0_0_seg:      121918 B       128 KB     93.02%
     iram0_2_seg:          0 GB      3264 KB      0.00%
     dram0_0_seg:       64176 B       320 KB     19.58%
     drom0_0_seg:          0 GB         8 MB      0.00%
    rtc_iram_seg:          0 GB         8 KB      0.00%
    rtc_slow_seg:          0 GB         4 KB      0.00%
        IDT_LIST:          72 B         8 KB      0.88%
[125/126] Flashing esp32
-- west flash: using runner esp32
-- runners.esp32: Converting ELF to BIN
esptool.py v2.7-dev

A fatal error occurred: Invalid segment count 17 (max 16). Usually this indicates a linker script problem.
ERROR: command exited with status 2: /home/steve/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 elf2image /home/steve/zephyrproject/zephyr/build/zephyr/zephyr.elf
run as "west -v flash --skip-rebuild" for a stack trace
FAILED: zephyr/cmake/flash/CMakeFiles/flash
cd /home/steve/zephyrproject/zephyr/build && /home/steve/.bin/cmake/cmake-3.13.1-Linux-x86_64/bin/cmake -E env /home/steve/.local/bin/west flash --skip-rebuild
ninja: build stopped: subcommand failed.

@mutrack mutrack added the bug The issue is a bug, or the PR is fixing a bug label Jun 28, 2019
@ioannisg ioannisg added the priority: medium Medium impact/importance bug label Jul 2, 2019
@nashif nashif added priority: low Low impact/importance bug and removed priority: medium Medium impact/importance bug labels Jul 6, 2019
@mike-scott
Copy link
Contributor

@nashif This isn't an LwM2M sample issue is it? I'm not sure what config is being set there that might cause this.

@nashif
Copy link
Member

nashif commented Aug 28, 2019

@mike-scott no, i think this has nothing to do with lwm2m.

@fake991
Copy link

fake991 commented Oct 15, 2019

has anyone managed to make it work?

@Deliver88
Copy link

Deliver88 commented Nov 14, 2019

@fake991 , @nashif
I faced this issue too, when tried running the WiFi example at samples/net/wifi. The error is caused from the esp-idf. At esp-idf/components/esptool_py/esptool you have to fix it in the esptool.phy, there you will find the section

def verify(self): if len(self.segments) > 16: raise FatalError('Invalid segment count %d (max 16). Usually this indicates a linker script problem.' % len(self.segments))

Changing it to a nother value (e.g. to 17 or what ever you like) will fix the error!

@nashif
Copy link
Member

nashif commented Mar 11, 2020

duplicate of #20980

@nashif nashif closed this as completed Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

6 participants