SDRAM usage and data corruption

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

SDRAM usage and data corruption

1,701 次查看
mspenard603
Contributor IV

Hi Gents,

 I'm trying to use the starting region of SDRAM (it runs from 0x81000000 to 0x82000000). And I use XiP flash so application code does not run out of SDRAM. Heap is located at the end of SDRAM. My config is as seen below.

My issue is that I experience data going corrupt if I use space below 0x81000000 (e.g., at 0x80800000). Based on my config would one expect memory overlap corruption issues???

daad (1).pngUntitled.png

0 项奖励
回复
8 回复数

1,684 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
I think you'd better tell me what exactly LWIP demo you want to discuss.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复

1,678 次查看
mspenard603
Contributor IV

Well, my issue is related to LWIP across any of the demos... 

From mem.c, this specifies LWIP heap usage. And I can move to SDRAM (0x8xxxxxxxx) if needed to free up SRAM_DTC:

#ifndef LWIP_RAM_HEAP_POINTER
/** the heap. we need one struct mem at the end and some room for alignment */
LWIP_DECLARE_MEMORY_ALIGNED(ram_heap, MEM_SIZE_ALIGNED + (2U * SIZEOF_STRUCT_MEM));

#define LWIP_RAM_HEAP_POINTER ram_heap

But I still see LWIP allocating a lot of stack when I examine the image. How do I move memp_memory_PBUF_POOL_base ?

Untitled.png

 

 

 

 

0 项奖励
回复

1,660 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
For instance, you can move the memp_memory_PBUF_POOL_base object to the SDRAM after the below configuration.

jeremyzhou_0-1655113514621.png

jeremyzhou_1-1655113540015.png

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复

1,649 次查看
mspenard603
Contributor IV

The macros for this really telescope... trying to follow them down. I see this comment below. Should I be doing this? The NXP port of LWIP doesn't seem to have cc.h ...???

/**
* @ingroup mempool
* Declare a private memory pool
* Private mempools example:
* .h: only when pool is used in multiple .c files: LWIP_MEMPOOL_PROTOTYPE(my_private_pool);
* .c:
* - in global variables section: LWIP_MEMPOOL_DECLARE(my_private_pool, 10, sizeof(foo), "Some description")
* - call ONCE before using pool (e.g. in some init() function): LWIP_MEMPOOL_INIT(my_private_pool);
* - allocate: void* my_new_mem = LWIP_MEMPOOL_ALLOC(my_private_pool);
* - free: LWIP_MEMPOOL_FREE(my_private_pool, my_new_mem);
*
* To relocate a pool, declare it as extern in cc.h. Example for GCC:
* extern u8_t \_\_attribute\_\_((section(".onchip_mem"))) memp_memory_my_private_pool_base[];
*/

0 项奖励
回复

1,653 次查看
mspenard603
Contributor IV

Is there something I can change in memp_std.h to move PBUF_POOL?

/*
* A list of pools of pbuf's used by LWIP.
*
* LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description)
* creates a pool name MEMP_pool_name. description is used in stats.c
* This allocates enough space for the pbuf struct and a payload.
* (Example: pbuf_payload_size=0 allocates only size for the struct)
*/
LWIP_MEMPOOL(PBUF, MEMP_NUM_PBUF, sizeof(struct pbuf), "PBUF_REF/ROM")
LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL")

0 项奖励
回复

1,655 次查看
mspenard603
Contributor IV

In the linker script configuration? Sorry, haven't done much memory map config in here yet. So I need a bit more guidance. 

0 项奖励
回复

1,692 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
1) My issue is that I experience data going corrupt if I use space below 0x81000000 (e.g., at 0x80800000). Based on my config would one expect memory overlap corruption issues???
-- No, I don't think so.
2) But why is there a Region1 specified at the same address???
-- The newest configuration will the affect region finally, and the region 1 setting is used to set the attribute of the memories that are not targeted for any specific purposes, to assure their attaribute is certain.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复

1,699 次查看
mspenard603
Contributor IV

My board.c lists two regions with the same base address (as used by SDRAM). Region 8 is what I expected. But why is there a Region1 specified at the same address???

/* Region 1 setting: Memory with Device type, not shareable, non-cacheable. */
MPU->RBAR = ARM_MPU_RBAR(1, 0x80000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB);

/* Region 8 setting: Memory with Normal type, not shareable, outer/inner write back */
MPU->RBAR = ARM_MPU_RBAR(8, 0x80000000U);
MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB);

 

 

0 项奖励
回复