TI E2E Community
TI C/C++ Compiler
TI C/C++ Compiler - Forum
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:
BIN .equ 200h illegal mneumonic specified
.text ; Progam Start
.global INITIALIZE ; define entry point
mov.w #0280h,SP ; Initialize stackpointer
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
Put & in front of the operand. For example ...
Thanks and regards,
TI C/C++ Compiler Forum ModeratorPlease 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.
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.
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.
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).
Joanna BoetzkesIf 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 Boetzkeswhere 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.
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.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.