• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Development Tools » TI C/C++ Compiler » TI C/C++ Compiler - Forum » .define errors
Share
TI C/C++ Compiler
  • Forum
Options
  • Subscribe via RSS

Forums

.define errors

  • Joanna Boetzkes
    Posted by Joanna Boetzkes
    on Apr 24 2012 18:45 PM
    Prodigy90 points

    I'm trying to build an assembler-only program in CCS v5.1 and I'm running into trouble with my definitions.

    I want to create several constants which are located at specific, sequencial locations in RAM which I would like to define.  I also want to initialize these addresses with values.

    The code I have written is:

    .cdecls C,LIST, 

    "msp430g2231.h"

    BIN  .equ 200h                                                           illegal mneumonic specified

    .define 0x0202,EmergencyFlag                              

    .define 0x0204,OpenValveTimer                            

    .define 0x0206,Divisor

    .define 0x0208,FullMeasurement

    ;------------------------------------------------------------------------------

               

    .text                           ; Progam Start          

    .global INITIALIZE           ; define entry point

    ;------------------------------------------------------------------------------

    INITIALIZE 

    mov.w   #0280h,SP               ; Initialize stackpointer

    StopWDT    

    mov.w   #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT

    mov.w #TASSEL_2+MC_2,&TACTL ; Initialize the Timer A contol Register and set it to continuous mode with the Sub-Master Clock

    ;------------------------------------------------------------------------------

    ; Definitions set up specifically for Multi-Tasking Routine

    ;------------------------------------------------------------------------------

    clr.w Bin                                                                                            illegal, un-relocatable operand

    clr.w EmergencyFlag                                                                        illegal, un-relocatable operand

    clr.w OpenValveTImer                                                                      undefined symbol

    clr.w Divisor                                                                                         illegal, un-relocatable operand

    clr.w FullMeasurement                                                                        illegal, un-relocatable operand

    I have noted the error messages beside the code.  Any idea how to fix this issue?

    Also, when using ".define" is the value given the address of the symbol, or the value of the symbol?

     

    Thanks for any help

    Joanna

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • George Mock
    Posted by George Mock
    on Apr 25 2012 15:17 PM
    Guru51390 points

    Put & in front of the operand. For example ...

    clr.w &Bin

    Thanks and regards,

    -George


    TI C/C++ Compiler Forum Moderator
    Please click Verify Answer on the best reply to your question.
    The Compiler Wiki answers most common questions.
    Track an issue with SDOWP. Enter your bug id in the "Find Record ID" box.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Joanna Boetzkes
    Posted by Joanna Boetzkes
    on Apr 25 2012 15:31 PM
    Prodigy90 points

    Thanks for the response.

    I added the '&' as suggested.  This gets rid of the error, but doesn't entirely solve my problem.

    I'm using these variables later on in my code.  I would like to see them changing in the debugger as I use them (just as you can do with the working registers), but they are not listed in the variables section.

    I suppose a better way of phrasing my question would be how do you define and initialize variables in assembly using CCS 5.1?

    I wrote some very simple C-code which initialized variables in an attempt to see this in the 'disassembler', but found that all the variables were automatically written to the working registers.  I would like to write my variables to RAM.

     

    Joanna

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • George Mock
    Posted by George Mock
    on Apr 26 2012 17:16 PM
    Guru51390 points

    It is easy enough to define data variables in assembly.  The key directive is .usect.  Read about it in the Assembly Language Tools book.  Define the variables in a section you name.  Then, in the link command file, allocate that section to a specific address.

    But, you also want to see these variables in CCS just like variables defined in C.  That is difficult.  The compiler uses a series of non-trivial debug directives (they all start with ".dw") to encode all of the Dwarf debug information for a variable.  Reproducing that in hand-coded assembly is not practical.  So far, I have no thought of a solution to this part of your problem.

    Thanks and regards,

    -George


    TI C/C++ Compiler Forum Moderator
    Please click Verify Answer on the best reply to your question.
    The Compiler Wiki answers most common questions.
    Track an issue with SDOWP. Enter your bug id in the "Find Record ID" box.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Joanna Boetzkes
    Posted by Joanna Boetzkes
    on Apr 27 2012 19:23 PM
    Prodigy90 points

    So, just so I ensure I understand what your saying:

    If I have an assembly program which contains a file register called LoopCounter in RAM, I cannot view what the value of that register is if I step through the program in CCS?  But i can in C?  When programming PICs in assembler, we commonly had 100+ such named registers. 

     

    Also, where is the link command file located, and how am I to modify it?  I've been through that Tools book already, but found it hard to follow.  What would really be helpful is an example!  Is there no examples that show such things?  (I was already pointed to those listed on the ti website, but they are short and do not include much useful code).

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • George Mock
    Posted by George Mock
    on Apr 30 2012 17:20 PM
    Guru51390 points

    Joanna Boetzkes
    If I have an assembly program which contains a file register called LoopCounter in RAM, I cannot view what the value of that register is if I step through the program in CCS?  But i can in C?  When programming PICs in assembler, we commonly had 100+ such named registers.

    I'm not sure what you mean by a "file register" in RAM.  You can certainly see ordinary CPU registers in CCS.  But such registers, and their visibility in CCS, is all built-in.  I presume you are talking about a piece of memory allocated and given a name by the user.  For such variables, the memory allocation step is straightforward.  The difficulty is associating the name and type with that chunk of memory so that CCS knows how to display it.  That information is encoded in Dwarf debug format with non-trivial assembler directives.  

    Joanna Boetzkes
    where is the link command file located, and how am I to modify it?

    This best shown by example.  In CCS create a new project.  The menu item is Project -> New CCS Project.  Name the project.  Then under Project templates and examples, choose the Blink The Led project.  Click Finish.  (BTW, these selections may be a bit different depending on which CCS version you use.)  Expand the project in the Project Explorer view.  You will see a file with a name similar to lnk_cc430f5123.cmd.  Double-click to edit it.  This is a linker command file.  Even for an assembly only project, you should probably use the link command file appropriate for your device.

    Thanks and regards,

    -George


    TI C/C++ Compiler Forum Moderator
    Please click Verify Answer on the best reply to your question.
    The Compiler Wiki answers most common questions.
    Track an issue with SDOWP. Enter your bug id in the "Find Record ID" box.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use