QE128 Paged memory and CodeWarrior ( C / C++)

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

QE128 Paged memory and CodeWarrior ( C / C++)

Jump to solution
1,932 Views
Ricardo_RauppV
Contributor I

Hi guys

I have some doubts about paged memory model for QE128 using CW6.2

1- I understood the more efficient approach using paged memory is use small memory model AND so allocate some extra code into paged area.It would maked the code smaller and faster, since the extra handling of ppage and call would be perform only when accessing the paged area.., si it?

 

2- To allocate code into paged area, we can use CODE_SEG pragma.Is it necessary to add tha "far" word in front of each function of the code placed into this area? or the pragma is enough to CW?

 

3- I re-compiled my old smll memory model project tobanked mode and CW complains about the interruption vectors, wich could have data lost...

The orinal vector declaration is:

 

void (* near const _vect[])() @0xFFC0 = { // Interrupt vector table
         Cpu_Interrupt,               // Int.no.  0 Vtpm3ovf (at FFC0)              Unassigned

         etc,etc,etc...

 

4- I read about const data cannot be accessed between banked code (different pages), but only between non banked  / banked, or vice-versa,...comments?

 

5- Some has a code to read/erase and write the internal flash..considering the data cab be in ANY page (banked or not)..?

 

Thanks guys....

 

Ricardo Raupp

 

Message Edited by RicardoRaupp on 2009-09-09 01:11 PM
Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
615 Views
CompilerGuru
NXP Employee
NXP Employee

Placing the interrupt handler explicitely should be all that is needed.

Of course there can always be non portable code with special assumptions. Also the banked memory model needs a bit more stack (3 byte return addresses), the timing is a bit different (say slower) for function calls.

 

Daniel

View solution in original post

0 Kudos
Reply
3 Replies
615 Views
CompilerGuru
NXP Employee
NXP Employee

1. Not sure I understand your setup concept.

What is your setup? Lots of constants or a lot of code? Code banking is actually quite efficient with the banked memory model. Data (constant) paging has more overhead.

In the end the setup which works best for you depends most on your needs, having a single huge array is different than having many small objects, for example.

 

2. The pragma CODE_SEG without qualifiers only changes into which section the code gets placed, not how the code itself. It wont cause functions to use the call/rtc calling convention unless you use the __FAR_SEG qualifier as well inside of the same pragma (or the memory model uses far functions by default).

3.Interrupt handlers must be allocated non banked,which is not the default in the banked memory model.

Place the handlers into an area allocated non banked with an explicit #pragma CODE_SEG.

 

4. Code cannot change PPAGE while running on an memory area controlled by
 PPAGE. However this is different than using the LAP access method of the S08, that can be used from anywhere. So it depends on how you access your data. As far as I know (not that much) is that the S08 compile is using LAP access to access banked data. If you have you own access routines, you can obviously choose how to access your constants.

 

5. I don't have that here. Note that when using LAP access there is no differentiation in between banked and non banked. Also non banked flash can be accessed in the banked window as well.

In the end, I don't think that banked access is much different from non banked in respect to flash programming.

 

Daniel

0 Kudos
Reply
615 Views
Ricardo_RauppV
Contributor I

Daniel

Very thanks for your time....

In order to avoid deal with banking mechanism, I remake my project (C++) using banked option.

I did it thinking CW would do everything to me, although charging me a small price.

The compilation was successful, but the system hangs up during the initial phase of my main..(no interrupts enabled yet).

Well, now it is starting my "boring day" ( I hope it ends quicly!)

Is there some special care to make the convertion to banked memory the way I did? I mean, simply recompiling a project (it was working perfectly) from non banked to banked model?

The only one care I had was to allocate the interrupt routines using

#pragma CODE_SEG __NEAR_SEG NON_BANKED ...

Is it enough?

Thanks !!!!

 

0 Kudos
Reply
616 Views
CompilerGuru
NXP Employee
NXP Employee

Placing the interrupt handler explicitely should be all that is needed.

Of course there can always be non portable code with special assumptions. Also the banked memory model needs a bit more stack (3 byte return addresses), the timing is a bit different (say slower) for function calls.

 

Daniel

0 Kudos
Reply