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.

MSP430FR5994: Default Interrupt Handler in assembler

Part Number: MSP430FR5994

Tool/software:

The MSP430 Assembly Language Tools (v16.9.0.LTS) manual says:

If you do not specify an ISR routine for some interrupt vectors, an ISR routine will be provided for those vectors from the RTS library and the RTS library will automatically be linked with your application. The default ISR routine puts the device in low power mode. You can override the ISR provided by the RTS by using the .intvec directive with the "default_isr" section name as shown in the following example.

.intvec "default_isr", isr_trap_function

Although I have this in my assembler file:

.intvec "default_isr",unexpected

The map file still shows:

LEA 0 0000ffb4 00000002
0000ffb4 00000002 rts430x_sc_sd_eabi.lib : int18.asm.obj (.int18)

PORT8 0 0000ffb6 00000002
0000ffb6 00000002 rts430x_sc_sd_eabi.lib : int19.asm.obj (.int19)

PORT7 0 0000ffb8 00000002
0000ffb8 00000002 rts430x_sc_sd_eabi.lib : int20.asm.obj (.int20)

EUSCI_B3 0 0000ffba 00000002
0000ffba 00000002 rts430x_sc_sd_eabi.lib : int21.asm.obj (.int21)

and so forth, mapping all unused interrupts something else.

I guess something is missing, any idea ?

  • How about to define a ISR as below?

  • Hi Gary, the problem is not to define an ISR, I have several working. The problem is to define a default ISR for all other interrupts, this is what the TI manual is explaining, but that does not work.

  • But based on the example it seems to define a ISR

    It seems no such description to overwrite the default ISR that no defined.

  • Could you help to share me your IAR project here? 

  • No, not really. 

  • However, if you create a assembler only project (I am working with CCS) with following code:

    ;-------------------------------------------------------------------------------
    ; MSP430 Assembler Code Template for use with TI Code Composer Studio
    ;
    ;
    ;-------------------------------------------------------------------------------
                .cdecls C,LIST,"msp430.h"       ; Include device header file
                
    ;-------------------------------------------------------------------------------
                .def    RESET                   ; Export program entry-point to
                                                ; make it known to linker.
    ;-------------------------------------------------------------------------------
                .text                           ; Assemble into program memory.
                .retain                         ; Override ELF conditional linking
                                                ; and retain current section.
                .retainrefs                     ; And retain any sections that have
                                                ; references to current section.
    
    ;-------------------------------------------------------------------------------
    RESET       mov.w   #__STACK_END,SP         ; Initialize stackpointer
    StopWDT     mov.w   #WDTPW|WDTHOLD,&WDTCTL  ; Stop watchdog timer
    
    
    ;-------------------------------------------------------------------------------
    ; Main loop here
    ;-------------------------------------------------------------------------------
    
    loop		jmp		loop
    
    unexpected	reti
    ;-------------------------------------------------------------------------------
    ; Stack Pointer definition
    ;-------------------------------------------------------------------------------
                .global __STACK_END
                .sect   .stack
                
    ;-------------------------------------------------------------------------------
    ; Interrupt Vectors
    ;-------------------------------------------------------------------------------
                .sect   ".reset"                ; MSP430 RESET Vector
                .short  RESET
                
    
                .intvec "default_isr",unexpected
    

    It will be easy to see in the map file that the executable does not contain ISR pointing to 'unexpected' but to ''rts430x_sc_sd_eabi.lib : int<xx>.asm.obj ", which is not requested.

  • Perhaps if you made the symbol "unexpected" externally visible as you did for "RESET" the linker would see it.

  • Very good observation, but unfortunately that changes nothing, I still have the library routine for each ISR.

  • Could you share me the CCS project here? Thanks

  • void.zip

    I did not really find the upload option, will this do ?

  • It is at here

  • Yes, that's what I did, the file is void.zip above.

  • I mean the whole project, but I don't find any zip file above

  • Oh, sorry missing that.

    So you want to make the device to do the function of the "unexpected" for the default ISR, right?

    If so I think you  have done it.

    You can try to generate the TI.TXT format firmware and you will see the default ISR start address is 0x400C

    Based on the information from the map file, 0x400C is the function of "unexpected"

  • Thanks for your help Gary. It appears that indeed the default ISR was missing the .def AND that I was relying on the map file, that is incorrect.

    For example in the above project, map files lists:

    rts430x_sc_sd_eabi.lib : int18.asm.obj (.int18)

    Which is not the case.

  • The linked file still refers to the object from the library:

    void.out:     file format elf32-msp430
    
    
    Disassembly of section .text:
    
    00004000 <RESET>:
        4000:       31 40 00 2c     mov     #11264, r1      ;#0x2c00
    
    00004004 <StopWDT>:
        4004:       b2 40 80 5a     mov     #23168, &0x015c ;#0x5a80
        4008:       5c 01 
    
    0000400a <loop>:
        400a:       ff 3f           jmp     $+0             ;abs 0x400a
    
    0000400c <__TI_ISR_TRAP>:
        400c:       00 13           reti  

    But convert it to a hex file and it is really clear that all of the vectors point to your routine:

    :0E4000003140002CB240805A5C01FF3F00139B
    :04FF8000FFFFFFFF81
    :04FF8400FFFFFFFF7D
    :08FF8800FFFFFFFFFFFFFFFF79
    :02FFB4000C40FF
    :02FFB6000C40FD
    :02FFB8000C40FB
    :02FFBA000C40F9
    :02FFBC000C40F7
    
    etc.

    So that .intvec statement isn't changing the symbol used, just its value. A little confusing but it gets the job done.

**Attention** This is a public forum