seems to work so far

This commit is contained in:
2024-02-23 21:20:16 +01:00
parent 491a544919
commit fd801003a8
3 changed files with 35 additions and 7 deletions

View File

@ -4,7 +4,7 @@ OBJDUMP=$(TOOLCHAIN_PREFIX)/bin/msp430-elf-objdump
MCU=msp430g2553 MCU=msp430g2553
ARTIFACT=firmware ARTIFACT=firmware
COMMON=-Wall -mmcu=$(MCU) -std=gnu99 -I $(TOOLCHAIN_PREFIX)/include -Os -g0 -fdata-sections -ffunction-sections COMMON=-Wall -mmcu=$(MCU) -std=gnu99 -I $(TOOLCHAIN_PREFIX)/include -Os -g0 -fdata-sections -ffunction-sections -ggdb -gdwarf-2
CFLAGS=$(COMMON) CFLAGS=$(COMMON)
ASFLAGS=$(COMMON) -D__ASSEMBLER__ ASFLAGS=$(COMMON) -D__ASSEMBLER__
@ -33,4 +33,3 @@ clean:
upload: $(ARTIFACT).elf upload: $(ARTIFACT).elf
mspdebug rf2500 "prog $(ARTIFACT).elf" mspdebug rf2500 "prog $(ARTIFACT).elf"

34
main.S
View File

@ -9,10 +9,13 @@
.section ".rodata","a" .section ".rodata","a"
screendatacnt:
.byte 0x01
screendata: screendata:
.byte 0x00 .byte 0x00
.byte 0x01
.byte 0x02
.byte 0x03
screendataend:
.byte 0xff
red: red:
colors1: colors1:
.byte 0b01001111 .byte 0b01001111
@ -51,6 +54,9 @@ _start:
;; initialize stack pointer with value from linker ;; initialize stack pointer with value from linker
mov.w #__stack, SP mov.w #__stack, SP
mov.w #0xaaaa, r7
mov.w #0x5555, r8
init: init:
;; configuration of GPIO Ports ;; configuration of GPIO Ports
mov.b #BIT0|BIT1|BIT2,&P1DIR mov.b #BIT0|BIT1|BIT2,&P1DIR
@ -71,22 +77,37 @@ init:
mov.w #OUTMOD_7,&TA1CCTL1 mov.w #OUTMOD_7,&TA1CCTL1
mov.w #OUTMOD_7,&TA1CCTL2 mov.w #OUTMOD_7,&TA1CCTL2
;; test data
mov.b #0b01101111,r5
;; initialize bit-counter for isr ;; initialize bit-counter for isr
mov.b #0x01,r6 mov.b #0x01,r6
;; initialize isr-sync register ;; initialize isr-sync register
mov.b #0x00,r4 mov.b #0x00,r4
;; screen data start/next into r7
mov.w #screendata, r7
;; screen data end into r8
mov.w #screendataend, r8
;; load first screen data value into r5
mov.b @r7,r5
inc.w r7
;; start timer in up mode ;; start timer in up mode
bis.w #MC0,&TA1CTL bis.w #MC0,&TA1CTL
;; enable interrupts ;; enable interrupts
eint eint
;; r4: synchronization between mainloop and isr ;; r4: synchronization between mainloop and isr
;; r5: data byte to be handled by isr ;; r5: data byte to be handled by isr
mainloop: mainloop:
;; prepare next byte to handle by isr ;; prepare next byte to handle by isr
cmp.w r7,r8
jnz mainloop_prepare_next_byte
mov.w &screendata,r7
mainloop_prepare_next_byte:
mov.b @r7,r9
inc.w r7
mainloop_wait_for_isr: mainloop_wait_for_isr:
;; check bit0 in sync register ;; check bit0 in sync register
@ -94,7 +115,7 @@ mainloop_wait_for_isr:
jz mainloop_wait_for_isr jz mainloop_wait_for_isr
;; load data ;; load data
mov.b #0b01001111,r5 mov.b r9,r5
mov.b #0x00,r4 mov.b #0x00,r4
;; signal reload ;; signal reload
bis #BIT2,&P1OUT bis #BIT2,&P1OUT
@ -103,6 +124,9 @@ mainloop_wait_for_isr:
;; continue ;; continue
jmp mainloop jmp mainloop
; --- timer isr --- ; --- timer isr ---
;; r6: exclusively used by isr as bit-counter ;; r6: exclusively used by isr as bit-counter
timer1_a0_isr: timer1_a0_isr:

5
readme.md Normal file
View File

@ -0,0 +1,5 @@
mspdebug rf2500 gdb
msp430-gdb -x firmware.gdb
Attention: the gdb in the TI toolchain package is broken, use the one from Debian