ASSEMBLY - Definition and allocation of segments - problem

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

ASSEMBLY - Definition and allocation of segments - problem

Jump to solution
974 Views
Leojunin
Contributor III

Hello to all forum. First of all I apologize for my English.

 

I am programming in assembly

 

I have a problem using a memory segment. Below is my configuration:

 

In the .prm file...

 

SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */

    Z_RAM                    =  READ_WRITE   0x0080 TO 0x00EF;

    Z_RAM2                  =  READ_WRITE   0x00F0 TO 0x00FF;

    RAM                      =  READ_WRITE   0x0100 TO 0x06FF;

    RAM2                    =  READ_WRITE   0x0700 TO 0x083F;

    STACK                  =  READ_WRITE   0x0840 TO 0x087F;

    ROM                      =  READ_ONLY    0x8000 TO 0xFFAD;

/* INTVECTS                 =  READ_ONLY    0xFFC0 TO 0xFFFF; Reserved for Interrupt Vectors */

END

 

PLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */

    _DATA_ZEROPAGE,                     /* zero page variables */

    MY_ZEROPAGE                         INTO  Z_RAM;

    Z_PAGE                                     INTO  Z_RAM2;

    DEFAULT_RAM                         INTO  RAM;

    HIGHPAGE                                 INTO  RAM2;

    SSTACK                              INTO  STACK;

    _PRESTART,                          /* startup code */

    STARTUP,                            /* startup data structures */

    ROM_VAR,                            /* constant variables */

    STRINGS,                            /* string literals */

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

    DEFAULT_ROM,

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

                                        INTO  ROM;

 

END

 

Then in my code, I add ...

 

; import symbols

           XREF __SEG_END_SSTACK, __SEG_END_DEFAULT_RAM

 

When compiling, I take the following values:

 

           LDHX #__SEG_END_SSTACK takes LDHX #0x0880 (correct)

           TXS

           ...

and

           LDX #__SEG_END_DEFAULT_RAM takes LDHX #0x0000 instead of #0x0700

 

 

What should I do?

 

Tanks to all

Labels (1)
1 Solution
735 Views
trytohelp
NXP Employee
NXP Employee

Hi,

I've performed some tests on my side with CW for MCU v6.3 and CW for MCU V10.6.4.

For both development tools, the linker generates a warning:

    No information available for segment 'DEFAULT_RAM'

Following the tests I did, it seems linker-defined objet is not working for DEFAULT_RAM.

I will create a SR to track the problem.

Keep you informed.


Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

7 Replies
736 Views
trytohelp
NXP Employee
NXP Employee

Hi,

I've performed some tests on my side with CW for MCU v6.3 and CW for MCU V10.6.4.

For both development tools, the linker generates a warning:

    No information available for segment 'DEFAULT_RAM'

Following the tests I did, it seems linker-defined objet is not working for DEFAULT_RAM.

I will create a SR to track the problem.

Keep you informed.


Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

735 Views
Leojunin
Contributor III

Tank you, Pascal

I commented that the program is working putting my desired value instead of __SEG_END_DEFAULT_RAM but had forgotten this and when I did a memory restructuring, missed the entire program and could not remember why!

I commented that, although I have the CodeWarrior 10.6 which came with the BDM, I have not installed it, and I'm using version 6.3

0 Kudos
735 Views
trytohelp
NXP Employee
NXP Employee

Hi Daniel,

In all case the problem is on linker side.

I've logged the issue in our bug base under the number ENGR00366601.

To track it I've created a SR# too (1-4058277390).

I don't know when I will receive feedback or information regarding this problem.

I will keep you informed.


Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
735 Views
Leojunin
Contributor III

Hello Pascal. The RAM segment I have placed in MY_HIGH_RAM

(MY_HIGH_RAM INTO RAM;) but also assigned the value 0x0000.

I can see the service request to see how it goes and thus, contribute ideas? Where can I find it?

Tank you

0 Kudos
735 Views
trytohelp
NXP Employee
NXP Employee

Hi,

In fact the tool is working as expected.

By default the macro is defined if the segment is used only.

On my examples the DEFAULT_RAM (which is .data too) was not used.

This is why the DEFAULT_RAM was not defined.

If a variable is placed in the DEFAULT_RAM section then the DEFAULT_RAM macro will be defined.

Example of map file:

*********************************************************************************************

OBJECT-ALLOCATION SECTION

    Name              Module                Addr  hSize  dSize    Ref    Section  RLIB

---------------------------------------------------------------------------------------------

MODULE:                -- asm_main_asm.obj --

- PROCEDURES:

    asm_main                                  2132      1A      26      1  MyCode  

- VARIABLES:

    temp_byte                                  80      1      1      1  MY_ZEROPAGE

- LABELS:

    __SEG_END_SSTACK                          302      0      0      2          

    __SEG_END_DEFAULT_ROM                    2132      0      0      1          

    __SEG_END_DEFAULT_RAM                      102      0      0      1          

    __SEG_END___DOT__data                      102      0      0      1          

MODULE:                -- main_c.obj --

- PROCEDURES:

    main                                      211E      14      20      1  .text  

- VARIABLES:

    my_val                                    100      2      2      1  .data  

    i                                          302      2      2      2  .bss    

The my_val is defined as global variable:

    int my_val=10;

This places my_val to DEFAULT_RAM section.

Attached you will find the project.

Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

735 Views
Leojunin
Contributor III

Thanks Pascal. I found the description of what you explained to me in the help. Nevertheless I tell you that no data in this segment because they are dynamically allocated by the application. What I did to take that value was, instead of taking the last value of the segment in question (__SEG_END_DEFAULT_RAM), take the value of the next segment, which itself is in use (__SEG_START_SYS_RAM).

0 Kudos
735 Views
trytohelp
NXP Employee
NXP Employee

Yes but this is how it should work according to the manual.

Extract of page 101

+++++++++++++++++++

Listing 3.47 .prm File

LINK example.abs

NAMES example.o END

SECTIONS

MY_RAM = READ_WRITE 0x0800 TO 0x0FFF;

MY_ROM = READ_ONLY 0x8000 TO 0xEFFF;

MY_STACK = NO_INIT 0x400 TO 0x4ff;

END

PLACEMENT

DEFAULT_ROM INTO MY_ROM;

DEFAULT_RAM INTO MY_RAM;

SSTACK INTO MY_STACK;

END

INIT main

Listing 3.48 Linker-Defined Symbols

__SEG_START_SSTACK 0x400

__SEG_END_SSTACK 0x500

__SEG_SIZE_SSTACK 0x100

+++++++++++++++++++


Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos