How to build a executed-in-flash application?

As I know, normally RedBoot use startup type "ROM", and application use
startup type "RAM", then we can use RedBoot "load" application into ram and
"go" it.

On my target board, this method works pretty well now. But since the ram
size is only 512K, I want the application image executed-in-place in the
flash to save ram for usage.

Could anyone give me some advices for it? Thanks in advance.
------------------------------------------------------------------------------------------------------------

> As I know, normally RedBoot use startup type "ROM", and application use
> startup type "RAM", then we can use RedBoot "load" application into ram and
> "go" it.

> On my target board, this method works pretty well now. But since the ram
> size is only 512K, I want the application image executed-in-place in the
> flash to save ram for usage.

> Could anyone give me some advices for it? Thanks in advance.

You need to make a custom set of .ldi and .h files in the
$HAL/current/include/pkgconf directory. This should be set so that the
image is linked for the location it will be in FLASH. 

To execute it, just do

go <address_in_flash>

   Andrew
-----------------------------------------------------------------------------------------------------------------

Thank you Andrew. I have create and run it successfully. 

There are still little problem: Since the applications has been wrote into flash, how to use "fis create" command to add it into FIS? I tried "fis create -n twothreads", but doesn't work. It report "*** invalid 'fis' command: required parameter missing".

However, I can use "fis create twothreads" to directly add the application after "load".

------------------------------------------------------------------------------------------------------------------

> Thank you Andrew. I have create and run it successfully. 

> There are still little problem: 
> Since the applications has been wrote into flash, how to use "fis create" 
> command to add it into FIS? I tried "fis create -n twothreads", but doesn't 
> work. It report "*** invalid 'fis' command: required parameter missing".

> However, I can use "fis create twothreads" to directly add the application 
> after "load".

You probably need to pass all the parameters. Eg the example in the
documentation at 
http://ecos.sourceware.org/docs-latest/redboot/fis-create-command.html

is

fis create RedBoot -f 0xa0000000 -b 0x8c400000 -l 0x20000

ie load it into flash at address 0xa0000000 from RAM address
0x8c400000 with 0x20000 bytes of image data.

Andrew
-------------------------------------------------------------------------------------------------------

You are right.

I looked through the source code:
Because the last "load" write the image into flash, which means the values of "entry_address/load_address/load_address_end" are not located in the "ram_start - ram_end" region.
So these values are treated as invalid in fis_create() function.


I use the commands below and it works."fis create -f 0x80040000 -l 0x000C0000 -n twothreads""go 0x80040000 另一种方法:Having a ROM RedBoot and a RAM application is only one of the standardscenarios. If you want the application to run from flash then thereshould be no need to have RedBoot in the system at all. Insteadconfigure eCos itself for ROM startup, link your application withthat, and install it in place of RedBoot. The application now hascontrol over all the hardware. The obvious caveats are: 1) you need some way of programming the flash without RedBoot. This is likely to involve a hardware debug solution such as BDM or jtag. 2) debugging applications in flash is generally a lot harder than ones in RAM (although that is going to be a problem whenever code resides in flash, irrespective of whether or not RedBoot is involved). 3) upgrading an application in the field becomes more difficult. 4) not all platforms will be tested in this scenario. Depending on your hardware there may be platform HAL issues.Andrew has been describing an alternative approach where RedBoot isstill in use and the application resides in a non-standard location inflash. That can also be made to work, but having a ROM startupapplication would be more conventional.

posted @ 2013-10-17 16:21  风仁  阅读(107)  评论(0编辑  收藏  举报