S12NE64 - Out of allocation space in segment ROM_C000 at address 0xEC6B

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

S12NE64 - Out of allocation space in segment ROM_C000 at address 0xEC6B

Jump to solution
1,703 Views
admin
Specialist II

Hello.

I'm working on my tesis to complete my studies of Electronic Engineering.

It's my first time with a microcontroller of S12's Series.

I really don't understand the themes of banked and non-banked memory.

I need to make a web server. For that I'm studing the AN2836 for NE64 microcontroller.

When I compile that project, codewarrior generates an error that says:

"Out of allocation space in segment ROM_C000 at address 0xEC6B"

The code of the .PRM is here:

 

NAMESENDSECTIONS  //    RAM       = READ_WRITE 0x2180 TO 0x3FFE;     /* BUFMAP = 0 (128 byte) *///    RAM       = READ_WRITE 0x2300 TO 0x3FFE;     /* BUFMAP = 1 (256 byte) *///    RAM       = READ_WRITE 0x2600 TO 0x3FFE;     /* BUFMAP = 2 (512 byte) *///    RAM       = READ_WRITE 0x2C00 TO 0x3FFE;     /* BUFMAP = 3 (1K) less then means no DHCP*/    RAM       = READ_WRITE 0x3200 TO 0x3FFE;     /* BUFMAP = 4 (1.5K) */    /* unbanked FLASH ROM */    ROM_4000 = READ_ONLY  0x4000 TO 0x7FFF;      ROM_C000 = READ_ONLY  0xC000 TO 0xF780;    /* banked FLASH ROM */    ROM_Mon  = READ_ONLY  0xF800 TO 0xFEFF;    SECURITY = READ_ONLY  0xFF00 TO 0xFF0F;        ROM_FF10 = READ_ONLY  0xFF10 TO 0xFF7F;    PAGE_3C  = READ_ONLY  0x3C8000 TO 0x3CBFFF;       PAGE_3D  = READ_ONLY  0x3D8000 TO 0x3DBFFF;   ENDPLACEMENT    _PRESTART,                   /* Used in HIWARE format: jump to _Startup at the code start */    STARTUP,                     /* startup data structures */    ROM_VAR,                     /* constant variables */    STRINGS,                     /* string literals */    NON_BANKED,                  /* runtime routines which must not be banked */    COPY                         /* copy down information: how to initialize variables */                                 INTO  ROM_4000,ROM_C000;    MyConstSegPage1        INTO  PAGE_3C;    DEFAULT_ROM                  INTO  PAGE_3D;    DEFAULT_RAM                  INTO  RAM;ENDSTACKTOP 0x3FFF

 How can I solve this problem?

In AN2836 comments the following:

 

 

"P&E_ICD_linker.prm also defines the placement of the sections. It is noteworthy to discuss the

MyConstSegPage1 placement

MyConstSegPage1 refers to a web server file array for the ActiveX

component, NE64DemoNOPIC_file, which is contained in NE64DemoNOPIC.c. Because

NE64DemoNOPIC.c is a constant array, by default, it would be stored in ROM_VAR which causes a

FLASH allocation problem for this project. Creating MyConstSegPage1 and grouping the

NE64DemoNOPIC_file data with DEFAULT_ROM resolves the FLASH allocation problem. More

information on FLASH allocation can be found within the CodeWarrior user manual."

 

I don't understand indeep that. My question is how to implement that correction to solve my problem?

Thank you very much, I will waiting your answers!

 

.

Labels (1)
Tags (1)
0 Kudos
1 Solution
996 Views
CrasyCat
Specialist III

Hello

 

You need to allocate your constant in  user defined section MyConstSegPage1 using

  #pragma CONST_SEG __GPAGE_SEG MyConstSegPage1

 

Please refer to section Paged Constant allocation (page 6) in attached technical note for more details.

 

CrasyCat

View solution in original post

0 Kudos
7 Replies
996 Views
kef
Specialist I
  • When I compile that project, codewarrior generates an error that says:
  • "Out of allocation space in segment ROM_C000 at address 0xEC6B"
  • How can I solve this problem?

S12 is 16bits CPU. It eaily addresses up to 64k of memory including peripheral registers address space, RAM and flash. S12NE64 comes with 64k of flash. Obviously it is not possible to have all 64k of flash, all RAM and registers in the same 64k address space. How dows S12 family handle that? -Flash is paged or banked. There's remappable flash page window at 0x8000-0xBFFF, which is mapped to different physical flash memory when you change contents of PPAGE register. S12 CPU has special instructions to call functions on different flash pages. CALL instruction stores changes PPAGE and then jumps subroutine in page window. On returrn RTC instruction is executed, which restores PPAGE and returns to caller. Now about your problem. S12 is able to address megabytes of program code easily using CALL and RTC instructions, but it is not so able to address lots of data. By default all data is allocated in nonbanked memory (outside of page window) at 0-0x7FFF and at 0xC000-0xFFFF. When your data (mostly constants, because S12NE doesn't have a lot of RAM) doesn't fit nonbanked memory, you have to allocate at least some parts of it in banked/paged memory. Access to that data is bit slow, because CPU has to jump away from banked memory, then switch PPAGE register to map required flash page containing your data to page window, read data, restore PPAGE, then return.

 

 

  • In AN2836 comments the following:
  •  

  • "P&E_ICD_linker.prm also defines the placement of the sections. It is noteworthy to discuss the ...

This is about how to define custom memory area in banked memory (it is done in prm file) and how to put some of your constants into that area (using compiler #pragma's).

 

Speaking about AN2836, prm mods are as follows:

PLACEMENT ...    MyConstSegPage1  INTO  PAGE_3C; ...END

  

Constants that go into MeConstSegPage1 are defined in NE64DemoNOPIC.c as follows:

/* This File was automatically generated by the CEncoder. Do not modify it!Date: Fri Sep 24 20:32:28 2004 File: NE64DemoNOPIC.CAB */#pragma CONST_SEG PPAGE MyConstSegPage1volatile const unsigned char NE64DemoNOPIC_file [] = {0x4D,0x53,0x43,0x46,0x00,0x00,0x00,0x00,0xCD,0x3C,0x0,...0xB8,0xC5,0xD6,0x36,0xD6,0xF2,0x91,0xDF};#pragma CONST_SEG DEFAULT

Top and bottom #pragma directives tells compiler to allocate all const's that come within these pragmas in PPAGE-banked memory in segment MyConstSegPage1

 

  • PD.: I have a CW limited to 32K of C code. How can I get one of 64K of C code?

You need to buy CW Standard edition or other license that allows 64k of code. For a while you may use no cost evaluation license.

0 Kudos
997 Views
CrasyCat
Specialist III

Hello

 

You need to allocate your constant in  user defined section MyConstSegPage1 using

  #pragma CONST_SEG __GPAGE_SEG MyConstSegPage1

 

Please refer to section Paged Constant allocation (page 6) in attached technical note for more details.

 

CrasyCat

0 Kudos
996 Views
admin
Specialist II

In what file of the project I have to allocate the constant.

The project have to many files, and I don't have idea where I need to put the line of code that you bring me.

I'm sorry but it's my first time whith microcontrollers of 16 bit.

Thank you for your help, and thank you for your time.

 

 

0 Kudos
996 Views
CrasyCat
Specialist III

Hello

 

Sorry I do not know the project so I cannot tell you explicitly in which file the buffer is defined or declared.

 

Basically you need to place the pragma in front of the buffer definition and declaration.

 

What about using the Search  -> Find in Files and then search for the name of the buffer in the project?

 

CrasyCat

0 Kudos
996 Views
admin
Specialist II

CrasyCat, Thank you again.

Now I find the declaration of the buffer, in the file Start12.c (Standard Start Up code)The bad new is that de buffer it's already declared like you tell me.

...#pragma DATA_SEG DEFAULT#if defined(FAR_DATA)#include "non_bank.sgm"/* the init function must be in non banked memory if banked variables are used *//* because _SET_PAGE is called, which may change any page register. */#pragma CONST_SEG __GPAGE_SEG MyConstSegPage1 #ifdef __cplusplus...

 Obviusly, when I click "make" the same error appears.

"Out of allocation space in segment ROM_C000 at address 0xEC6B"

What is happing?

 

Thank you.

 

PD.: I have a CW limited to 32K of C code. How can I get one of 64K of C code?

0 Kudos
996 Views
CrasyCat
Specialist III

Hello

 

I cannot really help you without the actual project.

 

You can try submitting a  service request and attach the failing project.

This way our support staff can look at this issue.

I would recommend you to submit a service request for that.

Click here to submit a service request.

CrasyCat

0 Kudos
996 Views
admin
Specialist II

Thank you crasy cat, I will try that.

 

Thanks a lot!

0 Kudos