S32K344 lwip with DCache enabled

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

S32K344 lwip with DCache enabled

Jump to solution
3,856 Views
ola_gook
Contributor III

(Using DS 3.5, latest RTD and latest lwip)

I have a working lwip project running and now need to also enable data cache with compiler flag D_CACHE_ENABLE.

However, as soon as I enable it, the lwip functionality is lost. The UM and IM for Gmac seem to state that it should be possible but I cannot understand exactly how. Gmac_Ip_Cfg data is placed in non cachable RAM and still it does not work. I disabled the flag -fdata-sections to make Cfg data end up in non cachable RAM (0x2043xxxx).
 
Is there example code for how to make lwip work together with dcache?
 
Regards
/Ola
0 Kudos
Reply
1 Solution
3,784 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @ola_gook 

You can take a look at this post:

https://community.nxp.com/t5/S32K/S32K344-S32K324-TCPIP-STACK-Intergration/m-p/1527082/highlight/tru...

There's step by step guide including demo application which contains these changes.

Regards,

Lukas

View solution in original post

0 Kudos
Reply
3 Replies
3,841 Views
ola_gook
Contributor III

I managed to get one step closer to the solution.

I found another similar issue where the proposed solution was to make sure the lwip heap is placed in non_cachable ram. Unfortunately, the detailed solution using S32DS was not possible to see due to bad resolution in attached image.

Instead, I did this temporarily by simply appending in mem.c:

LWIP_DECLARE_MEMORY_ALIGNED(ram_heap, MEM_SIZE_ALIGNED + (2U * SIZEOF_STRUCT_MEM))__attribute__((section(".mcal_bss_no_cacheable")));

 

I also made sure that the Gmac_Ip_Cfg.o elements are placed in non_cachable RAM by building without -fdata-sections

Current result is that pinging it (or connecting to port 80 with a browser, same result) works about 60% of the time. 

Thus, I get the feeling that there is some more data that needs to put in non_cachable RAM.

Any suggestions?

Regards

3,584 Views
yosri_c
Contributor IV

hi Ola ,

i'm just wondering where exactly did you append that one ?

i'm stuck with the same issue and couldn't find the exact fix for it

 

thank you

0 Kudos
Reply
3,785 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @ola_gook 

You can take a look at this post:

https://community.nxp.com/t5/S32K/S32K344-S32K324-TCPIP-STACK-Intergration/m-p/1527082/highlight/tru...

There's step by step guide including demo application which contains these changes.

Regards,

Lukas

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1840440%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K344%20lwip%20with%20DCache%20enabled%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1840440%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E(Using%20DS%203.5%2C%20latest%20RTD%20and%20latest%20lwip)%3C%2FP%3E%3CP%3EI%20have%20a%20working%20lwip%20project%20running%20and%20now%20need%20to%20also%20enable%20data%20cache%20with%20compiler%20flag%26nbsp%3B%3CSPAN%3ED_CACHE_ENABLE.%3C%2FSPAN%3E%3C%2FP%3E%3CDIV%3E%3CDIV%3EHowever%2C%20as%20soon%20as%20I%20enable%20it%2C%20the%20lwip%20functionality%20is%20lost.%20The%20UM%20and%20IM%20for%20Gmac%20seem%20to%20state%20that%20it%20should%20be%20possible%20but%20I%20cannot%20understand%20exactly%20how.%20Gmac_Ip_Cfg%20data%20is%20placed%20in%20non%20cachable%20RAM%20and%20still%20it%20does%20not%20work.%20I%20disabled%20the%20flag%26nbsp%3B%3CSPAN%3E-fdata-sections%20to%20make%20Cfg%20data%20end%20up%20in%20non%20cachable%20RAM%20(0x2043xxxx).%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EIs%20there%20example%20code%20for%20how%20to%20make%20lwip%20work%20together%20with%20dcache%3F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3ERegards%3C%2FDIV%3E%3CDIV%3E%2FOla%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1877422%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K344%20lwip%20with%20DCache%20enabled%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1877422%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ehi%20Ola%20%2C%3C%2FP%3E%3CP%3Ei'm%20just%20wondering%20where%20exactly%20did%20you%20append%20that%20one%20%3F%3C%2FP%3E%3CP%3Ei'm%20stuck%20with%20the%20same%20issue%20and%20couldn't%20find%20the%20exact%20fix%20for%20it%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Ethank%20you%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1843623%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K344%20lwip%20with%20DCache%20enabled%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1843623%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F138697%22%20target%3D%22_blank%22%3E%40ola_gook%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20take%20a%20look%20at%20this%20post%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K%2FS32K344-S32K324-TCPIP-STACK-Intergration%2Fm-p%2F1527082%2Fhighlight%2Ftrue%23M17897%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K%2FS32K344-S32K324-TCPIP-STACK-Intergration%2Fm-p%2F1527082%2Fhighlight%2Ftrue%23M17897%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThere's%20step%20by%20step%20guide%20including%20demo%20application%20which%20contains%20these%20changes.%3C%2FP%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3ELukas%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1840487%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20S32K344%20lwip%20with%20DCache%20enabled%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1840487%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20managed%20to%20get%20one%20step%20closer%20to%20the%20solution.%3C%2FP%3E%3CP%3EI%20found%20another%20similar%20issue%20where%20the%20proposed%20solution%20was%20to%20make%20sure%20the%20lwip%20heap%20is%20placed%20in%20non_cachable%20ram.%20Unfortunately%2C%20the%20detailed%20solution%20using%20S32DS%20was%20not%20possible%20to%20see%20due%20to%20bad%20resolution%20in%20attached%20image.%3C%2FP%3E%3CP%3EInstead%2C%20I%20did%20this%20temporarily%20by%20simply%20appending%20in%20mem.c%3A%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3ELWIP_DECLARE_MEMORY_ALIGNED%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3Eram_heap%3C%2FSPAN%3E%3CSPAN%3E%2C%20%3C%2FSPAN%3E%3CSPAN%3EMEM_SIZE_ALIGNED%3C%2FSPAN%3E%20%3CSPAN%3E%2B%3C%2FSPAN%3E%3CSPAN%3E%20(%3C%2FSPAN%3E%3CSPAN%3E2U%3C%2FSPAN%3E%20%3CSPAN%3E*%3C%2FSPAN%3E%20%3CSPAN%3ESIZEOF_STRUCT_MEM%3C%2FSPAN%3E%3CSPAN%3E))%3C%2FSPAN%3E%3CSPAN%3E__attribute__%3C%2FSPAN%3E%3CSPAN%3E((%3C%2FSPAN%3E%3CSPAN%3Esection%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3E%22.mcal_bss_no_cacheable%22%3C%2FSPAN%3E%3CSPAN%3E)))%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CP%3EI%20also%20made%20sure%20that%20the%20Gmac_Ip_Cfg.o%20elements%20are%20placed%20in%20non_cachable%20RAM%20by%20building%20without%26nbsp%3B%3CSPAN%3E-fdata-sections%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3ECurrent%20result%20is%20that%20pinging%20it%20(or%20connecting%20to%20port%2080%20with%20a%20browser%2C%20same%20result)%20works%20about%2060%25%20of%20the%20time.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThus%2C%20I%20get%20the%20feeling%20that%20there%20is%20some%20more%20data%20that%20needs%20to%20put%20in%20non_cachable%20RAM.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EAny%20suggestions%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3ERegards%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E