Closed chrise96 closed 7 years ago
@ivankravets
Still no luck with debugging the Arduino zero. So, I made a video to clarify the issue.
Arduino Zero (sam-ba) upload session erases bootloader
zeroUSB is working
I have the same problem as described above. Bootloader needs to be re-burned from arduino IDE for the board to work again.
It's already fixed on my local machine. I'll deploy fix this week. We are working on the very interesting feature for Arduino Zero/M0 Pro :)
Cool! :) Was it a big fix? Possible to describe it, so I can get the environment up and running sooner? :P
Ok, will try to deploy changes today :)
Thank you so much! :D
Please re-test current development branch:
pio platform uninstall atmelsam
pio platform install https://github.com/platformio/platform-atmelsam.git
Followed the steps you mentioned and initialized a new project. Sadly, the fix is not working. Output of the last lines uploading in verbose mode:
Error: at91samd21g18.cpu -- clearing lockup after double fault
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x61000003 pc: 0xfffffffe msp: 0xffffffd8
shutdown command invoked
So, after uploading, the bootloader will be wiped. The Arduino Zero .cc version is using the SAM-BA bootloader (for USB and UART interfaces). To use SAM-BA together with an application, we need to link the application starting at 0x2000.
Tried this in boards.txt, location SAMD package. But, no luck:
arduino_zero_edbg.bootloader.size=0x2000
zero
- you have to use Programming/Debug port zeroUSB
- you have to use USB port to program a boardArduino IDE > Settings > Verbose mode for build/upload
pio run -t upload -v
and share these results on http://pastebin.com too.We will compare both outputs and check what is wrong. Thanks!
Arduino IDE: https://pastebin.com/60cDtrtM
PlatformIO: https://pastebin.com/5m3BnmLr
Could you run PIO with --verbose
flag?
If you use PIO IDE, please open src/blink.ino
, then PIo IDE Terminal and run
pio run -t upload -v
platformio run -e zero -t upload -v https://pastebin.com/qtrMcJsr
Could you try again to flash board using Arduino IDE and then PIO?
Take a look at 22 line here. We don't erase your bootloader now.
pio run -t upload -v https://pastebin.com/3zkv66bh
I copied the complete SAMD package version 1.6.14 from Arduino in the right locations of ~/.platformio/packages/framework-arduinosam and still the same issue.
This looks different from the Arduino output.
Warn : Adding extra erase range, 00000000 to 0x00001fff
Any resolution to this? I'm having this issue as well. I can support debugging if anyone is still available to help resolve this.
No, I haven't fixed it with PlatformIO so used the Arduino IDE build and upload paths in Eclipse: https://www.youtube.com/watch?v=FRecvWhprhs&t=30s
So after digging more, I think this is a change in the OpenOCD. I had this process working back in December of 2016, but it looks like there was a new version of openocd in January. The root cause of this seems to be that openocd is erasing the 0-0x1fff block of flash in addition to the 0x2000 and above area where the program is expecting to be placed. We may be able to solve this with a linker command to place the compiled code at address 0. I'll keep digging into how we can fix this.
Could someone provide VERBOSE output of
pio run --verbose -t upload
Thanks!
sure ivankravets. Do you need the whole run or just the last few lines? Here are the relevant compile and flash lines: https://pastebin.com/mQgYFpEL
Note the following: line 4: verify reset 0x2000; shutdown" line 29: Warn : Adding extra erase range, 00000000 to 0x00001fff
Also, I just confirmed that if I program with PIO, then reprogram the bootloader with the arduino IDE, the program works as expected.
~/.platformio/packages/framework-arduinosam/variants/arduino_zero/openocd_scripts/arduino_zero.cfg
source [find interface/cmsis-dap.cfg]
set CHIPNAME at91samd21g18 set ENDIAN little
set telnet_port 0
at91samd bootloader 8192
source [find target/at91samdXX.cfg]
3. Upload firmware with PIO.
Does it work?
openocd doesn't seem to recognize the at91samd command:
GNU ARM Eclipse 64-bits Open On-Chip Debugger 0.10.0-00114-g84195369 (2017-04-19-00:49) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html /Users/user/.platformio/packages/framework-arduinosam/variants/arduino_zero/openocd_scripts/arduino_zero.cfg:30: Error: invalid command name "at91samd" in procedure 'script' at file "embedded:startup.tcl", line 60 at file "/Users/user/.platformio/packages/framework-arduinosam/variants/arduino_zero/openocd_scripts/arduino_zero.cfg", line 30 *** [upload] Error 1
Also on pastebin: https://pastebin.com/caqKB5Py
Hi @perception-aweichman ! Could you please try to restore your board to the default state (with bootloader) and then upload the blink sketch with this environment:
[env:zero]
platform = atmelsam
board = zero
framework = arduino
upload_flags = -d3 --log_output log.txt
And after programming please upload log.txt to pastebin.com. Thanks!
Sorry for the delay. Here is the log (I removed some PII from it before uploading).
It appears to be too large for pastebin... I'll just attach it here instead.... log.txt
Also, as a side note, I have a MKRZero (which is based on the same ATMELSAM framework) that doesn't have this same issue. It flashes with PIO and runs just fine afterward. It may not have the same bootloader structure as the Zero though.
Any progress on this? Anything I can do to assist the debugging?
@perception-aweichman please mail me@ikravets.com for further details
Please update development platform to v2.2.0 (pio update
). Does it work now?
Please create a new issue if you have a problem.
Finally! We have fixed all issues with Arduino Zero. Please update to 2.6.0:
Guys, we have made a huge update to Atmel SAM dev/platform. Integrated popular debuggers, custom upload tools/protocols, etc.
Could you re-test the latest UPSTREAM version with Arduino Zero?
We don't have this board and see that it is very specific. We updated openOCD to 0.10.0 and maybe it will not work with Arduino Zero. Please try both ports: USB Native and Programming.
Thanks!
/cc @chrise96 @perception-aweichman @PatrikSB
In eclipse I imported a Platformio project of the
zero
. Initialize platformio project using:platformio init --ide eclipse --board zero
mzeropro
is working on my .org arduino m0 pro. (Bootloader_D21) But thezero
doesn't work for me with the .cc Arduino Zero. (Bootloader SAM-BA)After I upload a simple blink sketch, my board looks dead. After this programming in the Arduino IDE doesn't work either... No errors are shown... But no leds toggle. I have to burn the bootloader again in the Arduino IDE, and the board can be used again.
In the console everything looks fine (blink.cpp in Platformio zero project):