DSPRelated.com
Forums

re-#pragma DATA_SECTION with c++

Started by theb...@excite.com July 5, 2005
My apoligises, part of the question was lost. Here it is in full.

hi all,
I posted a question recently on this forum and received a very helpful reply from robert(thank you). I just have another question about memory allocation. I wish to use the SDRAM on my c6416 dsk. I have written a command file for my project which I will include below and also I include the syntax I am using for C++ pragma to write a variable to SDRAM.

On compiling I get an error saying;
warning: pragma DATA_SECTION can only be applied to a file level symbol definition, not work
Note - work is the variable im trying to write to SDRAM

My command file is as follows;
-c
-heap 0x50000
-stack 0x90000

/* MODULE MEM */
-stack 0x400
MEMORY {
ISRAM : origin = 0x0, len = 0x100000
SDRAM : origin = 0x80000000, len = 0x1000000
FLASH : origin = 0x64000000, len = 0x80000
} SECTIONS {
.text :> ISRAM
.bss :> ISRAM
.cinit :> ISRAM
.stack :> ISRAM
.sysmem :> SDRAM
.const :> ISRAM
.switch :> ISRAM
.far :> SDRAM
.cio :> SDRAM
.mydata:>SDRAM
} and the syntax I am using with the pragma directive (as got from the Code Composer help) is;

#pragma DATA_SECTION(".mydata");
float work;

on checking the address of work in the watch window I can see it is still being stored in internal memory.

Any help would be greatly appreciated.

Niall Barry


Please refer to this webpage:
HYPERLINK
"http://www.squreshi.com/errata.html"http://www.squreshi.com/errata.html
You need another argument in your #pragma call. This pragma is not for
work, so work goes into the internal memory by default.
Regards,
Robert
_____

From: code-comp@code... [mailto:code-comp@code...] On Behalf
Of theblaahead@theb...
Sent: Tuesday, July 05, 2005 4:41 AM
To: code-comp@code...
Subject: [code-comp] re-#pragma DATA_SECTION with c++
My apoligises, part of the question was lost. Here it is in full.

hi all,
I posted a question recently on this forum and received a very
helpful reply from robert(thank you). I just have another question about
memory allocation. I wish to use the SDRAM on my c6416 dsk. I have written a
command file for my project which I will include below and also I include
the syntax I am using for C++ pragma to write a variable to SDRAM.

On compiling I get an error saying;
warning: pragma DATA_SECTION can only be applied to a file level symbol
definition, not work
Note - work is the variable im trying to write to SDRAM

My command file is as follows;
-c
-heap 0x50000
-stack 0x90000

/* MODULE MEM */
-stack 0x400
MEMORY {
ISRAM : origin = 0x0, len = 0x100000
SDRAM : origin = 0x80000000, len = 0x1000000
FLASH : origin = 0x64000000, len = 0x80000
} SECTIONS {
text :> ISRAM
bss :> ISRAM
cinit :> ISRAM
stack :> ISRAM
sysmem :> SDRAM
const :> ISRAM
switch :> ISRAM
far :> SDRAM
cio :> SDRAM
mydata:>SDRAM
} and the syntax I am using with the pragma directive (as got from the Code
Composer help) is;

#pragma DATA_SECTION(".mydata");
float work;

on checking the address of work in the watch window I can see it is still
being stored in internal memory.

Any help would be greatly appreciated.

Niall Barry
NEW! You can now post a message or access and search the archives of this
group on DSPRelated.com:
HYPERLINK
"http://www.dsprelated.com/groups/code-comp/1.php"http://www.dsprelated.com/
groups/code-comp/1.php

_____________________________________
Note: If you do a simple "reply" with your email client, only the author of
this message will receive your answer. You need to do a "reply all" if you
want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

Archives: HYPERLINK
"http://www.dsprelated.com/groups/code-comp/1.php"http://www.dsprelated.com/
groups/code-comp/1.php

To Post: Send an email to code-comp@code...

Other DSP Related Groups: HYPERLINK
"http://www.dsprelated.com/groups.php"http://www.dsprelated.com/groups.php



Hi SAURABH,
Using such a syntax gives me a compilation error of "BADLY FORMED PRAGMA", I think the syntax I am using is ok as my project is in C++ and that is , according to the CCS manual the correct syntax for a C++ pragma.
The error is solved by declaring the pragma outside of main. However since I need to declare multiple pointers for multiple dynamic arrays which are later initialised is there a way of partioning the memory so as to place enough space between the pointers to support the array.
This problem would be alleviated if I could declare the pointers in main when they need to be used.

Regards,
Niall

--- On Wed 07/06, SAURABH < saurabh.shah@saur... > wrote:
From: SAURABH [mailto: saurabh.shah@saur...]
To: theblaahead@theb...
Date: Wed, 6 Jul 2005 09:37:52 +0530
Subject: Re: [code-comp] re-#pragma DATA_SECTION with c++

Hi Niall,<br><br><br>The syntax for this pragma is like that,<br>#pragma DATA_SECTION(variable name, "User defined section"); // Even<br>.(dot) is optional<br><br><br>So use,<br> #pragma DATA_SECTION(work, ".mydata");<br> float work;<br><br>instead of<br>> #pragma DATA_SECTION(".mydata");<br>> float work;<br><br>I am sure your problem will be solved.<br><br><br><br><br>Treat your friends as you do your pictures,<br>and place them in their best light.<br><br>SAURABH SHAH<br>R&D Engineer<br>Matrix Telecom Pvt. Ltd.<br>ph. - (0265) 2630555<br>saurabh.shah@saur...<br>----- Original Message -----<br>From: <theblaahead@theb...><br>To: <code-comp@code...><br>Sent: Tuesday, July 05, 2005 3:10 PM<br>Subject: [code-comp] re-#pragma DATA_SECTION with c++<br><br><br>> My apoligises, part of the question was lost. Here it is in full.<br>><br>> hi all,<br>> I posted a question recently on this forum and received a very<br>helpful reply from robert(thank
you). I just have another question about<br>memory allocation. I wish to use the SDRAM on my c6416 dsk. I have written a<br>command file for my project which I will include below and also I include<br>the syntax I am using for C++ pragma to write a variable to SDRAM.<br>><br>> On compiling I get an error saying;<br>> warning: pragma DATA_SECTION can only be applied to a file level symbol<br>definition, not work<br>> Note - work is the variable im trying to write to SDRAM<br>><br>> My command file is as follows;<br>> -c<br>> -heap 0x50000<br>> -stack 0x90000<br>><br>> /* MODULE MEM */<br>> -stack 0x400<br>> MEMORY {<br>> ISRAM : origin = 0x0, len = 0x100000<br>> SDRAM : origin = 0x80000000, len = 0x1000000<br>> FLASH : origin = 0x64000000, len = 0x80000<br>> }<br>><br>><br>> SECTIONS {<br>> .text :> ISRAM<br>> .bss :> ISRAM<br>> .cinit :> ISRAM<br>> .stack :> ISRAM<br>> .sysmem :> SDRAM<br>> .const :> ISRAM<br>> .switch :> ISRAM<br>> .far
:> SDRAM<br>> .cio :> SDRAM<br>> .mydata:>SDRAM<br>> }<br>><br>><br>> and the syntax I am using with the pragma directive (as got from the Code<br>Composer help) is;<br>><br>> #pragma DATA_SECTION(".mydata");<br>> float work;<br>><br>> on checking the address of work in the watch window I can see it is still<br>being stored in internal memory.<br>><br>> Any help would be greatly appreciated.<br>><br>> Niall Barry<br>><br>><br>><br>><br>><br>><br>> NEW! You can now post a message or access and search the archives of this<br>group on DSPRelated.com:<br>> http://www.dsprelated.com/groups/code-comp/1.php<br>><br>> _____________________________________<br>> Note: If you do a simple "reply" with your email client, only the author<br>of this message will receive your answer. You need to do a "reply all" if<br>you want your answer to be distributed to the entire group.<br>><br>> _____________________________________<br>> About this discussion group:<br>><br>> Archives:
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!