SAME70 Xplained failed to build with ethernet networking


Sam Wong
 

I bought a new SAME70 Xplained board last week and pulled down the latest from Master. 
Sample projects work as long as networking is not involved. Network projects compiled and run but debugging showed that packet reception is fine but nothing got transmitted. 
Did some digging and saw some patches added for Rev.B chip that fixed the problem. I ran config to specify Rev.B chip. However, network projects now failed to build. 

-----------------------------
In file included from ../include/toolchain.h:39,
                 from ../include/sys/atomic.h:13,
                 from ../include/logging/log_msg.h:9,
                 from ../include/logging/log_core.h:9,
                 from ../include/logging/log.h:11,
                 from /home/sam/zephyr/zephyr/drivers/ethernet/eth_sam_gmac.c:26:
../include/toolchain/gcc.h:62:36: error: static assertion failed: "GMAC_QUEUE_NUM doesn\'t match soc header"
   62 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
      |                                    ^~~~~~~~~~~~~~
/home/sam/zephyr/zephyr/drivers/ethernet/eth_sam_gmac_priv.h:37:1: note: in expansion of macro 'BUILD_ASSERT'
   37 | BUILD_ASSERT(ARRAY_SIZE(GMAC->GMAC_TBQBAPQ) + 1 == GMAC_QUEUE_NUM,
      | ^~~~~~~~~~~~
[58/162] Building C object zephyr/arch...rm__core__aarch32.dir/irq_manage.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/sam/zeph
---------------------------------------

Further digging showed that GMAC_QUEUE_NUM is set to 3 but GMAC->GMAC_TBQBAPQ is 5 for Rev.B chip according to the declaration in the SDK. GMAC->GMAC_TBQBAPQ is 2 for Rev.A chip and so it won't trigger the BUILD_ASSERT. 

num_queue is in auto-generated devicetree_unfixed.h in the build directory. I don't know enough to figure out where to look for the origin of num_queue.
Any help would be appreciated.

Sam

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