I am trying to get a simple assembly language program setup in Code Composer 5. I have the option to start an empty assembly language project. And I am trying something very simple:
start: ld r0,#2
stop: b stop
It's as simple as it gets. But I can't get it to compile properly. It keeps complaining about stack and other stuff as well.
I know that I am missing something very simple. The stack for once that needs to be initialized. And maybe some other stuff too.
All I am trying to do is get some very simple assembly code up and running and debug it on my LM3S8962 board.
Any help is greatly appreciated.
mouka zwinaBut I can't get it to compile properly. It keeps complaining about stack and other stuff as well.
What are the exact errors you are getting? If you can copy and paste the full error message from the CCS build console that will be helpful.
When you create the new project are you selecting the "Empty Assembly-only Project" template from the list of templates? This would be the appropriate one to select for a project that is going to contain only assembly source files and no C source file. From there on you should be able to add your source file and build.
Please click This Resolved My Issue if the reply answers your question.
Search the wikis for common questions: Compiler, CCSv6, CCSv7Track a known bug with SDOWP. Enter the bug id in the "Find Record ID" box
In reply to AartiG:
That's exactly what I did.
1. I created a new Empty Assembly Project.
2. CCS did create an empty project for me.
3. I added a simple .asm file containing the code I showed before.
4. I tried assembling, but the assembler, or the compiler, complained about all kinds of things missing or undefined.
In reply to mouka zwina:
If you can post the complete output of the CCS build view we can try to explain what the errors mean and what could be causing them.
Was the code snippet you attached the full assembly source file? When you created the new project in CCS, did you pick Stellaris LM3S8962 as the device variant?
Here's all the code I had in my main.asm:
.textstart: mov r0,#1234 mov r1,#5678 add r2,r1,r0stop: b stop
here are the errors:
warning #10204-D: automatic RTS selection: could not resolve index library "libc.a" to a compatible libraryerror #10198-D: no input section is linked in
"../lm3s8962.cmd", line 44: error #10104: undefined symbol "__stack" used in expression>> Compilation failurewarning #10202-D: no suitable entry-point found; setting to 0error #10010: errors encountered during linking; "junk.out" not builtgmake: *** [junk.out] Error 1gmake: Target `all' not remade because of errors.
**** Build Finished ****
The quick-and-dirty answer is to change "start" to "main", and add a ".global main" directive (don't forget to indent it). You'll get a bunch of startup code that you don't really need, but that's probably the easiest path for now.
In reply to Archaeologist:
I just did. I added ".global main" directive. Without the double quotes obviously. But I am getting the same error messages as I did before.
I think it is compiling my project as if it were a C project. The reason I am saying this is because it is trying to link the object code with libc.a.
I don't even know if CCS is capable of assembling simple projects. It seems that gcc is always trying to compile stuff as a C project.
I tried several blank projects. But I am always getting the same errors. I tried changing stuff to address the errors I am getting, only to generate a lot more errors.
Please do a "build all" and show us the entire contents of the build console window.
**** Build of configuration Debug for project Test ****
"C:\\ti\\ccsv5\\utils\\bin\\gmake" -k all 'Building file: ../main.asm''Invoking: ARM Compiler'"C:/ti/ccsv5/tools/compiler/arm_5.0.1/bin/armcl" -mv7M3 --code_state=16 --abi=eabi -me -g --include_path="C:/ti/ccsv5/tools/compiler/arm_5.0.1/include" --diag_warning=225 --display_error_number --diag_wrap=off --preproc_with_compile --preproc_dependency="main.pp" "../main.asm"'Finished building: ../main.asm'' ''Building target: Test.out''Invoking: ARM Linker'"C:/ti/ccsv5/tools/compiler/arm_5.0.1/bin/armcl" -mv7M3 --code_state=16 --abi=eabi -me -g --diag_warning=225 --display_error_number --diag_wrap=off -z --stack_size=0 -m"Test.map" --heap_size=0 -i"C:/ti/ccsv5/tools/compiler/arm_5.0.1/lib" -i"C:/ti/ccsv5/tools/compiler/arm_5.0.1/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off -o "Test.out" "./main.obj" -l"libc.a" "../lm3s8962.cmd" <Linking>warning #10204-D: automatic RTS selection: could not resolve index library "libc.a" to a compatible library
>> Compilation failureerror #10198-D: no input section is linked in"../lm3s8962.cmd", line 44: error #10104: undefined symbol "__stack" used in expressionwarning #10202-D: no suitable entry-point found; setting to 0error #10010: errors encountered during linking; "Test.out" not builtgmake: *** [Test.out] Error 1gmake: Target `all' not remade because of errors.
Just for clarification: I went into the lm3s8962.cmd and I removed any references to the stack since I don't need it to be configured in an assembly project. But then I started getting errors relating to libc.a
I removed any reference to libc.a from my project settings, and I still couldn't build the project properly.
I have Googled CCS and I have found some stuff online relating to CCS 4. I have installed CCS 5. I don't know what happened when stuff got moved from version 4 to version 5. But I know for sure that an assembly project selected from the default CCS 5 templates does not work. Too many settings were not done properly.
Please take a look at this related thread. http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/176351/637520.aspx#637520
Although that one is for a MSP430 device the errors noted there are similar. If you add the .retain directive in your asm source file you should be able to get rid of the "no input sections linked in" error. You would also need to set the entry point in the linker options (--entry_point) probably to "start" in your case. And comment out the line that sets __STACK_TOP in the linker command file lm3s8962.cmd. I beleive this should allow you to build without errors.
Most users begin with C programs, and the out of box templates and examples are set up to work better with C projects rather than assembly only projects. If you plan to run code on a Stellaris LM3S8962 eval kit, the Stellarisware examples are a great starting point. I would advise taking a look at and starting with the examples there as they are specifically targeted to run on the eval kit.
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.