Problem allocating memory in xflash

View: New views
8 Messages — Rating Filter:   Alert me  

Problem allocating memory in xflash

by Parthasaradhi Nayani :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,
I have created an external flash memory section in the makefile thus

LDFLAGS += -Wl,--section-start,.exflash=0x850000

and named (defined) this section as XFLASH.

I have a structure "prclkp" of size 32 bytes. When I define

struct prclkp XFLASH PLULOC1[1023];   No error is reported, whereas

struct prclkp XFLASH PLULOC1[1024]; generates an error - "size of array too large"

If the size of the section is 64K, then the above i well within the limit but still the error is popping up. Has this anything to do with sign? Please advice. Thank you.


Regards,
Nayani



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@...
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Re: Problem allocating memory in xflash

by Tero Sinervo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Parthasaradhi Nayani wrote:
> I have a structure "prclkp" of size 32 bytes. When I define
>
> struct prclkp XFLASH PLULOC1[1023];   No error is reported, whereas
>
> struct prclkp XFLASH PLULOC1[1024]; generates an error - "size of array too large"

You've probably reached a built-in limit in gcc. It has nothing to do
with the size of your memory section.


--
Tero Sinervo


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@...
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Re: Problem allocating memory in xflash

by Jan Waclawek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>Parthasaradhi Nayani wrote:
>> I have a structure "prclkp" of size 32 bytes. When I define
>>
>> struct prclkp XFLASH PLULOC1[1023];   No error is reported, whereas
>>
>> struct prclkp XFLASH PLULOC1[1024]; generates an error - "size of array too large"
>
>You've probably reached a built-in limit in gcc. It has nothing to do
>with the size of your memory section.

I've just tried to compile a >64kB initialised variable with "gcc (GCC) 3.4.4 (cygming special)" to confirm this is NOT limit of gcc.
So, it appears to be limit of avr-gcc specifically.

JW


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@...
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Re: Problem allocating memory in xflash

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jan Waclawek <konfera@...> wrote:

> So, it appears to be limit of avr-gcc specifically.

Sure, it depends from sizeof(int).

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@...
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Re: Problem allocating memory in xflash

by Jan Waclawek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>> So, it appears to be limit of avr-gcc specifically.
>
>Sure, it depends from sizeof(int).

Hummm, for me, the relationship is not quite "sure". Can you explain that in more detail, please?
Also, how does it imply the 32k limit on the initialiser and the lack of warning when crossed?

Jan Waclawek


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@...
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Re: Problem allocating memory in xflash

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jan Waclawek <konfera@...> wrote:

>>Sure, it depends from sizeof(int).

> Hummm, for me, the relationship is not quite "sure". Can you explain
> that in more detail, please?

An array is implicitly (without the option to change it) indexed by
type `int'.  Not `unsigned int', it's `int' -- because negative
indices are explicitly allowed (e.g. to access the previous array
element through a pointer like "a[-1]").

I'm not quite sure why GCC doesn't accept more than __INT_MAX__
*bytes* (as opposed to array elements); perhaps it internally aliases
everything to bytes.

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@...
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Re: Problem allocating memory in xflash

by Parthasaradhi Nayani :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


From: Joerg Wunsch <j@...>>

Sure, it depends from sizeof(int).

My array size is 32K bytes and the section is supposed to be 64K right? and is not the built-in limit of a section 64K? Thanks.

Regards
Nayani


start: 0000-00-00 end: 0000-00-00
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@...
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Re: Problem allocating memory in xflash

by Parthasaradhi Nayani :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


From: Jan Waclawek <konfera@...>>

Sure, it depends from sizeof(int).

Hummm, for me, the relationship is not quite "sure". Can you explain that in more detail, please?

I tried to allocate 32K bytes of memory. I am not sure if this is a problem of user defined sections.

Nayani



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@...
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list