Hi Friends,
I have 1M flash memory allocated for Application. But the Application
size exceeds the
1M limit (Application size is 2M). But, now i cannot redesign the
hardware and fit in any extra Flash Memories to resolve this size issue
. I have RS232, Ethernet support on my
board. My Bootloader is loading the application perfectly. ( I tried
with a small application that
spits some strings on the hyperterminal ). Now the issue is with the
size of the original application which grew in size in the course of
time.
Is there any trick to load the 2M application into the 1M Flash Memory
and execute without any problem ??? ( The 2M is the stripped memory
size of the application )
Is it possible to load the application(splitting & joining) in some
sequence and handle some tricks in that manner to resolve this issue.
Kindly share your views / ideas .
Tonnes of Thx in advans,
Karthik Balaguru
Reply by Tom Lucas●September 26, 20062006-09-26
"KBG" <karthik.balaguru@lntinfotech.com> wrote in message
news:1159264939.249023.125630@m7g2000cwm.googlegroups.com...
> Hi Friends,
>
> I have 1M flash memory allocated for Application. But the Application
> size exceeds the
> 1M limit (Application size is 2M). But, now i cannot redesign the
> hardware and fit in any extra Flash Memories to resolve this size
> issue
> . I have RS232, Ethernet support on my
> board. My Bootloader is loading the application perfectly. ( I tried
> with a small application that
> spits some strings on the hyperterminal ). Now the issue is with the
> size of the original application which grew in size in the course of
> time.
>
> Is there any trick to load the 2M application into the 1M Flash Memory
> and execute without any problem ??? ( The 2M is the stripped memory
> size of the application )
>
> Is it possible to load the application(splitting & joining) in some
> sequence and handle some tricks in that manner to resolve this issue.
>
> Kindly share your views / ideas .
>
> Tonnes of Thx in advans,
> Karthik Balaguru
Some possible aids:
1) Have you got optimisation set to optimise for size in the compiler?
2) If you are using ARM then you can compile in Thumb mode to gain a
reduction in size at a cost of a performance decrease.
3) If you can't add an extra flash device can you change your current
one for a bigger one that will fit in the same footprint?
4) Can you compress anything? In my application I have a number of big
bitmaps that must be stored as constants and I use Run Length Encoding
to dramatically reduce their size.
However, what you are doing is firefighting and the only long term
solution is redesign the code to be more efficient or make space in the
hardware to fit your new code. Look again at was has changed to bloat
your code to double its size and think about what is necessary and what
is not. If you are using other people's modules then this will eb a lot
more difficult but their documentation may help.
Reply by Paul Keinanen●September 26, 20062006-09-26
On 26 Sep 2006 03:02:19 -0700, "KBG"
<karthik.balaguru@lntinfotech.com> wrote:
>Hi Friends,
>
>I have 1M flash memory allocated for Application. But the Application
>size exceeds the
>1M limit (Application size is 2M). But, now i cannot redesign the
>hardware and fit in any extra Flash Memories to resolve this size issue
>. I have RS232, Ethernet support on my
>board. My Bootloader is loading the application perfectly. ( I tried
>with a small application that
>spits some strings on the hyperterminal ). Now the issue is with the
>size of the original application which grew in size in the course of
>time.
Since you have an Ethernet adaptor on the board, why not just put a PC
or some other device with a large mass storage on the LAN and load
only those segments currently needed into Flash (or preferably RAM).
In the old days with 16 bit computers typically restricted to 64 KiB,
large programs were divided into overlays stored to disk. The
initialisation routines could be in one overlay branch and initially
loaded into memory and when all initialisation was done, the actual
application code branch was loaded on the same addresses as the
initialisation code, overwriting it. Each overly branch could contain
a root and several alternative branches, thus the overlay structure
was actually an overlay tree.
While very simple overlays could be handled with ordinary linkers and
some application code, any complex overlay structure would definitely
need a linker that understands about overlay trees and can generate
the autoload vectors.
Overlays were used also on MS-DOS to handle larger programs that did
not fit into the 512 KiB or 640 KiB physical memory of the original
PC.
With the LAN, you could have a single file server and multiple
embedded system with a small memory loading overlay segments from the
file server over the LAN. A UDP frame is well capable of carrying 1
KiB segments over the net. Implementing UDP on a small device with
Ethernet is easy and does not require much code or buffer space.
You would have to handle the situations, when the Ethernet or file
server temporary becomes unavailable.
A program RAM at the embedded device would be preferable, since the
Flash has a limited number of write operations.
Paul
Reply by Clifford Heath●September 26, 20062006-09-26
KBG wrote:
> I have 1M flash memory allocated for Application. But the Application
> size exceeds the 1M limit (Application size is 2M).
> ...My Bootloader is loading the application perfectly.
Are you bootloading from FLASH into RAM and executing from there?
If so, you need to compress the program into FLASH and uncompress
it into RAM, in a similar way to how the Linux kernel bootloader
works.
Reply by Mark McDougall●September 26, 20062006-09-26
KBG wrote:
> Now the issue is with the
> size of the original application which grew in size in the course of
> time.
I'm having trouble understanding how the application grew to 2MB when
your development platform only has 1 MB of flash??? Did you write an
extra 1MB of code before testing any of it???
Or is this a hypothetical homework question?
> Is there any trick to load the 2M application into the 1M Flash Memory
> and execute without any problem ??? ( The 2M is the stripped memory
> size of the application )
You don't say whether or not you are executing in-place from the flash,
or executing a copy out of RAM.
> Is it possible to load the application(splitting & joining) in some
> sequence and handle some tricks in that manner to resolve this issue.
How much (spare) RAM do you have? What percentage of your application is
code vs data?
Regards,
--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266
Reply by KBG●September 27, 20062006-09-27
Hi ,
I'm having trouble understanding how the application grew to 2MB when
your development platform only has 1 MB of flash??? Did you write an
extra 1MB of code before testing any of it???
>>>>>>>>>>>>>>>>>> It has exeeded in size so that it can not be placed
in Flash.
I do RAM execution, debugging and development . I did not try flashing
the application though many modules were getting integrated . Now the
code has got almost freezed as many modules have got finished . I did
try flashing now and there comes this issue.
It has not exactly doubled in size. It has crossed the 1.4 M mark.
You don't say whether or not you are executing in-place from the
flash,
or executing a copy out of RAM.
>>>>>>>>>>> Bootloader execution is done as 'executing in-place' in
Flash.
But the application gets executed by getting copied to RAM. This
copying is
done by Bootloader as in any other normal embedded systems. So, this
area also needs some tricks so that the image in bits/pieces can be put
together by some means and executed !!
How much (spare) RAM do you have? What percentage of your application
is
code vs data?
>>>>>>>>>>> RAM is not an issue. 32M is there and it is working
perfectly from
RAM . Only Flashing is the issue and i need tricks in that regard with
how to flash the big size image in bits / pieces as size has crossed
the Flash memory size and execute the bits / pieces as such or by
putting together in some groups with some tricks .
.XMAP file of the application has the following info w.r.t data & code
for your reference :
.text = 0x12C188 - 0xB0000 = 0x7C188
.rodata = 0x134CD5 - 0x12C188 = 0x8B4D
.data = 0x13620A - 0x134CE0 = 0x152A
.bss = 0x22AB66 - 0x136210 = 0xF4956
Regards,
Karthik Balaguru
Reply by KBG●September 27, 20062006-09-27
Hi ,
1) Have you got optimisation set to optimise for size in the compiler?
>>>>>>>>> Yes size optimisation has been enabled.
2) If you are using ARM then you can compile in Thumb mode to gain a
reduction in size at a cost of a performance decrease.
>>>>>>>> But , i am using Coldfire MCF5272 in this embedded application.
3) If you can't add an extra flash device can you change your current
one for a bigger one that will fit in the same footprint?
>>>>>>>> Mass production issues are there and handling via software will be cost-effective.
4) Can you compress anything? In my application I have a number of big
bitmaps that must be stored as constants and I use Run Length Encoding
to dramatically reduce their size.
>>>>>>>> There are no bitmaps, Lot of tasks are running .
However, what you are doing is firefighting and the only long term
solution is redesign the code to be more efficient or make space in
the
hardware to fit your new code. Look again at was has changed to bloat
your code to double its size and think about what is necessary and
what
is not. If you are using other people's modules then this will eb a
lot
more difficult but their documentation may help.
>>>>>>>> I am trying via this method also but i beleive there should be some other
software tricks to manage this situation , so trying to design and
incorporate it.
Regards,
Karthik Balaguru
Reply by Arlet●September 27, 20062006-09-27
KBG wrote:
> .XMAP file of the application has the following info w.r.t data & code
> for your reference :
> .text = 0x12C188 - 0xB0000 = 0x7C188
> .rodata = 0x134CD5 - 0x12C188 = 0x8B4D
> .data = 0x13620A - 0x134CE0 = 0x152A
> .bss = 0x22AB66 - 0x136210 = 0xF4956
According to this, you only have about 0.5 MB of text, rodata and data
combined. Is there additional stuff that goes into flash ? Or are you
trying to store the bss section in flash as well ? If so, check your
scripts that generate the flash image, and make sure the bss section is
removed. Instead, just clear the bss area at startup.
Reply by KBG●September 27, 20062006-09-27
Hi,
Are you bootloading from FLASH into RAM and executing from there?
>>>>>>>> Bootloader execution is done as 'executing in-place' in
Flash. But the application gets executed by getting copied to RAM.
This
copying is done by Bootloader as in any other normal embedded systems.
If so, you need to compress the program into FLASH and uncompress
it into RAM, in a similar way to how the Linux kernel bootloader
works.
>>>>>>>>> Do you mean to say that i need to incorporate some compression algorithms and dump into Flash and later the bootloader code should uncompress it while copying to the RAM area for execution ? I too beleive that this is one of the good ideas . But, the compression algorithms - Need to think about it . Is there any compression algorithm available in open-source for this kind of task oriented with embedded application or any tool for this kind of activitiy ?
I think, Splitting and putting-together or vice-versa is going to be a
bit easy but this also needs synchronisation and buffer management .
But, the absence of compression algorithms will ease the task here.
If there is some easy way oriented with this splitting &
putting-together idea , kindly share with me.
Which of the above method to adopt in this situation so that it would
be time-effective ?
Kindly share your ideas / views regarding this.
Regards,
Karthik Balaguru
Reply by Clifford Heath●September 27, 20062006-09-27
KBG wrote:
> Bootloader execution is done as 'executing in-place' in
> Flash. But the application gets executed by getting copied to RAM.
> This copying is done by Bootloader as in any other normal embedded systems.
Ok, so embed a decompression algorithm into your bootloader and
you're good to go. Linux uses deflate (the zip/gzip algorithm),
of which versions are freely available. Look at how Linux does
it.
Signal Processing Engineer Seeking a DSP Engineer to tackle complex technical challenges. Requires expertise in DSP algorithms, EW, anti-jam, and datalink vulnerability. Qualifications: Bachelor's degree, Secret Clearance, and proficiency in waveform modulation, LPD waveforms, signal detection, MATLAB, algorithm development, RF, data links, and EW systems. The position is on-site in Huntsville, AL and can support candidates at 3+ or 10+ years of experience.