String Array Max Size

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

String Array Max Size

Post by MarkW »

Hello,

Is it possible to declare a larger than 255 member size for a string? There was this
issue in V4/5 but it seems to have migrated to V6 as well....

Other compilers have no issue to dimesion a large array, only limited by ram
on the particular chip being used.

Bit disappointed :-(

Thanx

Mark

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: String Array Max Size

Post by kersing »

Flowcode 6 uses the same C compiler previous versions used, so the limit on array/string sizes is the same.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: String Array Max Size

Post by STibor »

Hello!

This is a big problem!

Flowcode V5
Build menu /compiler:

Code: Select all

-v -t PIC%p "%f.c" -idx 2
Linker/Assembler:

Code: Select all

-ld "C:\Program Files (x86)\Flowcode\v5\Tools\BoostC\lib" large\libc.pic16.lib large\rand.pic16.lib large\float.pic16.lib "%f.obj" -t PIC%p -d "%d" -p "%f" -idx2
Flowcode V6 not working.
What is the problem?

MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

Re: String Array Max Size

Post by MarkW »

Hi Ben,

Any help to declare larger string array in V6?

Thanx

Mark

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:

Re: String Array Max Size

Post by Benj »

Hello,

For Flowcode 6 you would use the following in the compiler options.

Compiler Parameters

Code: Select all

-v -t PIC$(chip:u) "$(target).c" -idx 2
Linker Parameters

Code: Select all

-ld "$(appdir)compilers\pic\boostc\lib" libc_$(family:/12F/16F).lib rand_$(family:/12F/16F).lib float_$(family:/12F/16F).lib "$(target).obj" -t PIC$(chip:u) -d "$(outdir:~-1)" -p "$(target)" -swcs 6 2 -idx2
This should be working but I am getting this error on my latest BoostC so maybe this now has a bug?
warning: unknown index size '2', ignored
Anyway have a go it might work for you.

Otherwise could you maybe use two string variables and switch between the two based on the index pointer or use a different device target e.g. 16-bit PIC or AVR?

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: String Array Max Size

Post by STibor »

Hello!

Added to the code and the error message.
Attachments
Flowcode1.fcfx
(3.56 KiB) Downloaded 230 times
large var.txt
(105.84 KiB) Downloaded 273 times

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:

Re: String Array Max Size

Post by Benj »

Hello,

It looks like the BoostC floating point library is not compatible with the idx2 option.

You can try this instead for your linker parameters but note that any Floating point or Random functions in your program will no longer work.

Code: Select all

-ld "$(appdir)compilers\pic\boostc\lib" libc_$(family:/12F/16F).lib "$(target).obj" -t PIC$(chip:u) -d "$(outdir:~-1)" -p "$(target)" -swcs 6 2 -idx2

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: String Array Max Size

Post by STibor »

Hello!
Same result.
Fat32/SD Card component does not use a bigger array element 256?

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:

Re: String Array Max Size

Post by Benj »

Hello,
Fat32/SD Card component does not use a bigger array element 256?
The FAT component uses two 256 byte arrays instead of one 512 byte array to avoid this problem with 8-bit PICs.

We do something like this.

Code: Select all

unsigned char ReadBuffer (unsigned int idx)
{
  if (idx > 255)
  {
    return buffer2[idx - 256]
  } 
  else
  {
    return buffer1[idx]
  }
}

Post Reply