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.

CCS/MSP430F5529: How can I read hex file?

Part Number: MSP430F5529

Tool/software: Code Composer Studio

Hi everyone.

I'm studying .hex file and .asm file. I heard that .hex file made from ccs is same with .asm file in same project.

But, I can't read the hex file. Can anybody help me? Is there any manual to read msp430's hex instructions?

%4E6F0800005C008100005CB11330000C43B11300001C43B1132A00F2E032000202001332D01000
%16660800005C20FD3F0343
%1265C80000FFD21C5C
%1265E80000FFD41C5C
%1266080000FFD61C5C
%1266280000FFD81C5C
%1266480000FFDA1C5C
%1266680000FFDC1C5C
%1266880000FFDE1C5C
%1265B80000FFE01C5C
%1265D80000FFE21C5C
%1265F80000FFE41C5C
%1266180000FFE61C5C
%1266380000FFE81C5C
%1266580000FFEA1C5C
%1265F80000FFEC145C
%1266980000FFEE1C5C
%1265C80000FFF01C5C
%1265E80000FFF21C5C
%1266080000FFF41C5C
%1266280000FFF61C5C
%1266480000FFF81C5C
%1266680000FFFA1C5C
%1266880000FFFC1C5C
%1265D80000FFFE005C
%4E624800010000B240805A5C01D2D30402B24010004203B240FF7F5203B24014014003034332D0
%366A68000100201800034303430C4310010343FF3F03431C431001
%0E82F800005C00
#include <msp430.h>

int main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  P1DIR |= 0x01;                            // P1.0 output
  TA0CCTL0 = CCIE;                          // CCR0 interrupt enabled
  TA0CCR0 = 32767;
  TA0CTL = TASSEL_1 + MC_1 + TACLR;         // SMCLK, upmode, clear TAR

  __bis_SR_register(LPM0_bits + GIE);       // Enter LPM0, enable interrupts
  __no_operation();                         // For debugger
}

// Timer0 A0 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER0_A0_VECTOR))) TIMER0_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
  P1OUT ^= 0x32;                            // Toggle P1.0
}

Thanks.

  • Yu Sehoon said:
    Is there any manual to read msp430's hex instructions?

    Please see the section titled Extended Tektronix Object Format in the MSP430 assembly tools manual.

    Thanks and regards,

    -George

  • Thanks George,

    I saw the manual but I couldn't understand what the object code is.

    For example, at line 3 the object code is 1c44.

    What is it? How can I calculate it?

  • I apologize for the delay.

    I understand you are confused regarding hex files.  But I remain unclear as to exactly why you are confused.  So, I'll start with some basics.

    Please see the article A Brief History of TI Object File Formats.  It introduces the concepts regarding an object file and a hex file, and how they are related.

    To further help you understand a hex file, I suggest this brief exercise.  Create a very simple object file, then convert it to a hex file.  This is not how the hex utility is used in practice.  But it is a good way to learn about it.

    Start with this assembly source code ...

    ; hex_example.asm
    
    	.data
    	.word	0x0000
    	.word	0x1111
    	.word	0x2222
    	.word	0x3333
    	.word	0x4444
    	.word	0x5555
    	.word	0x6666
    	.word	0x7777

    Assemble that file to object with this command ...

    % cl430 hex_example.asm

    That creates an object file name hex_example.obj.  Then convert it to hex with this command ...

    % hex430 --tektronix --romwidth=16 hex_example.obj
    Translating to Extended Tektronix format...
       "hex_example.obj" .data ==> .data
    warning: Data is being written to auto-generated file hex_example.x0

    In typical usage, the hex utility is used to convert the final executable output file created by the linker, and not a single object file.  

    Here is the contents of the file hex_example.x0 ...

    %2E68E80000000000001111222233334444555566667777
    %0E81E800000000

    To understand this hex file, please see the section titled Extended Tektronix Object Format in the MSP430 assembly tools manual.

    Thanks and regards,

    -George

  • Please let me know if my previous post explains hex files well enough.  If not, please describe where you are still confused.

    Thanks and regards,

    -George

  • Since it has been a while, I presume you have resolved your problem.  I'd appreciate if would tell us how you solved it.

    Thanks and regards,

    -George