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

Post Reply
User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Flowcode dsPIC & PIC24 could not allocate section

Post by Benj »

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.

Post Reply