DSPRelated.com
Forums

how can i allocate a heap in SDRAM using .cdb file

Started by fx-7...@163.com August 23, 2010
Cathy,

Regarding the location of the heap (the .heap section in the .cmd file)
Mostly the heap is used to satisfy the (C++:'new' and 'delete') (C: 'malloc' and
'free') function calls. I'm not sure the configuration for the BIOS is also keep in
the heap I think a section of the available heap is set aside at link time for the
configuration info, thereby reducing the size of the heap that is available to the
application.

While it can cause problems, the .heap section can be forced to reside in the external
ram (SDRAM) by an appropriate change to the line in the SECTIONS area of the .cmd file.
(I would not recommend such a change until everything else is working).

R. Williams

---------- Original Message -----------
From: f...@163.com
To: c...
Sent: Tue, 24 Aug 2010 22:01:14 -0400
Subject: [c6x] Re: how can i allocate a heap in SDRAM using .cdb file

> hello Williams and JS!
>
> if the 'enable memory mapping' is checked:
> after loading,it's like this, the address 0x00Axxxxx seems not writable
>
> 00A84400 _c_int00:
> -------- -------- -- --------- ----------------
> -------- -------- -- --------- ----------------
> -------- -------- -- --------- ----------------
> -------- -------- -- --------- ----------------
> -------- -------- -- --------- ----------------
> -------- -------- -- --------- ----------------
> -------- -------- -- --------- ----------------
> -------- -------- -- --------- ----------------
> -------- -------- -- --------- ----------------
>
> and if the 'enable memory mapping' is unchecked:
> the error verification address is these:
> 0xA84180
> 0xA84D0C
> 0xA5AA74
> 0xA80E60
> 0xA82494
> 0xA3D980
> 0xA84DBC
> 0xA5AA80
> 0xA62A70
> 0xA6AA60
> 0xA7CD00
> 0xA83978
> 0xA824A0
> 0xA84900
> 0xA84A00
> then in the message it will remind the error
>
> Can't Set Breakpoint at 0xa6c2b8: Error 0x00000008/-1076 Error during:
> Break Point, Cannot set/verify breakpoint at 0x00A6C2B8 Sequence
> ID: 7 Error Code: -1076 Error Class: 0x00000008 Breakpoint Manager:
> Attempting to set a hardware breakpoint instead
>
> it seems to me that the address around 0x00Axxxxx is the initial space
> for the execution of the whole project, is that right?
>
> i use the 'memory edit' tool to write the memory, in the aera of
> 0x00Axxxxx, it can not chage value there
>
> the *cfg.cmd file shows the memory partition
>
> /* MODULE MEM */
> -stack 0x400
> MEMORY {
> ISRAM : origin = 0x0, len = 0xe00000
> SDRAM : origin = 0x80000000, len = 0x1000000
> FLASH : origin = 0x64000000, len = 0x80000
>
> BTW
> i enlarge the space of my ISRAM, so i don't use SDRAM now, all the
> thing is put in ISRAM. so i go back to use the configuration tools.
>
> -----------------original txt------------------------
> hello!
> >i'm using TMS320C6416 board doing a project which has to use so much sapce, so ISRAM
may not be enough, then i use the SDRAM, but i'm just using the .cdb file to configure
the pro, no assembly source file. thus , i don't no how to add the section, e.g.
"my_sect", to the SDRAM, it's suggested by many friends that when a section is created,
lines about it must be added to the .cmd, the command linker file, but when i try to
modify the .cmd file, it's forbidden to change, which i guess is because i'm using the
.cdb file to configure it.
> >so how can i modify the cmd file when using a .cdb file to configure the project?
> >
> >in the project,i wrote these lines:
> >#pragma DATA_SECTION(m_abyBlockAllocate,".sdram")
> > Uint8 m_abyBlockAllocate[77 * 384]; //allocating buf
> >is that correct?
> >P.s. there's no error,but a warnig: creating output section .sdram without SECTIONS
specification
> >
> >i know the error is due to the reason that i didn't add lines to the .cmd file, but
i don't know how to do it. could anyone give a help ?
> >
> >thx in advance!
> >
> >cathy
> >
> >_____________________________________
> >
> >
------- End of Original Message -------

_____________________________________
cathy,

You really need to understand the device that you are programming when
you are dealing with embedded systems. The absolute minimum is to
understand the memory map.

On 8/24/2010 9:38 PM, f...@163.com wrote:
>
> there is one more thing
> when i enlarge the ISRAM from 0x00f00000 to 0x0f000000
>

ISRAM is physical memory. It only exists in the following address range.
Internal RAM (L2) 1MB 0000 0000 -- 000F FFFF

> and the heap size from 0x10000 to 0x0e200000
> the unwritable space changed
>

What is the "unwritable space"??
>
> from the 0x00Axxxxx to 0x0exxxxxx
>
> does this has sth to with the heap?
> what exactly is the heap?
>

You might check out
http://processors.wiki.ti.com/index.php/Code_Generation_Tools_FAQ
for a start.
>
> in my understanding, it just a space used to store the user data, the
> BIOS/DSP configuration data is stored in the space:
> ISRAM_length - heap_size
> is this understanding correct?
>
> p.s.
> when will u online, it seems our time lag is totally upside down. i
> cannot always reply the message in time...
>

I am GMT-6. Around 22:00 my time I usually catch up on my email.

My advice - even if you are in a hurry - take the time to understand the
basics of the DSP target and your tools. Work with small projects that
you understand. Then tweak them - move them from internal to external
memory [or vice versa]. Work with interrupts in a small project and then
move on to EDMA. All of this sounds like a lot of "delay" - but I think
[after a few years and trying several shortcuts] it is a good way to get
a solid foundation [and to make future projects easier].

mikedunn
> ---------------------original txt-----------------
> hello!
> >i'm using TMS320C6416 board doing a project which has to use so much
> sapce, so ISRAM may not be enough, then i use the SDRAM, but i'm just
> using the .cdb file to configure the pro, no assembly source file.
> thus , i don't no how to add the section, e.g. "my_sect", to the
> SDRAM, it's suggested by many friends that when a section is created,
> lines about it must be added to the .cmd, the command linker file, but
> when i try to modify the .cmd file, it's forbidden to change, which i
> guess is because i'm using the .cdb file to configure it.
> >so how can i modify the cmd file when using a .cdb file to configure
> the project?
> >
> >in the project,i wrote these lines:
> >#pragma DATA_SECTION(m_abyBlockAllocate,".sdram")
> > Uint8 m_abyBlockAllocate[77 * 384]; //allocating buf
> >is that correct?
> >P.s. there's no error,but a warnig: creating output section .sdram
> without SECTIONS specification
> >
> >i know the error is due to the reason that i didn't add lines to the
> .cmd file, but i don't know how to do it. could anyone give a help ?
> >
> >thx in advance!
> >
> >cathy
> >
> >_____________________________________
> >
> >
dear all!

hello Williams
i'm sure the setup select the correct chip,and both the CCS and config file setup.

hello Mikedunn
"unwritable space" means the aera where the data verification is failed.

and i wonder whether the whole space is enough..

gBufferXmt[2][196608*2];

Uint8 m_abyFicConvoEncodeOut[384];

Uint8 *m_apbySubChanTimeInterBuf[64][16];
above array, each pointer points to space of 864*8 byte

int m_anSubChanConvoEncodeOutLen[64][16];

Uint8 m_abyCif[864 * 8];

Uint8 m_abyBlockAllocate[77 * 384];

int m_anNormalizedPhase[154][384 * 8 / 2 + 1];

int m_anY[384 * 8 / 2 + 1];

double m_afDot[154][2048 * 2];

Uint8 *g_apbyRxBuf[40];
each pointer point to space of 6149 byte.
And i now know that the ISRAM is just 1MB, while the SDRAM is 16MB.also the heap space is for dynamic allocation.
well, i admit that i'm impatient when studying.
actually i'm new, oh maybe not that much new, cuz i've been doing the project with dsp for a term.
but in my lab, there's no one on this direction, so i have to study alone,sometimes when i met some question, i really don't know how to solve it.and maybe i lack some basic knowledge of developing embedded chip
is there any basic method or rule to obey when learning whatever embedded chip?

very much appretiate all your help!!

-----------------original txt------------------------
------------------
hello!
>i'm using TMS320C6416 board doing a project which has to use so much sapce, so ISRAM may not be enough, then i use the SDRAM, but i'm just using the .cdb file to configure the pro, no assembly source file. thus , i don't no how to add the section, e.g. "my_sect", to the SDRAM, it's suggested by many friends that when a section is created, lines about it must be added to the .cmd, the command linker file, but when i try to modify the .cmd file, it's forbidden to change, which i guess is because i'm using the .cdb file to configure it.
>so how can i modify the cmd file when using a .cdb file to configure the project?
>
>in the project,i wrote these lines:
>#pragma DATA_SECTION(m_abyBlockAllocate,".sdram")
> Uint8 m_abyBlockAllocate[77 * 384]; //allocating buf
>is that correct?
>P.s. there's no error,but a warnig: creating output section .sdram without SECTIONS specification
>
>i know the error is due to the reason that i didn't add lines to the .cmd file, but i don't know how to do it. could anyone give a help ?
>
>thx in advance!
>
>cathy
>
>_____________________________________

_____________________________________
Cathy,

On 8/25/2010 6:15 AM, f...@163.com wrote:
>
> dear all!
>
> hello Williams
> i'm sure the setup select the correct chip,and both the CCS and config
> file setup.
>
> hello Mikedunn
> "unwritable space" means the aera where the data verification is failed.
>

I don't know if I mentioned this...
Anytime that you get memory verification errors
1. Generate a map file for your project
2. Get a memory map for your hardware.
3. Check the addresses to see if there is memory present.
4. If the error is outside of the hardware ranges, fix the build
configuration for the project.
> and i wonder whether the whole space is enough..
>
> gBufferXmt[2][196608*2];
>
> Uint8 m_abyFicConvoEncodeOut[384];
>
> Uint8 *m_apbySubChanTimeInterBuf[64][16];
> above array, each pointer points to space of 864*8 byte
>
> int m_anSubChanConvoEncodeOutLen[64][16];
>
> Uint8 m_abyCif[864 * 8];
>
> Uint8 m_abyBlockAllocate[77 * 384];
>
> int m_anNormalizedPhase[154][384 * 8 / 2 + 1];
>
> int m_anY[384 * 8 / 2 + 1];
>
> double m_afDot[154][2048 * 2];
>
> Uint8 *g_apbyRxBuf[40];
> each pointer point to space of 6149 byte.
>
> And i now know that the ISRAM is just 1MB, while the SDRAM is
> 16MB.also the heap space is for dynamic allocation.
> well, i admit that i'm impatient when studying.
> actually i'm new, oh maybe not that much new, cuz i've been doing the
> project with dsp for a term.
> but in my lab, there's no one on this direction, so i have to study
> alone,sometimes when i met some question, i really don't know how to
> solve it.and maybe i lack some basic knowledge of developing embedded chip
> is there any basic method or rule to obey when learning whatever
> embedded chip?
>

The comments below apply to me - I have worked with people who can "read
all of the manuals" and just start to work. I practice what I call
'iterative learning'. I have been "new" on at least 2 dozen different
architectures, and this is similar to what works for me.
Remember - do things in steps - first crawl, then walk, then run. [I
will try to start at the beginning]
1. The first thing that I want to know is - what is the complete memory
address map of my hardware - including I/O addresses.
As you go about the steps below, look up the info in the documentation
to learn it - as you need it.
2. Build a simple project. If 'hello world' works, it is a good starting
place. If it doesn't work, you'll have to use a simpler project [Hello
world actually takes quite a bit to work on an embedded system]. Enhance
and modify it to run in different memory spaces if your target supports
them.
3. Think about your 'real project'. Pick a component of it [a memory
based algorithm is a good place to start], code it, debug it, build it,
understand it.
4. Work on a simple timer example. Start with polling the timer and then
implement it with interrupts.
5. Do the same for I/O. Start with a polling example and then implement
interrupts.
6. Now put some of the pieces together. Integrate and debug them.
Hopefully some of these 'pieces' are somewhat representative of your
final system - even though they may be 'throw away code' [that is 'throw
away' in relation to the project - you may want to save them for future
use].
7. Implement EDMA examples.
8. Depending on your project, you may want to do some benchmarking or
performance measurements. Use you example code, tweak it, measure it,
understand it.
9. Now you are ready to get started. Do the same thing with your project
- implement it and debug it incrementally. You may have to get creative
to work with 'part of a project', but it can usually be done. During
this stage always think about 'what if it does not work??' - 'what
information would I need to know??'. At some time it won't work and you
or someone else] will need to troubleshoot it - if you have built in
some debug info provisions, it will be a lot easier to
troubleshoot/maintain.

gotta' go for now.
mikedunn
> very much appretiate all your help!!
>
> -----------------original txt------------------------
> ------------------
> hello!
> >i'm using TMS320C6416 board doing a project which has to use so much
> sapce, so ISRAM may not be enough, then i use the SDRAM, but i'm just
> using the .cdb file to configure the pro, no assembly source file.
> thus , i don't no how to add the section, e.g. "my_sect", to the
> SDRAM, it's suggested by many friends that when a section is created,
> lines about it must be added to the .cmd, the command linker file, but
> when i try to modify the .cmd file, it's forbidden to change, which i
> guess is because i'm using the .cdb file to configure it.
> >so how can i modify the cmd file when using a .cdb file to configure
> the project?
> >
> >in the project,i wrote these lines:
> >#pragma DATA_SECTION(m_abyBlockAllocate,".sdram")
> > Uint8 m_abyBlockAllocate[77 * 384]; //allocating buf
> >is that correct?
> >P.s. there's no error,but a warnig: creating output section .sdram
> without SECTIONS specification
> >
> >i know the error is due to the reason that i didn't add lines to the
> .cmd file, but i don't know how to do it. could anyone give a help ?
> >
> >thx in advance!
> >
> >cathy
> >
> >_____________________________________
> >
> >