-
Notifications
You must be signed in to change notification settings - Fork 2.1k
boards/arduino-mkr1000: add initial support (without wifi) #6666
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
Conversation
1149bd0 to
f6a3d83
Compare
|
@haukepetersen, interested in testing this one ? |
c674ecf to
8c8133d
Compare
|
I'm planning to add the wifi driver soon using a package from WiFi101 repository. But I prefer adding this in a follow-up PR. Are there people interested in testing this PR so we can merge it fast ? |
956807c to
08fe0e2
Compare
|
Hi, I came from #6985 . I am currently merging your branch with my work. I have a question before making a PR to you branch, because I have no experience with programming with BOSSA: Why does Linkerscript's flash address start with 0x2000? Can't BOSSA access to system memory, or you want keep arduino bootloader? |
|
@kbumsik I merged your PR. Thanks ! I you could give your test result of this PR (flash, ADC, PWM, UART, etc) that would be great and we could merge it fast. |
|
@aabadie Thanks for a quick feedback :) I will work on ATWINC1500 driver targeting both MKR1000 and WINC1500 XPlained Pro. |
|
This needs rebase and a fix for ADC after #7009. |
|
@kaspar030, I would go for option 3. Seems to be the more reasonable for me: point 1 break "we support latest Ubuntu LTS" as you said and point 2 breaks full cppcheck support (sam0.h is not a vendor file but RIOT code). |
| include $(RIOTMAKE)/tools/jlink.inc.mk | ||
|
|
||
| # set default serial port depending on operating system | ||
| PORT_LINUX ?= /dev/ttyUSB0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be ttyACM0 for independent of the programmer, right? So IMHO these two lines should be taken out of this if block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean with independent of the programmer ?
The board USB port is /dev/ttyACM0 but I don't know how it behaves if ones uses the JLINK programmer which I didn't test. If @kbumsik set it to /dev/ttyUSB0 there's probably a good reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied Makefile from stm32f4 discovery. Just like the case in stm32f4 discovery, /dev/ttyUSB0 is for UART serial converter. So you are right - this is independent to the JLink. I added this when I didn't know how bossac works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, ok, I understand now (sorry, for the delay...!)
| # when BOSSA is used, use a different flash map | ||
| # refer https://github.com/shumatech/BOSSA for this programmer | ||
| export PROGRAMMER = bossa | ||
| export CPU_MODEL = samd21g18a_mkr1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a different CPU model here? If it is because of the different linkerscript, then it would be the cleaner solution to override the linkerscript variable here directly!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not aware of this variable, I'll change that as you suggest
| @@ -0,0 +1,7 @@ | |||
| source [find interface/cmsis-dap.cfg] | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this board support being flashed using openocd through CMSIS-DAP? If so, this option is not usable as there is no option the board's Makefile.include... So I'd say either remove this file or add the needed options to the Makefile.include
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not. We can just remove ir.
| */ | ||
| #define XTIMER TIMER_0 | ||
| #define XTIMER_CHAN (0) | ||
| /** @} */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for this block, as these are the default values. Just remove them.
cpu/sam0_common/include/sam0.h
Outdated
| #elif defined(CPU_MODEL_SAMD21G17AU) | ||
| #include "vendor/samd21/include/samd21g17au.h" | ||
| #elif defined(CPU_MODEL_SAMD21G18A) | ||
| #elif defined(CPU_MODEL_SAMD21G18A) || defined(CPU_MODEL_SAMD21G18A_MKR1000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as stated above, there should be no need for this varaible.
|
About the Murdock issue: |
|
One more question: I was not able to flash the board, as bossac gives me some GLIB errors: Does anyone have a quick solution to this? |
The bossa binary was built on my Linux using gcc 6.2. I probably have a too recent glibc and this is not compatible with yours. I'll rebuild it using an older Ubuntu (16.04) |
|
@haukepetersen, except your bossa issue, your other comments are addressed. |
|
Changes look good. I still can't flash my board (played around with some bossac versions and compiled it myself for a try), but it seems in the end I bricked my board... It doesn't register as /dev/ttyACM0 anymore... About the bossa issue: I think it would make much sense (as a next step) to include it in form of a Makefile as part of the RIOT tools folder and get rid of the binaries for the arduino sam based boards after all. This way, users of these boards can build their bossac themselves and we get around shipping binaries (which was always sub-optimal). What do you think? |
haukepetersen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untested ACK (as my board seems bricked)
|
@haukepetersen , I am not sure it is your case, once you flash the MKR1000 using Bossa, it normally won't go back to the bootloader mode so you won't see it as tty device. If you want to flash it again, you may double press the reset button and it will go to the bootloader mode. The board will tell you it is in the bootloader mode by slowly blinking the green LED. |
|
Sounds like a plan :-) Will give it a try... |
+1 good idea |
|
@haukepetersen, regarding the "bricked" board, as @kbumsik said, just double press the reset button before flashing. I initially added a comment about that in flash script |
| # when BOSSA is used (default), use a different flash map | ||
| # refer https://github.com/shumatech/BOSSA for this programmer | ||
| export PROGRAMMER = bossa | ||
| export LINKER_SCRIPT ?= $(RIOTCPU)/$(CPU)/ldscripts/$(CPU_MODEL)_mkr1000.ld |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path to the linkerscript must be $(RIOTCPU)/sam0/ldscripts/$(CPU_MODEL)_mkr1000.ld
EDIT:
$(RIOTCPU)/sam0_common/ldscripts/$(CPU_MODEL)_mkr1000.ld
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, missed that change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
6cd8024 to
6158fac
Compare
|
Looks good to me now, though the issue with the |
|
squashed and rebased. |
|
Murdock is happy -> let's go! |
This PR adds a partial support for the Arduino MKR1000 board.
This board uses the same MCU as the Arduino Zero : a SAMD21G18A. But apparently, one has to keep the bootloader at the beginning of the flash memory : as a consequence I added a custom linker script.
The debug UART is also not available via the USB port so one needs an FTDI plugged on the RX/TX pins (pins number 13/14) on the board to access it.
Last thing (but not least) : to flash the board via USB, one needs to use Bossa (like for Arduino-due). For the moment, I have to double press the reset button each time I want to flash the board. This is not very convenient and it's not necessary with the Arduino IDE.
Adding an SPI driver for the ATWINC1500 Wifi module will also be required if one wants to add WiFi to this board.