Upgrade arm-none-eabi compiler

It was 5 years out of date and didn't fully support C++20.

In doing so, flip off "freestanding" mode for the cortex-m4f compiler's
use of libstdc++.
This is because some libraries appear to have been using STL headers
that cannot be safely linked against in freestanding mode (e.g.,
<ostream>). I am unsure why the prior compiler was not catching this.
If this becomes a problem, we can disable it.

Change-Id: Ie08ce2c089f787b0433a761ad2242dcd2a516404
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/motors/button_board.cc b/motors/button_board.cc
index fb17328..1d20fdb 100644
--- a/motors/button_board.cc
+++ b/motors/button_board.cc
@@ -289,7 +289,11 @@
   PORTB_PCR19 = PORT_PCR_DSE | PORT_PCR_MUX(2);
 
   // .1ms filter time.
-  PORTA_DFWR = PORTB_DFWR = PORTC_DFWR = PORTD_DFWR = PORTE_DFWR = 6000;
+  PORTA_DFWR = 6000;
+  PORTB_DFWR = 6000;
+  PORTC_DFWR = 6000;
+  PORTD_DFWR = 6000;
+  PORTE_DFWR = 6000;
 
   // Set up the buttons. The LEDs pull them up to 5V, so the Teensy needs to not
   // be set to pull up.
diff --git a/motors/motor.cc b/motors/motor.cc
index a343301..ed1296c 100644
--- a/motors/motor.cc
+++ b/motors/motor.cc
@@ -40,8 +40,10 @@
               "Need to prescale");
 
 void Motor::Init() {
-  pwm_ftm_->CNTIN = encoder_ftm_->CNTIN = 0;
-  pwm_ftm_->CNT = encoder_ftm_->CNT = 0;
+  pwm_ftm_->CNTIN = 0;
+  encoder_ftm_->CNTIN = 0;
+  pwm_ftm_->CNT = 0;
+  encoder_ftm_->CNT = 0;
 
   pwm_ftm_->MOD = counts_per_cycle() - 1;
   encoder_ftm_->MOD = controls_->mechanical_counts_per_revolution() - 1;
diff --git a/motors/peripheral/adc_dma.cc b/motors/peripheral/adc_dma.cc
index d2dc6c9..15d50eb 100644
--- a/motors/peripheral/adc_dma.cc
+++ b/motors/peripheral/adc_dma.cc
@@ -147,17 +147,16 @@
   DMAMUX0.CHCFG[reconfigure_dma_channel(0)] = 0;
   DMAMUX0.CHCFG[reconfigure_dma_channel(1)] = 0;
 
-  static constexpr ssize_t kResultABOffset =
-      static_cast<ssize_t>(offsetof(KINETIS_ADC_t, RB)) -
-      static_cast<ssize_t>(offsetof(KINETIS_ADC_t, RA));
+  static constexpr long kResultABOffset =
+      static_cast<long>(offsetof(KINETIS_ADC_t, RB)) -
+      static_cast<long>(offsetof(KINETIS_ADC_t, RA));
   static_assert(kResultABOffset > 0, "Offset is backwards");
-  static constexpr ssize_t kResultOffsetBits =
-      ConstexprLog2(kResultABOffset * 2);
-  static constexpr ssize_t kSC1ABOffset =
-      static_cast<ssize_t>(offsetof(KINETIS_ADC_t, SC1B)) -
-      static_cast<ssize_t>(offsetof(KINETIS_ADC_t, SC1A));
+  static constexpr long kResultOffsetBits = ConstexprLog2(kResultABOffset * 2);
+  static constexpr long kSC1ABOffset =
+      static_cast<long>(offsetof(KINETIS_ADC_t, SC1B)) -
+      static_cast<long>(offsetof(KINETIS_ADC_t, SC1A));
   static_assert(kSC1ABOffset > 0, "Offset is backwards");
-  static constexpr ssize_t kSC1OffsetBits = ConstexprLog2(kSC1ABOffset * 2);
+  static constexpr long kSC1OffsetBits = ConstexprLog2(kSC1ABOffset * 2);
   for (int adc = 0; adc < 2; ++adc) {
     // Make sure we can actually write to all the fields in the DMA channels.
     DMA.CDNE = result_dma_channel(adc);
@@ -204,16 +203,16 @@
       if (next_result_channel != -1) {
         link = M_TCD_ELINK | V_TCD_LINKCH(next_result_channel);
       }
-      result_dma(adc)->CITER = result_dma(adc)->BITER =
-          link | 4 /* 4 minor iterations */;
+      result_dma(adc)->CITER = link | 4 /* 4 minor iterations */;
+      result_dma(adc)->BITER = link | 4 /* 4 minor iterations */;
     }
     {
       uint16_t link = 0;
       if (next_reconfigure_channel != -1) {
         link = M_TCD_ELINK | V_TCD_LINKCH(next_reconfigure_channel);
       }
-      reconfigure_dma(adc)->CITER = reconfigure_dma(adc)->BITER =
-          link | 4 /* 4 minor iterations */;
+      reconfigure_dma(adc)->CITER = link | 4 /* 4 minor iterations */;
+      reconfigure_dma(adc)->BITER = link | 4 /* 4 minor iterations */;
     }
     result_dma(adc)->DLASTSGA = -(kNumberAdcSamples * sizeof(uint16_t));
     reconfigure_dma(adc)->DLASTSGA = 0;
diff --git a/motors/pistol_grip/controller.cc b/motors/pistol_grip/controller.cc
index 5a0d5a2..a88b9a0 100644
--- a/motors/pistol_grip/controller.cc
+++ b/motors/pistol_grip/controller.cc
@@ -792,7 +792,8 @@
   uint32_t motor0_sum = 0, motor1_sum = 0, wheel_sum = 0;
 
   // First clear both encoders.
-  MOTOR0_ENCODER_FTM->CNT = MOTOR1_ENCODER_FTM->CNT = 0;
+  MOTOR0_ENCODER_FTM->CNT = 0;
+  MOTOR1_ENCODER_FTM->CNT = 0;
   for (int i = 0; i < kNumberSamples; ++i) {
     delay(1);
 
@@ -847,7 +848,10 @@
   PORTA_PCR13 = PORT_PCR_DSE | PORT_PCR_MUX(2);
 
   // .1ms filter time.
-  PORTA_DFWR = PORTC_DFWR = PORTD_DFWR = PORTE_DFWR = 6000;
+  PORTA_DFWR = 6000;
+  PORTC_DFWR = 6000;
+  PORTD_DFWR = 6000;
+  PORTE_DFWR = 6000;
 
   // BTN0
   PORTC_PCR7 = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_MUX(1);
@@ -946,8 +950,8 @@
   PIT_TCTRL3 = PIT_TCTRL_TIE | PIT_TCTRL_TEN;
 
   // Have them both wait for the GTB signal.
-  FTM0->CONF = FTM3->CONF =
-      FTM_CONF_GTBEEN | FTM_CONF_NUMTOF(kSwitchingDivisor - 1);
+  FTM0->CONF = FTM_CONF_GTBEEN | FTM_CONF_NUMTOF(kSwitchingDivisor - 1);
+  FTM3->CONF = FTM_CONF_GTBEEN | FTM_CONF_NUMTOF(kSwitchingDivisor - 1);
   // Make FTM3's period half of what it should be so we can get it a half-cycle
   // out of phase.
   const uint32_t original_mod = FTM3->MOD;