Didn't get much actually done today. I mostly fought with GCC and Binutils. Specifically, the linker and linker scripts and trying to compile with -nostdlib. I may skip this bit for now and come back to it as the stdlib works for now.
I seem to be unable to find the documentation regarding interrupts (especially with regard to the generated assembly.) I decided to write a quick C test to figure out what it's expecting. It's interesting, but not surprising, the old toolchain and new toolchain produce interrupts differently.
#include <msp430.h>
#define t_int(i) void __interrupt(i) test_##i() {}
t_int(TRAPINT_VECTOR)
t_int(PORT1_VECTOR)
t_int(PORT2_VECTOR)
t_int(ADC10_VECTOR)
t_int(USCIAB0TX_VECTOR)
t_int(USCIAB0RX_VECTOR)
t_int(TIMER0_A1_VECTOR)
t_int(TIMER0_A0_VECTOR)
t_int(WDT_VECTOR)
t_int(COMPARATORA_VECTOR)
t_int(TIMER1_A1_VECTOR)
t_int(TIMER1_A0_VECTOR)
t_int(NMI_VECTOR)
t_int(RESET_VECTOR)
compiled with:
msp430-elf-gcc -I$MSPGCC/include -mmcu=msp430g2553 -S test_inter.c
It results in (just a snippet):
.balign 2
.global test_TIMER0_A0_VECTOR
.section __interrupt_vector_10,"ax",@progbits
.word test_TIMER0_A0_VECTOR
.text
test_TIMER0_A0_VECTOR:
; start of function
; attributes: interrupt
; framesize_regs: 0
; framesize_locals: 0
; framesize_outgoing: 0
; framesize: 0
; elim ap -> fp 2
; elim fp -> sp 0
; saved regs:(none)
; start of prologue
; end of prologue
; start of epilogue
RETI
.size test_TIMER0_A0_VECTOR, .-test_TIMER0_A0_VECTOR
A similar macro
#define t_int(i) void __attribute__((interrupt(i))) test_##i() {}
for the old toolchain produced:
.p2align 1,0
.global test_TIMER0_A0_VECTOR
.type test_TIMER0_A0_VECTOR,@function
/***********************
* Interrupt Vector 9 Service Routine `test_TIMER0_A0_VECTOR'
***********************/
test_TIMER0_A0_VECTOR:
.global __isr_9
__isr_9:
push r4
mov r1, r4
add #2, r4
pop r4
reti
.Lfe7:
.size test_TIMER0_A0_VECTOR,.Lfe7-test_TIMER0_A0_VECTOR
;; End of function
It's interesting that the new toolchain puts the interrupt in a different section, while the old toolchain has a predefined global that, I'm assuming, the linker knows to look for. Not sure which one I like, but both feel relatively under documented.
Today is my 15th day in a row. I think I'm more proud of that than what I was able to accomplish today.
I didn't get nearly as much as I would have liked to done. I started reading the documentation for USCI UART in the User's Guide, I started to look at how MSPGCC generates interrupts in assembly. At about that time, I realized I'm not yet using the upstream Ti MSP430 GCC. I ended up downloading that, and fixing my code to compile with that toolchain, which was trivially adding a couple ampersands in front of some constants. It was actually more work to edit the Makefile to work out the MSP430 GCC toolchain directory. I find it slightly inconvenient to need to tell msp430-elf-gcc where to include standard headers from. Overall, I think the new toolchain is the right switch going forward.