From fd801003a8fcf3c24457db502505f5b1a4632345 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Fri, 23 Feb 2024 21:20:16 +0100 Subject: [PATCH] seems to work so far --- Makefile | 3 +-- main.S | 34 +++++++++++++++++++++++++++++----- readme.md | 5 +++++ 3 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 readme.md diff --git a/Makefile b/Makefile index 383bd20..7c3bc70 100644 --- a/Makefile +++ b/Makefile @@ -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" - diff --git a/main.S b/main.S index 6148571..15f48f0 100644 --- a/main.S +++ b/main.S @@ -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: diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..1c53ad2 --- /dev/null +++ b/readme.md @@ -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 +