Reply by gopalakrishnan vishal anand February 10, 20092009-02-10
Hi Bahaa,

The definitions of MY_DATA_1_runstart and MY_DATA_1_size must be Uint16 and not constants as you have defined. These values will be updated by the linker based on the linking process. If you make these changes you shouldn't get the warning meseg. I tried the same with the control card here and it works fine for me. The updation of the memory location will happen on even before the code starts execution because it is initialised data. On the end of the following sequence of events, the memory location will be updated

Reset CPU -> Restart CPU -> Go Main (Data in the memory location will be updated after this step)

Thanks,
Vishal
--- On Mon, 2/9/09, bahaa hafez wrote:

From: bahaa hafez
Subject: RE: [c28x] Writing a value in a certain memory location
To: a...@yahoo.com
Date: Monday, February 9, 2009, 6:40 PM

#yiv1779205673 .hmmessage P
{
margin:0px;padding:0px;}
#yiv1779205673 {
font-size:10pt;font-family:Verdana;}

Hi Vishal,

Thank you for spending your time on this helpful commented reply.

I followed the steps you mentioned.

1- I modified the DSP281x_Headers_nonBIOS.cmd which is the cmd file I am using.

a. I added the line below in the MEMORY part in the PAGE :1 section:

MY_MEMOMRY_SPACE: origin = 0x00200D, length = 0x000002

b. I added the lines below in the SECTIONS part:

MY_Data_1 : > MY_MEMOMRY_SPACE,PAGE = 1
RUN_START(_MY_DATA_1_runstart)
RUN_SIZE(_MY_DATA_1_size)

2- I modified the DSP281x_Device.h to include the definition for My_Data_1_runstart and My_Data_1_size As following

#define _MY_DATA_1_runstart 1
#define _MY_DATA_1_size 2

3- In the .c file, which contains the main function, I included these two lines before the main function starts.

#pragma DATA_SECTION(My_Sample_Data,"My_Data_1");
Uint16 My_Sample_Data=0x0003;

When I build my project, I got the following warning

>> warning: creating output section My_Data_1 without SECTIONS specification

When I tried to see the value in the targeted memory location, after running the code, using View>>Memory in CCS and enter the address 0x00200D I can see that

0x0000200D My_Sample_Data
0x0000200D 0xFFFF

Which shows that I wasnt able to write the required value in the targeted memory location.

Iwould appreciate your help withthe following questions

1-Is there any wrong step in the previous sequence?

2-Is it normal to have that warning?

3-What are the definitions should I use for My_Data_1_runstart and My_Data_1_size?

Sorry for asking so many questions, but this is my first time to deal with the memory mapping files in 2812.

Thanks in advance

Regards,

Bahaa

Date: Sun, 8 Feb 2009 21:26:15 -0800
From: a...@yahoo.com
Subject: Re: [c28x] Writing a value in a certain memory location
To: b...@hotmail.com

Hi,

You need to use the #pragma directive for placing a data is a specific section in the memory. Here's a snippet of what you need to do.

In the linker command file Memory options, you'll have to do the following

PAGE 1 : /* Data Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */
/* Registers remain on PAGE1 */
MY_MEMORY_SPACE : origin = 0x00200D, length = 0x000001
This instruction reserves the memory location, 0x00200D for the memory named, MY_MEMORY_SPACE. You can link the data that you want to into this memory location by using the SECTIONS and #pragma directives as given below.

In the linker command file, you'll have to create a section in the following lines

My_Data_1: > MY_MEMORY_SPACE,PAGE = 1 align (xxx),block (xxx)
RUN_START(_My_Data_1_runstart)
RUN_SIZE(_My_Data_1_size)

The align and block directives are optional. Refer to the assembler document for details regarding this. The primitives, My_Data_1_runstart and My_Data_1_size need to be defined as global variables in some other header file in your prject space. These are the relocatable references used by the linker for placing the data into the defined sections. This portion preforms the allocation of the specific memory

In the *.c file in which you need to reference the data which will be placed in the memory location given above, have the following lines,

#pragma DATA_SECTION (My_Sample_Data, "My_Data_1")
Uint16 My_Sample_Data = 0x0003;

Using the steps mentioned above, you can place the data in any section of the memory that you want. If you want to change the memoru location to 0x002100 from 0x00200D, then all you have to do is to change the definition of MY_MEMORY_SPACE.

Hope this helps.

Thanks,
Vishal

--- On Sun, 2/8/09, b...@hotmail.com wrote:

From: b...@hotmail.com
Subject: [c28x] Writing a value in a certain memory location
To: c...
Date: Sunday, February 8, 2009, 4:38 PM

Hi all,

I am using F2812 TI dsp.

I want to write a value in a certain memory location.

The value is"0x0003" its address is "0x00200D".

I am not sure if there is a way to write that in C.

If you can please tell me about the assembly code which should be used to

perform such task and how to include it in a C code?

Best regards,

Bahaa

#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mkp
{border:1px solid #d8d8d8;font-family:Arial;padding:0px 14px;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mkp hr
{border:1px solid #d8d8d8;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mkp #EC_hd
{color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mkp #EC_ads
{margin-bottom:10px;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mkp .EC_ad
{padding:0 0;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mkp .EC_ad a
{color:#0000ff;text-decoration:none;}

#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor #EC_ygrp-lc
{font-family:Arial;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor #EC_ygrp-lc #EC_hd
{font-weight:bold;font-size:78%;line-height:122%;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor #EC_ygrp-lc .EC_ad
{margin-bottom:10px;padding:0 0;}

#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mlmsg
{font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mlmsg table
{font-size:inherit;font:100%;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mlmsg select, #yiv1779205673 .ExternalClass #EC_yiv1966011597 input, #yiv1779205673 .ExternalClass #EC_yiv1966011597 textarea
{font:99% arial, helvetica, clean, sans-serif;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mlmsg pre, #yiv1779205673 .ExternalClass #EC_yiv1966011597 code
{font:115% monospace;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mlmsg EC_*
{line-height:1.22em;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-text
{font-family:Georgia;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-text p
{}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 dd.EC_last p a
{font-family:Verdana;font-weight:bold;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-vitnav
{padding-top:10px;font-family:Verdana;font-size:77%;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-vitnav a
{padding:0 1px;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mlmsg #EC_logo
{padding-bottom:10px;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-reco
{margin-bottom:20px;padding:0px;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-reco #EC_reco-head
{font-weight:bold;color:#ff7900;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_reco-category
{font-size:77%;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_reco-desc
{font-size:77%;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-vital a
{text-decoration:none;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-vital a:hover
{text-decoration:underline;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor #EC_ov ul
{padding:0 0 0 8px;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor #EC_ov li
{list-style-type:square;padding:6px 0;font-size:77%;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor #EC_ov li a
{text-decoration:none;font-size:130%;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor #EC_nc
{background-color:#eee;margin-bottom:20px;padding:0 8px;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor .EC_ad
{padding:8px 0;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor .EC_ad #EC_hd1
{font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor .EC_ad a
{text-decoration:none;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor .EC_ad a:hover
{text-decoration:underline;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-sponsor .EC_ad p
{}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 EC_o
{font-size:0;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 .EC_MsoNormal
{}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-text tt
{font-size:120%;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 blockquote
{}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 .EC_replbq
{}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 dd.EC_last p span
{margin-right:10px;font-family:Verdana;font-weight:bold;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 dd.EC_last p span.EC_yshortcuts
{margin-right:0;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 div.EC_photo-title a, #yiv1779205673 .ExternalClass #EC_yiv1966011597 div.EC_photo-title a:active, #yiv1779205673 .ExternalClass #EC_yiv1966011597 div.EC_photo-title a:hover, #yiv1779205673 .ExternalClass #EC_yiv1966011597 div.EC_photo-title a:visited
{text-decoration:none;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 div.EC_file-title a, #yiv1779205673 .ExternalClass #EC_yiv1966011597 div.EC_file-title a:active, #yiv1779205673 .ExternalClass #EC_yiv1966011597 div.EC_file-title a:hover, #yiv1779205673 .ExternalClass #EC_yiv1966011597 div.EC_file-title a:visited
{text-decoration:none;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-msg p
{clear:both;padding:15px 0 3px 0;overflow:hidden;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-msg p span
{color:#1E66AE;font-weight:bold;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 EC_div#ygrp-mlmsg #EC_ygrp-msg p a span.EC_yshortcuts
{font-family:Verdana;font-size:10px;font-weight:normal;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-msg p a
{font-family:Verdana;font-size:10px;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 #EC_ygrp-mlmsg a
{color:#1E66AE;}
#yiv1779205673 .ExternalClass #EC_yiv1966011597 div.EC_attach-table div div a
{text-decoration:none;}

_____________________________________
Reply by Jim Webb February 10, 20092009-02-10
Hi Bahaa,
All you need to do is this:
*(int*)0x200d = 0x3;

Now that I have your attention, I would like to suggest that you consider using our software, VisSim, to automatically generate C code.
We have blocks for all the peripherals on the F2812, F280x, F282x, F283x,.
It fully supports IQMath and allows you to create visual block diagrams of your algorithm, simulate to fix bugs and tune respones, and generate C code.
It has saved our users years of development time. You can download a free trial here: www.vissim.com/downloads/demos.html.
Reply by Andrew Nesterov February 10, 20092009-02-10
The method is correct, and I used it many many times for a C6x.
I could guess a couple of reasons that it did not work for you:
does this memory location exist and can you change its value in
the CCS memory view window? I also heard that on a C2000 device
you might need to enable either peripheral space or ram space
by setting some bits in a configuration register. Please refer
to your device's datasheet for exact information.

The memory map file provides with an information about memory spaces
to the linker, but physically from a program you could dereference
any address, obviously only valid addresses would be read/written.

HTH,

Andrew

> Date: 09-Feb-2009 05:39:12 -0800
>
> Hi Andrew,
>
> thank for your reply and your time.
>
> I tried your solution and it didn't work.
>
> I know that its syntax is correct in C, However, for the DSP i think
> it is more complicated to implement it as we have to define that location
> in the memory map file for the project beside using a special directives.
>
> I am not sure of my reply, so please correct me if i am wrong or missing
> something.
>
> However, I tried it now on F2812 and there was no change in that memory
> location when i watched it using CCS memory window.
>
> thank you again.
>
> regards,
>
> Bahaa
> Date: Mon, 9 Feb 2009 05:10:09 -0800
> From: andrew.n
> To: c...; bahaahafez
> Subject: Re: Writing a value in a certain memory location
> > > Hi Bahaa,
> > This could be performed very simple in C:
> > *(int *)0x00200D = 0x0003;
> > HTH,
> > Andrew
> > > Writing a value in a certain memory location
> > Posted by: "bahaahafez@
> > Date: Sun Feb 8, 2009 12:52 pm ((PST))
> >> > Hi all,
> >> > I am using F2812 TI dsp.
> >> > I want to write a value in a certain memory location.
> >> > The value is"0x0003" its address is "0x00200D".
> >> > I am not sure if there is a way to write that in C.
> >> > If you can please tell me about the assembly code which should be used to
> >> > perform such task and how to include it in a C code?
> >> > Best regards,
> >> > Bahaa
> >

_____________________________________
Reply by Andrew Nesterov February 9, 20092009-02-09
Hi Bahaa,

This could be performed very simple in C:

*(int *)0x00200D = 0x0003;

HTH,

Andrew

> Writing a value in a certain memory location
> Posted by: "bahaahafez@
> Date: Sun Feb 8, 2009 12:52 pm ((PST))
>
> Hi all,
>
> I am using F2812 TI dsp.
>
> I want to write a value in a certain memory location.
>
> The value is"0x0003" its address is "0x00200D".
>
> I am not sure if there is a way to write that in C.
>
> If you can please tell me about the assembly code which should be used to
>
> perform such task and how to include it in a C code?
>
> Best regards,
>
> Bahaa
>

_____________________________________
Reply by baha...@hotmail.com February 8, 20092009-02-08
Hi all,

I am using F2812 TI dsp.

I want to write a value in a certain memory location.

The value is"0x0003" its address is "0x00200D".

I am not sure if there is a way to write that in C.

If you can please tell me about the assembly code which should be used to

perform such task and how to include it in a C code?

Best regards,

Bahaa

_____________________________________