[riot-notifications] [RIOT-OS/RIOT] boards/arduino-mkr: provide stdio over USB and setup automatic flash with bossa (#12304)

Alexandre Abadie notifications at github.com
Thu Sep 26 08:32:22 CEST 2019


<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

### Contribution description

This PR provides stdio over USB to all Arduino MKR boards and setup the reset in bootloader mode like it's done with Arduino IDE.

In Arduino, the application reset in bootloader mode when the stdio is opened at 1200 baud.
In this PR, the hook function is implemented in `board.c` but the actual connection with `cdc_acm_stdio` is done in the `cdc_acm_stdio` when the RESET_IN_BOOTLOADER module is loaded. This might not be the cleanest but it works. Any better suggestion is welcome of course.

To be able to reset in bootloader, there are other tricks:
- open the serial at 1200 baud with stty
- force the bootloader mode: this code is taken from @ynezz who commented about it in #7510. His code is  [here](https://github.com/ynezz/RIOT/commit/9ca8afc4dffdf583824a0d01b19da3dda3529714#diff-970cb2802ea5c7c9ca519a80fe0b1327). I just readapted it for this PR.
- Adapted the build system in order to add delay after preflash command (to let some time for the application to reset in bootloader)

I'm testing this PR with arduino-mkrfox1200 but it should work the same with other mkr boards. It's also probably adaptable to SODAQ boards as well.

<!--
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes
-->


### Testing procedure

Just build/flash/term any application with an Arduino MKR board plugged via USB : the board is automatically flashed and stdio is printed (shell works as well).

<!--
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
-->


### Issues/PRs references

Based on #11085 to get the stdio feature.

<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/12304

-- Commit Summary --

  * usb cdc acm: add common defines for cdc acm
  * usbus: Add cdc acm function
  * USBUS cdc acm: Add STDIO wrapper for CDC ACM
  * fixup! usbus: Add cdc acm function
  * fixup! USBUS cdc acm: Add STDIO wrapper for CDC ACM
  * test/usbus_cdc_acm_stdio: USB CDC ACM STDIO test
  * fixup! test/usbus_cdc_acm_stdio: USB CDC ACM STDIO test
  * fixup! usb_cdc: Add common defines and message structs
  * fixup! fixup! usbus: Add cdc acm function
  * fixup! fixup! USBUS cdc acm: Add STDIO wrapper for CDC ACM
  * fixup! fixup! usb_cdc: Add common defines and message structs
  * fixup! fixup! fixup! usbus: Add cdc acm function
  * fixup! fixup! fixup! usbus: Add cdc acm function
  * fixup! fixup! USBUS cdc acm: Add STDIO wrapper for CDC ACM
  * fixup! USBUS cdc acm: Add STDIO wrapper for CDC ACM
  * fixup! USBUS cdc acm: Add STDIO wrapper for CDC ACM
  * fixup! fixup! fixup! USBUS cdc acm: Add STDIO wrapper for CDC ACM
  * fixup! test/usbus_cdc_acm_stdio: USB CDC ACM STDIO test
  * fixup! fixup! fixup! fixup! usbus: Add cdc acm function
  * fixup! fixup! fixup! USBUS cdc acm: Add STDIO wrapper for CDC ACM
  * fixup! fixup! fixup! fixup! USBUS cdc acm: Add STDIO wrapper for CDC ACM
  * fixup! fixup! fixup! fixup! fixup! usbus: Add cdc acm function
  * fixup! fixup! fixup! fixup! fixup! usbus: Add cdc acm function
  * fixup! fixup! fixup! fixup! USBUS cdc acm: Add STDIO wrapper for CDC ACM
  * fixup! fixup! fixup! fixup! fixup! fixup! usbus: Add cdc acm function
  * fixup! fixup! fixup! fixup! fixup! fixup! fixup! usbus: Add cdc acm function
  * fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! usbus: Add cdc acm function
  * fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! usbus: Add cdc acm function
  * fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! usbus: Add cdc acm function
  * fixup! fixup! test/usbus_cdc_acm_stdio: USB CDC ACM STDIO test
  * boards/arduino-mkr: use USB CDC-ACM for stdio
  * makefiles: sys/cdc-acm-stdio: provide a reset in bootloader hook
  * boards/arduino-mkr: implement reset in bootloader feature
  * Makefile.include: add preflash-with-delay target
  * tools/bossa: use preflash-with-delay when required
  * boards/arduino-mkr: setup preflash and term delays
  * boards/arduino-mkrfox1200: update doc about flash and stdio

-- File Changes --

    M Makefile.dep (12)
    M Makefile.include (3)
    M boards/arduino-mkrfox1200/doc.txt (13)
    M boards/common/arduino-mkr/Makefile.dep (8)
    M boards/common/arduino-mkr/Makefile.include (15)
    M boards/common/arduino-mkr/board.c (32)
    M makefiles/pseudomodules.inc.mk (3)
    M makefiles/tools/bossa.inc.mk (6)
    M sys/auto_init/usb/auto_init_usb.c (8)
    M sys/include/usb/cdc.h (61)
    A sys/include/usb/usbus/cdc/acm.h (165)
    M sys/usb/usbus/Makefile (3)
    A sys/usb/usbus/cdc/acm/Makefile (7)
    A sys/usb/usbus/cdc/acm/cdc_acm.c (328)
    A sys/usb/usbus/cdc/acm/cdc_acm_stdio.c (103)
    A tests/usbus_cdc_acm_stdio/Makefile (27)
    A tests/usbus_cdc_acm_stdio/main.c (33)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/12304.patch
https://github.com/RIOT-OS/RIOT/pull/12304.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/12304
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190925/0f9a6d8f/attachment-0001.htm>


More information about the notifications mailing list