Alex19
Jun 15 2012, 21:06
Доброго времени суток.
Процессор LPC1114, IAR5.50.
Ругается на вот такую вставку
asm ("LDR r0, =0x1000"); // Error[Og006]: Syntax error in inline assembly: "Error[401]: Operand syntax error"...
Подскажите, что здесь не так?
ILYAUL
Jun 15 2012, 21:19
Помоему равно тут лишнее
Alex19
Jun 15 2012, 21:29
Без равно -
Error[Lp002]: relocation failed: value out of range or illegal: 0xbe0
Kind : R_ARM_THM_PC8[0xb]
Location: 0x0000041c
"main" + 0x4b ...
А втавку беру из AN10995 по созданию загрузчка, там вот такие строки (правда там LPCXpresso)
asm volatile("ldr r0, =0x1004");
asm volatile("ldr r0, [r0]");
asm volatile("mov pc, r0");
В чем может быть разница?
_Артём_
Jun 15 2012, 22:59
Цитата(Alex19 @ Jun 16 2012, 00:29)

В чем может быть разница?
Какая разница, в чём эта разница?
Зачем там АСМ вообще нужен? Разве без него никак?
ILYAUL
Jun 16 2012, 19:39
User manual Rev. 8 — 8 March 2012 474 of 536
NXP Semiconductors UM10398
28.5.4.4.1 Syntax
LDR Rt, label
where:
Rt is the register to load.
label is a PC-relative expression.
See Section 28–28.5.3.5.
28.5.4.4.2 Operation
Loads the register specified by Rt from the word in memory specified by label.
28.5.4.4.3 Restrictions
In these instructions, label must be within 1020 bytes of the current PC and word aligned.
28.5.4.4.4 Condition flags
These instructions do not change the flags.
Chapter 28: LPC111x/LPC11Cxx Appendix: ARM Cortex-M0 reference
28.5.4.4.5 Examples
LDR R0, LookUpTable ; Load R0 with a word of data from an address
; labelled as LookUpTable.
LDR R3, [PC, #100] ; Load R3 with memory word at (PC + 100).
Для просмотра полной версии этой страницы, пожалуйста,
пройдите по ссылке.