Relocatable assembler sections. Help me please!!!

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

Relocatable assembler sections. Help me please!!!

7,654 Views
Leo_Junin
Contributor I
What I want to do is the following thing and I cannot cause that the parameters section works correctly. That I must do? In which place I define the parameters section? The CW compiles but not link it.
 
 
Labels (1)
0 Kudos
Reply
13 Replies

1,318 Views
rocco
Senior Contributor II
Hi, Leo-Junin:

It looks like it worked to me.

The page-zero ram was placed at 0x60, the PARAMETERS section was placed at 0xC000, and the code at 0xC200.

If this is not what you wanted, then you need to tell us what you were trying to do.

Also, what processor are you trying to use?

Are you using CodeWarrior? If you look in your .PRM file, you will see what addresses the linker will use to place the sections. All three of you sections should be listed there.

Message Edited by rocco on 2006-08-12 01:14 PM

0 Kudos
Reply

1,317 Views
Leo_Junin
Contributor I

Hi rocco, 

Tank you for you aid.  I'm using 908LJ12, also I'm using CW 3.1. Desire that the CODE section this a continuation of PARAMETERS section at the time of compiling it, but it seems to me that the compiler does not accept another section to me although I have defined it in the .PRM file.

0 Kudos
Reply

1,318 Views
rocco
Senior Contributor II
Hi, Leo-Junin:

When you say "compiler", are you speaking of the assembler, the linker, or both together?

By putting the parameters and code in separate sections, you are instructing the assembler to keep them separate. The linker will then put everything together.

If you want them together, you can either put them in the same section, or have the linker combine the sections through the .PRM file. If you attach your .PRM file, we may be able to tell you how it should be modified.

However, although I use the assembler and linker, I do not use the CodeWarrior IDE, so I do not know how you would modify the .PRM through CodeWarrior. I always edit the .PRM directly, but I don't know if CodeWarrior will let you do that.
0 Kudos
Reply

1,318 Views
Leo_Junin
Contributor I

Hi Rocco.

When I say to "complier" I refer to the united compiler and linker. Desire that the PARAMETERS SECTION and the CODE SECTION are located in the segment ROM, one to continuation of the other respectively. In the .PRM file, I generate this sections, but in the .MAP file they do no appear. When I enter to debug, the PARAMETER SECTION is not present.

Now I'm not in house, but soon I pass the .PRM file to you.
Tank you very much.
0 Kudos
Reply

1,318 Views
Leo_Junin
Contributor I
Hello
 
I tell you that the .PRM file I have not modified it.
 
Desire that the PARAMETERS SECTION and the CODE SECTION are located in the segment ROM, one to continuation of the other respectively but, nondesire that is left a block of memory without using, it is to say that, if PARAMETERS SECTION occupies from $C000 to $C039, the CODE SECTION begins in $C03A. You understand to me now?
Anyway, I can´t obtain two completlely separated blocks. I have installed a superior version of CW just in case the one that I used it worked bad.
 
Excuseme, I most seem native.
 
Tanks.
0 Kudos
Reply

1,318 Views
Santa
Contributor I
Can you post your .prm file. In that file is where you specify where each section starts ends. Modifing that will let your two sections be continious and don't leave any unused ROM.

For example

SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
EEPROM = READ_ONLY 0xEE00 TO 0xEE50;
ROM = READ_ONLY 0xEE51 TO 0xFDFF;
Z_RAM = READ_WRITE 0x0094 TO 0x00DF;
ROM1 = READ_ONLY 0xFFB0 TO 0xFFBD;
ROM2 = READ_ONLY 0xFFC2 TO 0xFFCF;
END

ROM follows EEPROM, but if I only define 2 constants in section EEPROM I will have lost 30 bytes of flash. So if I know I will be only using 2 bytes of EEPROM my prm will look like this:

SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
EEPROM = READ_ONLY 0xEE00 TO 0xEE01;
ROM = READ_ONLY 0xEE02 TO 0xFDFF;
Z_RAM = READ_WRITE 0x0094 TO 0x00DF;
ROM1 = READ_ONLY 0xFFB0 TO 0xFFBD;
ROM2 = READ_ONLY 0xFFC2 TO 0xFFCF;
END
0 Kudos
Reply

1,318 Views
rocco
Senior Contributor II
To add to what Santa said:

It may be that the linker is putting the two sections (CODE and PARAMETERS) in different segments. By modifying the PLACEMENT portion of the .PRM file, you can instruct the linker to place them in the same segment, thereby concatenating them together.
0 Kudos
Reply

1,318 Views
Leo_Junin
Contributor I
Hi Rocco
After several attempts, I pass to you  the . PRM file in text format so that you see it. I cannot make work section EEPROM. When I debug the program, the data located in this section, do not appear in the memory.
 

/* This is a linker parameter file for the LJ12 */
NAMES   END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */

SEGMENTS /* here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */
  Z_RAM  = READ_WRITE 0x0060 TO 0x00FF;
  RAM    = READ_WRITE 0x0100 TO 0x025F;
  EEPROM = READ_ONLY  0xC000 TO 0xC1FF;
  ROM    = READ_ONLY  0xC200 TO 0xEFFF;
END

PLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */
  PARAMETERS                    INTO EEPROM;
  DEFAULT_ROM                   INTO ROM;
  DEFAULT_RAM                   INTO RAM;
  ZEROPAGE                      INTO Z_RAM;
END

STACKSIZE 0x20

VECTOR 18 RTIIsr
VECTOR 1 TickIsr
VECTOR 0 Entry  /* reset vector: this is the default entry point for a Assembly application. */
INIT Entry     /* for assembly applications: that this is as well the initialization entry point */

0 Kudos
Reply

1,318 Views
rocco
Senior Contributor II
Hi, Leo-Junin:

The system is doing exactly what the .PRM file said to do. It is putting the PARAMETERS section in the EEPROM segment, and the CODE section in the ROM segment.

If you want the CODE section to go into the EEPROM segment, immediately following the PARAMETERS section, add this line:

CODE INTO EEPROM;

after the line:

PARAMETERS INTO EEPROM;
0 Kudos
Reply

1,318 Views
CrasyCat
Specialist III

Or alternatively write

PARAMETERS, CODE INTO EEPROM;

This will also place CODE right after PARAMETERS into EEPROM.

CrasyCat

0 Kudos
Reply

1,318 Views
Leo_Junin
Contributor I
I have solved it. Thank you very much to all. I did not respond before because the system did not warn to me that there were new messages.
 
0 Kudos
Reply

1,318 Views
Santa
Contributor I
the .prm fil eseems to be ok. Can you post your .c or .asm file to see in which section are your EEPROM constants being placed?
0 Kudos
Reply

1,318 Views
Leo_Junin
Contributor I

Before nothing tanks.

Correct Rocco, it is exactly what I want to do, but the CW this not taking it. I am going to return to prove and I say to them that is happened.

Tanks to you two. (Gracias a los dos)

0 Kudos
Reply