Forums - Using malloc with ThreadX

3 posts / 0 new
Last post
Using malloc with ThreadX
angus.ku
Join Date: 3 May 18
Posts: 20
Posted: Thu, 2018-06-14 23:38

Hi~

I would like to know where is heap area that can be allocated with ThreadX??

First, I checked heap size by function: qapi_Heap_Status()

I got status of free size which is over 100Kbytes.

After that, I allocated one byte space, and I found that it's address exceeds 0x10090000

I figured out  my memory section below:

=========================================

-----------------------0x100A2000
[RAM_SBL_RO_MEMORY]
-----------------------0x100A0000

-----------------------0x10090000
[APP ZI]
[APP DATA]
-----------------------0x10080000
 
If it can be allocated from 0x10090000 to 0x100A0000, It seems only 0x10000 (64k) continously.
So I wonder to know where are heap areas??
 
Many Thx~
 
 
 
=========================================
I pasted my memory section from Quartz.ld below:
MEMORY
{
 RAM_AON_PATCHROM_RO_MEMORY                        (W)  : ORIGIN = 0x10001600, LENGTH = 0x4c0
 RAM_AON_RO_MEMORY                                 (W)  : ORIGIN = 0x10001ac0, LENGTH = 0x140
 RAM_AON_ROM_PATCHTABLE_RW_MEMORY                  (W)  : ORIGIN = 0x10001c00, LENGTH = 0x180
 RAM_AON_DATA_MEMORY                               (W)  : ORIGIN = 0x10001dc0, LENGTH = 0x240
 RAM_SOM_BSP_ROM_PATCHTABLE_RW_MEMORY              (W)  : ORIGIN = 0x10002f00, LENGTH = 0xd00
 RAM_SOM_BSP_DATA_MEMORY                           (W)  : ORIGIN = 0x10003c00, LENGTH = 0x500
 RAM_SOM_BSP_ROM2RAM_INDIRECTION_TABLE_RW_MEMORY   (W)  : ORIGIN = 0x10004100, LENGTH = 0x40
 RAM_SOM_DEVCFG_DATA_RW_MEMORY                     (W)  : ORIGIN = 0x10004140, LENGTH = 0x6c0
 RAM_SOM_BSP_PATCHROM_RO_MEMORY                    (RX) : ORIGIN = 0x10004800, LENGTH = 0xe00
 RAM_BSP_VENEER_RO_MEMORY                          (RX) : ORIGIN = 0x10005600, LENGTH = 0xe00
 RAM_SOM_BSP_RO_MEMORY                             (RX) : ORIGIN = 0x10006400, LENGTH = 0x1200
 RAM_SOM_BSP_DIAG_BUF_MEMORY                       (W)  : ORIGIN = 0x1000e400, LENGTH = 0x280
 RAM_SOM_BSP_HEAP_MEMORY                           (W)  : ORIGIN = 0x1000e680, LENGTH = 0x1200
 RAM_SOM_BSP_STACK_MEMORY                          (W)  : ORIGIN = 0x1000f880, LENGTH = 0x780
 RAM_SOM_APPS_RO_MEMORY                            (RX) : ORIGIN = 0x10007600, LENGTH = 0x5a00
 RAM_SOM_APPS_DATA_MEMORY                          (W)  : ORIGIN = 0x1000d000, LENGTH = 0x1400
 RAM_FOM_BSP_ROM_PATCHTABLE_RW_MEMORY              (W)  : ORIGIN = 0x10013400, LENGTH = 0x3400
 RAM_FOM_BSP_ROM2RAM_INDIRECTION_TABLE_RW_0_MEMORY (W)  : ORIGIN = 0x10016800, LENGTH = 0x200
 RAM_FOM_BSP_ROM2RAM_INDIRECTION_TABLE_RW_1_MEMORY (W)  : ORIGIN = 0x10016a00, LENGTH = 0x200
 RAM_FOM_DEVCFG_DATA_RW_MEMORY                     (W)  : ORIGIN = 0x1001d400, LENGTH = 0xc00
 RAM_FOM_BSP_DATA_MEMORY                           (W)  : ORIGIN = 0x10016c00, LENGTH = 0x6800
 RAM_FOM_BSP_STACK_MEMORY                          (W)  : ORIGIN = 0x100af800, LENGTH = 0x800
 RAM_SBL_RAMDUMP_MEMORY                            (W)  : ORIGIN = 0x1001e000, LENGTH = 0x2000
 RAM_FOM_BSP_PATCHROM_RO_MEMORY                    (RX) : ORIGIN = 0x10020000, LENGTH = 0x5000
 RAM_FOM_BSP_RO_MEMORY                             (RX) : ORIGIN = 0x10025000, LENGTH = 0x21000
 RAM_FOM_APPS_RO_MEMORY                            (RX) : ORIGIN = 0x10046000, LENGTH = 0x3a000
 RAM_FOM_APPS_DATA_MEMORY                          (W)  : ORIGIN = 0x10080000, LENGTH = 0x10000
 RAM_SBL_RO_MEMORY                                 (RX) : ORIGIN = 0x100a0000, LENGTH = 0x2000
 RAM_SBL_RW_MEMORY                                 (W)  : ORIGIN = 0x100a2000, LENGTH = 0x6000
 RAM_SBL_ZI_MEMORY                                 (W)  : ORIGIN = 0x100a8000, LENGTH = 0x2000
 SBL_LOG_META_INFO_RW_MEMORY                       (W)  : ORIGIN = 0x100aa000, LENGTH = 0x40
 SBL_LOG_BUF_RW_MEMORY                             (W)  : ORIGIN = 0x100aa040, LENGTH = 0x1000
 XIP_RO_MEMORY                                     (RX) : ORIGIN = 0x1000000, LENGTH = 0x180000
 RAM_DIAG_STRING_RO_MEMORY                         (W)  : ORIGIN = 0x40000000,LENGTH = 0x2000
}
 
  • Up0
  • Down0
manjulak Moderator
Join Date: 5 Dec 14
Posts: 33
Posted: Tue, 2018-06-26 18:17

Can you please refer to section 4.3.4(Resize application memory) in 80-YA121-142 document. Heap starts at the end of APP data region. If your application code does not use all of the allocated app data region then its used for heap.

  • Up0
  • Down0
angus.ku
Join Date: 3 May 18
Posts: 20
Posted: Wed, 2018-06-27 18:03

Thanks for your assistance.

I also found It describes "SBL ends (reclaimed as HEAP)", in programmers_guide section 4.2 QCA402X boot flow, 

It can expliain  why some of memory can be allocated in SBL section.

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.