Re: usb device network on nrf52840 platform


cpmcparland@...
 

Andrezej, thanks for looking at this.  To keep things simple, I went back to the sample project:

samples/net/echo_server

With the exception of adding the first line, I don't believe I have changed anything from the zephyr clone I
made a few weeks ago (1_13_99).  Here's the prj.conf.

************************************************
#CONFIG_NEWLIB_LIBC=y
# Generic networking options
CONFIG_NETWORKING=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP=y
#CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=y
#CONFIG_NET_DHCPV4=y

# Kernel options
#CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y
#CONFIG_INIT_STACKS=y

# Logging
CONFIG_NET_LOG=y
CONFIG_LOG=y
CONFIG_NET_STATISTICS=y
CONFIG_PRINTK=y

# Network buffers
CONFIG_NET_PKT_RX_COUNT=14
CONFIG_NET_PKT_TX_COUNT=14
CONFIG_NET_BUF_RX_COUNT=36
CONFIG_NET_BUF_TX_COUNT=36
CONFIG_NET_CONTEXT_NET_PKT_POOL=y

# IP address options
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3
#CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=4
CONFIG_NET_MAX_CONTEXTS=10

# Network shell
CONFIG_NET_SHELL=y

# Network application options and configuration
CONFIG_NET_APP_SERVER=y
CONFIG_NET_CONFIG_SETTINGS=y
#CONFIG_NET_CONFIG_NEED_IPV6=y
CONFIG_NET_CONFIG_NEED_IPV4=y
#CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1"
#CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2"
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"

***************************************************
When the first line is uncommented, I get compile-time errors like the following (simple variations not copied here-
but, I can send complete listing if needed).

$cmake -DCONF_FILE="prj.conf overlay-netusb.conf" -DBOARD=nrf52840_pca10056 ../../
.... cmake completes successfully ...
$make
Scanning dependencies of target kobj_types_h_target
[  0%] Generating include/generated/kobj-types-enum.h, include/generated/otype-to-str.h
[  0%] Built target kobj_types_h_target
Scanning dependencies of target syscall_list_h_target
[  1%] Generating misc/generated/syscalls.json
[  1%] Generating include/generated/syscall_dispatch.c, include/generated/syscall_list.h
[  2%] Built target syscall_list_h_target
Scanning dependencies of target syscall_macros_h_target
[  2%] Generating include/generated/syscall_macros.h
[  2%] Built target syscall_macros_h_target
Scanning dependencies of target driver_validation_h_target
[  2%] Generating include/generated/driver-validation.h
[  2%] Built target driver_validation_h_target
Scanning dependencies of target offsets
[  2%] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj
[  3%] Linking C static library liboffsets.a
[  3%] Built target offsets
Scanning dependencies of target offsets_h
[  3%] Generating include/generated/offsets.h
[  3%] Built target offsets_h
Scanning dependencies of target app
[  3%] Building C object CMakeFiles/app.dir/src/echo-server.c.obj
[  4%] Building C object CMakeFiles/app.dir/src/udp.c.obj
[  4%] Building C object CMakeFiles/app.dir/src/tcp.c.obj
[  5%] Linking C static library libapp.a
[  5%] Built target app
Scanning dependencies of target zephyr
[  6%] Building C object zephyr/CMakeFiles/zephyr.dir/arch/common/isr_tables.c.obj
[  7%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/thread_entry.c.obj
[  7%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/crc/crc32_sw.c.obj
[  8%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/crc/crc16_sw.c.obj
[  8%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/crc/crc8_sw.c.obj
[  9%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/mempool/mempool.c.obj
[  9%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/rbtree/rb.c.obj
[ 10%] Building C object zephyr/CMakeFiles/zephyr.dir/misc/printk.c.obj
[ 11%] Building C object zephyr/CMakeFiles/zephyr.dir/misc/generated/configs.c.obj
[ 11%] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/nrf52/power.c.obj
[ 12%] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/nrf52/soc.c.obj
[ 12%] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/nrf52/mpu_regions.c.obj
[ 13%] Building C object zephyr/CMakeFiles/zephyr.dir/ext/hal/nordic/nrfx/mdk/system_nrf52840.c.obj
[ 13%] Building C object zephyr/CMakeFiles/zephyr.dir/ext/hal/nordic/nrfx_glue.c.obj
[ 14%] Building C object zephyr/CMakeFiles/zephyr.dir/ext/hal/nordic/nrfx/drivers/src/nrfx_systick.c.obj
[ 15%] Building C object zephyr/CMakeFiles/zephyr.dir/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c.obj

In file included from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/nrfx.h:37:0,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:32:
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:161:5: error: expected declaration specifiers or ‘...’ before ‘(’ token
     ((NRF_USBD_EPIN_CHECK(ep) ? NRFX_USBD_EPIN_BITPOS_0 : NRFX_USBD_EPOUT_BITPOS_0) \
     ^
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/./nrfx_glue.h:65:23: note: in definition of macro ‘NRFX_STATIC_ASSERT’
         static_assert(expression, "assertion failed")
                       ^~~~~~~~~~
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:185:20: note: in expansion of macro ‘NRFX_USBD_EP_BITPOS’
 NRFX_STATIC_ASSERT(NRFX_USBD_EP_BITPOS(NRFX_USBD_EPIN1)  == USBD_EPDATASTATUS_EPIN1_Pos );
                    ^~~~~~~~~~~~~~~~~~~

... more similar errors...

In file included from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/nrfx.h:37:0,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:32:
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c: In function ‘usbd_dmareq_process’:
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:1397:50: warning: passing argument 1 of ‘atomic_and’ from incompatible pointer type [-Wincompatible-pointer-types]
                     (void)(NRFX_ATOMIC_FETCH_AND(&m_ep_dma_waiting, ~(1U << pos)));
                                                  ^
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/./nrfx_glue.h:186:58: note: in definition of macro ‘NRFX_ATOMIC_FETCH_AND’
 #define NRFX_ATOMIC_FETCH_AND(p_data, value)  atomic_and(p_data, value)
                                                          ^~~~~~
In file included from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/include/kernel_includes.h:21:0,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/include/kernel.h:17,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/./nrfx_glue.h:139,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/nrfx.h:37,
                 from /home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c:32:
/home/mcp/ZephyrProjects/zephyr-1_13_99/zephyr/include/atomic.h:248:28: note: expected ‘atomic_t * {aka int *}’ but argument is of type ‘uint32_t * {aka long unsigned int *}’
 static inline atomic_val_t atomic_and(atomic_t *target, atomic_val_t value)
                            ^~~~~~~~~~
zephyr/CMakeFiles/zephyr.dir/build.make:257: recipe for target 'zephyr/CMakeFiles/zephyr.dir/ext/hal/nordic/nrfx/drivers/src/nrfx_usbd.c.obj' failed

... more similar errors...

I know echo_server does not require newlib; but my app may.  This is the same behavior I see in my project.
Thought focusing on a sample project would help keep things a bit clearer.

Cheers,
Chuck McP

Join devel@lists.zephyrproject.org to automatically receive all group messages.