This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430G2553: Trying to program the MSP430G2 Launchpad with a file produced by msp430gcc us with msp430flasher

Part Number: MSP430G2553


Hello!

I am trying to use the Msp430G2 Launchpad with the command line. The tools I want to use are the MSP430 GCC Compiler for building and the MSP4430Flasher for flashing. The output of the gcc compiler is an .out-file. But I need a TI-txt file or a hex file.

How can i get one of this kind of files? I did'nt find anything in the documents.

Thanks in advance. Best regards,

Guenther

  • Hello Guenther,

    Please refer to this E2E thread.

  • Thanks for the fast reply.

    I tried to compile the file (blink.c) with Code Composer Studio 9. In the Project Properties I enabled the GNU Objcopy Utility. So I got an .hex file as an output.

    Then I opened the Debug_GNU Folder with the PowerShell and entered:

    msp430flasher -n msp430g2xx3 -w blink.hex

    It failed, the Shell said:

    Exit: 59
    ERROR: Could not determine file type

    I remembered that I had tested the msp430flasher with a hex file generated by the TI-Compiler and this also failed. Then I build a TI-txt file ant that worked.

    This I am going to test again. But regarding to SLAU654E page 4, msp430flasher should accept both, TI-txt and HEX (Intel-hex). Maybe the generated hex is no intel-hex?

    Best regards,

    Guenther

  • Hello,

    because my CCS intallation has problems with changing the compiler in an existing project, I created two new ones, one with the TI Compiler and one with the GCC compiler. Both projects contain the blink.c file from the msp430 gcc example folder.

    At the project with the TI compiler I activated the MSP430 Hex Utility and choose the "Output Intel hex format " in the Output Options. After the succesful building, I try to flash it with the MSP430Flasher and it worked. After pressing the reset button, the LED started to blink. It also works with a Intel hex file, not only with a TI-txt file!

    Then I tested the project with the GCC compiler, there is only one kind of hex file to choose. Here I got the same massage as above: "Could not determine file type".

    Can the MSP430Flasher only handel hex files created by the TI compiler?

    Best Regards,
    Guenther
  • The hex file format is pretty standard.  If you look at the two hex files in your text editor, do they appear to be the same format?

  • Good idea, here is the content of the hex file generated by the TI compiler:

    :20C000002183B240805A2001D2D32200D2E32100B140102700009183000081930000F62785
    :20C02000FA3F31400004B01244C00C43B01200C01C43B0123EC032D01000FD3F03430343C2
    :08C04000FF3F03431C433041A4
    :02FFDE00FFFF23
    :02FFE00036C029
    :02FFE40036C025
    :02FFE60036C023
    :02FFEA0036C01F
    :02FFEC0036C01D
    :02FFEE0036C01B
    :02FFF00036C019
    :02FFF20036C017
    :02FFF40036C015
    :02FFF60036C013
    :02FFF80036C011
    :02FFFA0036C00F
    :02FFFC0036C00D
    :02FFFE0022C01F
    :00000001FF

    ... and the content of the file geneted by GCC is much bigger (11,7 kB), I won't post everythings:

    ELFÿ i À 4 ¨, 4 ( L¿ L¿ D D D Â F Â
    ...
    Ã
    ...
    ÓE ( ÔE ^ ÖE L ×E ØE ü ÙE ¾ †E à ‡E e
    ...
    TA1CCTL1 TA1CCTL2 UCB0CTL0 P2IES ADC10SA UCB0BR0 ADC10MEM P2IN TA0CCR1 P3SEL TA0CTL W:\PMI\board_test\blink_GCC\Debug
    ...

    I think I have to look to the GCC compiler options again.

    BR, Guenther
  • I don't know anything about GCC, but I wonder if you are taking the process to the end - linking, etc. - to produce the actual hex file.  In any case, the second file obviously isn't a hex file, and Flasher won't know what to do with it.

    It's funny how the TI compiler fills in all of the unused interrupt vectors and points them to what I assume is a return from interrupt instruction.  It's also funny that it leaves the word at 0xFFDEas 0xFFFF, which leaves open the possibility of bricking the chip if an incorrect BSL password is sent.  A null word there would prevent that.  Well, maybe the blinky code is doing that.

  • Hello Guenther,
    is there anything else we could do for you? May I ask what the purpose of the intended programming option on your side is? The CCS IDE is available for free, so we would like to understand, why you're spending so much time on an uncomfortable and complex approach for programming.

    Best regards
    Peter
  • Hello Peter,
    I am interested in programming the msp430 only with the command line.
    Yes, the use of he CCS IDE is an option, but we have problems to get a connection between the MSP430G2 launchpad and the internal terminal of the Code Composer Studio.

    Best Regatds,
    Guenther
  • Hello Guenther,
    when speaking about the terminal, do you mean the terminal for e.g. UART/RS232 communication, or what's the intention to connect to the LP from a terminal?

    Best regards
    Peter
  • Here is the source code of blink.c:

    int main(void) {
    	WDTCTL = WDTPW | WDTHOLD;		// Stop watchdog timer
    	P1DIR |= 0x01;					// Set P1.0 to output direction
    
    	for(;;) {
    		volatile unsigned int i;	// volatile to prevent optimization
    
    		P1OUT ^= 0x01;				// Toggle P1.0 using exclusive-OR
    
    		i = 10000;					// SW Delay
    		do i--;
    		while(i != 0);
    	}
    	
    	return 0;
    }

  • Guenther,
    I assume this is related to George's post on the interrupt vectors etc. But the points he mentioned are not related to the C-code, but the project options of the blink.c

    Best regards
    Peter
  • Hello Guenther,
    I assume your questions have been answered sufficiently. Thus I am closing the thread.

    Best regards
    Peter
  • Hallo Peter,
    my question how to get a file with the MSP430 GCC compiler that can be used with the MSP430Flasher, is not really answered. I have to use the code composer studio.
    You can close the thread.

    Best regards,
    Guenther
  • Hello Guenther,
    sorry for that. In general, I'd recommend you using the main stream of tools and procedures for debugging and programming. There you can assume easier handling and thoroughly tested steps. The more you go with non common options, the risk of running into issues is higher. For debugging the CCS standard configuration and compiler and use of the MSP430-FET is the best approach, and for production programming e,g, the production programmer offered from TI, which is the Gang Programmer www.ti.com/.../MSP-GANG

    Best regards
    Peter

**Attention** This is a public forum