C5509A : xyz spans page boundary

Started by andr...@gmail.com August 10, 2011
Hi All,

I have a code where I work with static memory allocation due to performance considerations.
Buffer sizes can be parametrized by changing a macro.

But now I have the problem that every time I change from buffer size X to buffer size Y I get different linker errors like:
- .bss spans page boundary
- placement fails for section xyz

What I do normally is adjust section sizes, exclude buffer A, B, C from section xyz until I don't get no linker errors anymore. But this is - of course - absolutely not optimal. What is the best way avoid those problems for buffers of any size? The problem is that the admissible buffer sizes range from 256 bytes to ~10 kBytes...

Thank you for sharing your experience and your tips

Best regards,

Andreas
Andreas-

> I have a code where I work with static memory allocation
> due to performance considerations.
> Buffer sizes can be parametrized by changing a macro.
>
> But now I have the problem that every time I change from
> buffer size X to buffer size Y I get different linker errors
> like:
> - .bss spans page boundary
> - placement fails for section xyz
>
> What I do normally is adjust section sizes, exclude buffer
> A, B, C from section xyz until I don't get no linker errors
> anymore. But this is - of course - absolutely not optimal.
> What is the best way avoid those problems for buffers of
> any size? The problem is that the admissible buffer sizes
> range from 256 bytes to ~10 kBytes...

You might try creating one or more dedicated memory sections in your .cmd file (or in DSP BIOS config, if applicable)
and then assigning the "problem buffers" to those sections. The objective is to fix large data buffers in place, so
they don't move during code editing and linking, otherwise they end up too close to a 64k boundary -- or they push
something else to close to the boundary -- and you get linker errors such as you describe.

For example in your .cmd file:

MEMORY {

:
PAGE 1: IRAM_BUF (RW): origin = 1000h length = 8000h
:

}

SECTIONS {

:
"Buffer1" > IRAM_BUF
"Buffer2" > IRAM_BUF
"Buffer3" > IRAM_BUF
:
}

and then in your code:

#pragma DATA_SECTION(A, "Buffer1");
int A[size_macro_A];
#pragma DATA_SECTION(B, "Buffer2");
int B[size_macro_B];
#pragma DATA_SECTION(C, "Buffer3");
int C[size_macro_C];

There are more detailed examples in the forums, TI web pages, etc. You can use the examples above as keywords to search.

C55x note: in the example above, PAGE1 is typically used for data memory, which includes areas such as .bss, .stack,
and .sysmem (heap).

-Jeff
Andreas,

In addition to Jeff's hints, you may want to check out your .MAP file.
It will tell you where things are located and give you a hint when
you're close to the limit. Also, if you use the large memory model it
might give you more breathing room (at the expense of some performance
and code space).

Regards,
Bill
> -----Original Message-----
> From: c... [mailto:c...] On Behalf Of
Jeff
> Brower
> Sent: Wednesday, August 10, 2011 1:49 PM
> To: a...@gmail.com
> Cc: c...
> Subject: Re: [c55x] C5509A : xyz spans page boundary
>
> Andreas-
>
> > I have a code where I work with static memory allocation
> > due to performance considerations.
> > Buffer sizes can be parametrized by changing a macro.
> >
> > But now I have the problem that every time I change from
> > buffer size X to buffer size Y I get different linker errors
> > like:
> > - .bss spans page boundary
> > - placement fails for section xyz
> >
> > What I do normally is adjust section sizes, exclude buffer
> > A, B, C from section xyz until I don't get no linker errors
> > anymore. But this is - of course - absolutely not optimal.
> > What is the best way avoid those problems for buffers of
> > any size? The problem is that the admissible buffer sizes
> > range from 256 bytes to ~10 kBytes...
>
> You might try creating one or more dedicated memory sections in your
.cmd file
> (or in DSP BIOS config, if applicable)
> and then assigning the "problem buffers" to those sections. The
objective is
> to fix large data buffers in place, so
> they don't move during code editing and linking, otherwise they end up
too
> close to a 64k boundary -- or they push
> something else to close to the boundary -- and you get linker errors
such as
> you describe.
>
> For example in your .cmd file:
>
> MEMORY {
>
> :
> PAGE 1: IRAM_BUF (RW): origin = 1000h length = 8000h
> :
>
> }
>
> SECTIONS {
>
> :
> "Buffer1" > IRAM_BUF
> "Buffer2" > IRAM_BUF
> "Buffer3" > IRAM_BUF
> :
> }
>
> and then in your code:
>
> #pragma DATA_SECTION(A, "Buffer1");
> int A[size_macro_A];
> #pragma DATA_SECTION(B, "Buffer2");
> int B[size_macro_B];
> #pragma DATA_SECTION(C, "Buffer3");
> int C[size_macro_C];
>
> There are more detailed examples in the forums, TI web pages, etc.
You can
> use the examples above as keywords to search.
>
> C55x note: in the example above, PAGE1 is typically used for data
memory,
> which includes areas such as .bss, .stack,
> and .sysmem (heap).
>
> -Jeff
>
>
>