<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Computer, Electron and Technology &#187; heap</title>
	<atom:link href="http://www.donevii.com/post/tag/heap/feed" rel="self" type="application/rss+xml" />
	<link>http://www.donevii.com</link>
	<description>DoneVII CET &#38; CPPLITE</description>
	<lastBuildDate>Wed, 02 Jun 2010 10:45:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to run mod file that is loaded into HEAP</title>
		<link>http://www.donevii.com/post/820.html</link>
		<comments>http://www.donevii.com/post/820.html#comments</comments>
		<pubDate>Sun, 17 May 2009 07:23:07 +0000</pubDate>
		<dc:creator>gavinkwoe</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[brew]]></category>
		<category><![CDATA[heap]]></category>
		<category><![CDATA[mod]]></category>
		<category><![CDATA[modloader]]></category>
		<category><![CDATA[动态加载]]></category>

		<guid isPermaLink="false">http://www.donevii.com/?p=820</guid>
		<description><![CDATA[05-15-2008, 11:20 PM Brewin Registered User Join Date: Mar 2006 Posts: 152 Rep Power: 4 How to run mod file that is loaded in the HEAP&#8230; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;... ]]></description>
			<content:encoded><![CDATA[<p>05-15-2008, 11:20 PM<br />
 Brewin<br />
Registered User   Join Date: Mar 2006<br />
Posts: 152<br />
Rep Power: 4</p>
<p> How to run <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file that is loaded in the <a href="http://www.donevii.com/post/tag/heap" class="st_tag internal_tag" rel="tag" title="Posts tagged with heap">HEAP</a>&#8230;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Hi everyone,<br />
How can I run a <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">MOD</a> file that is loaded into the <a href="http://www.donevii.com/post/tag/heap" class="st_tag internal_tag" rel="tag" title="Posts tagged with heap">HEAP</a>???? Any idea&#8217;s&#8230;</p>
<p>__________________<br />
Thanks everyone for the info they share here..<br />
Ramki@TTSL<br />
 VALUE HAS A VALUE ONLY IF ITS VALUE IS VALUED</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Last edited by Brewin : 05-15-2008 at 11:27 PM. </p>
<p>Brewin<br />
View Public Profile<br />
Send a private message to Brewin<br />
Send email to Brewin<br />
Find all posts by Brewin<br />
Add Brewin to Your Buddy List </p>
<p>  #2   06-04-2008, 07:36 PM<br />
ArdyFalls<br />
Registered User   Join Date: Apr 2007<br />
Posts: 23<br />
Rep Power: 0</p>
<p>Steps for loading a <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> into the <a href="http://www.donevii.com/post/tag/heap" class="st_tag internal_tag" rel="tag" title="Posts tagged with heap">heap</a></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>1) malloc memory on the <a href="http://www.donevii.com/post/tag/heap" class="st_tag internal_tag" rel="tag" title="Posts tagged with heap">heap</a> that is the size of the mode file + 4 in bytes.<br />
2) Set the initial 4 btyes to point to the AEE struct thing that has all the AEEStdlib funcitons.<br />
3) Set the processors program counter (PC register) to address 0<br />
Please note, I could be kinda off, look at the code for AEE_ModLoad, it is always at address zero. It will tell you the arguments that you need to pass to it before setting the pc register to it. Remember, the first four arguments of any function are passed in registers r0 -r4.</p>
<p>I hope this helps</p>
<p>__________________<br />
Ardavon Falls<br />
Senior Software Engineer<br />
MobiTV Inc</p>
<p>ArdyFalls<br />
View Public Profile<br />
Send a private message to ArdyFalls<br />
Find all posts by ArdyFalls<br />
Add ArdyFalls to Your Buddy List </p>
<p>  #3   07-28-2008, 10:45 PM<br />
 Brewin<br />
Registered User   Join Date: Mar 2006<br />
Posts: 152<br />
Rep Power: 4</p>
<p> Loading and running a compressed <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file&#8230;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Hi All,<br />
To run a compressed <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file in <a href="http://www.donevii.com/post/tag/brew" class="st_tag internal_tag" rel="tag" title="Posts tagged with brew">BREW</a> you need to create a <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> loader(Approxmately 700+ bytes, atleast mine).</p>
<p>For 2.x <a href="http://www.donevii.com/post/tag/brew" class="st_tag internal_tag" rel="tag" title="Posts tagged with brew">brew</a> devices, your <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> loader file name should be same as of your app name.<br />
Ex: myapp.mif, myapp.<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a>(your <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> loader), filename.gz(your compressed myapp.<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file, you can name this file as filename.bar so that you don&#8217;t have any problems when user disables your app).</p>
<p>For 3.x <a href="http://www.donevii.com/post/tag/brew" class="st_tag internal_tag" rel="tag" title="Posts tagged with brew">brew</a> devices on which we can read a <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file by setting the required permissions in MIF can add this <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> loader file content at the start of your compressed <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file or you can use the same as that used for 2.x which don&#8217;t required any permissions or settings in MIF.<br />
Ex: myapp.mif, myapp.<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a>(your <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> loader + filename.gz).</p>
<p>To create a <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> loader, you have every information you need in 2 threads.</p>
<p>First read only the first post by user &#8220;ajiva&#8221; in the following thread. Then return to this thread for additional info you need.</p>
<p>Quote:</p>
<p>http://brewforums.qualcomm.com/showthread.php?t=11637</p>
<p>A call to AEEMod_Load that you have seen in the first thread will set the params in the registers.</p>
<p>Quote:<br />
Note 1: Don&#8217;t release the buffer that contains the uncompressed content of your actual <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file in your <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> loader. Once the actual app is closed, it will released by <a href="http://www.donevii.com/post/tag/brew" class="st_tag internal_tag" rel="tag" title="Posts tagged with brew">BREW</a> system.<br />
Note2: Release all other allocated buffers and interfaces you created in <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> loader before making a call to AEEMod_Load.</p>
<p>Thanks for ajiva and Ardy Falls for the valuable info they provided. </p>
<p>__________________<br />
Thanks everyone for the info they share here..<br />
Ramki@TTSL<br />
 VALUE HAS A VALUE ONLY IF ITS VALUE IS VALUED</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Last edited by Brewin : 08-06-2008 at 12:59 AM. </p>
<p>Brewin<br />
View Public Profile<br />
Send a private message to Brewin<br />
Send email to Brewin<br />
Find all posts by Brewin<br />
Add Brewin to Your Buddy List </p>
<p>  #4   07-29-2008, 12:36 AM<br />
Rajni<br />
Registered User   Join Date: Apr 2005<br />
Posts: 32<br />
Rep Power: 0</p>
<p> Really usefull</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Hi Ramki,<br />
Really very useful information.</p>
<p>Rajni<br />
View Public Profile<br />
Send a private message to Rajni<br />
Find all posts by Rajni<br />
Add Rajni to Your Buddy List </p>
<p>  #5   08-06-2008, 12:57 AM<br />
 Brewin<br />
Registered User   Join Date: Mar 2006<br />
Posts: 152<br />
Rep Power: 4</p>
<p> Loading and running a compressed extension <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file&#8230;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Hi all,<br />
The above procedure is not working in case if the compressed <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file is an extension. Applet compressed <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file is running fine. The decompressed file of the extension <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> is Identical with the original extension <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file, but device is getting crashed when AEEMod_Load of the extension <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> is executed.</p>
<p>if both an applet and extensions loads the same way then<br />
why is this difference..</p>
<p>If I use normal extension <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> everything goes well.</p>
<p>Do anyone has any idea about this. </p>
<p>Quote:<br />
The extension I used is xmlparser, I will write my own extension and check does it make any difference using debug info. </p>
<p>__________________<br />
Thanks everyone for the info they share here..<br />
Ramki@TTSL<br />
 VALUE HAS A VALUE ONLY IF ITS VALUE IS VALUED</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Last edited by Brewin : 08-06-2008 at 01:02 AM. </p>
<p>Brewin<br />
View Public Profile<br />
Send a private message to Brewin<br />
Send email to Brewin<br />
Find all posts by Brewin<br />
Add Brewin to Your Buddy List </p>
<p>  #6   08-06-2008, 06:15 AM<br />
 Brewin<br />
Registered User   Join Date: Mar 2006<br />
Posts: 152<br />
Rep Power: 4</p>
<p> Loading a compressed module(Application/Extension)</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>I hope I got the resolution,<br />
Quote:<br />
Originally Posted by Brewin<br />
Hi all,<br />
The above procedure is not working in case if the compressed <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file is an extension. Applet compressed <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file is running fine. The decompressed file of the extension <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> is Identical with the original extension <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file, but device is getting crashed when AEEMod_Load of the extension <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> is executed.</p>
<p>if both an applet and extensions loads the same way then<br />
why is this difference..</p>
<p>If I use normal extension <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> everything goes well.</p>
<p>Do anyone has any idea about this. </p>
<p>If the module irrespective of Application or Extension, is complied with standard AEEModGen.C then the <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">MOD</a> compression will work else the behavior is unknown.</p>
<p>Hope this helps, Please correct me if I am wrong.<br />
But since all module will have the same entry point why this happens&#8230; </p>
<p>__________________<br />
Thanks everyone for the info they share here..<br />
Ramki@TTSL<br />
 VALUE HAS A VALUE ONLY IF ITS VALUE IS VALUED</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Last edited by Brewin : 08-06-2008 at 06:17 AM. </p>
<p>Brewin<br />
View Public Profile<br />
Send a private message to Brewin<br />
Send email to Brewin<br />
Find all posts by Brewin<br />
Add Brewin to Your Buddy List </p>
<p>  #7   08-07-2008, 12:32 PM<br />
TG1e<br />
Registered User   Join Date: May 2008<br />
Posts: 3<br />
Rep Power: 0</p>
<p>Reference code please [if possible]</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Addressed to all who are working (or have worked) on this topic of loading a <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> from <a href="http://www.donevii.com/post/tag/heap" class="st_tag internal_tag" rel="tag" title="Posts tagged with heap">heap</a> mem&#8230;<br />
Will it be possible for you to post some reference code?</p>
<p>Also, for clarity&#8230;</p>
<p>Do we only have to call AEEMod_Load?<br />
Or do we have to call the other functions as well&#8230;.How does the AEE come to know that we have loaded the compressed (and now decompressed) <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a>? How will the AEE send events to this newly loaded <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a>?</p>
<p>Awaiting your response(s)&#8230;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Last edited by TG1e : 08-07-2008 at 12:34 PM. </p>
<p>TG1e<br />
View Public Profile<br />
Send a private message to TG1e<br />
Find all posts by TG1e<br />
Add TG1e to Your Buddy List </p>
<p>  #8   08-23-2008, 06:51 AM<br />
 Brewin<br />
Registered User   Join Date: Mar 2006<br />
Posts: 152<br />
Rep Power: 4</p>
<p> Loading compressed <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file..Step by Step</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Quote:<br />
Originally Posted by TG1e<br />
Addressed to all who are working (or have worked) on this topic of loading a <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> from <a href="http://www.donevii.com/post/tag/heap" class="st_tag internal_tag" rel="tag" title="Posts tagged with heap">heap</a> mem&#8230;<br />
Will it be possible for you to post some reference code?</p>
<p>What code you need, first compress you <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">MOD</a> file with gzip(if 7zip is used then you need to supply you own decompressor code in the <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> loader or bootloader)<br />
Example: You have an application with myapp.<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a>, myapp.bar, myapp.mif<br />
After compressing <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">MOD</a>, your files are myapp.zip, myapp.bar,myapp.mif.<br />
Now write a bootloader which will load myapp.zip into memory and uncompress..</p>
<p>1. Create a project with name ex: <a href="http://www.donevii.com/post/tag/modloader" class="st_tag internal_tag" rel="tag" title="Posts tagged with modloader">modloader</a>.</p>
<p>2. copy AEEModGen.C and AEEModGen.H into your project and add the following header files<br />
AEE.h, AEEShell.h, AEEUnzipStream.h, AEEFile.h, AEEHeap.h, AEEStdLib.h.</p>
<p>3. Delete everything not related to AEEMod_Load and AEEStaticMod_New in both files and add the below line</p>
<p>Quote:<br />
For AEEMod_Load typecast&#8230;..<br />
typedef int (*RunLoadMod)(IShell *ps, void * ph, IModule ** pMod);</p>
<p>2. Delete every thing inside the AEEStaticMod_New function.</p>
<p>3. Now inside the AEEStaticMod_New function declare pointers to IUnzipAStream, IFileMgr and IFile interfaces.</p>
<p>4. Create an Instance of IFileMgr and IUnzipStream(if compressed with gzip). else<br />
provide your own decompress function here.</p>
<p>5.Now allocate some memory and copy the &#8220;ph&#8221; variable which is the pointer to AEEHelper Functions into the first four bytes of allocated memory.</p>
<p>6. Open myapp.zip and Set it for uncompressing using<br />
&#8221; IUNZIPASTREAM_SetStream &#8220;.</p>
<p>7. Now read the uncompressed stream using &#8221; IUNZIPASTREAM_Read &#8221; and copy the contents from 5th byte onwards into the same buffer using MEMCPY, REALLOC as per requirements.<br />
( Now your buffer contains pointer to AEEHelper functions + uncompressed myapp.zip, now buffer size will be a minimum of 4+sizeof(myapp.<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a>) ).</p>
<p>8. Once your buffer is ready with the above you are done. Release the IFileMgr, Ifile and IUnzipStream interface pointers.</p>
<p>9. Now type cast the 5th byte of the buffer to AEEMod_Load with a return statement like</p>
<p>Quote:<br />
return (RunLoadMod)(buffer+4)(pIShell,ph,ppMod);<br />
to execute the actual <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file&#8230;.  </p>
<p>Note: Don&#8217;t release the buffer, once the app exits this memory will be released by AEE.</p>
<p>You <a href="http://www.donevii.com/post/tag/modloader" class="st_tag internal_tag" rel="tag" title="Posts tagged with modloader">modloader</a> is ready now.<br />
Compile and create the <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file and rename the <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file as myapp.<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a>.</p>
<p>Now you app contains, myapp.mif, myapp.<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a>, myapp.zip, myapp.bar.</p>
<p>Quote:<br />
Also, for clarity&#8230;<br />
Do we only have to call AEEMod_Load?<br />
Or do we have to call the other functions as well&#8230;.How does the AEE come to know that we have loaded the compressed (and now decompressed) <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a>? How will the AEE send events to this newly loaded <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a>?</p>
<p>When you click on your app, AEE loads the <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file associated with the app name in this case it is myapp.<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a>(<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> loader) and executes the first address i.e AEEMod_load which will feed the actual <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> to the AEE, it&#8217;s not the AEE that load your actual <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">MOD</a> file.</p>
<p>There is no applet related to <a href="http://www.donevii.com/post/tag/modloader" class="st_tag internal_tag" rel="tag" title="Posts tagged with modloader">modloader</a>, when AEE encounter the last statement in the AEEStaticMod_New of the <a href="http://www.donevii.com/post/tag/modloader" class="st_tag internal_tag" rel="tag" title="Posts tagged with modloader">modloader</a> AEE just jumps to the address where we have kept the actual <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">MOD</a> file and exectues from there in the process whatever is created and registered(IModuleVtbl, Applet, Applet_HandleEvent) are all belongs to the actual application <a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file and AEE will send events to the registered handleEvent of the top visible applet which is nothing but your application handle Event. </p>
<p>__________________<br />
Thanks everyone for the info they share here..<br />
Ramki@TTSL<br />
 VALUE HAS A VALUE ONLY IF ITS VALUE IS VALUED</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Last edited by Brewin : 08-23-2008 at 06:59 AM. </p>
<p>Brewin<br />
View Public Profile<br />
Send a private message to Brewin<br />
Send email to Brewin<br />
Find all posts by Brewin<br />
Add Brewin to Your Buddy List </p>
<p>  #9   01-13-2009, 07:55 AM<br />
ed_est<br />
Registered User   Join Date: Jan 2009<br />
Posts: 3<br />
Rep Power: 0</p>
<p>Hi Brewin,<br />
I am interested in the functionality that you have described in this topic and I have tried to create a <a href="http://www.donevii.com/post/tag/modloader" class="st_tag internal_tag" rel="tag" title="Posts tagged with modloader">modloader</a> by myself according the steps you have provided, but unfortunately my device just reboots when I am trying to execute the loaded into memory .<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">mod</a> file. I have tried my code on different devices with different <a href="http://www.donevii.com/post/tag/brew" class="st_tag internal_tag" rel="tag" title="Posts tagged with brew">BREW</a> version and on all of them I had device reboot.<br />
Here is my code in AEEStaticMod_New function ( I have simplified it because I don&#8217;t use compression for .<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">MOD</a> file, also I have removed all checks):</p>
<p>ISHELL_CreateInstance(pIShell, AEECLSID_FILEMGR, (void**) &#038;piFileMgr);<br />
piFile = IFILEMGR_OpenFile(piFileMgr, &#8220;realmod.bin&#8221;, _OFM_READ);<br />
IFILE_GetInfo(piFile, &#038;iFileInfo);<br />
filesize = iFileInfo.dwSize;<br />
pBuf = (byte*) MALLOC (filesize + 4);<br />
MEMCPY(pBuf, ph, 4);<br />
pBuf2 = pBuf + 4;<br />
pFunc = (RunLoadMod)pBuf2;<br />
bytesread = IFILE_Read(piFile, pBuf2, filesize);<br />
IFILE_Release(piFile);<br />
IFILEMGR_Release(piFileMgr);<br />
return pFunc(pIShell,ph,ppMod);</p>
<p>Can you help me to understand why I can&#8217;t start .<a href="http://www.donevii.com/post/tag/mod" class="st_tag internal_tag" rel="tag" title="Posts tagged with mod">MOD</a> file I have loaded by <a href="http://www.donevii.com/post/tag/modloader" class="st_tag internal_tag" rel="tag" title="Posts tagged with modloader">modloader</a>? I am doing all needed steps that you provided in your post and everything seems correct for me, but maybe you will find that I am doing something wrong.</p>
<p>Thanks in advance.</p>
<p>ed_est<br />
View Public Profile<br />
Send a private message to ed_est<br />
Send email to ed_est<br />
Find all posts by ed_est<br />
Add ed_est to Your Buddy List </p>
<p>  #10   01-13-2009, 08:44 PM<br />
 Brewin<br />
Registered User   Join Date: Mar 2006<br />
Posts: 152<br />
Rep Power: 4</p>
<p>Helper functions Entry point problem&#8230;..</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Quote:<br />
Originally Posted by ed_est<br />
MEMCPY(pBuf, ph, 4); *********<br />
pBuf2 = pBuf + 4;<br />
((RunLoadMod)pBuf2)(pIShell,ph,ppMod); </p>
<p>You problem is here. It not properly copying the ph pointer(Helper functions Entry point).<br />
MEMCPY(pBuf, ph, 4);</p>
<p>__________________<br />
Thanks everyone for the info they share here..<br />
Ramki@TTSL<br />
 VALUE HAS A VALUE ONLY IF ITS VALUE IS VALUED</p>
<p>Brewin<br />
View Public Profile<br />
Send a private message to Brewin<br />
Send email to Brewin<br />
Find all posts by Brewin<br />
Add Brewin to Your Buddy List </p>
<p>  #11   01-14-2009, 06:17 AM<br />
ed_est<br />
Registered User   Join Date: Jan 2009<br />
Posts: 3<br />
Rep Power: 0</p>
<p>Brewin,<br />
Thank you very match for your help.<br />
I have fixed the this part of code and now it works.</p>

	<h4>相关文章</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.donevii.com/post/817.html" title="在BREW程序中调用另一个mod的分析 (2009-05-17)">在BREW程序中调用另一个mod的分析</a> (0)</li>
	<li><a href="http://www.donevii.com/post/744.html" title="《深入BREW》 &#8211; 硬件基础 (2009-01-18)">《深入BREW》 &#8211; 硬件基础</a> (0)</li>
	<li><a href="http://www.donevii.com/post/746.html" title="《深入BREW》 &#8211; BREW原理 (2009-01-18)">《深入BREW》 &#8211; BREW原理</a> (1)</li>
	<li><a href="http://www.donevii.com/post/479.html" title="[转] 嵌入式单地址空间中实现动态加载的过程 (2008-09-11)">[转] 嵌入式单地址空间中实现动态加载的过程</a> (0)</li>
	<li><a href="http://www.donevii.com/post/481.html" title="[转] 实现动态加载VXWORKS .O/.OUT模块 (2008-09-11)">[转] 实现动态加载VXWORKS .O/.OUT模块</a> (1)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.donevii.com/post/820.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
