-
Notifications
You must be signed in to change notification settings - Fork 2.1k
boards/arduino-mkr: feather-m0: sodaq-*: provide stdio over USB and setup automatic flash with bossa #12304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fjmolinas
merged 17 commits into
RIOT-OS:master
from
aabadie:pr/boards/arduino-mkr_stdio
Mar 18, 2020
Merged
boards/arduino-mkr: feather-m0: sodaq-*: provide stdio over USB and setup automatic flash with bossa #12304
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
accbfbd
tools/bossa: add and configure preflash-delay when required
aabadie 643187c
sys: add usb_board_reset module
aabadie 95bf34e
makefiles: sys/cdc-acm-stdio: provide a reset in bootloader hook
aabadie c7f6d53
boards/samd21-arduino-bootloader: add common board module
aabadie a2c2066
boards/arduino-mkr: use bootloader_arduino feature
aabadie 8632978
boards/arduino-mkrfox1200: update doc about flash and stdio
aabadie edd4f69
boards/feather-m0: use bootloader_arduino feature
aabadie 1ffb78f
boards/feather-m0: update doc about flash and stdio
aabadie 8e2c6c3
boards/sodaq-*: update doc about flash and stdio
aabadie eb20cfe
Makefile.dep: blacklist bootloader_arduino feature when required
aabadie 1342060
boards/arduino-mkrwan1300: update doc about flash and stdio
aabadie f5a17a9
boards/sodaq-*: use bootloader_arduino feature
aabadie a91c4bf
dist/testrunner: add optional delay before opening serial
aabadie 0e511a6
tests/bench_xtimer: update low memory boards list
aabadie 182cb87
sys: periph_uart is required for arduino
aabadie 4145c19
tests/ssp: blacklist bootloader_arduino feature
aabadie 012567e
tests/unittests: blacklist bootloader_arduino feature
aabadie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,37 @@ | ||
| /** | ||
| * @defgroup boards_arduino-mkrwan1300 Arduino MKR WAN 1300 | ||
| * @ingroup boards | ||
| * @brief Support for the Arduino MKR WAN 1300 board. | ||
| * | ||
| * ### General information | ||
| * | ||
| * The [Arduino MKR WAN 1300](https://store.arduino.cc/mkr-wan-1300) board is | ||
| * a learning and development board that provides LoRa connectivity and is | ||
| * powered by an Atmel SAMD21 microcontroller. | ||
| * | ||
| * ### Pinout | ||
| * | ||
| * <img src="https://www.arduino.cc/en/uploads/Main/MKR1000_pinout.png" | ||
| * alt="Arduino MKR WAN 1300 pinout" style="height:800px;"/> | ||
| * | ||
| * ### Flash the board | ||
| * | ||
| * 1. Put the board in bootloader mode by double tapping the reset button.<br/> | ||
| * When the board is in bootloader mode, the user led (amber) oscillates | ||
| * smoothly. | ||
| * | ||
| * | ||
| * 2. Use `BOARD=arduino-mkrwan1300` with the `make` command.<br/> | ||
| * Example with `hello-world` application: | ||
| * ``` | ||
| * make BOARD=arduino-mkrwan1300 -C examples/hello-world flash | ||
| * ``` | ||
| * | ||
| * @warning Unplug the board from the anti-static protective foam before | ||
| * starting to use it otherwise it may not work as expected. | ||
| * | ||
| * ### Accessing STDIO via UART | ||
| * | ||
| * To access the STDIO of RIOT, a FTDI to USB converted needs to be plugged to | ||
| * the RX/TX pins on the board. | ||
| @defgroup boards_arduino-mkrwan1300 Arduino MKR WAN 1300 | ||
| @ingroup boards | ||
| @brief Support for the Arduino MKR WAN 1300 board. | ||
|
|
||
| ### General information | ||
|
|
||
| The [Arduino MKR WAN 1300](https://store.arduino.cc/mkr-wan-1300) board is | ||
| a learning and development board that provides LoRa connectivity and is | ||
| powered by an Atmel SAMD21 microcontroller. | ||
|
|
||
| ### Pinout | ||
|
|
||
| <img src="https://www.arduino.cc/en/uploads/Main/MKR1000_pinout.png" | ||
| alt="Arduino MKR WAN 1300 pinout" style="height:800px;"/> | ||
|
|
||
| ### Flash the board | ||
|
|
||
| Use `BOARD=arduino-mkrgsm1400` with the `make` command.<br/> | ||
| Example with `hello-world` application: | ||
| ``` | ||
| make BOARD=arduino-mkrgsm1400 -C examples/hello-world flash | ||
| ``` | ||
|
|
||
| @note If the application crashes, automatic reflashing via USB, as explained | ||
| above won't be possible. In this case, the board must be set in | ||
| bootloader mode by double tapping the reset button before running the | ||
| flash command. | ||
|
|
||
| ### Accessing STDIO via UART | ||
|
|
||
| STDIO of RIOT is directly available over the USB port. | ||
|
|
||
| The `TERM_DELAY` environment variable can be used to add a delay (in second) | ||
| before opening the serial terminal. The default value is 2s which should be | ||
| enough in most of the situation. | ||
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| ifneq (,$(filter saul_default,$(USEMODULE))) | ||
| USEMODULE += saul_gpio | ||
| endif | ||
|
|
||
| # setup the samd21 arduino bootloader related dependencies | ||
| include $(RIOTBOARD)/common/samd21-arduino-bootloader/Makefile.dep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| MODULE = boards_common_samd21-arduino-bootloader | ||
bergzand marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| include $(RIOTBASE)/Makefile.base | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Provide stdio over USB by default | ||
| # This is a temporary solution until management of stdio is correctly | ||
| # handled by the build system | ||
| DEFAULT_MODULE += stdio_cdc_acm | ||
fjmolinas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Default auto-initialization of usbus for stdio other USB | ||
| USEMODULE += auto_init_usbus | ||
|
|
||
| # This boards requires support for Arduino bootloader. | ||
| USEMODULE += usb_board_reset | ||
| USEMODULE += boards_common_samd21-arduino-bootloader | ||
aabadie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| FEATURES_REQUIRED += bootloader_arduino | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # setup the flash tool used | ||
| # Bossa is the default programmer | ||
| PROGRAMMER ?= bossa | ||
|
|
||
| ifeq ($(PROGRAMMER),bossa) | ||
| # by default, we use BOSSA to flash this board and take into account the | ||
| # preinstalled Arduino bootloader. ROM_OFFSET skips the space taken by | ||
| # such bootloader. | ||
| ROM_OFFSET ?= 0x2000 | ||
| BOSSA_ARDUINO_PREFLASH = yes | ||
| PREFLASH_DELAY = 1 | ||
|
|
||
| ifneq (,$(filter reset flash flash-only, $(MAKECMDGOALS))) | ||
| # By default, add 2 seconds delay before opening terminal: this is required | ||
| # when opening the terminal right after flashing. In this case, the stdio | ||
| # over USB needs some time after reset before being ready. | ||
| TERM_DELAY ?= 2 | ||
| TERMDEPS += term-delay | ||
| endif | ||
|
|
||
| include $(RIOTMAKE)/tools/bossa.inc.mk | ||
| endif | ||
|
|
||
| term-delay: | ||
| sleep $(TERM_DELAY) | ||
fjmolinas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| TESTRUNNER_CONNECT_DELAY ?= $(TERM_DELAY) | ||
| $(call target-export-variables,test,TESTRUNNER_CONNECT_DELAY) | ||
|
|
||
| # Add the samd21-arduino-bootloader directory to the build | ||
| DIRS += $(RIOTBOARD)/common/samd21-arduino-bootloader | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Copyright (C) 2019 Inria | ||
| * 2019 Kees Bakker, SODAQ | ||
| * | ||
| * This file is subject to the terms and conditions of the GNU Lesser | ||
| * General Public License v2.1. See the file LICENSE in the top level | ||
| * directory for more details. | ||
| */ | ||
|
|
||
| /** | ||
| * @ingroup boards_common | ||
| * @{ | ||
| * @file | ||
| * @brief Board common implementations for managing an Arduino bootloader | ||
| * | ||
| * @author Alexandre Abadie <[email protected]> | ||
| * @author Kees Bakker <[email protected]> | ||
| * | ||
| * @} | ||
| */ | ||
|
|
||
| #define USB_H_USER_IS_RIOT_INTERNAL | ||
|
|
||
| #include "usb_board_reset.h" | ||
|
|
||
|
|
||
| #define SAMD21_DOUBLE_TAP_ADDR (0x20007FFCUL) | ||
| #define SAMD21_DOUBLE_TAP_MAGIC_NUMBER (0x07738135UL) | ||
|
|
||
| void usb_board_reset_in_bootloader(void) | ||
| { | ||
| /* The Arduino bootloader checks for a magic number in SRAM to remain in | ||
| bootloader mode. | ||
| See | ||
| https://github.com/arduino/ArduinoCore-samd/blob/master/bootloaders/zero/board_definitions_arduino_mkr1000.h#L38 | ||
| and | ||
| https://github.com/arduino/ArduinoCore-samd/blob/master/bootloaders/zero/main.c#L94 | ||
| for implementation details. */ | ||
| uint32_t *reset_addr = (uint32_t *)SAMD21_DOUBLE_TAP_ADDR; | ||
| *reset_addr = (uint32_t)SAMD21_DOUBLE_TAP_MAGIC_NUMBER; | ||
|
|
||
| usb_board_reset_in_application(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| ifneq (,$(filter saul_default,$(USEMODULE))) | ||
| USEMODULE += saul_gpio | ||
| endif | ||
|
|
||
| # setup the samd21 arduino bootloader related dependencies | ||
| include $(RIOTBOARD)/common/samd21-arduino-bootloader/Makefile.dep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| ifneq (,$(filter saul_default,$(USEMODULE))) | ||
| USEMODULE += saul_gpio | ||
| endif | ||
|
|
||
| # setup the samd21 arduino bootloader related dependencies | ||
| include $(RIOTBOARD)/common/samd21-arduino-bootloader/Makefile.dep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.