реклама на сайте
подробности

 
 
> Глюк оптимизации в IAR 3.10C
Tech
сообщение Nov 1 2005, 03:36
Сообщение #1


Участник
*

Группа: Участник
Сообщений: 20
Регистрация: 1-12-04
Пользователь №: 1 267



Пол дня искал ошибку, оказалось EW IAR AVR оптимизировал код:

было:
if(a == x1) {...}
if(a == x2) {...}
...
откомпилировалось как:
if(a == x1) {...}
else {...}
...
помогло:
if(a == x1) {...}
else if(a == x2) {...}
else {}
...
или
case
...
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
Tech
сообщение Nov 29 2005, 08:46
Сообщение #2


Участник
*

Группа: Участник
Сообщений: 20
Регистрация: 1-12-04
Пользователь №: 1 267



Как в IAR AVR должны передаваться аргументы во внешнюю ассемблерную функцию?
Возможно я неправильно понял документацию, но из того что я понял следует:
Если внешняя ассемблерная функция объявлена как
extern unsigned int Func(unsigned int, unsigned int);,
то параметры должны передаваться так
R17:R16 Func(R17:R16, R21:R20),
а получилось R17:R16 Func(R17:R16, R19:R18).

Чего я не учёл, может pragma какая?
Или компилятор брыкается?
Go to the top of the page
 
+Quote Post
ms1
сообщение Nov 29 2005, 22:42
Сообщение #3


Частый гость
**

Группа: Свой
Сообщений: 150
Регистрация: 13-10-05
Пользователь №: 9 614



Цитата(Tech @ Nov 29 2005, 11:46) *
Как в IAR AVR должны передаваться аргументы во внешнюю ассемблерную функцию?

Register assignment using the new calling convention

In the new calling convention, as many parameters as possible are passed in registers.
The remaining parameters are passed on the stack. The compiler may change the order
of the parameters in order to achieve the most efficient register usage.
The algorithm for assigning parameters to registers is quite complex in the new calling
convention. For details, you should create a list file and see how the compiler assigns the
different parameters to the available registers, see Creating skeleton code, page 96.
Below follows some examples of combinations of register assignment.
A function with the following signature (not C++):
void foo(char __far * a, int b, char c, int d)
would have a allocated to R18:R17:R16, b to R21:R20 (alignment requirement
prevents R20:R19), c to R19 (first fit), and d to R23:R22 (first fit).
...

Все это из файла EWAVR_CompilerReference.pdf
AVR® IAR C/C++ Compiler Reference Guide Fourth edition: February 2005
Part number: CAVR-4
стр.103 (физически это стр.125)

Да и вот еще:
This guide applies to version 4.x of AVR IAR Embedded Workbench
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 12th August 2025 - 12:44
Рейтинг@Mail.ru


Страница сгенерированна за 0.01391 секунд с 7
ELECTRONIX ©2004-2016