Continue to Site

IAR C for AVR problem: Error[420]

Status
Not open for further replies.

Nicholas

Member level 4
Member level 4
Joined
Feb 21, 2004
Messages
77
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
711
iar asmline - ogasm

Hi all,
I m trying IAR C Compiler for AVR ATmega48. In compilation, I got this error msg below. What shall I do?

Internal Error: [AsmLine - OgAsm]: Error[420]: Instructions must be at an even address. Insert directive 'ALIGN 1' here.

Help pls.
 

IAR C for AVR problem

Did you try to insert the directive before mentioned line ? That will help .
Flash is organised as 2 byte length word and as AVR is RISC its instruction length is fixed . If you allocate constant memory in flash and wont align it to word length boundary -you will get this kind of errors .
 

IAR C for AVR problem

Problem is it doesn't mention any line in this error. So I don't know where and how to fix it.
 

IAR C for AVR problem

Could you please post whole compilation output?
 

Re: IAR C for AVR problem

Building configuration: RD200X1 - Debug
main.c
Internal Error: [AsmLine - OgAsm]: Error[420]: Instructions must be at an even address. Insert directive 'ALIGN 1' here.
RJMP tmr0srv

Total number of errors: 1
Total number of warnings: 0

That's all.
Thanks.
 

IAR C for AVR problem

Where did you define interrupt ISR routines ?
- assembler or
- c soruce

if it is in c sourcefile - compiler settings are needed to be investigated .
if it is assembler file - i will need your assembler source where isr vector table is resided .



The reason for error is that :
Compiler found "RJMP tmr0srv" which is palced at odd address in flash memory . AVR FLASH is btye addresable memory but instructions occupy even number of bytes . "RJMP tmr0srv" is most probably
jump to interrupt service routine , but placed to odd
FLASH memory location . Did you place something like "DB 1" into interrupt vector table ? if so , plase note that one single "RJMP xxx" occupies 4 bytes in flash , so placeholder for one unused vector entry should look like DB 4.
 

IAR C for AVR problem

Problem solved. I incorrectly specified a wrong vector for the interrupt service function. //Shy

Thanks you all.
Nicholas
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top