Error compiling SAM-BA applets for 9G20

Microchip in-system programming solution: SAM-BA

Moderators: nferre, fab

User avatar
pingswept
Posts: 59
Joined: Mon Jul 19, 2010 8:47 pm

Error compiling SAM-BA applets for 9G20

Wed Oct 06, 2010 1:21 am

Hello all,

I'm trying to recompile the serialflash applet for SAM-BA 2.9 or 2.10 to add support for an SST serial flash chip.

If I try to compile the applet with the 2010q1 Codesourcery toolchain, I get the "cannot use register index with PC-relative addressing" error described in this thread: forum/viewtopic.php/p,32660/#p32660

The thread suggests that perhaps the 2008q1 version of Codesourcery would work. When I use that version instead, I get a new error:

Code: Select all

$ cs-make clean BOARD=at91sam9g20-ek CHIP=at91sam9g20 sdram
Makefile:193: warning: overriding commands for target `debug'
Makefile:193: warning: ignoring old commands for target `debug'
Makefile:193: warning: overriding commands for target `debug'
Makefile:193: warning: ignoring old commands for target `debug'
rm -f obj/*.o bin/*.bin bin/*.elf bin/*.map
arm-none-eabi-gcc -g -Os -I../../at91lib/boards/at91sam9g20-ek -I../../at91lib/peripherals -I../../at91lib/memories -I../../at91lib -Dat91sam9g20 -D__ASSEMBLY__ -Dsdram -c -o obj/sdram_isp_cstartup.o ../common/isp_cstartup.S

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
cs-make: *** [obj/sdram_isp_cstartup.o] Error 3
This occurs in both SAM-BA 2.9 and 2.10 on Windows 7.

Any suggestions? Is there a different toolchain that is known to work for compiling applets?
Brandon Stafford
Rascal Micro
User avatar
pingswept
Posts: 59
Joined: Mon Jul 19, 2010 8:47 pm

Re: Error compiling SAM-BA applets for 9G20

Wed Oct 06, 2010 5:58 pm

Turns out that this was a Cygwin problem.

Specifying a temp directory fixed it:

Code: Select all

export TEMP=/tmp
Thanks to AVRFreaks and Google for the solution: http://www.avrfreaks.net/index.php?name ... ic&t=92416
Brandon Stafford
Rascal Micro
User avatar
pingswept
Posts: 59
Joined: Mon Jul 19, 2010 8:47 pm

Re: Error compiling SAM-BA applets for 9G20

Wed Oct 06, 2010 6:13 pm

I did run into one other compilation error:

Code: Select all

mkdir: cannot create directory `../tcl_lib/at91sam9g20-ek/': No such file or directory
cs-make: *** [sdram] Error 1
I suspect it was a permissions problem. Rather than digging around to fix permissions, I just created the directory manually. This resulted in compilation of the SAM-BA 2.10 serialflash applet by Codesourcery 2008q1 without errors. The same toolchain also worked with SAM-BA 2.9.

For the record, here's my build command:

Code: Select all

cs-make clean BOARD=at91sam9g20-ek CHIP=at91sam9g20 sdram
Brandon Stafford
Rascal Micro
falingtrea
Location: Mounds View, MN
Posts: 209
Joined: Wed Jan 09, 2008 5:09 pm

Re: Error compiling SAM-BA applets for 9G20

Wed Oct 06, 2010 6:41 pm

One thing to keep in mind. I had to change the page size parameter for the SST25VF080B part from 256 to 1 in order to program the part correctly in SAM-BA, because SST parts do not have a page write, only a byte write.
Tim Barr
Multitech Inc.
User avatar
pingswept
Posts: 59
Joined: Mon Jul 19, 2010 8:47 pm

Re: Error compiling SAM-BA applets for 9G20

Wed Oct 06, 2010 9:37 pm

Tim wrote:
I had to change the page size parameter for the SST25VF080B part from 256 to 1 in order to program the part correctly in SAM-BA, because SST parts do not have a page write, only a byte write.
Thanks, Tim. I caught that from your post a few weeks ago. I made that change this morning. I can now successfully read out the JEDEC ID for the SST25VF032B. Unfortunately, it seems that I can't successfully write data to the chip.

Code: Select all

(AT91-ISP v1.13) 1 % send_file {SerialFlash AT25/AT26} "C:/at91bootstrap.bin" 0x0 0
-I- Send File C:/at91bootstrap.bin at address 0x0
GENERIC::SendFile C:/at91bootstrap.bin at address 0x0
-I- File size : 0x11E0 byte(s)
-I- 	Writing: 0x11E0 bytes at 0x0 (buffer addr : 0x20002F94)
-I- 	0x11E0 bytes written by applet
As you can see above, SAM-BA claims to write the data correctly. However, when I "compare sent file with memory," the check fails. Also, the board does not successfully boot. When I look at the SDRAM buffer address (0x20002F94) in SAM-BA after a write attempt, I see bytes that look correct, and the binary size appears in the correct interrupt vector, so it seems that the binary is making it at least to the processor.

After I execute the file compare, the SDRAM buffer is all 0xFFFFFFFF's, which is what I assume it is reading back from the serial flash. Given that the JEDEC ID is read out correctly, the problem is likely in the write operation.

Any ideas about what could be going awry?
Brandon Stafford
Rascal Micro
falingtrea
Location: Mounds View, MN
Posts: 209
Joined: Wed Jan 09, 2008 5:09 pm

Re: Error compiling SAM-BA applets for 9G20

Thu Oct 07, 2010 7:23 pm

Did you try a read from SAM-BA? Just read the date from the memory chip and then view the data in a binary viewer. See if it looks right.

Also, just from the file size, I think you are still using the wrong version of bootstrap. You need to compile the bootstrap froom the code that comes in the at91sam9g20-revC-ek-softpack-1.8.zip software package. There is a zip file called "at91bootstrap-at91sam9g20-ek-gnu.zip" that has SPI Flash memory support. The size of the bootstrap should be closer to 0x27D8 (10k). The bootstrap code in "bootstrap-vx.xx" does not have SPI flash support. The proper bootstrap code uses similar code to SAM-BA so there should be a "AT26.c" driver that you need to add the ID to.
Tim Barr
Multitech Inc.
User avatar
pingswept
Posts: 59
Joined: Mon Jul 19, 2010 8:47 pm

Re: Error compiling SAM-BA applets for 9G20

Fri Oct 08, 2010 7:46 pm

OK, I've worked some more on this. It doesn't work yet, but I think I'm close.
Did you try a read from SAM-BA? Just read the date from the memory chip and then view the data in a binary viewer
(You meant "data," not "date, right?) When I read data back from the chip, I get all 0xFFFFFFFF. I am inclined to believe that this is because the writing is failing, rather than the reading, as the chip appears to respond correctly to other commands.

Update: I'm moving the rest of this post to a new thread because it's not really about compiling SAM-BA applets any more.

Here's the new thread: forum/viewtopic.php/f,26/t,19621/
Brandon Stafford
Rascal Micro

Return to “SAM-BA”

Who is online

Users browsing this forum: No registered users and 1 guest