EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Regarding Compilation errors

Started by bharat April 18, 2007
Hi,

I am compiling the MSP430 assembly code.
I am using IAR workbench(IAR Assembler for MSP430 V3.30A/W32 (3.30.1.9))
I am using the msp430x112 controller.
When i try to compile the following code

;-----
;word variables start here
;-----
.bss v_measured_reading,2
.bss v_reference_reading,2
.bss i1_measured_reading,2
.bss i1_reference_reading,2
.bss i2_measured_reading,2

it gives the following error
Error[40] bad instruction.

Could any one tell what is wrong in those lines or am i missing any
includes?

Actually i read in a document that STD_DEF.asm should be included but i did
not the document any where.

Could any one provide me the link for the above file?

Thanks in advance

--
Regards,
Bharat

Beginning Microcontrollers with the MSP430

bharat wrote:
> Hi,
>
> I am compiling the MSP430 assembly code.
> I am using IAR workbench(IAR Assembler for MSP430 V3.30A/W32 (3.30.1.9))
> I am using the msp430x112 controller.
> When i try to compile the following code
>
> ;----------------------
> ;word variables start here
> ;----------------------
> .bss v_measured_reading,2
> .bss v_reference_reading,2
> .bss i1_measured_reading,2
> .bss i1_reference_reading,2
> .bss i2_measured_reading,2
>
> it gives the following error
> Error[40] bad instruction.
>
> Could any one tell what is wrong in those lines or am i missing any
> includes?

My guess it that you're using assembler files written for another tool.

I'm not sure what the .bss directive does, but if it reserves space for
a zero-initialized variable I suggest that you replace it with the
following C code:

int v_measured_reading, v_reference_reading, i1_measured_reading;
int i1_reference_reading, i2_measured_reading;

Or, if you really need to write in assembler:

PUBLIC i1_measured_reading
PUBLIC i1_reference_reading
PUBLIC i2_measured_reading
PUBLIC v_measured_reading
PUBLIC v_reference_reading

RSEG DATA16_Z:DATA:SORT:NOROOT(1)
REQUIRE ?cstart_init_zero
v_measured_reading:
DS8 2
v_reference_reading:
DS8 2
i1_measured_reading:
DS8 2
i1_reference_reading:
DS8 2
i2_measured_reading:
DS8 2
-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.
Thanks for your help.
It works for me .
I am writing the assembly code.
when i have the following lines

;-----
; register substitution
;-----
*irop2l SET R15
irop2m SET R14*
i get the following error

*Error[0]:Invalid syntax*

Is anything worng in the above lines?
Could you please tell what the error is?
Thanks in advance,

Regards,
bharat

On 19 Apr 2007 01:20:18 -0700, Anders Lindgren
wrote:
>
> bharat wrote:
> >
> >
> > Hi,
> >
> > I am compiling the MSP430 assembly code.
> > I am using IAR workbench(IAR Assembler for MSP430 V3.30A/W32 (3.30.1.9))
> > I am using the msp430x112 controller.
> > When i try to compile the following code
> >
> > ;----------------------
> > ;word variables start here
> > ;----------------------
> > .bss v_measured_reading,2
> > .bss v_reference_reading,2
> > .bss i1_measured_reading,2
> > .bss i1_reference_reading,2
> > .bss i2_measured_reading,2
> >
> > it gives the following error
> > Error[40] bad instruction.
> >
> > Could any one tell what is wrong in those lines or am i missing any
> > includes?
>
> My guess it that you're using assembler files written for another tool.
>
> I'm not sure what the .bss directive does, but if it reserves space for
> a zero-initialized variable I suggest that you replace it with the
> following C code:
>
> int v_measured_reading, v_reference_reading, i1_measured_reading;
> int i1_reference_reading, i2_measured_reading;
>
> Or, if you really need to write in assembler:
>
> PUBLIC i1_measured_reading
> PUBLIC i1_reference_reading
> PUBLIC i2_measured_reading
> PUBLIC v_measured_reading
> PUBLIC v_reference_reading
>
> RSEG DATA16_Z:DATA:SORT:NOROOT(1)
> REQUIRE ?cstart_init_zero
> v_measured_reading:
> DS8 2
> v_reference_reading:
> DS8 2
> i1_measured_reading:
> DS8 2
> i1_reference_reading:
> DS8 2
> i2_measured_reading:
> DS8 2
>
> -- Anders Lindgren, IAR Systems
> --
> Disclaimer: Opinions expressed in this posting are strictly my own and
> not necessarily those of my employer.
>

--
Regards,
Bharat
bharat wrote:
> Thanks for your help.
> It works for me .
> I am writing the assembly code.
> when i have the following lines
>
> ;----------------------
> ; register substitution
> ;----------------------
> *irop2l SET R15
> irop2m SET R14*
>
> i get the following error
>
> *Error[0]:Invalid syntax*
>
> Is anything worng in the above lines?
> Could you please tell what the error is?

I would suggest that you should read the manual and try to find good
example to study.

In this case, the "SET" directive is used to make one label equal
another. Since "R14" are registers and not labels this does not work.

My recommendation is to use the following:

#define irop2l R15
#define irop2m R14

-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.
Thanks for your reply.
Actually i am writing the assembly code.
Can i use C-preprocessor directives in my assembly code.

i am trying to do following thing

xx EQU 00001h
yy EQU xx>>1

Is this write??

Regards,
bharat
On 19 Apr 2007 04:37:28 -0700, Anders Lindgren
wrote:
>
> bharat wrote:
> >
> >
> > Thanks for your help.
> > It works for me .
> > I am writing the assembly code.
> > when i have the following lines
> >
> > ;----------------------
> > ; register substitution
> > ;----------------------
> > *irop2l SET R15
> > irop2m SET R14*
> >
> > i get the following error
> >
> > *Error[0]:Invalid syntax*
> >
> > Is anything worng in the above lines?
> > Could you please tell what the error is?
>
> I would suggest that you should read the manual and try to find good
> example to study.
>
> In this case, the "SET" directive is used to make one label equal
> another. Since "R14" are registers and not labels this does not work.
>
> My recommendation is to use the following:
>
> #define irop2l R15
> #define irop2m R14
>
> -- Anders Lindgren, IAR Systems
> --
> Disclaimer: Opinions expressed in this posting are strictly my own and
> not necessarily those of my employer.
>

--
Regards,
Bharat
bharat wrote:
> Thanks for your reply.
> Actually i am writing the assembly code.
> Can i use C-preprocessor directives in my assembly code.
>
> i am trying to do following thing
>
> xx EQU 00001h
> yy EQU xx>>1
>
> Is this write??

Hi bharat!

Yes, you can use C preprocessor directives, like #defines, in assembler
code.

However, your example doesn't make sense -- if you explain what you were
trying to do then someone might be able to help you.

-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.
Hi Anders,
Thanks for your reply.

Actually i have taken TI application example code for meter reading which
is in assembly.
This assembly code is in old TI format and i am trying to convert it into
new format.
I found some errors on assembly directives.
I have following lines of code::

MAX_I_SEL EQU 4
FAST_LED EQU 1
IF (MAX_I_SEL = 1)
DELTA_HI EQU 00005h
DELTA_LO EQU 0910bh
ELSEIF (MAX_I_SEL = 2)
DELTA_HI EQU 00002h
DELTA_LO EQU 0e046h
ELSEIF (MAX_I_SEL = 3)
DELTA_HI EQU 00002h
DELTA_LO EQU 09905h
ELSEIF (MAX_I_SEL = 4)
DELTA_HI EQU 00001h
DELTA_LO EQU 0cf24h
ENDIF
IF FAST_LED
DELTA_LOW EQU (((DELTA_HI&1)<<15)+(DELTA_LO>>1))
DELTA_HIGH EQU DELTA_HI>>1
ELSE
DELTA_HIGH EQU DELTA_HI
DELTA_LOW EQU DELTA_LO
ENDIF
........
I get an error that

Error[50]: Undefined symbol:'DELTA_HI'
Error[50]: Undefined symbol:'DELTA_LO'

Could you tell me why i am getting this error even though the syntax is
correct?

Regards,
bharat

On 4/23/07, Anders Lindgren wrote:

> bharat wrote:
> >
> >
> > Thanks for your reply.
> > Actually i am writing the assembly code.
> > Can i use C-preprocessor directives in my assembly code.
> >
> > i am trying to do following thing
> >
> > xx EQU 00001h
> > yy EQU xx>>1
> >
> > Is this write??
>
> Hi bharat!
>
> Yes, you can use C preprocessor directives, like #defines, in assembler
> code.
>
> However, your example doesn't make sense -- if you explain what you were
> trying to do then someone might be able to help you.
>
> -- Anders Lindgren, IAR Systems
> --
> Disclaimer: Opinions expressed in this posting are strictly my own and
> not necessarily those of my employer.
>

--
Regards,
Bharat

The 2024 Embedded Online Conference