I reserve memory space in starup.a51 file as follow {
CSEG AT KARRAYDATADDR ;0x017c karray:
DS (8*16) } And then,when I use asm Compiler directly in a c file as follow {
#pragma asm
MOV R1,#HIGH (karray)
MOV R1,#LOW (karray)
#pragma endasm }
I receive the following error message: .\obj\cprm.src(4095): error A14: BAD RELOCATABLE EXPRESSION
I find that the src file(cprm.src) have replace the expression as follow {
; MOV R1,#HIGH (karray)
MOV R1,# (karray>>8)
; MOV R1,#LOW (karray)
MOV R1,# (karray) }
What is going on and how can I fix it?
Sorry,I I didn't mean to assign to the same 8-bit register.It is a test case.The correct case should be following. {
MOV ER01,#HIGH (karray)
MOV ER00,# (karray)
#pragma endasm } Return to Error A14. Error A14 mean *** Error A14 Bad Relocatable Expression A relocatable expression was invalid. Valid relocatable expressions may contain only one relocatable symbol which may be a segment symbol, external symbol, or a symbol belonging to a relocatable segment. The assembler cannot perform mathematical operations involving more than one relocatable symbol. There are also restrictions for arithmetic operations with symbols as described under Relocatable Expressions.
Following is from keil help: Relocatable expressions are so named because they contain a reference to a relocatable or external symbol. These types of expressions can only be partially calculated by the assembler since the assembler does not know the final location of relocatable segments. The final calculations are performed by the linker. A relocatable expression normally contains only a relocatable symbol, however, it may contain other operands and operators as well. A relocatable symbol can be modified by adding or subtracting a constant value.
Examples for valid relocatable expression relocatable_symbol + absolute_expression relocatable_symbol - absolute_expression absolute_expression + relocatable_symbol