Imxrt1020-evk: ethernet echo server sample doesn't work built via PlatformIO, but works built directly with Zephyr

I used PlatformIO to build Ethernet Echo server sample of Zephyr zephyr/samples/net/sockets/echo at zephyr-v2.5.0 · zephyrproject-rtos/zephyr · GitHub for mimxrt1020-evk board. It compiled fine but didn’t boot (console outputs nothing, ethernet gives no carrier signal). However using Zephyr’s west build the same code (with same Zephyr version, i.e., 2.5.0) did work. What could be the difference?

What’s the full platformio.ini?

Hello Max! The platformio.ini contents are

[env:mimxrt1020_evk]
platform = nxpimxrt
framework = zephyr 
board = mimxrt1020_evk

Can you try my example at GitHub - maxgerhardt/pio-zephyr-socket-example?

1 Like

Certainly! I did and got the same result – silence on console (UART); no carrier on Ethernet; Ethernet port LEDs on at partial brightness, unresponsive to cable or incoming packets.

The commands I ran and build output
janis@leopard:~/src/pio-zephyr-socket-example$ platformio --version
PlatformIO Core, version 5.1.1
janis@leopard:~/src/pio-zephyr-socket-example$ platformio run -e mimxrt1020_evk --target upload --upload-port /media/janis/RT1020-EVK/
Processing mimxrt1020_evk (platform: nxpimxrt; board: mimxrt1020_evk; framework: zephyr)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nxpimxrt/mimxrt1020_evk.html
PLATFORM: NXP i.MX RT (4.1.0) > NXP i.MX RT1020 Evaluation Kit
HARDWARE: MIMXRT1021DAG5A 500MHz, 32MB RAM, 8MB Flash
DEBUG: Current (jlink) On-board (jlink) External (blackmagic)
PACKAGES: 
 - framework-zephyr 2.20500.210226 (2.5.0) 
 - framework-zephyr-canopennode 0.0.0-alpha+sha.468d350028 
 - framework-zephyr-civetweb 0.0.0-alpha+sha.e6903b80c0 
 - framework-zephyr-cmsis 0.0.0-alpha+sha.c3bd2094f9 
 - framework-zephyr-fatfs 0.0.0-alpha+sha.1d1fcc725a 
 - framework-zephyr-hal-nxp 0.0.0-alpha+sha.b916bca1d5 
 - framework-zephyr-hal-st 0.0.0-alpha+sha.b52fdbf4b6 
 - framework-zephyr-libmetal 0.0.0-alpha+sha.9d4ee2c3cf 
 - framework-zephyr-littlefs 0.0.0-alpha+sha.9e4498d1c7 
 - framework-zephyr-loramac-node 0.0.0-alpha+sha.3f545d76a2 
 - framework-zephyr-lvgl 0.0.0-alpha+sha.31acbaa36e 
 - framework-zephyr-mbedtls 0.0.0-alpha+sha.24d84ecff1 
 - framework-zephyr-mcuboot 0.0.0-alpha+sha.3fc59410b6 
 - framework-zephyr-mcumgr 0.0.0-alpha+sha.43845e883f 
 - framework-zephyr-mipi-sys-t 0.0.0-alpha+sha.75e671550a 
 - framework-zephyr-open-amp 0.0.0-alpha+sha.de1b85a130 
 - framework-zephyr-openthread 0.0.0-alpha+sha.1d668284a0 
 - framework-zephyr-segger 0.0.0-alpha+sha.38c79a447e 
 - framework-zephyr-sof 0.0.0-alpha+sha.b5b772dd61 
 - framework-zephyr-tfm-mcuboot 1.7.0-rc1 
 - framework-zephyr-tinycbor 0.0.0-alpha+sha.40daca97b4 
 - framework-zephyr-tinycrypt 0.0.0-alpha+sha.3e9a49d267 
 - framework-zephyr-trusted-firmware-m 0.0.0-alpha+sha.96340fb6c0 
 - tool-cmake 3.16.4 
 - tool-dtc 1.4.7 
 - tool-gperf 3.0.4 
 - tool-ninja 1.7.1 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
Reading CMake configuration...
Parsing system calls...
Generating syscall files
Generating KObject files...
Validating driver...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/mimxrt1020_evk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr_final/zephyr/misc/empty_file.c.o
Generating header file with offsets .pio/build/mimxrt1020_evk/zephyr/include/generated/offsets.h
Archiving .pio/build/mimxrt1020_evk/zephyr/liboffsets.a
Indexing .pio/build/mimxrt1020_evk/zephyr/liboffsets.a
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32/zephyr/arch/arch/arm/core/aarch32/prep_c.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/drivers/timer/cortex_m_systick.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/subsys/net/lib/sockets/getaddrinfo.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32__cortex_m/zephyr/arch/arch/arm/core/aarch32/cortex_m/fault_s.S.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/sem.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32/zephyr/arch/arch/arm/core/aarch32/thread.c.o
Compiling .pio/build/mimxrt1020_evk/lib__libc__newlib/zephyr/lib/libc/newlib/libc-hooks.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/drivers/console/uart_console.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/subsys/logging/log_msg.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/timeutil.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/hex.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/utils.c.o
Compiling .pio/build/mimxrt1020_evk/arch__common/zephyr/arch/common/sw_isr_common.c.o
Compiling .pio/build/mimxrt1020_evk/..__-hal-nxp/modules/framework-zephyr-hal-nxp/mcux/components/phyksz8081/fsl_phy.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/udp.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32__cortex_m__mpu/zephyr/arch/arch/arm/core/aarch32/cortex_m/mpu/arm_mpu.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/timeout.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/lib/libc/newlib/liblib__libc__newlib.a
Indexing .pio/build/mimxrt1020_evk/zephyr/lib/libc/newlib/liblib__libc__newlib.a
Compiling .pio/build/mimxrt1020_evk/drivers__serial/zephyr/drivers/serial/uart_mcux_lpuart.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32__cortex_m/zephyr/arch/arch/arm/core/aarch32/cortex_m/thread_abort.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/arch/common/libarch__common.a
Indexing .pio/build/mimxrt1020_evk/zephyr/arch/common/libarch__common.a
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/cbprintf.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/fatal.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/net_context.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32/zephyr/arch/arch/arm/core/aarch32/nmi_on_reset.S.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/drivers/timer/sys_clock_init.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/drivers/serial/libdrivers__serial.a
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/configs.c.o
Indexing .pio/build/mimxrt1020_evk/zephyr/drivers/serial/libdrivers__serial.a
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32__cortex_m/zephyr/arch/arch/arm/core/aarch32/cortex_m/reset.S.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/sched.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32/zephyr/arch/arch/arm/core/aarch32/irq_manage.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/subsys/logging/log_core.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/thread_entry.c.o
Compiling .pio/build/mimxrt1020_evk/lib__posix/zephyr/lib/posix/nanosleep.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/fdtable.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/net_timeout.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/tcp2.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32__cortex_m__mpu/zephyr/arch/arch/arm/core/aarch32/cortex_m/mpu/arm_core_mpu.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/xip.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net/zephyr/subsys/net/buf.c.o
Compiling .pio/build/mimxrt1020_evk/soc__arm__common__cortex_m/zephyr/soc/arm/common/cortex_m/arm_mpu_regions.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/arch/arch/arm/core/aarch32/cortex_m/mpu/libarch__arm__core__aarch32__cortex_m__mpu.a
Indexing .pio/build/mimxrt1020_evk/zephyr/arch/arch/arm/core/aarch32/cortex_m/mpu/libarch__arm__core__aarch32__cortex_m__mpu.a
Archiving .pio/build/mimxrt1020_evk/zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32__cortex_m/zephyr/arch/arch/arm/core/aarch32/cortex_m/irq_init.c.o
Indexing .pio/build/mimxrt1020_evk/zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/version.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/errno.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32/zephyr/arch/arch/arm/core/aarch32/nmi.c.o
Generating final linker script .pio/build/mimxrt1020_evk/zephyr/linker_pass_final.cmd
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/subsys/net/lib/utils/addr_utils.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/queue.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr_prebuilt/zephyr/misc/empty_file.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32/zephyr/arch/arch/arm/core/aarch32/swap_helper.S.o
Compiling .pio/build/mimxrt1020_evk/isr_tables/zephyr/arch/common/isr_tables.c.o
Compiling .pio/build/mimxrt1020_evk/..__-hal-nxp/modules/framework-zephyr-hal-nxp/mcux/drivers/imx/fsl_lpuart.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/subsys/logging/log_list.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/sem.c.o
Compiling .pio/build/mimxrt1020_evk/src/socket_echo.o
Archiving .pio/build/mimxrt1020_evk/zephyr/arch/common/libisr_tables.a
Indexing .pio/build/mimxrt1020_evk/zephyr/arch/common/libisr_tables.a
Compiling .pio/build/mimxrt1020_evk/lib__posix/zephyr/lib/posix/pthread_common.c.o
Compiling .pio/build/mimxrt1020_evk/drivers__entropy/zephyr/drivers/entropy/entropy_mcux_trng.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/subsys/net/libsubsys__net.a
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/idle.c.o
Indexing .pio/build/mimxrt1020_evk/zephyr/subsys/net/libsubsys__net.a
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/crc7_sw.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/net_if.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__l2__ethernet/zephyr/subsys/net/l2/ethernet/arp.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/lib/posix/liblib__posix.a
Indexing .pio/build/mimxrt1020_evk/zephyr/lib/posix/liblib__posix.a
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/connection.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/drivers/entropy/libdrivers__entropy.a
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/banner.c.o
Indexing .pio/build/mimxrt1020_evk/zephyr/drivers/entropy/libdrivers__entropy.a
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/subsys/net/lib/sockets/sockets_misc.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32__cortex_m/zephyr/arch/arch/arm/core/aarch32/cortex_m/scb.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/thread_abort.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32/zephyr/arch/arch/arm/core/aarch32/fatal.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/drivers/ethernet/eth_mcux.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/cbprintf_complete.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/pipes.c.o
Compiling .pio/build/mimxrt1020_evk/..__-hal-nxp/modules/framework-zephyr-hal-nxp/mcux/drivers/imx/fsl_cache.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/rb.c.o
Compiling .pio/build/mimxrt1020_evk/..__-hal-nxp/modules/framework-zephyr-hal-nxp/mcux/drivers/imx/fsl_trng.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/net_core.c.o
Compiling .pio/build/mimxrt1020_evk/..__-hal-nxp/modules/framework-zephyr-hal-nxp/mcux/devices/MIMXRT1021/fsl_clock.c.o
Compiling .pio/build/mimxrt1020_evk/..__-hal-nxp/modules/framework-zephyr-hal-nxp/mcux/boards/evkmimxrt1020/dcd.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__l2__ethernet/zephyr/subsys/net/l2/ethernet/ethernet.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/ipv4.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/smp.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/subsys/net/lib/sockets/getnameinfo.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32__cortex_m/zephyr/arch/arch/arm/core/aarch32/cortex_m/exc_exit.S.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/thread.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/dec.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32/zephyr/arch/arch/arm/core/aarch32/cpu_idle.S.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32__cortex_m/zephyr/arch/arch/arm/core/aarch32/cortex_m/vector_table.S.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/heap-validate.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/device.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/mutex.c.o
Compiling .pio/build/mimxrt1020_evk/boards__arm__mimxrt1020_evk/zephyr/boards/arm/mimxrt1020_evk/pinmux.c.o
Compiling .pio/build/mimxrt1020_evk/drivers__gpio/zephyr/drivers/gpio/gpio_mcux_igpio.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/onoff.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/mailbox.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/mempool.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/subsys/net/l2/ethernet/libsubsys__net__l2__ethernet.a
Indexing .pio/build/mimxrt1020_evk/zephyr/subsys/net/l2/ethernet/libsubsys__net__l2__ethernet.a
Archiving .pio/build/mimxrt1020_evk/zephyr/boards/arm/mimxrt1020_evk/libboards__arm__mimxrt1020_evk.a
Indexing .pio/build/mimxrt1020_evk/zephyr/boards/arm/mimxrt1020_evk/libboards__arm__mimxrt1020_evk.a
Compiling .pio/build/mimxrt1020_evk/subsys__random/zephyr/subsys/random/rand32_entropy_device.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/crc8_sw.c.o
Compiling .pio/build/mimxrt1020_evk/..__-hal-nxp/modules/framework-zephyr-hal-nxp/mcux/boards/evkmimxrt1020/evkmimxrt1020_flexspi_nor_config.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/icmpv4.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/drivers/gpio/libdrivers__gpio.a
Indexing .pio/build/mimxrt1020_evk/zephyr/drivers/gpio/libdrivers__gpio.a
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/condvar.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/subsys/net/lib/sockets/sockets_select.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/soc/arm/nxp_imx/rt/soc.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/system_work_q.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32/zephyr/arch/arch/arm/core/aarch32/swap.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/drivers/clock_control/clock_control_mcux_ccm.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/subsys/random/libsubsys__random.a
Indexing .pio/build/mimxrt1020_evk/zephyr/subsys/random/libsubsys__random.a
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/subsys/logging/log_backend_uart.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/heap.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/msg_q.c.o
Compiling .pio/build/mimxrt1020_evk/..__-hal-nxp/modules/framework-zephyr-hal-nxp/mcux/drivers/imx/fsl_enet.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/net_pkt.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/printk.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/kheap.c.o
Generating linker script .pio/build/mimxrt1020_evk/zephyr/linker.cmd
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/poll.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/crc16_sw.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/net_tc.c.o
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32/zephyr/arch/arch/arm/core/aarch32/isr_wrapper.S.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/subsys/net/lib/sockets/sockets.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a
Compiling .pio/build/mimxrt1020_evk/arch__arm__core__aarch32__cortex_m/zephyr/arch/arch/arm/core/aarch32/cortex_m/fault.c.o
Indexing .pio/build/mimxrt1020_evk/zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/stack.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/subsys/logging/log_output.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/work_q.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/mem_slab.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__lib__config/zephyr/subsys/net/lib/config/init.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/notify.c.o
Compiling .pio/build/mimxrt1020_evk/subsys__net__ip/zephyr/subsys/net/ip/net_mgmt.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/init.c.o
Archiving .pio/build/mimxrt1020_evk/zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a
Indexing .pio/build/mimxrt1020_evk/zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/timer.c.o
Compiling .pio/build/mimxrt1020_evk/..__-hal-nxp/modules/framework-zephyr-hal-nxp/mcux/drivers/imx/fsl_gpio.c.o
Compiling .pio/build/mimxrt1020_evk/zephyr/zephyr/lib/os/crc32_sw.c.o
Compiling .pio/build/mimxrt1020_evk/kernel/zephyr/kernel/work_q.c.o
Archiving .pio/build/mimxrt1020_evk/modules/framework-zephyr-hal-nxp/lib..__framework-zephyr-hal-nxp.a
Indexing .pio/build/mimxrt1020_evk/modules/framework-zephyr-hal-nxp/lib..__framework-zephyr-hal-nxp.a
Archiving .pio/build/mimxrt1020_evk/zephyr/subsys/net/lib/config/libsubsys__net__lib__config.a
Indexing .pio/build/mimxrt1020_evk/zephyr/subsys/net/lib/config/libsubsys__net__lib__config.a
Archiving .pio/build/mimxrt1020_evk/zephyr/kernel/libkernel.a
Indexing .pio/build/mimxrt1020_evk/zephyr/kernel/libkernel.a
Archiving .pio/build/mimxrt1020_evk/zephyr/libzephyr.a
Archiving .pio/build/mimxrt1020_evk/zephyr/subsys/net/ip/libsubsys__net__ip.a
Indexing .pio/build/mimxrt1020_evk/zephyr/libzephyr.a
Indexing .pio/build/mimxrt1020_evk/zephyr/subsys/net/ip/libsubsys__net__ip.a
Linking .pio/build/mimxrt1020_evk/firmware-pre.elf
Generating ISR list .pio/build/mimxrt1020_evk/zephyr/isrList.bin
Generating ISR table .pio/build/mimxrt1020_evk/zephyr/isr_tables.c
Compiling .pio/build/mimxrt1020_evk/zephyr_final/zephyr/isr_tables.c.o
Linking .pio/build/mimxrt1020_evk/firmware.elf
Checking size .pio/build/mimxrt1020_evk/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.1% (used 32247 bytes from 33554432 bytes)
Flash: [          ]   0.9% (used 76368 bytes from 8388608 bytes)
Building .pio/build/mimxrt1020_evk/firmware.bin
Configuring upload protocol...
AVAILABLE: blackmagic, jlink, mbed
CURRENT: upload_protocol = mbed
Looking for upload disk...
Use manually specified: /media/janis/RT1020-EVK/
Uploading .pio/build/mimxrt1020_evk/firmware.bin
Firmware has been successfully uploaded.
(Some boards may require manual hard reset)
========================================================================================== [SUCCESS] Took 17.41 seconds ==========================================================================================

Thank you! For the record, the example you provided is identical almost same (w/ diff) to what I was compiling save for some cosmetic changes (comments and readme files) and logging config. I could expect the same result but at least we have ruled out project configuration error now, I think. Where do we go next?

There are a few more things to to try. First of all, please add

CONFIG_SERIAL=y
CONFIG_STDOUT_CONSOLE=y

to the zephyr/prj.conf, then delete the .pio folder of the project and rebuild and reupload again. I’ve seen these options in the other Zephyr examples too.

Another thing that can be tested is Zephyr 2.6.0 support, available in the current dev version, usable like this in the platformio.ini. This also requires updating the code to zephyr/samples/net/sockets/echo at zephyr-v2.6.0 · zephyrproject-rtos/zephyr · GitHub.

And finally if both of that does not work, please build the standard example platform-nxpimxrt/examples/mbed-rtos-ethernet-tls at develop · platformio/platform-nxpimxrt · GitHub and flash it on the board, that is using mbed-os.

First, a slight correction. The example you provided did differ a little, but that’s almost surely inconsequential.

diff prj.conf
diff --git a/zephyr/prj.conf b/zephyr/prj.conf
index 6526148..af81ce7 100644
--- a/zephyr/prj.conf
+++ b/zephyr/prj.conf
@@ -18,3 +18,19 @@ CONFIG_NET_CONFIG_SETTINGS=y
 CONFIG_NET_CONFIG_NEED_IPV4=y
 CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
 CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
+
+#overlay-log.conf
+CONFIG_LOG=y
+CONFIG_LOG_MODE_IMMEDIATE=y
+CONFIG_LOG_BACKEND_SHOW_COLOR=n
+
+CONFIG_NET_LOG=y
+
+#CONFIG_NET_IF_LOG_LEVEL_DBG=y
+#CONFIG_NET_L2_ETHERNET_LOG_LEVEL_DBG=y
+
+CONFIG_NET_SOCKETS_LOG_LEVEL_DBG=y
+CONFIG_NET_CONN_LOG_LEVEL_DBG=y
+CONFIG_NET_CONTEXT_LOG_LEVEL_DBG=y
+
+CONFIG_NET_TCP_LOG_LEVEL_DBG=y
\ No newline at end of file

I tried adding the configuration options, but for the record, it looks like they’re enabled by default already:

janis@leopard:~/src/pio-zephyr-socket-example$ grep -E 'CONFIG_(SERIAL|STDOUT_CONSOLE)' .pio/build/mimxrt1020_evk/zephyr/.config
CONFIG_SERIAL=y
CONFIG_SERIAL_HAS_DRIVER=y
CONFIG_SERIAL_SUPPORT_INTERRUPT=y
CONFIG_STDOUT_CONSOLE=y

I continued regardless. The build produced an identical binary and flashing it had – expectedly – no changes on the behaviour.

I tried this too. It did download the new framework version (and a lot of other crud) but, unfortunately, no changes in the behaviour.
The built and flashed binary was certainly different this time.

Thanks! But even after adding mimxrt1020_evk to platformio.ini I got greeted with:

Error: This board doesn't support mbed framework!

Do you think we should force it (by adding it to supported frameworks)?

Argh I forgot, mbed-os only has support for the imxrt1050, mbed-os/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS at mbed-os-6.1.0 · ARMmbed/mbed-os · GitHub. The chips probably not compatible :confused:

Hm okay. Either something is really fundamentally broken here with PlatformIO’s support for Zephyr or there’s a wrong toolchain compiler flags setup.

Do you happen to have a JLink? With that the board is debuggable in PlatformIO.

Then one could see where in the world it is stuck in the code.

Another thing I’ll try now is expand the NXP IMX platform with the Teensy4.0 + bleeding edge Zephyr support (zephyr/boards/arm/teensy4 at main · zephyrproject-rtos/zephyr · GitHub). That’s the only NXP i.MX RT based board that I have here for debugging. That way I can find out if that doesn’t work too, or in reverse, if it is, that implies the problem is either the Zephyr version or board-specific settings.

Funny, I was able to get Teensy 4.0 + Zephyr support to compile, blinking a GPIO pin and calling printk() for serial output. The blinky works, but not the UART. The docs and code say that digital pin 1 is TX of the UART at 115200 baud, but there’s nothing coming out of there.

Reference project at GitHub - maxgerhardt/pio-teensy4-with-zephyr.

Can you test whether the blinky example does not work too? platform-nxpimxrt/examples/zephyr-blink at develop · platformio/platform-nxpimxrt · GitHub

Per dts the LED output should be “(green) User LD1”, GPIO port 1 pin 5. (aka “D4” on the Arduino header, too).

Cool! Thanks for the effort!

Perhaps I should’ve mentioned that before. I can confirm the blinky example works. I did test that before moving on to Ethernet samples.

I have also tested the Zephyr’s own “Hello World” sample zephyr/samples/hello_world at zephyr-v2.5.0 · zephyrproject-rtos/zephyr · GitHub which also worked when adapted and built by PlatformIO. So I am getting UART output from this board too.

As soon as I tried Ethernet examples, it no longer worked despite apparently building successfully. Zephyr doesn’t even seem to boot. :confused:

I just happen to have one! Although the fat 20-pin cable is missing – will have to find it… or crimp a new one. I’ll let you know when I get to debugging this thing.

Weird, so it has to be something specific to Ethernet and PlatformIO. Maybe some init function crashes due to wrongly set compile-time constants so that the firmware doesn’t even reach main().

In any case, since it’s a clear-cut case of the same project code working in Zephyr natively but not through PlatformIO, please file an issue at GitHub - platformio/platform-nxpimxrt: NXP i.MX RT: development platform for PlatformIO for developer assistance. If you get can JLink debugging to work and see in wich function it might stuck or throwing an error, that would be of great help for them, surely, but mainly the devs have to have figure this one out.

It is weird. It’s ethernet causing the issue for me but whether it is ethernet-specific or something more fundamental is indeed probably best left to devs to find out. I’ll file the issue. Thanks for assistance, Max!

I shall mark this topic solved once it actually is (i.e., filed issue is resolved).