From those of you who are in Prof. Khan's ECE2560 microcontroller's class, I have been getting a lot of questions on how to load the assembly project examples onto the MSP430 Launchpad. For this tutorial, I will use the Blinky.asm.
To start, go ahead and start up CCS v5. Do note that in order to be able to program the MSP430 Launchpad, you will need to be on the Free Code Size Limited license.
1) To create a new project, go to File>New>CCS Project. Make sure you choose CCS Project and not just Project!
2) Look at the screenshot below and make sure that you make the same selections. Make sure that you have MSP430 selected as your device, and MSP430G2553 as your variant. Also Choose Empty Assembly-only Project as a template. You can name your project as you wish, it does not have to be Blinking_LEDs.
4) Once the new source file is created, the new file will open up in the editor. But you will notice that it is not empty. It puts a couple of lines in the file which include the date and your name. You can see a picture of it below. Delete all of these lines because if you leave them there, your compiler will give you errors. This title would work fine if we were programming in C, but assembly compiler will not be happy.
5) Once you deleted the lines, go to this PDF file here. You might notice that this is the PDF file on Prof. Khan's website which contains the example code. You will see that the code is copied directly from CCS into the PDF file. You will also see that line numbers are also present. What you can do at this point is copy all of the text and paste it into your new .asm source file on CCS. However, you are not quite done yet because you will need to reformat the whole code in order to be able to compile it. You will see that every line is messed up and the indentations are all wrong. You can try fixing it, but don;t even try because I am nice enough to provide you with this text file which includes the same code, in the correct format. I have done all of the manual labor for you. So all you have to do is open up the .txt file, copy the contents and paste it into your source file on CCS.
6) Once you have that done, all you have to do is debug your code and program your Launchpad. To do this, click on the button that has a bug on it and this button will build, compile and program your code. So it is a pretty useful button, isn't it? If you don't know which button I am talking about, check out the screenshot below.
7) Once CCS finishes programming your MSP430, you will have to command your MSP430 to execute your code in order to see your LEDs blink. To do this, click on the button that looks like a play button. To end your debug session and go back to editing your code, click on the stop button. Here is a screenshot that shows where these buttons are located on the CCS Debug window.
Common Problems
Some of you will inevitably run into problems during debugging. The most common problem will be that you have the wrong license on CCS so you will get a message saying that you cannot program MSP430s with your current license. To fix this, go to Help>Code Composer Studio Licensing Information. Then go to the Upgrade tab and choose Launch License Setup. Once the License Setup Wizard comes up, click on CODE SIZE LIMITED (MSP430) and then click on Finish. Now you should be able to debug your code.
Have questions? Comment below and ask them. I will get back to you.
-Anil
When I press the debug button, I get an error that says the program has errors and asks if I want to run it anyway. I select yes and get this error:
ReplyDeleteMSP430: GEL: Encountered a problem loading file: C:\Users\Boba Fett\workspace\Blinking_LEDs\Debug\Blinking_LEDs.out Could not open file
Do you have any ideas about why this is happening? I tried the licencing solution you posted but it didn't change anything.
Well, because the program has errors, it tries compiling it but it can't. When it asks you if you want to continue, hit no and go back to your code and fix the error. What is the error?
DeleteSorry, I forgot to include that.
Delete"Blinking_LEDs.out" not built Blinking_LEDs C/C++ Problem
#10198-D no input section is linked in Blinking_LEDs C/C++ Problem
Hi Kowabunga,
DeleteI had this problem too, and the way I was taught to fix it was to go to the project folder on the menu on the left, right click on the project folder, and go to Properties. Under the "General" menu (located on the left), there should be a pull down menu labeled "Output Format". You'll want to make sure that it is set to "legacy COFF" and click OK. Let me know if this helps!
I don't really understand why you are getting this error, I would have to see your CCS. Have you followed the steps up above? Have you created a brand new project and start from scratch? Because the default settings when you create a project should not give you an error like that. Try Brock's suggestion. If that does not work, come see me at class tomorrow and I will help you out.
DeleteI researched you issue a bit at TI Kowabunga, but the error speaks for itself. Basically the linker has not found any “referenced” input sections to retain for the output file. I have added what TI says below:
DeleteA likely scenario for this message to appear is if you are building an ELF project with only assembly source files that do not have any "referenced" sections. This is a fundamental difference between COFF and ELF. COFF retains all sections by default. The opposite is true for ELF. In ELF, all sections are eligible for removal via conditional linking meaning that they will be removed if they are not referenced. If a section needs to be retained, the user must make sure that they are explicitly retained.
This would not be an issue with most C projects, as there is an entry point (defined by the C runtime library) which in turn calls main, and so sections will be pulled into the link. In the case of a single assembly source file, this is not the case.
I received the same errors as well after following your instructions - even after adding ".data" to the linker file under the 'Sections' heading.
DeleteFor more info: here is the Build report: (Notice the "no input section is linked in" error.)
**** Build of configuration Debug for project Blinking_LEDs ****
C:\ti\ccsv5\utils\bin\gmake -k all
'Building target: Blinking_LEDs.out'
'Invoking: MSP430 Linker'
"C:/ti/ccsv5/tools/compiler/msp430_4.1.1/bin/cl430" -vmsp --abi=eabi -g --advice:power=all --define=__MSP430G2553__ --diag_warning=225 --display_error_number --diag_wrap=off --printf_support=minimal -z --stack_size=0 -m"Blinking_LEDs.map" --heap_size=0 -i"C:/ti/ccsv5/ccs_base/msp430/include" -i"C:/ti/ccsv5/tools/compiler/msp430_4.1.1/lib" -i"C:/ti/ccsv5/tools/compiler/msp430_4.1.1/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off -o "Blinking_LEDs.out" "./main.obj" "../lnk_msp430g2553.cmd"
error #10198-D: no input section is linked in
"../lnk_msp430g2553.cmd", line 80: warning #10374-D: Interrupt vector "PORT1" does not have an interrupt handler routine.
>> Compilation failure
"../lnk_msp430g2553.cmd", line 81: warning #10374-D: Interrupt vector "PORT2" does not have an interrupt handler routine.
"../lnk_msp430g2553.cmd", line 83: warning #10374-D: Interrupt vector "ADC10" does not have an interrupt handler routine.
"../lnk_msp430g2553.cmd", line 84: warning #10374-D: Interrupt vector "USCIAB0TX" does not have an interrupt handler routine.
"../lnk_msp430g2553.cmd", line 85: warning #10374-D: Interrupt vector "USCIAB0RX" does not have an interrupt handler routine.
"../lnk_msp430g2553.cmd", line 86: warning #10374-D: Interrupt vector "TIMER0_A1" does not have an interrupt handler routine.
"../lnk_msp430g2553.cmd", line 87: warning #10374-D: Interrupt vector "TIMER0_A0" does not have an interrupt handler routine.
"../lnk_msp430g2553.cmd", line 88: warning #10374-D: Interrupt vector "WDT" does not have an interrupt handler routine.
"../lnk_msp430g2553.cmd", line 89: warning #10374-D: Interrupt vector "COMPARATORA" does not have an interrupt handler routine.
"../lnk_msp430g2553.cmd", line 90: warning #10374-D: Interrupt vector "TIMER1_A1" does not have an interrupt handler routine.
"../lnk_msp430g2553.cmd", line 91: warning #10374-D: Interrupt vector "TIMER1_A0" does not have an interrupt handler routine.
"../lnk_msp430g2553.cmd", line 92: warning #10374-D: Interrupt vector "NMI" does not have an interrupt handler routine.
warning #10202-D: no suitable entry-point found; setting to 0
error #10010: errors encountered during linking; "Blinking_LEDs.out" not built
gmake: *** [Blinking_LEDs.out] Error 1
gmake: Target `all' not remade because of errors.
Any other suggestions?
Start all over, this time, when you are creating a new CCS project (when you have the window showed in the first picture in the tutorial), click on Advanced settings and make sure of the following:
Delete-Compiler Version: TI v4.0.0
-Output Format: Legacy COFF
-Linker Command File:
-Runtime Support Library:
Make sure all the other settings are like shown in the first picture. Follow the rest of the steps in the tutorial and do no add .data in the command file for this project. Let me know if this works.
-Anil
thanks!
ReplyDeleteI have Compiler v4.1.1, and couldn't find an earlier version, but adjusting the Output Format was enough to complete the communication path.
I tried out your test code and got it to compile, but when I tried to program the msp430 i got:
ReplyDeleteMSP430: Error initializing emulator: Could not find MSP-FET430UIF on specified COM port
Try plugging in the launchpad to different usb ports. Also make sure you have the correct Emulator /debugger selected.
Delete