TFTP Client Example

Chris Johns cjohns at cybertec.com.au
Thu Apr 19 22:27:20 UTC 2001


peter.o.mueller at gmx.de wrote:
> 
> Does anyone use this to download user code and executes it afterwards? In
> our case this could speed up development a lot: just press reset, code in rom
> downloads the application, starts it, user monitors output ...
> 

I do and I also have debugging support with BDM. On the Coldfire I have
the downloaded application's entry point the start of the image. I have
the bootrom load a HALT instruction just before entry then execute it.
My .gdbinit script have :

#
# Catch application exits etc.
#

define set-rtems-breakpoints
 b _Internal_error_Occurred
 b exit
 b _exit
end

#
# If a stop occurs and the program counter is 0xfffe single stop on
# to the real code.
#

define hook-stop
 if $pc == 0x17ffe
   si
   set-rtems-breakpoints
 end
end

#
# NOTE: YOU MUST define a .gdbinit in your home directory where you
#       place the connect command. This is something like :
#
#           define bdm-target-connect
#             target bdm bshost:/dev/bdmcf0
#           end
#
#              where `bshost' is a host running the BDM server.
#
bdm-target-connect

#
# Run from reset to the breakpoint set by the boot rom eg --debug option
#

c

#
# Temp break on main to get us to main.
#

tbreak main
c


The first `c'ontinue starts the processor as if from reset and executes
the code in ROM which is the boot rom. This loads the image. The code is
loaded to 0x18000 and so a break at 0x17ffe is the bootrom finishing.
The halt is stepped over (this does work). A break point is set on
`main' and we `c'ontinue over the BSP and RTEMS initialisation code. For
a large 1Mbyte+ file is only takes a few seconds. This is using large
blocksize TFTP.

This could be made to work for targets that use a serial port and remote
stub and have a network interface.

-- 
 Chris Johns, cjohns @ cybertec.com.au



More information about the users mailing list