(startup problems) Trying to "crawl" on the SAM7X8E (Due)

Discussion around product based on ARM Cortex M3 core.

Moderators: nferre, ncollot

tomhartnett
Posts: 6
Joined: Sat May 28, 2011 3:01 am

(startup problems) Trying to "crawl" on the SAM7X8E (Due)

Wed Jan 21, 2015 7:39 pm

Hi,

I'm trying to "learn to crawl" on the SAM7X8E.

I've been through this many times: SAM7X512 (netduino), SAM9G45 (minibox picoSAM9G35), Marvell/Sheeva, RaspberryPi, STM32 (which IS a CM3) (netduino 2)... I "bootstrap" my understanding with a series of crawl.. walk.. run.. programs.

The "crawl" program is simple a "while (1)" loop that writes a character to the UART and then does a programmed delay. No interrupts. Nothing fancy.

(As an aside, the "walk" program introduces timer (SysTimer on the CM3) and serial (UART/USART) interrupts. The "run" program adds a small handful of utilities and enough system initialization to be loaded into flash and become my simple bootloader.)

I erased the Arduino boot code on the Due, and I'm able to download my program with SAM-BA (via "S"). But when I try to run it (via "G"), it just hangs.

I download the code to 20002000. There's a (hex) 20 byte header, so the first instruction is at 20002020. (I verified the download with a long/tedious string of word reads ("w"). I've tried jumping to ("G") 20002020 and (because it's a CM3) 20002021.. both just hang.

Obviously, SAM-BA initializes the UART (and related PIOs)..

Another thing that doesn't make sense to me is that if, using SAM-BA's write word ("W") command, I try to simply output a character to the UART-THR (400e081c), I don't see anything on the serial port (or in my capture file).

So.. I'm (for the time being) lost. Any advice would be appreciated.

Regards,

Tom
k2tom
Posts: 5
Joined: Wed Jan 21, 2015 10:49 pm

Re: (startup problems) Trying to "crawl" on the SAM7X8E (Due

Mon Jan 26, 2015 2:59 pm

Answering my own question...

The problem is that the "target" (address) of the SAM-BA G(o) command is not a code address.. or a Thumb2/CM3 "address+1." The Go target has to be an SP-PC pair (where the PC is the address+1).
Magician
Posts: 8
Joined: Tue Aug 12, 2014 4:38 pm

Re: (startup problems) Trying to "crawl" on the SAM7X8E (Due

Mon Jan 26, 2015 4:29 pm

DUE is SAM3X8E. If it's important.
k2tom
Posts: 5
Joined: Wed Jan 21, 2015 10:49 pm

Re: (startup problems) Trying to "crawl" on the SAM7X8E (Due

Mon Jan 26, 2015 9:26 pm

Yes, it's important.. but in my case I just fat-fingered the "7" when I of course meant "3." I've done a lot of work with the SAM7X(512) and I guess old habits die hard.

Return to “SAM3 Cortex-M3 MCU”

Who is online

Users browsing this forum: No registered users and 3 guests