• AVR Freaks

Hot!Out of RAM on DSPIC33CH512

Author
Virland
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/10/18 05:08:55
  • Location: 0
  • Status: offline
2020/09/09 21:45:06 (permalink)
0

Out of RAM on DSPIC33CH512

Hello!
I ran into a problem with the linker when building a project that requires more than 30 kilobytes of RAM (approximate value). When assembling, an out of memory error appears, although the amount of memory on the datasheet is 48kb.
 
If the required RAM size is less than that value(for example, 29kByte), the code is builded succesfully and works correctly.
I am using DSPIC33CH512MC804 microcontroller. MPLAB IDE v5.30 is used for compilation, XC16 compiler v1.50.
 
The build log is given below:
build/Simulink/production/master.o: Link Error: Could not allocate section .bss, size = 29156 bytes, attributes = bss
build/Simulink/production/MCHP_UART1_Rx_Interrupt.o: Link Error: Could not allocate section .bss, size = 36 bytes, attributes = bss
build/Simulink/production/MCHP_UART2_Tx.Interrupt.o: Link Error: Could not allocate section .bss, size = 36 bytes, attributes = bss
build/Simulink/production/rt_nonfinite.o: Link Error: Could not allocate section .bss, size = 24 bytes, attributes = bss
build/Simulink/production/MCHP_UART1_Tx.Interrupt.o: Link Error: Could not allocate section .bss, size = 12 bytes, attributes = bss
build/Simulink/production/MCHP_UART2_Rx_Interrupt.o: Link Error: Could not allocate section .bss, size = 12 bytes, attributes = bss
build/Simulink/production/master_main.o: Link Error: Could not allocate section .bss, size = 2 bytes, attributes = bss
memset.CH_eo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
memset.CH_eo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
memcpy.CH_eo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
memcpy.CH_eo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
floatundisf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
floatundisf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
floatdisf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
floatdisf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
fcompare.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
fcompare.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
errno.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
errno.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
_frexpf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
_frexpf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
umodsi3.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
umodsi3.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
udivsi3.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
udivsi3.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
sqrtf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
sqrtf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
sinf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
sinf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
sincosf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
sincosf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
mulsf3.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
mulsf3.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
modsi3.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
modsi3.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
ldexpf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
ldexpf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
futil.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
futil.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
funpack2.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
funpack2.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
funpack.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
funpack.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
frexpf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
frexpf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
fpack.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
fpack.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
fne.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
fne.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
fmodrem.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
fmodrem.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
fmodf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
fmodf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
floorf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
floorf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
floatunsisf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
floatunsisf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
floatsisf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
floatsisf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
fixunssfsi.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
fixunssfsi.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
fixsfsi.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
fixsfsi.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
fgtge.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
fgtge.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
feqltle.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
feqltle.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
fchop.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
fchop.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
divsi3.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
divsi3.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
divsf3.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
divsf3.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
cosf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
cosf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
ceilf.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
ceilf.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
addsf3.cheo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
addsf3.cheo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
delay32ch.Leo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
delay32ch.Leo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
crt_start_mode_normalch.Leo: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
crt_start_mode_normalch.Leo: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
data_init_dualch.o: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
data_init_dualch.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
crt0_dualch.o: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
crt0_dualch.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/slave.o: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
build/Simulink/production/slave.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/_ext/1472/slave_upload.o: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
build/Simulink/production/_ext/1472/slave_upload.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/_ext/1472/dac_simulink.o: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
build/Simulink/production/_ext/1472/dac_simulink.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/rt_nonfinite.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/rtGetNaN.o: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
build/Simulink/production/rtGetNaN.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/rtGetInf.o: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
build/Simulink/production/rtGetInf.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/master_main.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/master_data.o: Link Error: Could not allocate section .bss, size = 0 bytes, attributes = bss
build/Simulink/production/master_data.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/master.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/MCHP_UART2_Tx.Interrupt.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/MCHP_UART2_Rx_Interrupt.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/MCHP_UART1_Tx.Interrupt.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
build/Simulink/production/MCHP_UART1_Rx_Interrupt.o: Link Error: Could not allocate section .data, size = 0 bytes, attributes = data
Link Error: Could not allocate data memory
make[2]: *** [dist/Simulink/production/master.X.production.hex] Error 255
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
 
#1

4 Replies Related Threads

    JPortici
    Super Member
    • Total Posts : 1202
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: Out of RAM on DSPIC33CH512 2020/09/09 23:03:33 (permalink)
    0
    it can happen when you are close to full resourse usage.
    it could be that the compiler determines that the stack/heap will be at least so big that it can't keep all the variables in the first 32k of RAM, or you require a contigous section of memory that it can't allocate for some reason (like if you are forcing some data to be at a specific address or in Y data space)
    there are options in the compiler you can try, such as data model and allowing large arrays
    Check the compiler manual!
    #2
    Virland
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2019/10/18 05:08:55
    • Location: 0
    • Status: offline
    Re: Out of RAM on DSPIC33CH512 2020/09/09 23:28:43 (permalink)
    0
    Oh, I forgot to add, that I set the following project properties:
     - code model: large
     - data model: large
     - allow arrays larger than 32k: checked
     - location of data constants: code memory
     
    #3
    JPortici
    Super Member
    • Total Posts : 1202
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: Out of RAM on DSPIC33CH512 2020/09/09 23:48:01 (permalink)
    4 (1)
    okay.. I have three possible scenarios in order of "likeness"
    - the compiler has determined it can't allocate enough stack/heap (but in that case i think it should signal that it couldn't allocate stack/heap)
    - you have both a large array and something that breaks the memory in parts, like declaring variables in yspace so it can't find a contigous range big enough
    - bug in the linker
     
    Hope that someone else with more expertise on gcc will chime in..
     
    by the way, which MCU? i can't find no DSPIC33CH512MC804
    Edit: Oh, i see now that it's the simulink subforum.. #2 gains some points
    post edited by JPortici - 2020/09/09 23:51:28
    #4
    Lubin
    Moderator
    • Total Posts : 447
    • Reward points : 5
    • Joined: 2007/03/31 07:38:15
    • Location: Bayonne, France
    • Status: offline
    Re: Out of RAM on DSPIC33CH512 2020/09/10 00:04:53 (permalink)
    0
    Hi,
    It is unusual with Simulink to generate code which does not fit a dsPIC  in either code or RAM size.
    Few key points to check for RAM is allocating constant in code, then activate the compiler optimization (-O1/-O2 or further with license).
     
    You might open the generated MPLAB X project which provides an easy access to a more complete set of compiler options flags ; If you find one which fix the issue, you might add that flag in the compiler option block in Simulink then.
     
    This is a question for the compiler thread
     
    Lubin
    #5
    Jump to:
    © 2020 APG vNext Commercial Version 4.5