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.
2 parents b6a8d0d + 731ac3d commit afd9b18Copy full SHA for afd9b18
src/portable/ti/msp430x5xx/dcd_msp430x5xx.c
@@ -631,7 +631,18 @@ void dcd_int_handler(uint8_t rhport)
631
handle_setup_packet();
632
}
633
634
- uint16_t curr_vector = USBVECINT;
+ // Workaround possible bug in MSP430 GCC 9.3.0 where volatile variable
635
+ // USBVECINT is read from twice when only once is intended. The second
636
+ // (garbage) read seems to be triggered by certain switch statement
637
+ // configurations.
638
+ uint16_t curr_vector;
639
+ #if __GNUC__ > 9 || (__GNUC__ == 9 && __GNUC_MINOR__ > 2)
640
+ asm volatile ("mov %1, %0"
641
+ : "=r" (curr_vector)
642
+ : "m" (USBVECINT));
643
+ #else
644
+ curr_vector = USBVECINT;
645
+ #endif
646
647
switch(curr_vector)
648
{
0 commit comments