Other Parts Discussed in Thread: CAPTIVATE-FR2676, CAPTIVATE-PGMR
Hello,
For a project we use the MSP430FR2676 microcontroller. The project uses the MSP430-GCC compiler and it is required to enable large-model addressing because of linkage with TI libraries. The large-model addressing can be enabled by providing the -mlarge compiler flag during compilation. This switches the addressing from 16-bit to 20-bit and uses the MSP430X instructions instead of the default MSP430 instruction set.
We got to this issue since in the Captivate library it was blocked/stuck at the CAPT_blockOnFlag() method after invoking the __bis_SR_register() . When downsizing the issue we found that this issue also occurs in a simple example as described below.
When the -mlarge flag is disabled it compiles successfully and the code is able to run successfully. The code does initialization of peripherals (like clocks, GPIO, etc.) and after the initialization it is put to low power mode using the function call: __bis_SR_register(LPM0_bits | GIE). The system is now waiting for a button press on port 5, and when pressing the button on the evaluation kit it wakes up the device and executes the actions that are defined in the interrupt service routine succesfully.
When the -mlarge flag is enabled it compiles successfully and the code is able to run. However, when we use the same code as in previous example: initialize and go to low power mode after initialization by using the function call: __bis_SR_register(LPM0_bits | GIE). The system is waiting for a button press on port 5, and when the button is pressed it will never reach the interrupt service routine. Instead when invoking the pause button in the debugger it is shown that it got stuck at address 0x000004. When we remove the LPM0_bits argument from the function call, it seems that it gets stuck at 0x000004 immediately after calling the __bis_SR_register() function.
We are using version: "msp430-elf-gcc (Mitto Systems Limited - msp430-gcc 9.3.1.11) 9.3.1" of the MSP430-GCC compiler.
Is it possible that we are missing some compilation flags in order to use this large-model addressing? Or is there anything else what we do wrong (might seem strange since it seems to work with small-model addressing)?
We have also looked at "chapter 8.2 NOP Instructions Required Between Interrupt State Changes" of the MSP-GCC user guide, but this does not seem to have any effect. We also looked at "table 4-3 MSP430 GCC Assembler Options" by applying the flags -Wa,-mu and -Wa,-mn but this also does not have any effect. See https://www.ti.com/lit/ug/slau646f/slau646f.pdf
Thanks for your help.