Flowcode dsPIC & PIC24 could not allocate section

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

User avatar
Matrix Staff
Posts: 14797
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4759 times
Been thanked: 4361 times

Flowcode dsPIC & PIC24 could not allocate section

Postby Benj » Fri Mar 01, 2013 1:43 pm

When using large variables in Flowcode for dsPIC and PIC24 you may get this error message.

Link Error: Could not allocate section .varname, size = xx bytes, attributes = data near

This is because the near compiler model is being used for optimization. Only the lower 8K of memory can be used in the near data mode to to allow the rest of the memory to be used you have to use the large code model.

To do this open this file into a text editor, you may have to copy out of the program files folder first to allow the file to be edited.

C:\Program Files (x86)\Flowcode(dsPIC)\v5\Tools\MX_bats\pic16_C30_comp.bat

Inside the file find this line.

Code: Select all

pic30-gcc -c -mcpu=%3 -funsigned-char -fno-short-double -Os -I"%~dp0..\C_tools\support\h" -I"%~dp0..\MX_support" -Wall -std=gnu99 %1.c -o %1.o

and change to this.

Code: Select all

pic30-gcc -c -mcpu=%3 -funsigned-char -mlarge-data -fno-short-double -Os -I"%~dp0..\C_tools\support\h" -I"%~dp0..\MX_support" -Wall -std=gnu99 %1.c -o %1.o

To revert back to the standard code model you simply have to reverse the procedure.
These users thanked the author Benj for the post:
kersing (Fri Mar 01, 2013 2:39 pm)
Rating: 5%