Run in ram

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Run in ram

1,250 Views
oceansea
Contributor III

Our customer has a request on our bootloader, that is, the flash diver must not stored into the flash, it should download from CAN cummunication and then excute it to do flash download operation,when reset ,the data have no. I had noted that our community have some question about how to excute a function on ram, but they were all store into the flash, and when needed or program start, copy to ram, they are still store in flash.  what I need is when: excute compile, I can get a section of target file in ram. not place in flash.  and i have tried to do this, so I modified the prm file: use the ram as read-only type and place function in ram ,but the IDE prompt error 

Labels (1)
0 Kudos
12 Replies

976 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

In the past, when CodeWarrior 2.0 was used for debugging, there was a RAM target interface possible to be used to debug the code. The CodeWarrior directly loaded code into RAM ane executed it out of it. Unfortunately, this feature

has dissapeared with newer versions of the CodeWarrior and newer be used again.

Best regards,

Ladislav

0 Kudos

976 Views
kef2
Senior Contributor IV

Hi,

It doesn't make a lot of sense to add RAM target for each project, usually only small ones will fit the RAM, perhaps it was a right decision to not add them by default. And multiple targets in the same project still are present in CW 5.x. Project->Create Target, Project->Set Default Target menus and Targets tab still are enough for multiple targets in one project. Multiple PRM's can be readded to the project, ticking only targets which should use specified PRM. Thinking about this thread subject, hmm, it could be still the same project for loadable driver and bootloader, just an extra layer of complication.

Edward

0 Kudos

976 Views
kef2
Senior Contributor IV

This is very simple. You need separate executable (s19, elf, etc) for flash driver, which is targeted to RAM instead of flash. You will somehow download it to RAM and execute. What you need is just change flash ROM segment address to point to RAM. Needless to say that you need to reduce RAM segment size to make it not overlapping with your new flash segment location. Of course this small flash driver executable project should be nonbanked. Since Codewarrior linker optimizes unused functions and variables out, you need to specify your driver functions in ENTRIES section of PRM file. That's it.

0 Kudos

976 Views
oceansea
Contributor III

thank you  reply 

well , i try to do follow your idea ,but it show this problem :

1564104915(1).jpg

0 Kudos

976 Views
kef2
Senior Contributor IV

You didn't complete ...,COPY INTO destination, that's the source of your error. You shouldn't touch PLACEMENT section at all, only change SEGMENTS section to make ROM pointing to addresses in RAM, trim RAM segment to make room for ROM. Yes, it could be as you do

   RAM = READ_WRITE 0x002E00 TO 0x003FFF;

   ROM = READ_ONLY  0x002200 TO 0x002FFF;

please restore PLACEMENT section.

0 Kudos

976 Views
oceansea
Contributor III

Thanks for your quick response, but i'm sorry that i dont't quite understand your thought. 

maby is try to modify prm file follow below:

NAMES

END

SEGMENTS

   RAM = READ_WRITE 0x002E00 TO 0x003FFF;

   ROM = READ_ONLY  0x002200 TO 0x002FFF;

END

PLACEMENT

    _PRESTART,   

   STARTUP, 

   ROM_VAR, 

   STRINGS,

   NON_BANKED,   

   DEFAULT_ROM,

   COPY                                INTO

   DEFAULT_RAM   

                                     INTO RAM;RM;

   END

INIT _EntryPoint

STACKSIZE 0x200

 

really?

0 Kudos

976 Views
kef2
Senior Contributor IV

PLACEMENT

    _PRESTART,   

   STARTUP, 

   ROM_VAR, 

   STRINGS,

   NON_BANKED,   

   DEFAULT_ROM,

   COPY                                INTO

   DEFAULT_RAM   

                                     INTO RAM;RM;

   END

a,b,c INTO x;

d,e,f INTO y;

x and y are entries form SEGMENTS..END. You have only RAM and ROM segments, so INTO can be only into RAM or into ROM, but you made INTO pointing to DEFAULT_RAM, which is incorrect and this is why Codewarrior complained.

0 Kudos

976 Views
oceansea
Contributor III

Thanks for your quick response,and i understand your thought;

but i still have a problem ,that : 

//////////////////////////////////////

COPY                                INTO

   DEFAULT_RAM   

                                     INTO RAM;RM;

/////////////////////////////////////////////////////////////////////

is copy the 

//////////////////////////////////

 STARTUP, 

   ROM_VAR, 

   STRINGS,

   NON_BANKED,   

   DEFAULT_ROM,

/////////////////////////////////////////

into DEFAULT_RAM ?

and what's the meaning about:   INTO RAM;RM  ???

thank you very much

0 Kudos

978 Views
kef2
Senior Contributor IV

Arghh. You broke PLACEMENT section of your PRM, I explained why it is broken. You need to restore it, just that.

0 Kudos

978 Views
oceansea
Contributor III

hi,

i do change follow your idea , it show :

1565055967(1).jpg

i  replace DEFAULT_RAM to RAM ,but it still  show some wrong

0 Kudos

978 Views
kef2
Senior Contributor IV

Hi,

again, I suggested you to restore PLACEMENT block to it virgin state. You broke it again. RAM can't be at the same time SEGMENT and PLACEMENT. a,b,c INTO RAM INTO RAM, ROM; . If you don't know how to restore PLACEMENT block, create new project and copy PLACEMENT from there.

Edward

0 Kudos

978 Views
oceansea
Contributor III

hi,

i don't know how to restore PLACEMENT block, this is my prj ,the prm file is generate by the PE, 

could you help me modify it ?

0 Kudos