EmbeddedRelated.com
Forums
Memfault State of IoT Report

yagarto for AT91SAM9261

Started by sjmanion January 18, 2008
I'm having some trouble programming the AT91SAM9261, and I'm hoping
someone out there can point me in the right direction.

I'm using the latest yagarto tool chain to program the AT91SAM9261.
I'm connecting to the chip using the Atmel SAM-ICE JTAG via USB. I
have tried to follow the sometimes conflicting setup info in the
documents "Using Open Source Tools for AT91SAM7S Cross Development
Revision C," "GNU-Based Software Development on AT91SAM
Microcontrollers," and "Getting Started with the AT91SAM9261
Microcontroller." My hardware, for now, is the Atmel 9261 evaluation
board.

I can compile various "blinking LED" demo programs. I can use SAM-BA
(version 2.6) to load them into the 160kb of integrated SRAM on the
9261, either directly from SAM-BA, or by using the following script file:
send_file {SRAM} "MySramCode.bin" 0x301000 0
go 0x301000

I have the linker set up to put the text at 0x301000 and the data at
0x300000. When I do this, the code appears to work correctly. This
leads me to believe that I have correctly installed and set up the
compiler, at least some of eclipse, and sam-ba.

I have a couple of problems:
1) Even though I can load and execute code into SRAM using SAM-BA, I
cannot use the eclipse debugger to debug it. I've tried following the
setup parameters in the various documents listed above, but still
can't get it working. I set up the J-Link JDB server and run it. It
appears to start correctly and find the hardware. The "Debugger" tab
starts out red and says "waiting for connection". In Eclipse, I've
used "Run->Open Run Dialog" to set up a run configuration. I've
selected "Zylin Embedded debug (Native)" and clicked the "New" button.
I select my project and use "MySramCode.elf" as the application under
the "Main" tab. Under the Debugger tab I've changed the GDB debugger
field from "gdb" to "arm-elf-gdb" and left everything else as is.
Under the Commands tab I've set the "Init" commands to "targer remote
localhost:2331" and the "Run commands" to "monitor reset 1\n load\n"
as documented in Atmel's "GNU base .." from above. When I run the
configuration, it briefly connects to the J-Link GDB server, then
disconnects with various error messages. The following appears on the
eclipse console:

source .gdbinit
target remote localhost:2331
0x00000000 in ?? ()
monitor reset 1
Remote communication error: Bad file descriptor.
load
Loading section .text, size 0x9e58 lma 0x301000
putpkt: write failed: No error.

I also get a pop-up window from "J-Link ARM V3.78c Error" that says
"Bad JTAG communication: Write to IR: Expected 0x1, got 0x0 (TAP
Command: 15)@0ff 0x5". Does anyone have any idea what is wrong?

2) I also cannot use SAM-BA to program the built in SPI DataFlash. I
attempt to do so by clicking on the "DataFlash AT45DB/DCB" tab,
running the "Enable Dataflash on CS0" script, selecting "MyCode.bin"
as the "Send File Name" and 0x0 as the address, then clicking the
"Send File" tab. Afterwards I click the "Compare sent file with
memory" tab, and everything matches. However, when I hit the board
reset button, instead of getting my program generated message on the
DBGU port, I get the ">RomBOOT" message. I believe this indicates
that the "MyCode.bin" file loaded into the DataFlash is not a correct
ARM9 executable file image, but I don't quite understand why. The
9261 documentation, section 13.6, states that the code loaded from
DataFlash "must be position independent or linked at address 0x0".
I've tried changing the linker options to put the text at 0x0, but
that doesn't help. Any ideas?

Sorry for the long post. I've tried to be specific so that people can
understand what I'm doing. I would appreciate any help anyone can
offer on either of these problems.

Thanks,
Steve
Steve,

Did you ever solve your question about using the Eclipse debugger?

I have a similar problem in that I cannot debug the SAM7X in Flash
using Eclipse and SAM-ICE.

It seems that there is a very small number of us who have this problem
and even though I have scoured the internet for an answer, I have found
none.

Good Luck,
David

> I have a couple of problems:
> 1) Even though I can load and execute code into SRAM using SAM-BA, I
> cannot use the eclipse debugger to debug it.
No, I still have not solved the problem.

I am reasonably certain that my problem lies in the commands that my
Eclipse setup is sending to arm-elf-gdb. I believe those commands
come from a file named ".gdbinit" and from the command 'run' commands
in the Debug Configuration "Commands" tab. If anyone has any
suggestions as to what those should be, either for the SRAM or the
DataFlash configuration, I would appreciate hearing them.

Steve
--- In A..., "davidbt1951" wrote:
>
> Steve,
>
> Did you ever solve your question about using the Eclipse debugger?
>
> I have a similar problem in that I cannot debug the SAM7X in Flash
> using Eclipse and SAM-ICE.
>
> It seems that there is a very small number of us who have this problem
> and even though I have scoured the internet for an answer, I have found
> none.
>
> Good Luck,
> David
>
> > I have a couple of problems:
> > 1) Even though I can load and execute code into SRAM using SAM-BA, I
> > cannot use the eclipse debugger to debug it.
>
--- In A..., "sjmanion" wrote:
> Remote communication error: Bad file descriptor.
> load
> Loading section .text, size 0x9e58 lma 0x301000
> putpkt: write failed: No error.

I had this SAM-ICE connection problem when accidentally set J-Link GDB
server options to big endian.


Memfault State of IoT Report