Zephyr networking stack on i.MX RT1170 Cortex-M4 secondary core

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Zephyr networking stack on i.MX RT1170 Cortex-M4 secondary core

Zephyr networking stack on i.MX RT1170 Cortex-M4 secondary core

Zephyr is enabled on the MIMXRT1170-EVK board and can run on both the primary Cortex-M7 and secondary Cortex-M4 cores.  This example shows how to run an Ethernet networking sample on the M4 core, using the dhcpv4_client sample.  By default for the M4 on this board, the code (.text) and data sections are linked to the Tightly Coupled Memories (TCMs) RAM_L and RAM_U (called sram0 and sram1 in the Zephyr devicetree).  But one of these TCMs is not large enough to place all of the code of a networking sample.  This example moves the M4 code to the internal 512 KB OCRAM1 using a devicetree overlay.

This example also leverages Sysbuild and the M4 launcher feature.  Sysbuild builds both images for the M7 and M4.  The M7 boots first from flash, and runs a simple cm4_launcher app.  That app copies the M4 image from flash to RAM (OCRAM1 in this case) and then starts the M4.  This cm4_launcher app simplifies booting and testing apps on the M4.

Requirements

This example is enabled and tested with the following:

  • MIMXRT1170-EVKB board
  • Zephyr v4.2.0
  • Zephyr SDK v0.17.2
  • Connect an Ethernet cable to J32 for the 10/100M PHY

DHCP example app

Apply the attached patch to the Zephyr repository.  Some details about this patch:

  • The mimxrt1170_evk Kconfig.defconfig is modified to define CONFIG_NET_L2_ETHERNET when building the the M4.  This improvement will be submitted to upstream Zephyr.
  • Adds the sysbuild folder to the dhcp sample with the cm4_launcher to run on the M7
  • Modifies the M7 devicetree and Kconfig to prevent using resources that are used by the M4.
  • Modifies the M4 linker settings to place the code (.text) zephyr,flash node in ocram1, and the data zephyr,sram node in sram1 (RAM_U).

Build and flash the app with CLI using these commands:

west build -b mimxrt1170_evk//cm4 samples/net/dhcpv4_client/ --sysbuild --pristine
west flash

Reset the board after flashing.

To build the app with NXP's MCUXpresso extension for VS Code, see the Sysbuild wiki.  You will also need to flash the cm4_launcher domain to the flash.  This MCUboot article has similar steps to enable sysbuild and flash the other domain.

When both images are flashed, the RT1170 will boot and print this to the console:

[00:00:00.051,000] <inf> phy_mii: PHY (0) ID 1CC816
[00:00:00.053,000] <inf> eth_nxp_enet_mac: Link is down
*** Booting Zephyr OS build v4.2.0-1-g692f19148321 ***
[00:00:00.053,000] <inf> net_dhcpv4_client_sample: Run dhcpv4 client
[00:00:00.053,000] <inf> net_dhcpv4_client_sample: Start on ethernet: index=1
[00:00:03.153,000] <inf> phy_mii: PHY (0) Link speed 100 Mb, full duplex
[00:00:03.153,000] <inf> eth_nxp_enet_mac: Link is up
[00:00:03.170,000] <inf> net_dhcpv4: Received: 192.168.86.159
[00:00:03.170,000] <inf> net_dhcpv4_client_sample: Address[1]: 192.168.86.159
[00:00:03.170,000] <inf> net_dhcpv4_client_sample: Subnet[1]: 255.255.255.0
[00:00:03.170,000] <inf> net_dhcpv4_client_sample: Router[1]: 192.168.86.1
[00:00:03.170,000] <inf> net_dhcpv4_client_sample: Lease time[1]: 86400 seconds
uart:~$

For more articles, see NXP's Zephyr Knowledge Hub.

Attachments
No ratings
Version history
Last update:
2 weeks ago
Updated by: