Pages: 1 [2]   Go Down
Author Topic: Debugging Arduino Due using SAM-ICE JTAG (an approach)  (Read 12443 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well here is the reference on github.com
git@github.com:neilh10/at91sam3xaz01.git
It incorporates an Arduino compilable port for Atmel Studio 6.
I've ported through Arduino SAM release 1.5.2 (but not run it) but it doesn't incorporate all Arduino SAM libray files. I did download and run tests on a version that had release 1.5.1 - so not that different.
I've  download the github zip file into a temporary directory, and in n AS6.0.1996 opened the project file  sam3xApp01\sam3xApp01.atsln
and then build the solution.
It compiled and linked OK - but I haven't tested it by downloading it through the JTAG.
AS6.0.1996 is the lowest rev  that supports JTAG/SAM-ICE through ATSAM3X JTAG.
It is "As Is" - a development snapshot for unit testing some of the hardware drivers.
See the "ReadMe-AboutThisBuild-SAM3XAZ.docx" - I intend to label any specific differences between my hw and this build as HWSAM3XAZA but not done yet.
Its also my first time through using github.com - and incredibly impressive as it is a fair number of files.
Last time I did such an impressive remote source control was in 2001 with a commerical system called "Continuus" that operated on a private network between two sites and that ended up supporting 50+ working programmers. The simplicity of GIT so far blows me away (though it took about 4 hours to get all of this uploaded). Thanks to all the people contributed to the gitHub online tutorials as well as the git cmd line utility and Git Gui and SSH to work.
Be interested in what you can share about the project you are working on. smiley
« Last Edit: March 04, 2013, 11:49:41 pm by neil12 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Neil, very many thanks for the time and effort to prepare and post this. Much appreciated.  
BTW I'm supporting a number of Arduino development projects being undertaken my electronics students and attempting to get better debug facilities by utilising the SAM-ICE, but keeping the Arduino framework.

I built your project((in Version: 6.0.1996 - Service Pack 2) and got errors in adc.h (Part of the output is shown) - see below.
I can understand that some conditionally included definitions are not actually being included. Does the project build for you? Is there some definition that is missing? Have you had similar issues? I see that you have injected an error into this file previously to test a conditionally compiled macro definition...
clip from adc.c:
#if SAM3S_SERIES || SAM4S_SERIES || SAM3XA_SERIES
//error njh;
...

      In file included from ../arduino/hardware/arduino/sam/system/libsam/chip.h:44:0,
                       from ../arduino/hardware/arduino/sam/cores/arduino/Arduino.h:34,
                       from ../arduino/hardware/arduino/sam/cores/arduino/cortex_handlers.c:19:
C:\at91sam3xaz01-master\sam3xApp01\arduino\hardware\arduino\sam\system\libsam\include\adc.h(170,48): 'enum adc_resolution_t' declared inside parameter list [enabled by default]
C:\at91sam3xaz01-master\sam3xApp01\arduino\hardware\arduino\sam\system\libsam\include\adc.h(170,48): its scope is only this definition or declaration, which is probably not what you want [enabled by default]

Error   8   use of enum 'adc_channel_num_t' without previous declaration   C:\at91sam3xaz01-master\sam3xApp01\arduino\hardware\arduino\sam\system\libsam\include\adc.h   173   48   sam3xApp01
Error   9   use of enum 'adc_channel_num_t' without previous declaration   C:\at91sam3xaz01-master\sam3xApp01\arduino\hardware\arduino\sam\system\libsam\include\adc.h   174   49   sam3xApp01
Error   10   use of enum 'adc_channel_num_t' without previous declaration   C:\at91sam3xaz01-master\sam3xApp01\arduino\hardware\arduino\sam\system\libsam\include\adc.h   177   62   sam3xApp01
Error   11   use of enum 'adc_channel_num_t' without previous declaration   C:\at91sam3xaz01-master\sam3xApp01\arduino\hardware\arduino\sam\system\libsam\include\adc.h   178   61   sam3xApp01
Error   7   use of enum 'adc_resolution_t' without previous declaration   C:\at91sam3xaz01-master\sam3xApp01\arduino\hardware\arduino\sam\system\libsam\include\adc.h   170   48   sam3xApp01
« Last Edit: March 05, 2013, 12:53:00 pm by peteb » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm yes I remember I got that problem as well and here is my correction -
The fix seems to be change AS6 to be the sames as the arduino-1.5.1r2 in
C:\Program Files\Atmel\Atmel Studio 6.0\extensions\Atmel\ARMGCC\3.3.1.128\ARMSupportFiles\Device\ATMEL\sam.h
/* Entire SAM3XA series */
#define SAM3XA_SERIES (SAM3X4 || SAM3X8 || SAM3A4 || SAM3A8)
from
#define SAM3XA_SERIES (SAM3A4 || SAM3A8)

I got it from
\My Documents\Arduino\arduino-1.5.1r2\hardware\arduino\sam\system\CMSIS\Device\ATMEL\sam.h
/* Entire SAM3XA series */
#define SAM3XA_SERIES ( SAM3X4 || SAM3X8 || SAM3A4 || SAM3A8)

Let me know if that works for you.

Background: The fix is in the AS6 toolchain so it makes me nervous.
I did send it through to Eric Weddington Jan 10th,2013 and though he responded, he didn't say if the fix I proposed was good.
I see from
http://www.atmel.com/tools/atmelstudio.aspx
that there is another release
Atmel Studio 6.1 beta (build 2440)
and 6.1 has an upgraded  ARM Toolchain 4.7.2
from AS 6.0  ARM Toolchain 4.7.0.59 - GCC  4.7.0

« Last Edit: March 05, 2013, 09:08:22 pm by neil12 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks again for all your help. Exactly right! I updated as suggested: #define SAM3XA_SERIES (SAM3X4 || SAM3X8 || SAM3A4 || SAM3A8)
The example builds, executes and is debuggable via SAM-ICE. I will now undertake some more testing.

BTW, I did try the Atmel Studio 6.1 beta (build 2440). I set up for ATSAM3X8E. I found that there appeared to be a problem when setting up the toolchain in Project Properties. Just by selecting the toolchain configuration to be "All Configurations" an application error was displayed: "Error occurred computing the All Configuration settings".  I tried uninstalling, re-downloading and re-installing but the problem persisted. So, it seemed to be unusable. I wonder if anybody else has come across this? I then installed the earlier version: 6.0.1996 - Service Pack 2 that I am currently using.

Pete
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Neil and Pete, you guys are awesome!
I was going through all the same problems.  I had tried the two most recent releases of 6.1, neither of which worked.  Not only was the recommendation for 6.0 excellent, but the sample project posted to github was a game changer.  Thanks guys.
I'm now successfully getting my Due blinky test running while debugging with the SAM-ICE.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey glad it was useful. SAM3X has a lot of very nice opportunities with its internal ram and peripherals and low power.
Shame this fix hasn't made it in to the AS.
However it does seem the real productive programming is moving to anenvironment with python in it, and there is another productive OOPs paradigm that I've come across using www.squirrel-lang.org - one programsa 'nut' (ElectricImp.com is using it on WiFi SD card).
Neil
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

          I am working with custom SAM3X8C board using SAM-ICE to program it using Atmel STudio 6. i would like to know if there is a way to reset the microncontroller over SAM-ICE through Atmel Studio 6 with out programming it? I am trying to avoid unplugging the power to the board to do a reset.

Thanks.
Logged

Pages: 1 [2]   Go Up
Jump to: