Hi all,
I am using the AT91SAM3U4 (Cortex-M3) controller with 2 flash banks in it.
At first, my binary file fits in the first flash bank of 128kByte. With the (part) script/cfg file below, I was able to program the binary:
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME at91sam3 0x000080000 0 1 1 $_TARGETNAME
# This is a 256K chip - it has the 2nd bank
#set _FLASHNAME $_CHIPNAME.flash
#flash bank $_FLASHNAME at91sam3 0x000100000 0 1 1 $_TARGETNAME
flash banks
init
reset
halt
flash erase_sector 0 0 last
flash write_bank 0 at91sam3u4_flash.bin 0
Now, my code size needs both flash banks. How must I change my script/cfg file? The script below results in an error.
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME at91sam3 0x000080000 0 1 1 $_TARGETNAME
# This is a 256K chip - it has the 2nd bank
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME at91sam3 0x000100000 0 1 1 $_TARGETNAME
flash banks
init
reset
halt
flash erase_sector 0 0 last
flash erase_sector 1 0 last
flash write_bank 0 at91sam3u4_flash.bin 0
flash write_bank 1 at91sam3u4_flash.bin 0
The error is at the end of the command window, after erasing the 2 flash banks:
erased sectors 0 through 15 on flash bank 0 in 0.104000s
erased sectors 0 through 15 on flash bank 1 in 0.136000s
Error: Flash write error - past end of bank
Error: offset: 0x00000000, count 0x00022b8c, BankEnd: 0x00020000
Error: error writing to flash at address 0x00080000 at offset 0x00000000 (-4)
Command handler execution failed
What is wrong, who can help me?
Hi,
You could split your bin file in two and program them separately.
Regards, T.
p.s. Could you post your openocd config file?
Hi,
Thanks for your answer. Here is my total config file.
But is there no possibility to program the bin file at once?
# common stuff
# script for ATMEL sam3, a CORTEX-M3 chip
#
# at91sam3u4e
# at91sam3u2e
# at91sam3u1e
# at91sam3u4c
# at91sam3u2c
# at91sam3u1c
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME sam3
}
if { [info exists ENDIAN] } {
set _ENDIAN $ENDIAN
} else {
set _ENDIAN little
}
#jtag scan chain
if { [info exists CPUTAPID ] } {
set _CPUTAPID $CPUTAPID
} else {
set _CPUTAPID 0x4ba00477
}
#
# Amontec JTAGkey
#
# http://www.amontec.com/jtagkey.shtml
#
interface ft2232
ft2232_device_desc "Amontec JTAGkey"
ft2232_layout jtagkey
ft2232_vid_pid 0x0403 0xcff8
jtag_khz 200
#tcl_port 6666
#telnet_port 4444
#gdb_port 3333
#interface ft2232
#ft2232_device_desc "Amontec JTAGkey A"
#ft2232_layout jtagkey
#ft2232_vid_pid 0x0403 0xcff8
#jtag_khz 30
#jtag_nsrst_delay 200
#jtag_ntrst_delay 200
#reset_config srst_only srst_pulls_trst
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
# 16K is plenty, the smallest chip has this much
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 16384 -work-area-backup 0
$_TARGETNAME configure -event gdb-flash-erase-start {
halt
}
# size is automatically "calculated" by probing
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME at91sam3 0x000080000 0 1 1 $_TARGETNAME
# This is a 256K chip - it has the 2nd bank
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME at91sam3 0x000100000 0 1 1 $_TARGETNAME
flash banks
init
reset
halt
flash erase_sector 0 0 last
flash erase_sector 1 0 last
flash write_bank 0 at91sam3u4_flash.bin 0
flash write_bank 1 at91sam3u4_flash.bin 0
shutdown