EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Segments in IAR Assembler

Started by Kipton Moravec September 22, 2006
I am writing for a MSP430F2012. I am writing it mostly in C with the
interrupts in assembler for the IAR Compiler

Here is what I have:



;-------
; Public Data
;-------
RSEG interrupt_d :DATA
; 16-bit
A DS16 1
B DS16 1
; 8-bit
new_a DS8 1
new_b DS8 1

PUBLIC A
PUBLIC B
PUBLIC new_a
PUBLIC new_b

;-------
; Private Data
;-------

; 16-bit
TEMP DS16 1
; 8-bit

RSEG interrupt_a :CODE


I get an error on the "RSEG interrupt_d :DATA" line.
There is no error on the "RSEG interrupt_a :CODE" line.

The message is:
Fatal Error [e72] Segment interrupt_d must be defined in a segment
definition option (-Z, -b, or -P).

I can not seem to find error e72 in the help. How do I look it up?

I think I have two choices:

1. Use the name all the other data segments use for the C code, which I
can't seem to find.

2. Find out where to put a "-P(DATA)interrupt_d 0-27F" line in the IAR
compiler options. (If the syntax is correct.)

Help anybody?

--
Kipton Moravec

Beginning Microcontrollers with the MSP430

>From: Kipton Moravec
>Subject: [msp430] Segments in IAR Assembler

>
>I am writing for a MSP430F2012. I am writing it mostly in C with the
>interrupts in assembler for the IAR Compiler
>
>Here is what I have:
>
[snip]

>
>I get an error on the "RSEG interrupt_d :DATA" line.
>There is no error on the "RSEG interrupt_a :CODE" line.
>
>The message is:
>Fatal Error [e72] Segment interrupt_d must be defined in a segment
>definition option (-Z, -b, or -P).
>

I think (general disclaimers abound! it's too late on a Friday afternoon to be held to any of this ;-)

as I was saying - I think your issue is your *.xcl file... this is the one that defines the segments of memory... a typical 'c' file has a CODE segment, but it has data segments defined as:

//segment address range max usage (assm option)
// size
//------- ------------- ---- -------------------
//UDATA0 0200-09FF 2 Kb Uninitialized variables
//IDATA0 0200-09FF 2 Kb Initialized variables
//CSTACK 0200-09FF 2 Kb Run-time stack/auto vars
//ECSTR 0200-09FF 2 Kb Writeable strng literals
and for the code segment:

//Program and non-volatile segments (FLASH)
//========================================//segment address range max size usage (assembler option)
//------- ------------- -------- -------------------
//INFO 1000-10FF 256 bytes Information memory
//CODE 4000-FFDF <48 Kb Program code
//CONST 4000-FFDF <48 Kb Constant "const" vars
//CSTR 4000-FFDF <48 Kb String literals
//CDATA0 4000-FFDF <48 Kb Inits for IDATA0
//CCSTR 4000-FFDF <48 Kb Inits for ECSTR
//INTVEC FFE0-FFFF 32 bytes Interrupt vectors

(example is from MSP430F148C.xcl)
so, CODE is defined, but DATA isn't.
May not be the issue, but I've had to play a few games with these files before...

Good Luck!

Rachel Adamec
Norristown, PA, USA
Thanks that was the hint I needed.

"RSEG interrupt_d :DATA"
had to be changed to:
"RSEG DATA16_N :DATA"

"RSEG interrupt_a :CODE"
had to be changed to:
"RSEG CODE :CODE"

Now it compiles and links. I looked at the linker output to get the
names. The names are different than what you have below.

Kip

On Fri, 2006-09-22 at 14:42 -0500, Rachel Adamec wrote:
> >From: Kipton Moravec
> >Subject: [msp430] Segments in IAR Assembler
>
> >
> >I am writing for a MSP430F2012. I am writing it mostly in C with the
> >interrupts in assembler for the IAR Compiler
> >
> >Here is what I have:
> >
> [snip]
>
> >
> >I get an error on the "RSEG interrupt_d :DATA" line.
> >There is no error on the "RSEG interrupt_a :CODE" line.
> >
> >The message is:
> >Fatal Error [e72] Segment interrupt_d must be defined in a segment
> >definition option (-Z, -b, or -P).
> > I think (general disclaimers abound! it's too late on a Friday
> afternoon to be held to any of this ;-)
>
> as I was saying - I think your issue is your *.xcl file... this is the
> one that defines the segments of memory... a typical 'c' file has a
> CODE segment, but it has data segments defined as:
>
> //segment address range max usage (assm option)
> // size
> //------- ------------- ---- -------------------
> //UDATA0 0200-09FF 2 Kb Uninitialized variables
> //IDATA0 0200-09FF 2 Kb Initialized variables
> //CSTACK 0200-09FF 2 Kb Run-time stack/auto vars
> //ECSTR 0200-09FF 2 Kb Writeable strng literals
>
> and for the code segment:
>
> //Program and non-volatile segments (FLASH)
> //========================================> //segment address range max size usage (assembler option)
> //------- ------------- -------- -------------------
> //INFO 1000-10FF 256 bytes Information memory
> //CODE 4000-FFDF <48 Kb Program code
> //CONST 4000-FFDF <48 Kb Constant "const" vars
> //CSTR 4000-FFDF <48 Kb String literals
> //CDATA0 4000-FFDF <48 Kb Inits for IDATA0
> //CCSTR 4000-FFDF <48 Kb Inits for ECSTR
> //INTVEC FFE0-FFFF 32 bytes Interrupt vectors
>
> (example is from MSP430F148C.xcl)
> so, CODE is defined, but DATA isn't.
>
> May not be the issue, but I've had to play a few games with these
> files before...
>
> Good Luck!
>
> Rachel Adamec
> Norristown, PA, USA
--
Kipton Moravec

The 2024 Embedded Online Conference