Part Number: MSP430FR5739
Tool/software: Code Composer Studio
Hi there,
I am working in assembly on the MSP430FR5739 experimenter board and having issues using .data. I would like to save some bytes in a table. I have found that I can program the MSP and data in the table can be read even after a reset, but not after I unplug the board. My impression was that data included in the .data section would be loaded from ROM into RAM. Does that only happen when the device is being programmed? How do I ensure that the .data section is available even after a board unplug?
Minimal viable code for this below. In this code, I use a byte to set the LEDS 1-4 on. This works fine using the debugger and after a reset, but does not work if I unplug the board and plug it back in.
Thanks!
; 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
;-------------------------------------------------------------------------------
mov.b #0Fh,&PJDIR ; set LED1-LED4 to output
mov #label,R4
mov.b @R4,&PJOUT
jmp $
.data
label .byte 0Fh,02h
;-------------------------------------------------------------------------------
; Stack Pointer definition
;-------------------------------------------------------------------------------
.global __STACK_END
.sect .stack
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; MSP430 RESET Vector
.short RESET