DATA_DTCM and NETWORKING Hello World


alessandro.moroni@...
 

Hello

I'm just trying to use the NETWORKING using the internal DATA_DTCM.
I can execute the hello world sample with DATA_DTCM=y, but i can't execute it with both:

CONFIG_DATA_DTCM=y
CONFIG_NETWORKING=y

I'm developing in the MIMXRT1050-EVK board.
The problem is that debugging i can't see the step line and the board breaks and i can't reprogram it (to fix the board, i have to use this procedure: https://community.nxp.com/thread/493530#comments ).

I can execute the sample dumb_webserver too with CONFIG_NETWORKING=y, but not with CONFIG_DATA_DTCM=y

Thanks,
Best Regards.

Alessandro Moroni.


Loic Poulain
 



Le mer. 2 oct. 2019 à 06:28, <alessandro.moroni@...> a écrit :
Hello

I'm just trying to use the NETWORKING using the internal DATA_DTCM.
I can execute the hello world sample with DATA_DTCM=y, but i can't execute it with both:

CONFIG_DATA_DTCM=y
CONFIG_NETWORKING=y

I'm developing in the MIMXRT1050-EVK board.
The problem is that debugging i can't see the step line and the board breaks and i can't reprogram it (to fix the board, i have to use this procedure: https://community.nxp.com/thread/493530#comments ).

I can execute the sample dumb_webserver too with CONFIG_NETWORKING=y, but not with CONFIG_DATA_DTCM=y

AFAIK, Problem is that you can not use highly coupled memory (DTCM) for DMA transfer, since NXP ethernet driver and probably hal driver use transfer buffer for DMA, this breaks. Ideally we should create a kind of __DMAABLE macro for such buffer. To fix that either relocate network data to OCRAM or external SDRAM. Or build with DATA_OCRAM and relocate the code you want in DTCM. 

E.g. 
zephyr_code_relocate(src/main.c DTCM_DATA_BSS)

You'll have to define DTCM section in a custom.ld or in imx rt linker, something like:
+#if (DT_MCUX_DTCM_SIZE > 0) && !defined(CONFIG_DATA_DTCM)
+ DTCM (wx) : ORIGIN = DT_MCUX_DTCM_BASE_ADDRESS, LENGTH = DT_MCUX_DTCM_SIZE
+#endif

Regards, 


alessandro.moroni@...
 

Hello, thanks for the reply.

I can't compile with CONFIG_DATA_OCRAM (I guess because I'm using version 2.0.0 and not the last of Zephyr). I will try to update it but my main problem is another.

My final goal is a comparison between my bare-metal webserver (using raw lwip + mbedtls) and a webserver created with Zephyr (using sockets).

I don't understand why the bare-metal version is much faster than the zephyr version. The example "samples/net/sockets/dumb_http_server" takes about 350ms to serve a request. I thought it was because of the external SDRAM but using it in my bare metal, the performance doesn't drop so much.

In the bare-metal version, HTTP requests are much faster than HTTPS (as I expected).
On Zephyr, HTTP requests take 350ms while HTTPS are very variable but often they are even less than 350ms! (I can't explain the reason).

Do you have any idea of the reason?

I apologize for the off-topic, if it is a problem I will create a different discussion.

Best Regards,
Alessandro.


Jukka Rissanen
 

Hi Alessandro,

could you create github issue about the slowness of the networking
stack, we can then discuss more about the issue there.


Cheers,
Jukka



On Thu, 2019-10-03 at 04:06 -0700, alessandro.moroni@studio.unibo.it
wrote:
Hello, thanks for the reply.

I can't compile with CONFIG_DATA_OCRAM (I guess because I'm using
version 2.0.0 and not the last of Zephyr). I will try to update it
but my main problem is another.

My final goal is a comparison between my bare-metal webserver (using
raw lwip + mbedtls) and a webserver created with Zephyr (using
sockets).

I don't understand why the bare-metal version is much faster than the
zephyr version. The example "samples/net/sockets/dumb_http_server"
takes about 350ms to serve a request. I thought it was because of the
external SDRAM but using it in my bare metal, the performance doesn't
drop so much.

In the bare-metal version, HTTP requests are much faster than HTTPS
(as I expected).
On Zephyr, HTTP requests take 350ms while HTTPS are very variable but
often they are even less than 350ms! (I can't explain the reason).

Do you have any idea of the reason?

I apologize for the off-topic, if it is a problem I will create a
different discussion.

Best Regards,
Alessandro.