Malloc failed in RT1060-EVK project CSI_RGB565

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

Malloc failed in RT1060-EVK project CSI_RGB565

1,589 Views
vvzhong
Contributor I

Hi,

We are evaluate RT1060 performance with RT1060 evk.

The first step we have to do now is to use the OV7725 and caputre the YUV422 data.Then extract the Y data to the buff. So will use malloc to apply for a buffer, and the buffer address should be in 0x8000xxxx。

There is no problem when using malloc(100), but malloc(480*272) will fail. With print, malloc(480*272) return 0, but malloc(100) will return 0x80000300. Our project base on the example CSI_RGB565 build with IAR ,and configuration is sdram_debug. Evk board have 256Mbit SDRAM, what cause this issuse happend?

Did I not open SDRAM in the code?

In fsl_commom.c, there is SDK_Malloc but the same result. Do I create memory management myself? 

uint8_t *recontent =(uint8_t*)malloc(100);
uint8_t *src = (uint8_t*)malloc(480*272);
printf("recontent 0x%x\r\n",recontent);
printf("src 0x%x\r\n",src);

pastedImage_2.png

thanks !

Labels (1)
Tags (1)
0 Kudos
2 Replies

1,273 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi,

In case of the malloc function, it is usually not recommended in embedded systems, because it uses the default RAM memory, which is limited and may cause issues with the Heap/Stack.

In case of the i.MX RT, when creating MCUXpresso projects for EVKB-MIMXRT1050 board, it usually includes 4 RAM sections: SRAM_DTC (128KB), SRAM_ITC (128KB), SRAM_OC (256KB) and BOARD_SDRAM (32MB).

You could change which segment is the default one on the Project properties -> C/C++ Build -> MCU Settings.

You could also define variables inside specific memory segments. For this approach, you could refer to the following links:

Controlling data and function placement in memory 

Defining Variables at Absolute Addresses with gcc | MCU on Eclipse 


Hope this will be useful for you.
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,273 Views
vvzhong
Contributor I

      Hi, Carlos.

      I solved this problem by using simple heap management replace malloc.

      Best regards!

0 Kudos