Heap usage memory RT1050 handling / External SDRAM

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

Heap usage memory RT1050 handling / External SDRAM

跳至解决方案
1,982 次查看
rubensjunior
Contributor IV

Dear colleagues!

I need to place the heap section to the BOARD_SDRAM. It is on the SRAM_OC currently. How I do?

Bellow is my actual memory use.

pastedImage_1.png

Thanks a lot!

Rubens Júnior.

标签 (1)
1 解答
1,739 次查看
Takashi_Kashiwagi
Senior Contributor I

HI Rubens-san

you can change the region of Heap in "Project Poperties->C/C++ Build->Settings->MCU Linker->Managed Linker Script".

Please set Region to "BOARD_SDRAM".

pastedImage_3.png

Best Regards,

T.Kashiwagi

在原帖中查看解决方案

4 回复数
1,740 次查看
Takashi_Kashiwagi
Senior Contributor I

HI Rubens-san

you can change the region of Heap in "Project Poperties->C/C++ Build->Settings->MCU Linker->Managed Linker Script".

Please set Region to "BOARD_SDRAM".

pastedImage_3.png

Best Regards,

T.Kashiwagi

1,739 次查看
ian_l
Contributor II

Hi,

I created a simple project in MCUXpresso  v11.1.0 [Build 3209] using the new project wizard with all default settings, and changed the heap to use SDRAM as shown above. However as soon as the heap allocation function is called, the program jumps to HardFault_Handler.

This is tested on the RT1050EVKB. And I have the script found in another in the debug config (see screenshot below).

Here is the main function. Please advice, thanks.

int main(void) {

/* Board pin init */

BOARD_InitPins();

BOARD_InitBootClocks();

/* Update the core clock */

SystemCoreClockUpdate();

float* data1 = (float*)malloc (256); // this will cause the jump to HardFault_Handler

free (data1);

}

pastedImage_1.png

1,739 次查看
Takashi_Kashiwagi
Senior Contributor I

Hi Lan-san.

  • How many is the Heap Size? (The image I uploaded is 0 :smileycry:. Please set a valid value such as 0x1000)

In addition, In the case of the sample project, when HardFault is performed, HardFault_Handler of semihost_hardfault.c is executed.

With Hardfault_Handler, you can analyze the PC and SP for the instruction that caused the hard fault. Please check the values.

pastedImage_1.png

Best Regards,

T.Kashiwagi

0 项奖励
回复
1,739 次查看
rubensjunior
Contributor IV

Hi @takashi kashiwagi,

Thank you very much for your help. The result was positive.

Best Regards,

Rubens Júnior