title: Parse Error in Diab compiler
body: <p>i'm trying to run LZMA (C version) (7-zip.org/sdk.html) on an MPC5748G from NXP, by compiling a simple code to encode/decode a stream , but i get some errors ... 
  However the files are compiled successfully on my laptop and i was able to run the LZMA application</p>
  
  <p>Here is the errors that DCC displays:</p>
  
  <pre><code>scons: done reading SConscript files.
  scons: Building targets ...
  ..\tools\wr\mpc5748_wr594\diab\5.9.4.2\WIN32\bin\dcc.exe -c -Xenum-is-best -Xrtti-off -Xexceptions-off -Xforce-declarations -ee1481 -tPPCVLEES:simple -Xsection-split -g3 -XO -Xsize-opt -DTGT_MPC5748_WR594 -DC_DERIVATIVE_MPC5748G -DFREESCALE_OS -DAUTOSAR_OS_USED -DOSDIABPPC -DADC_INTERRUPT_TYPE=MCAL_ISR_TYPE_NONE -DCAN_INTERRUPT_TYPE=MCAL_ISR_TYPE_NONE -DGPT_INTERRUPT_TYPE=MCAL_ISR_TYPE_NONE -DICU_INTERRUPT_TYPE=MCAL_ISR_TYPE_NONE -DLIN_INTERRUPT_TYPE=MCAL_ISR_TYPE_NONE -DPWM_INTERRUPT_TYPE=MCAL_ISR_TYPE_NONE -DSPI_INTERRUPT_TYPE=MCAL_ISR_TYPE_NONE -DTGT_DBG -DTGT_APP -DCFG_CFG -DCFG_CAN -DCFG_CSL -DCFG_MCU -DCFG_DUT -DCFG_MEM -DCFG_MOV -DCFG_GPI -DCFG_GPO -DCFG_ADC -DCFG_SED -DCFG_FRY -DCFG_LPM -DCFG_ETH -IC:\GW_MCU\tools\wr\mpc5748_wr594\diab\5.9.4.2\include -Ibsw\mcal\mcalAS\inc -I. lib\lzma\Alloc.c -o lib\lzma\Alloc.o
  ..\tools\wr\mpc5748_wr594\diab\5.9.4.2\WIN32\bin\dcc.exe -tPPCVLEES:simple -u__lear_calypso_memory_init -Wl,-Xremove-unused-sections -Wl,-Xunused-sections-list -lc -Wl,-m6 -Wm bsw/mcal/mcalm/linkerDescriptionVLE_App.dld -o out\app\BmwBdc2018GwmDutApp.elf out/app\objToLink.inl 1&gt;out/app/BmwBdc2018GwmDutApp.map
  dld: warning: Undefined symbol '__HEAP_END' in file 'sbrk.o(C:\GW_MCU\tools\wr\mpc5748_wr594\diab\5.9.4.2\PPCVLEE\libchar.a)'
  dld: warning: Undefined symbol '__HEAP_START' in file 'sbrk.o(C:\GW_MCU\tools\wr\mpc5748_wr594\diab\5.9.4.2\PPCVLEE\libchar.a)'
  dld: error: Undefined symbols found - no output written
  </code></pre>
  
  <p>This error is proper to diab compiler and here is what i've found in documentation:</p>
  
  <pre><code>Dynamic Memory Allocation - the heap, malloc( ), sbrk( )
  malloc( ) allocates memory from a heap managed by function sbrk( ) in src/sbrk.c.
  There are two ways to create the heap:
  ■ Define __HEAP_START and __HEAP_END, typically in a linker command file.
  See the files conf/default.dld, conf/sample.dld, and 25.6 Command File
  Structure, p.419 for examples.
  ■ Recompile sbrk.c as follows:
  dcc -ttarget -c -D SBRK_SIZE=n sbrk.c
  where n is the size of the desired heap in bytes.
  </code></pre>
  
  <p>I'm not the author of either source code of target neither LZMA SDK in C.
  What i have understood is that the LZMA encoder allocate at least 1Mb of RAM for the encoder and The MPC5748 provide only 768Kb of RAM.</p>
  
  <p>So i have tagged the question to LZMA and diab compiler(No tag found)  , only someone how worked in both could help me</p>
  
  <p><strong>UPDATE</strong> :</p>
  
  <p>i  removed the problem in     dld: warning: Undefined symbol 'LzmaEncProps_Init' in file 'lib/lzma/LzmaLib.o'by including the corresponding source file into my makefile however the HEAP problem persist.
  The problem disapeared However the apps doesn't run
  Using trace32 debugger i was able to diagnostic the source of this error:
  at line </p>
  
  <pre><code> p-&gt;probs = (CLzmaProb *)alloc-&gt;Alloc(alloc, numProbs * sizeof(CLzmaProb));
  </code></pre>
  
  <p>The line returns empty p->probs so it seems that alloc has not been able to allocate all the needed size</p>
  
  <p>Thanks</p>