Other Parts Discussed in Thread: UNIFLASH
Hi everyone,
I'm using a msp430fr6043 with USS module. I'm using cl430 (from ti-cgt-msp430_21.6.1.LTS) to compile/link using the following flags:
Compiler:
CFLAGS += --define=__MSP430FR6043__ CFLAGS += --define=_MPU_ENABLE CFLAGS += --c99 CFLAGS += --silicon_version=mspx CFLAGS += --code_model=large CFLAGS += --data_model=large CFLAGS += --opt_level=4 CFLAGS += --opt_for_speed=1 CFLAGS += --use_hw_mpy=F5 CFLAGS += --compile_only CFLAGS += --printf_support=minimal CFLAGS += --diag_wrap=off CFLAGS += --display_error_number CFLAGS += --silicon_errata=CPU21 CFLAGS += --silicon_errata=CPU22 CFLAGS += --silicon_errata=CPU40 CFLAGS += --disable_interrupts_around_hw_mpy=on CFLAGS += --section_sizes=on CFLAGS += --obj_extension=.o CFLAGS += --obj_directory=$(BUILD_DIR)
Linker (also cl430):
LDFLAGS += --silicon_version=mspx LDFLAGS += --silicon_errata=CPU21 LDFLAGS += --silicon_errata=CPU22 LDFLAGS += --silicon_errata=CPU40 LDFLAGS += --code_model=large LDFLAGS += --data_model=large LDFLAGS += --printf_support=minimal LDFLAGS += --run_linker # Next flags are linker flags LDFLAGS += --use_hw_mpy=f5 LDFLAGS += --heap_size=160 LDFLAGS += --stack_size=512 LDFLAGS += --cinit_hold_wdt=on LDFLAGS += --entry_point=_c_int00_noargs LDFLAGS += --section_sizes=on LDFLAGS += -m"$(PROJECT).map" LDFLAGS += -xml_link_info="$(PROJECT).xml"
I'm also generating an .hex file with:
hex430 --memwidth=8 --romwidth=8 --diag_wrap=off --intel project.elf -o project.hex
But I'm getting some unusual behaviors.
Problem 1:
- When loading the *.elf file with mspdebug,
- program starts
- runs for ~1s
- stops (no reset, no interrupt called)
- When loading the *.elf file with mspdebug,
- program starts
- runs normally
- When loading the *.hex file with uniflash,
- program starts
- runs normally
- If the program is running and I power cycle the board
- Same as (1.)
Both 1. and 2. happen with the same file. If I program the msp 4x in a row with the same file, sometimes 1. happens, other times 2. happens
Problem 2:
If I have a global variable declared as:
const struct my_struct_t my_struct = { &my_element_1, &my_element_2, &my_element_3 };
The addresses stored in the struct are correct after the program is flashed, but not after a power cycle.
Seems the memory is not being initialized the second time.
I think both problems are related, but I can't figure out what I'm missing...