Simple question about RTL
Chris Johns
chrisj at rtems.org
Tue Aug 23 00:37:19 UTC 2016
On 19/08/2016 16:39, xuelin.tian at qkmtech.com wrote:
> I have a simple question about RTEMS dynamic loading. I have set up my
> shell via serial port, and it works well. As my system (base kernel) is
> running, how can I load my application (like, ***.tar) into my target?
For testing and playing around the RTL shell commands are the simplest.
Your target needs to be able to read the code some way.
For real applications there are a few parts to the problem you need to
solve:
1. Loading symbols.
2. Target access to the code to load.
3. Code in the base image to load the code.
These are system level issues and vary based on a your system
requirements and the target hardware.
For symbol loading you can either perform a two pass linking process and
embed the symbols in the base image. The first link pass creates an
image that can be used to obtain the list of symbols in the base and the
second pass links a generated file containing those symbols resolving
them to the final address map. The second method for symbols is to
create an external object file of the symbols from the base image you
load dynamically. This approach means you have suitable target storage
to hold this file, eg a JFFS2 file system.
Target access to the code means you have some storage on the target you
can write the code into. You could also have a reliable network, ie an
engineered network, to download the code at start up. What you can do
and how it works is very target and system dependent. RTEMS has a wide
range of file systems, media and network transfer methods to help.
You need some code in the base image to manage the loading of your code.
There is a shell command or you can write code to make dlopen calls. You
may also want to package the code before placing it on the target. For
example you may have a few files in your application, the symbols, a
root module and then other modules. By packaging I mean you may create a
gz compressed tar file on the host and you add code to the vase image to
decompress and unpack the tar file before loading. The tar file could
also be encrypted depending on your requirements.
Chris
More information about the users
mailing list