9S08 Banked Memory and CW10.6 and PE

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

9S08 Banked Memory and CW10.6 and PE

Jump to solution
1,140 Views
GaryOlmstead
Senior Contributor I

( I thought I posted this a couple days ago, but it doesn't show up in My Content.  I apologize if this is a repeat.)

Hello Experts --

I am using a QE128 processor with CW10.6 and Processor Expert in the small memory model.  I have recently run into the dreaded "can't allocate memory at address 0x7ff8" or something like that.  The program is nearly done, I only need a little more program space (~4-6K). So far, I have tried:

 - Creating a new, banked project.  Result: It doesn't compile the Processor Expert generated component definitions.  Another post here suggests PE can't deal with banked memory.

 - Creating a project using a processor with a flash that was small enough to not need banking.  Didn't work because I need every one of the 80 pins on the QE128, and there aren't any 80 pin processors with non-banked flash.

 

- Forcing some of the code into the upper page.  CW knows how to put the interrupt vectors up there, why not some code as well?  Why not, indeed, but I haven't found the recipe yet.

So, on to the questions:

- Is there a way to force PE to compile its components into banked memory?

- Is there a way to force code into 0xC000-0xdfff without banked memory?  How about data tables, as I have rather a lot of those?

Best Regards

Gary Olmstead

Ventura CA

0 Kudos
1 Solution
982 Views
GaryOlmstead
Senior Contributor I

Edward --

I moved to CW11.1, banked mode, everything else either at default or as it was in the original code, and it complies correctly, using code banks.

I intend to go back and try your methods, but the truth is that I am so far behind schedule that I'm unlikely to find the time.

Thank you for your help.

Gary

View solution in original post

0 Kudos
6 Replies
983 Views
GaryOlmstead
Senior Contributor I

Edward --

I moved to CW11.1, banked mode, everything else either at default or as it was in the original code, and it complies correctly, using code banks.

I intend to go back and try your methods, but the truth is that I am so far behind schedule that I'm unlikely to find the time.

Thank you for your help.

Gary

0 Kudos
982 Views
GaryOlmstead
Senior Contributor I

Hi Edward --

I tried disabling the .prm file generation and hand-modifying the pro file so that ROM1 extended from 0x8000 to 0xffad, but it didn't make any difference.

I will try CW11.1, and let you know what happens.

Gary

0 Kudos
982 Views
kef2
Senior Contributor IV

Hi Gary,

It doesn't make sense to extend ROM1 while it is not used! By default ROM1 in not used in nonbanked code placement. As I wrote previously by default you have in *.prm: 

<list of various purpose nonbanked memory chunks> INTO ROM;

you need to change it to make above end with

INTO ROM, ROM1;

Here's what you should have initially:

_PRESTART, /* startup code */

STARTUP, /* startup data structures */

ROM_VAR, /* constant variables */

STRINGS, /* string literals */

VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */

NON_BANKED, /* runtime routines which must not be banked */

//.ostext, /* OSEK */

COPY /* copy down information: how to initialize variables */

INTO ROM; /* ,ROM1: To use "ROM1" as well, pass the option -OnB=b to the compiler */

A sou see ROM1 is commented out. You should make it included in placement:

...

INTO ROM, ROM1;

If you receive some king of linker "fixup overflow" error, then as instructed in comments above you need to add -OnB=b string to compiler command line setting. To do so right click your project, then Properties->Settings->HCS08 Compiler->Expert Settings. Now add that -OnB=b at the end of Command line pattern.

0 Kudos
982 Views
kef2
Senior Contributor IV

Hi,

Does CW10.6 fail to compile every banked S08 project with PE or it is just yours because of perhaps lots of const data in flash? CW11.1 seems having no problems with banked and PE, though can't say for sure, I tend to avoid things like Processor Expert.

Obvious problem with CW11.1 PE generated prm file is that ROM1 (nonbanked 0xC000..) is assigned to banked ROM and I see no option to change it PE-wise. But you can disable prm file generation by PE. See Component Inspector -> Cpu-> Build options->Generate PRM file =no. Then edit prm. You may also leave PE generated *.prm as is and specify in linker settings different *.prm file. In newly created project folder tree I see two *.prm files, Project.prm and ProcessorExpert.prm. First one gives you a hint how to enable nonbanked 0xC000:

1. change _PRESTART, ..., COPY  INTO ROM, ROM1; instead of INTO ROM;

2. add -OnB=b to compiler command line

 

Edward

0 Kudos
982 Views
GaryOlmstead
Senior Contributor I

I tried compiling a very small banked program, and got the same answer, so it appears that PE can't handle banked memory at all.

I was trying to avoid CW11, as I have no idea what its problems are, and I am very close to finishing this project....

0 Kudos
982 Views
kef2
Senior Contributor IV

OK. But even with small memory model, I guess ROM1 is not included in default code placement. Steps to include it apply as well for small memory model. And if 0x2080..0x7FFF + 0xC000..0xFxxx still won't be enough, I'd switch to continuous 0x2080..0xFxxx ROM segment. This could drag debugger problems, perhaps both with flashing over Multilink and symbolic information for page window, but doable. Let me know if you need this by now.

0 Kudos