seems to work so far

This commit is contained in:
Wolfgang Hottgenroth 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
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)
ASFLAGS=$(COMMON) -D__ASSEMBLER__
@ -33,4 +33,3 @@ clean:
upload: $(ARTIFACT).elf
mspdebug rf2500 "prog $(ARTIFACT).elf"

34
main.S
View File

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