There isn't a software serial library, but fortunately you can configure the SAMD21's spare serial communciation (SERCOM) modules to obtain multiple hardware serial ports. The SAMD21 has 6 (0..5) flexible SERCOM modules that can be configured either as an I2C, SPI or Serial port. Looking at the MKR1000's "variant.cpp" file it looks as though 3 are currently in use, that's:
Sercom 0 - I2C
Sercom 1 - SPI
Sercom 5 - Serial1
That leaves Sercom 2, 3 and 4 that are free to be configured how you wish.
Here's an Adafruit article, (it's for their Adafruit Feather M0, but it uses the same SAMD21G18A processor): Creating a new Serial | Using ATSAMD21 SERCOM for more SPI, I2C and Serial ports | Adafruit Learning System
The article also tells you how to configure the SERCOM modules to add additional I2C and SPI ports.
The code to set-up MKR1000's Serial2 (using SERCOM3) on digital pins 0 (TX) and 1 (RX) should go something like this:
#include <Arduino.h> // required before wiring_private.h
#include <wiring_private.h>
// Serial2 pin and pad definitions (in Arduino files Variant.h & Variant.cpp)
#define PIN_SERIAL2_RX (1ul) // Pin description number for PIO_SERCOM on D1
#define PIN_SERIAL2_TX (0ul) // Pin description number for PIO_SERCOM on D0
#define PAD_SERIAL2_TX (UART_TX_PAD_0) // SERCOM pad 0 TX
#define PAD_SERIAL2_RX (SERCOM_RX_PAD_1) // SERCOM pad 1 RX
// Instantiate the Serial2 class
Uart Serial2(&sercom3, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX);
void setup()
{
Serial2.begin(115200); // Begin Serial2
pinPeripheral(0, PIO_SERCOM); // Assign pins 0 & 1 SERCOM functionality
pinPeripheral(1, PIO_SERCOM);
}
void loop()
{
if (Serial2.available()) // Check if incoming data is available
{
byte byteRead = Serial2.read(); // Read the most recent byte
Serial2.write(byteRead); // Echo the byte back out on the serial port
}
}
void SERCOM3_Handler() // Interrupt handler for SERCOM3
{
Serial2.IrqHandler();
}
According to Adafruit you need to include "Arduino.h". I got the code to compile without it, so it's probably unnecessary, but as I don't own a MKR1000 can't confirm whether this include can be omitted.