What about rearranging the Serial mappings?

What could be included in further releases, or for the forum.
Post Reply
Posts: 255
Joined: Fri Jun 03, 2016 8:19 am

What about rearranging the Serial mappings?

Post by edogaldo » Tue Mar 28, 2017 10:43 am

Hi there, I think that having different Serial mappings depending on the upload methods is confusing, so I'd suggest to reorganize the mapping so that it can be (somewhat) independent from the upload method.
The new mapping I'd propose is the following:
  • Maple bootloader/STLink
    • Serial = USB Serial
    • Serialx = USARTx (x = 1..n)
  • ST Bootloader (Serial)/BMP
    • Serial = Serialk (Serial alias to Serialk - k = 1..n - could be different for different boards, i.e. Nucleo boards have the STlink's USB_to_Serial adapter bound to USART2)
    • Serialx = USARTx (x = 1..n)
Of course this change would not be backward compatible but it could be cleaner/better for new developments..

What about it?

Posts: 1514
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: What about rearranging the Serial mappings?

Post by stevestrong » Tue Mar 28, 2017 12:12 pm


In addition I would suggest that USB serial should be defined as "SerialUSB" or "Serial0" (in this case "Serial" becomes an alias for Serial[y], wherein y=0...<max_serial_port_nr>.)

Posts: 93
Joined: Thu Mar 30, 2017 2:41 pm
Location: bella italy

Re: What about rearranging the Serial mappings?

Post by aster » Tue Apr 11, 2017 9:10 am

SerialUSB. would works great

Posts: 717
Joined: Thu Jul 21, 2016 4:24 pm

Re: What about rearranging the Serial mappings?

Post by ag123 » Tue May 02, 2017 11:10 am

one of those troubles is that i think a lot of sketches out there simply reference Serial as the default serial device / console
the actual physical layer is 'transparent', but it wouldn't be surprising if Serial is 'patched everywhere in the sketch' for those using Serial as the default serial interface with the host

what then could be done is perhaps to have something like

Code: Select all

#define Serial SerialUSB
those who do not want this default assignment could perhaps edit platforms.txt and omit the SERIAL_USB define

my thoughts are that SerialUSB is pretty much the de-facto default serial device on stm32 devices for sketches

Post Reply