We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f4efb51 commit 731ac3dCopy full SHA for 731ac3d
src/portable/ti/msp430x5xx/dcd_msp430x5xx.c
@@ -623,7 +623,18 @@ void dcd_int_handler(uint8_t rhport)
623
handle_setup_packet();
624
}
625
626
- uint16_t curr_vector = USBVECINT;
+ // Workaround possible bug in MSP430 GCC 9.3.0 where volatile variable
627
+ // USBVECINT is read from twice when only once is intended. The second
628
+ // (garbage) read seems to be triggered by certain switch statement
629
+ // configurations.
630
+ uint16_t curr_vector;
631
+ #if __GNUC__ > 9 || (__GNUC__ == 9 && __GNUC_MINOR__ > 2)
632
+ asm volatile ("mov %1, %0"
633
+ : "=r" (curr_vector)
634
+ : "m" (USBVECINT));
635
+ #else
636
+ curr_vector = USBVECINT;
637
+ #endif
638
639
switch(curr_vector)
640
{
0 commit comments