|
Баг ядра LPC2368? |
|
|
|
Nov 17 2009, 14:51
|
.
     
Группа: Участник
Сообщений: 4 005
Регистрация: 3-05-06
Из: Россия
Пользователь №: 16 753

|
Цитата(Rst7 @ Nov 17 2009, 20:17)  Тактичное приглашение к флуду?  Для кого флуд, а для кого ценная информация  Заметил ещё одну "странность" в коде прологов/эпилогов обычных функций, генеримом CW 1.7.9 с нулевой оптимизацией. Код E1A0C00D mov r12, sp E92DD800 stmfd sp!, {r11-r12, lr-pc} E24CB004 sub r11, r12, #0x00000004 ... E24BD00C sub sp, r11, #0x0000000C E89D6800 ldmfd sp, {r11, sp-lr} E12FFF1E bx lr Всё вроде нормально, но зачем в стеке сохраняется PC, кто-нибудь знает?
--------------------
Заблуждаться - Ваше законное право :-)
|
|
|
|
|
Nov 17 2009, 16:24
|
Местный
  
Группа: Свой
Сообщений: 279
Регистрация: 2-07-08
Из: Новосибирск
Пользователь №: 38 699

|
Цитата(GetSmart @ Nov 17 2009, 16:19)  Внатуре  Эти кретины сохраняют регистр не в стеке, а в свободной его области. И я потом на ней работаю и ненароком затираю  Кто сообщит автору FreeRTOS, что у него косяк?  Вообще то, эти кретины про это в ФАКе написали. Ну дак ктож его читает Цитата See the description of the configKERNEL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY configuration parameters for additional information.
As downloaded most ports do not implement interrupt nesting - the exceptions being the Cortex M3 and PIC32 ports. In most cases the use of a fast real timer kernel removes the need for interrupts to nest.
Nesting interrupts introduces uncertainty into the stack usage requirements and complicates system behaviour analysis. Instead it is preferred that interrupt handlers do nothing but collect event data, post the data to a task, and clear the interrupt source. This permits the interrupt to exit very promptly by deferring any necessary computational processing of the event data to the task level - inside 'interrupt tasks'. The task level processing can be performed with interrupts enabled, negating the requirement for nesting.
This scheme has the added advantage of flexible event processing prioritisation. Task priorities are used instead of the prioritisation being dependent on the priority assigned to each interrupt source by the target processor. The prioritisation of interrupt handler tasks would normally be chosen to be higher than ordinary tasks within the same application - thereby allowing the interrupt handler to return directly into the peripheral handler task. The interrupt can interrupt a normal task, grab the data, then return to the interrupt handling task. When the interrupt handling task completes, the interrupted task (or whichever task is now the highest priority ready task) will automatically continue from the point at which it was interrupted. Processing of the interrupt routine itself and the interrupt handler task will be contiguous in time just as if all the processing had been performed in the interrupt itself, but using a much simpler mechanism.
In the case that a very fast interrupt response is required for a certain peripheral then the peripheral priority can normally be set to above that of the kernel itself. This means the processing of the peripheral will never be delayed by the action of the kernel. http://www.freertos.org/index.html?http://...org/FAQISR.html
|
|
|
|
|
Nov 17 2009, 16:38
|
Местный
  
Группа: Свой
Сообщений: 279
Регистрация: 2-07-08
Из: Новосибирск
Пользователь №: 38 699

|
Цитата(GetSmart @ Nov 17 2009, 19:31)  Ну я вообще не очень дружу с аглицким, но выделенным шрифтом не совсем тот баг обозначен (кажется). Там скорее всего про то, что таймер переключения тредов должен быть самым низкоприоритетным прерыванием (у меня 15). Что я сразу сделал и даже в какой-то ветке отписАлся. Выделил я не баг, а их мнение: "В большинстве случаев, использование быстрого реал-таймового ядра избавляет от необходимости использовать вложенные прерывания" Примечание переводчика: оборот "в большинстве случаев", ИМХО, по аналогии с тестом ДНК - максимальная вероятность 99.99%. 0.01% оставляется на вероятность того, что ДНК двух человек - идентична А до выделенного написано: Исходный вариант FreeRTOS не реализует (читай - не работает) вложенные прерывания. Исключение - кортекс М3 и ПИК32
|
|
|
|
|
Nov 17 2009, 18:09
|
.
     
Группа: Участник
Сообщений: 4 005
Регистрация: 3-05-06
Из: Россия
Пользователь №: 16 753

|
А вот из-за этой конструкции внутри portSAVE_CONTEXT() нельзя работать во вложенных прерываниях на стеке System/User. Хотя это и не резонно. Код /* Push all the system mode registers onto the task stack. */ \ "STMDB LR,{R0-LR}^ \n\t" \ "NOP \n\t" \ "SUB LR, LR, #60 \n\t" \ Если нельзя будет работать на стеке SVC, то будет обидно. Но пока стабильно моя прога работает. Работая на SVC есть один минус - нельзя вызывать portYIELD(), то бишь влетать снова в SVC, но из прерывания это делать как-то нелогично даже. А работая в Undef-е или в Abort-е - можно.
Сообщение отредактировал GetSmart - Nov 17 2009, 18:13
--------------------
Заблуждаться - Ваше законное право :-)
|
|
|
|
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0
|
|
|